Centering ScrollView in the middle of the screen
-
Hello fello Qt Devs,
how does one center ScrollView in the middle of the screen?
I have it as an element of page and tried achors.horizontalCenter: parent.horizontalCenter
anchors.centerIn:
x:
made the text be inside of Column{} and set ScrollViews height to that columns height and even tried to center the Text{} elements of the ScrollView to center of page by its Id, but nothing works. It is either left-aligned or breaks.Should I remove the Page element since it might interfere,k but how then i put buttons that stay in the same location when one scrolls, and I also havent seen ScrollView centered even when its standalone, in tutorial version it was also left-aligned.
Cheers, DSU
-
Keep in mind that when you try to center elements containing text, you also need to align the text itself inside the component (vertical and horizontal alignment).
-
@sierdzio There also seems to be some interaction with wrap mode of the text, also depends if one uses JS script:
my text string, or not. Anyways, i ended up using ColumnLayout with a ListView that fills it and that ListView has delegate Item that has column embedded in it, which is anchors.horizontalCenter: parent.horizontalCenter . I tried to have just column as delegate, but that also wouldnt work, so i wrapped it in an item.
Anyways it is not that important atm, i might return here once I have time to experiment more. -
D DSpUz has marked this topic as solved