Compare commits
2 Commits
8275fe1093
...
2f6f8599c0
Author | SHA1 | Date |
---|---|---|
|
2f6f8599c0 | |
|
dbb33daa52 |
|
@ -245,12 +245,12 @@ RibbonWindow {
|
|||
}
|
||||
RibbonPushButton{
|
||||
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
|
||||
}
|
||||
RibbonPushButton{
|
||||
text: qsTr("Menu")
|
||||
icon_source: "qrc:/RibbonUIAPP/resources/imgs/search.png"
|
||||
icon_source: "qrc:/qt/qml/RibbonUIAPP/resources/imgs/search.png"
|
||||
Action{
|
||||
text: "Test Item 3"
|
||||
}
|
||||
|
|
|
@ -6,32 +6,48 @@ import RibbonUI
|
|||
RibbonView {
|
||||
id: control
|
||||
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
|
||||
Rectangle{
|
||||
id: container_bg
|
||||
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
|
||||
implicitHeight: control.page_height
|
||||
layer.enabled: true
|
||||
layer.effect: RibbonShadow {
|
||||
id: effect
|
||||
shadow_opacity:modern_style ? 0.2 : 0.5
|
||||
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
|
||||
}
|
||||
ColumnLayout{
|
||||
id:container
|
||||
spacing: control.spacing
|
||||
clip: true
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
Rectangle{
|
||||
id: container_bg
|
||||
anchors{
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
topMargin: modern_style ? 20 : 30
|
||||
bottomMargin: modern_style ? 20 : 30
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
radius: modern_style ? 10 : 5
|
||||
color: dark_mode ? "#262626" : "white"
|
||||
implicitWidth: control.page_width
|
||||
implicitHeight: control.page_height
|
||||
layer.enabled: true
|
||||
layer.effect: RibbonShadow {
|
||||
id: effect
|
||||
shadow_opacity:modern_style ? 0.2 : 0.5
|
||||
}
|
||||
ColumnLayout{
|
||||
id:container
|
||||
spacing: control.spacing
|
||||
clip: true
|
||||
anchors{
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
width: parent.width
|
||||
}
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,6 @@ 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{
|
||||
|
@ -38,7 +34,7 @@ Item {
|
|||
top: parent.top
|
||||
}
|
||||
height: Math.abs(top_padding)
|
||||
target: flickview
|
||||
target: container
|
||||
mask_opacity: 0
|
||||
visible: top_padding
|
||||
clip: true
|
||||
|
@ -52,24 +48,14 @@ 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
|
||||
}
|
||||
width: parent.width
|
||||
ColumnLayout{
|
||||
id:container
|
||||
anchors{
|
||||
top: parent.top
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
bottom: parent.bottom
|
||||
}
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,58 +67,10 @@ Item {
|
|||
bottom: parent.bottom
|
||||
}
|
||||
height: Math.abs(bottom_padding)
|
||||
target: flickview
|
||||
target: container
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ RibbonUI::RibbonUI(QQuickItem *parent)
|
|||
{
|
||||
version(VER_JOIN((RIBBONUI_VERSION)));
|
||||
qt_version(QString(qVersion()).replace('.',"").toInt());
|
||||
qDebug()<<_qt_version;
|
||||
}
|
||||
|
||||
RibbonUI* RibbonUI::instance(){
|
||||
|
|
Loading…
Reference in New Issue