Compare commits

..

No commits in common. "2f6f8599c081be5f92dd67e4a80aaf1c2783fe31" and "8275fe1093d3ae127a86d578833fd7b1d9701d1b" have entirely different histories.

4 changed files with 95 additions and 48 deletions

View File

@ -245,12 +245,12 @@ RibbonWindow {
}
RibbonPushButton{
text: qsTr("No Menu")
icon_source: "qrc:/qt/qml/RibbonUIAPP/resources/imgs/heart.png"
icon_source: "qrc:/RibbonUIAPP/resources/imgs/heart.png"
icon_size: height-5
}
RibbonPushButton{
text: qsTr("Menu")
icon_source: "qrc:/qt/qml/RibbonUIAPP/resources/imgs/search.png"
icon_source: "qrc:/RibbonUIAPP/resources/imgs/search.png"
Action{
text: "Test Item 3"
}

View File

@ -6,28 +6,13 @@ import RibbonUI
RibbonView {
id: control
property int page_width: width * 0.7
property int page_height: container.height + page_margin*2
property int page_margin: 50
property int page_height: 1000
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{
id: container_bg
anchors{
top: parent.top
topMargin: modern_style ? 20 : 30
bottomMargin: modern_style ? 20 : 30
horizontalCenter: parent.horizontalCenter
}
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.topMargin: modern_style ? 20 : 30
Layout.bottomMargin: modern_style ? 20 : 30
radius: modern_style ? 10 : 5
color: dark_mode ? "#262626" : "white"
implicitWidth: control.page_width
@ -50,4 +35,3 @@ RibbonView {
}
}
}
}

View File

@ -12,6 +12,10 @@ Item {
property int spacing: 5
property int top_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
clip: true
anchors{
@ -34,7 +38,7 @@ Item {
top: parent.top
}
height: Math.abs(top_padding)
target: container
target: flickview
mask_opacity: 0
visible: top_padding
clip: true
@ -48,16 +52,26 @@ Item {
implicitHeight: parent.height - Math.abs(top_padding) - Math.abs(bottom_padding)
implicitWidth: parent.width
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{
id:container
anchors{
top: parent.top
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
}
width: parent.width
}
}
}
RibbonBlur{
id: bottom_mask
@ -67,10 +81,58 @@ Item {
bottom: parent.bottom
}
height: Math.abs(bottom_padding)
target: container
target: flickview
mask_opacity: 0
visible: bottom_padding
clip: true
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
}
}

View File

@ -9,6 +9,7 @@ RibbonUI::RibbonUI(QQuickItem *parent)
{
version(VER_JOIN((RIBBONUI_VERSION)));
qt_version(QString(qVersion()).replace('.',"").toInt());
qDebug()<<_qt_version;
}
RibbonUI* RibbonUI::instance(){