Compare commits
2 Commits
8275fe1093
...
2f6f8599c0
Author | SHA1 | Date |
---|---|---|
|
2f6f8599c0 | |
|
dbb33daa52 |
|
@ -245,12 +245,12 @@ RibbonWindow {
|
||||||
}
|
}
|
||||||
RibbonPushButton{
|
RibbonPushButton{
|
||||||
text: qsTr("No Menu")
|
text: qsTr("No Menu")
|
||||||
icon_source: "qrc:/RibbonUIAPP/resources/imgs/heart.png"
|
icon_source: "qrc:/qt/qml/RibbonUIAPP/resources/imgs/heart.png"
|
||||||
icon_size: height-5
|
icon_size: height-5
|
||||||
}
|
}
|
||||||
RibbonPushButton{
|
RibbonPushButton{
|
||||||
text: qsTr("Menu")
|
text: qsTr("Menu")
|
||||||
icon_source: "qrc:/RibbonUIAPP/resources/imgs/search.png"
|
icon_source: "qrc:/qt/qml/RibbonUIAPP/resources/imgs/search.png"
|
||||||
Action{
|
Action{
|
||||||
text: "Test Item 3"
|
text: "Test Item 3"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,28 @@ import RibbonUI
|
||||||
RibbonView {
|
RibbonView {
|
||||||
id: control
|
id: control
|
||||||
property int page_width: width * 0.7
|
property int page_width: width * 0.7
|
||||||
property int page_height: 1000
|
property int page_height: container.height + page_margin*2
|
||||||
|
property int page_margin: 50
|
||||||
default property alias content: container.data
|
default property alias content: container.data
|
||||||
|
Flickable{
|
||||||
|
id:flickview
|
||||||
|
Layout.preferredWidth: parent.width
|
||||||
|
Layout.preferredHeight: parent.height
|
||||||
|
contentWidth: control.width
|
||||||
|
contentHeight: container_bg.height + container_bg.anchors.topMargin + container_bg.anchors.bottomMargin
|
||||||
|
ScrollBar.vertical: ScrollBar {
|
||||||
|
anchors.right: flickview.right
|
||||||
|
anchors.rightMargin: 2
|
||||||
|
}
|
||||||
|
boundsBehavior: Flickable.DragOverBounds
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id: container_bg
|
id: container_bg
|
||||||
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
|
anchors{
|
||||||
Layout.topMargin: modern_style ? 20 : 30
|
top: parent.top
|
||||||
Layout.bottomMargin: modern_style ? 20 : 30
|
topMargin: modern_style ? 20 : 30
|
||||||
|
bottomMargin: modern_style ? 20 : 30
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
radius: modern_style ? 10 : 5
|
radius: modern_style ? 10 : 5
|
||||||
color: dark_mode ? "#262626" : "white"
|
color: dark_mode ? "#262626" : "white"
|
||||||
implicitWidth: control.page_width
|
implicitWidth: control.page_width
|
||||||
|
@ -35,3 +50,4 @@ RibbonView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -12,10 +12,6 @@ Item {
|
||||||
property int spacing: 5
|
property int spacing: 5
|
||||||
property int top_padding: 0
|
property int top_padding: 0
|
||||||
property int bottom_padding: 0
|
property int bottom_padding: 0
|
||||||
property double pull_threshold: 10
|
|
||||||
property alias flickview: flickview
|
|
||||||
signal pull_up_triggered()
|
|
||||||
signal pull_down_triggered()
|
|
||||||
z:-2
|
z:-2
|
||||||
clip: true
|
clip: true
|
||||||
anchors{
|
anchors{
|
||||||
|
@ -38,7 +34,7 @@ Item {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
}
|
}
|
||||||
height: Math.abs(top_padding)
|
height: Math.abs(top_padding)
|
||||||
target: flickview
|
target: container
|
||||||
mask_opacity: 0
|
mask_opacity: 0
|
||||||
visible: top_padding
|
visible: top_padding
|
||||||
clip: true
|
clip: true
|
||||||
|
@ -52,26 +48,16 @@ Item {
|
||||||
implicitHeight: parent.height - Math.abs(top_padding) - Math.abs(bottom_padding)
|
implicitHeight: parent.height - Math.abs(top_padding) - Math.abs(bottom_padding)
|
||||||
implicitWidth: parent.width
|
implicitWidth: parent.width
|
||||||
clip: true
|
clip: true
|
||||||
Flickable{
|
|
||||||
id:flickview
|
|
||||||
anchors.fill: parent
|
|
||||||
contentWidth: parent.width
|
|
||||||
contentHeight: container.height
|
|
||||||
ScrollBar.vertical: ScrollBar {
|
|
||||||
anchors.right: flickview.right
|
|
||||||
anchors.rightMargin: 2
|
|
||||||
}
|
|
||||||
boundsBehavior: Flickable.DragOverBounds
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
id:container
|
id:container
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
bottom: parent.bottom
|
||||||
}
|
}
|
||||||
width: parent.width
|
width: parent.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
RibbonBlur{
|
RibbonBlur{
|
||||||
id: bottom_mask
|
id: bottom_mask
|
||||||
|
@ -81,58 +67,10 @@ Item {
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
}
|
}
|
||||||
height: Math.abs(bottom_padding)
|
height: Math.abs(bottom_padding)
|
||||||
target: flickview
|
target: container
|
||||||
mask_opacity: 0
|
mask_opacity: 0
|
||||||
visible: bottom_padding
|
visible: bottom_padding
|
||||||
clip: true
|
clip: true
|
||||||
target_rect: Qt.rect(x,y-top_padding,width,height)
|
target_rect: Qt.rect(x,y-top_padding,width,height)
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer
|
|
||||||
{
|
|
||||||
id: timer
|
|
||||||
property int type: 0
|
|
||||||
interval:200
|
|
||||||
repeat: false
|
|
||||||
onTriggered: {
|
|
||||||
if (type == 1)
|
|
||||||
pull_up_triggered()
|
|
||||||
else if (type == 2)
|
|
||||||
pull_down_triggered()
|
|
||||||
type = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
states: [
|
|
||||||
State {
|
|
||||||
id: pull_up
|
|
||||||
name: "pullUp"; when: (flickview.contentY < -pull_threshold)
|
|
||||||
StateChangeScript {
|
|
||||||
name: "pullUp_func"
|
|
||||||
script: {
|
|
||||||
timer.type = 1
|
|
||||||
timer.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
id: pull_bottom
|
|
||||||
name: "pullBottom"; when: (flickview.contentHeight > 0) && (flickview.contentY > (flickview.contentHeight - flickview.height + pull_threshold))
|
|
||||||
StateChangeScript {
|
|
||||||
name: "pullBottom_func"
|
|
||||||
script: {
|
|
||||||
timer.type = 2
|
|
||||||
timer.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
function scroll_to_up(){
|
|
||||||
flickview.contentY = flickview.height
|
|
||||||
}
|
|
||||||
|
|
||||||
function scroll_to_bottom(){
|
|
||||||
flickview.contentY = flickview.contentHeight > flickview.height ? flickview.contentHeight - flickview.height : flickview.contentY
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ RibbonUI::RibbonUI(QQuickItem *parent)
|
||||||
{
|
{
|
||||||
version(VER_JOIN((RIBBONUI_VERSION)));
|
version(VER_JOIN((RIBBONUI_VERSION)));
|
||||||
qt_version(QString(qVersion()).replace('.',"").toInt());
|
qt_version(QString(qVersion()).replace('.',"").toInt());
|
||||||
qDebug()<<_qt_version;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RibbonUI* RibbonUI::instance(){
|
RibbonUI* RibbonUI::instance(){
|
||||||
|
|
Loading…
Reference in New Issue