Compare commits
No commits in common. "2f6f8599c081be5f92dd67e4a80aaf1c2783fe31" and "8275fe1093d3ae127a86d578833fd7b1d9701d1b" have entirely different histories.
2f6f8599c0
...
8275fe1093
|
@ -245,12 +245,12 @@ RibbonWindow {
|
||||||
}
|
}
|
||||||
RibbonPushButton{
|
RibbonPushButton{
|
||||||
text: qsTr("No Menu")
|
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
|
icon_size: height-5
|
||||||
}
|
}
|
||||||
RibbonPushButton{
|
RibbonPushButton{
|
||||||
text: qsTr("Menu")
|
text: qsTr("Menu")
|
||||||
icon_source: "qrc:/qt/qml/RibbonUIAPP/resources/imgs/search.png"
|
icon_source: "qrc:/RibbonUIAPP/resources/imgs/search.png"
|
||||||
Action{
|
Action{
|
||||||
text: "Test Item 3"
|
text: "Test Item 3"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,48 +6,32 @@ 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: container.height + page_margin*2
|
property int page_height: 1000
|
||||||
property int page_margin: 50
|
|
||||||
default property alias content: container.data
|
default property alias content: container.data
|
||||||
Flickable{
|
Rectangle{
|
||||||
id:flickview
|
id: container_bg
|
||||||
Layout.preferredWidth: parent.width
|
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
|
||||||
Layout.preferredHeight: parent.height
|
Layout.topMargin: modern_style ? 20 : 30
|
||||||
contentWidth: control.width
|
Layout.bottomMargin: modern_style ? 20 : 30
|
||||||
contentHeight: container_bg.height + container_bg.anchors.topMargin + container_bg.anchors.bottomMargin
|
radius: modern_style ? 10 : 5
|
||||||
ScrollBar.vertical: ScrollBar {
|
color: dark_mode ? "#262626" : "white"
|
||||||
anchors.right: flickview.right
|
implicitWidth: control.page_width
|
||||||
anchors.rightMargin: 2
|
implicitHeight: control.page_height
|
||||||
|
layer.enabled: true
|
||||||
|
layer.effect: RibbonShadow {
|
||||||
|
id: effect
|
||||||
|
shadow_opacity:modern_style ? 0.2 : 0.5
|
||||||
}
|
}
|
||||||
boundsBehavior: Flickable.DragOverBounds
|
ColumnLayout{
|
||||||
Rectangle{
|
id:container
|
||||||
id: container_bg
|
spacing: control.spacing
|
||||||
|
clip: true
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
topMargin: modern_style ? 20 : 30
|
left: parent.left
|
||||||
bottomMargin: modern_style ? 20 : 30
|
right: parent.right
|
||||||
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,6 +12,10 @@ 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{
|
||||||
|
@ -34,7 +38,7 @@ Item {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
}
|
}
|
||||||
height: Math.abs(top_padding)
|
height: Math.abs(top_padding)
|
||||||
target: container
|
target: flickview
|
||||||
mask_opacity: 0
|
mask_opacity: 0
|
||||||
visible: top_padding
|
visible: top_padding
|
||||||
clip: true
|
clip: true
|
||||||
|
@ -48,14 +52,24 @@ 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
|
||||||
ColumnLayout{
|
Flickable{
|
||||||
id:container
|
id:flickview
|
||||||
anchors{
|
anchors.fill: parent
|
||||||
top: parent.top
|
contentWidth: parent.width
|
||||||
horizontalCenter: parent.horizontalCenter
|
contentHeight: container.height
|
||||||
bottom: parent.bottom
|
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
|
||||||
}
|
}
|
||||||
width: parent.width
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,10 +81,58 @@ Item {
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
}
|
}
|
||||||
height: Math.abs(bottom_padding)
|
height: Math.abs(bottom_padding)
|
||||||
target: container
|
target: flickview
|
||||||
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,6 +9,7 @@ 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