QScrollArea does not create a QScrollBar
-
Hi! i'm trying to have a scrollable area inside a widget. i have a normal widget, empty, called sidebar. i want to place a scrollarea with some buttons in it. When i place the buttons inside the scrollArea, and i apply a layout, it creates a scrollbar for less than a second, but then disappears! therefore, i can't access anything that is not shown because i can't scroll. when i compile it and run the project, it works normally and i can scroll. this is really weird. i am working on Macos (m1).
Some info:QT Creator: 8.0.2
QT 6.3.2
Coded in c++
-
Hi and welcome to devnet,
Don't set a layout on your QScrollArea. Build a widget with these buttons and set the widget on the QScrollArea.
-
S SGaist moved this topic from Qt Design Studio on
-
@SGaist thanks for such a quick reply!
i tried to do it without any layout. it still doesnt work. when i create a qscrollarea it automatically creates a qwidget inside. if i apply the buttons directly to it, it doesnt work, just like the first post i made. if i create another qwidget, and i drag it inside the pre-made qwidget (the default one) it still doesn't work. :( -
So you are using Designer to build your widget.
Apply a layout on the widget. If you just put "floating" buttons, the widget will not expand automatically to fit them all in.
-
Which OS are you on ?
-
Then that's completely normal. By default, on macOS scroll bars don't stay visible unless in use. You can either hover over the region to make them appear and use them or scroll with gestures or mouse central wheel.
-
@SGaist i know that. In fact, it works when i “launch” the program. The thing is, it doesn’t work when i am in design studio. Therefore, without a scrollbar, I can’t add elements that should be visible while scrolling down. As i said, it appears for like half a second, then disappears. I can scroll, drag, ecc and nothing happens.
(All of this inside the “edit” in studio design) -
Do you mean Designer with Qt Creator ?
Qt Design Studio is a different beast.
-
@SGaist the problem that i have is that i cannot scrool while being in the Design mode of QTcreator. After i place down a scrollArea, place all the stuff inside, and apply a layout, i can see the scrollbar for like half a second, then it disappears. it's really frustrating! i've changed many settings, copied many tutorials and still doesnt work.
-
-
-