mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-26 05:17:05 +08:00
Merge pull request #570 from gaetandezeiraud/feature-fluscrollablepage-reset-scroll
Add property autoResetScroll to FluScrollablePage
This commit is contained in:
commit
c9e0732f99
@ -5,8 +5,11 @@ import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluPage {
|
||||
property bool autoResetScroll: false
|
||||
default property alias content: container.data
|
||||
|
||||
Flickable{
|
||||
id: flickable
|
||||
clip: true
|
||||
anchors.fill: parent
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
@ -17,4 +20,14 @@ FluPage {
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
function resetScroll() {
|
||||
flickable.contentY = 0;
|
||||
}
|
||||
|
||||
StackView.onActivated: {
|
||||
if (autoResetScroll) {
|
||||
resetScroll(); // Call this function to reset the scroll position to the top
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,11 @@ import QtQuick.Controls
|
||||
import FluentUI
|
||||
|
||||
FluPage {
|
||||
property bool autoResetScroll: false
|
||||
default property alias content: container.data
|
||||
|
||||
Flickable{
|
||||
id: flickable
|
||||
clip: true
|
||||
anchors.fill: parent
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
@ -17,4 +20,14 @@ FluPage {
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
function resetScroll() {
|
||||
flickable.contentY = 0;
|
||||
}
|
||||
|
||||
StackView.onActivated: {
|
||||
if (autoResetScroll) {
|
||||
resetScroll(); // Call this function to reset the scroll position to the top
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user