Quantcast
Channel: Active questions tagged qtquick2 - Stack Overflow
Viewing all articles
Browse latest Browse all 137

Scrolling not working for ScrollView wrapping a StackView in QtQuick application

$
0
0

I am trying to create a desktop app using StackView wrapped in ScrollView so that all pages pushed to the stack are scrollable if necessary. However, the scrolling isn't working. How can I make scrollbars appear when the content exceeds the window dimensions?

Here is a sample code to illustrate what I am trying to achieve.

Main.qml

import QtQuick 2.15import QtQuick.Controls 2.15ApplicationWindow {    visible: true    width: 200    height: 200    ScrollView {        id: scrollView        anchors.fill: parent        StackView {            id: stackView            anchors.fill: parent            initialItem: Page1 {}        }    }}

Page1.qml

import QtQuick 2.15import QtQuick.Layouts 1.15import QtQuick.Controls 2.15Rectangle {    id: page1    width: stackView.width    height: stackView.height    Label {        text: "ABC"        font.pixelSize: 224    }}

Below is the application window that clearly needs some scroll bars but doesn't have any.

Application window


Viewing all articles
Browse latest Browse all 137

Trending Articles