Glitch when resize widget in a layout
-
wrote on 10 Dec 2023, 15:08 last edited by
I encountered a glitch when resize widgets in a layout
Here is the video: https://mega.nz/file/ISJCRA4Q#sqWrb8IlKNO9LVQ0QJufiPNkVYyK7UFH6lq80m_S4_8
(You may need to download this video to view it offline if your browser doesn't support playing this video)Here is a brief structure of these components:
QScrollArea -> parentWidget (just a QWidget) -> QVBoxLayout -> [widget1, widget2, widget3, stretch]
widget1
,widget2
,widget3
are custom widgets. In the video, I showwidget2
andwidget3
.
When clicked on the header of a widget, it triggers an animation. This animation works onminimumHeight
andmaximumHeight
attribute, making that widget fold or unfold.
As you can see, unfoldingwidget2
orwidget3
can cause a glitch. This glitch only happens when total size of all widgets [widget1
,widget2
,widget3
] go beyond the edge of the window (i.e. parentWidget becomes too big and QScrollArea will need a scrollbar)
Which causes this glitch and how to fix this?
I use Qt 5.15.8 on OpenSUSE Leap 15.5
Many thanks! -
Hi and welcome to devnet,
First thing I would do is to try with a more recent version of Qt. There have been several releases since 5.15.8.
One thing you could try is to force the scroll bar to be off until the animation ends and then allow it to appear.
Hope it helps.
-
Hi and welcome to devnet,
First thing I would do is to try with a more recent version of Qt. There have been several releases since 5.15.8.
One thing you could try is to force the scroll bar to be off until the animation ends and then allow it to appear.
Hope it helps.
I can’t watch the video. Just by reading, I think I know which glitch it is. It’s fixed in Qt 6, so you could try 6.2 or better 6.5.
-
I can’t watch the video. Just by reading, I think I know which glitch it is. It’s fixed in Qt 6, so you could try 6.2 or better 6.5.
wrote on 11 Dec 2023, 12:53 last edited by@Axel-Spoerl said in Glitch when resize widget in a layout:
I can’t watch the video. Just by reading, I think I know which glitch it is. It’s fixed in Qt 6, so you could try 6.2 or better 6.5.
I will migrate my code to Qt 6.5 and see if this issue is fixed or not, and I will provide an update on this issue later.
Many thanks! -
Hi and welcome to devnet,
First thing I would do is to try with a more recent version of Qt. There have been several releases since 5.15.8.
One thing you could try is to force the scroll bar to be off until the animation ends and then allow it to appear.
Hope it helps.
wrote on 16 Dec 2023, 12:20 last edited by tnn24@Axel-Spoerl said in Glitch when resize widget in a layout:
I can’t watch the video. Just by reading, I think I know which glitch it is. It’s fixed in Qt 6, so you could try 6.2 or better 6.5.
I migrated my project to Qt6 and built it with both Qt 6.2 on Ubuntu 22.04 and Qt 6.6 on openSUSE Tumbleweed. Sadly, the glitch is still there
@SGaist said in Glitch when resize widget in a layout:
Hi and welcome to devnet,
First thing I would do is to try with a more recent version of Qt. There have been several releases since 5.15.8.
One thing you could try is to force the scroll bar to be off until the animation ends and then allow it to appear.
Hope it helps.
Yes, scroll bar of QScrollArea is off the whole time
Not sure if this is a bug in Qt or a problem in my code. If I provide a simple code that reproduces the problem, could you guys take a look?
-
@Axel-Spoerl said in Glitch when resize widget in a layout:
I can’t watch the video. Just by reading, I think I know which glitch it is. It’s fixed in Qt 6, so you could try 6.2 or better 6.5.
I migrated my project to Qt6 and built it with both Qt 6.2 on Ubuntu 22.04 and Qt 6.6 on openSUSE Tumbleweed. Sadly, the glitch is still there
@SGaist said in Glitch when resize widget in a layout:
Hi and welcome to devnet,
First thing I would do is to try with a more recent version of Qt. There have been several releases since 5.15.8.
One thing you could try is to force the scroll bar to be off until the animation ends and then allow it to appear.
Hope it helps.
Yes, scroll bar of QScrollArea is off the whole time
Not sure if this is a bug in Qt or a problem in my code. If I provide a simple code that reproduces the problem, could you guys take a look?
@tnn24
Yes, please provide a minimal reproducer! -
@tnn24
Yes, please provide a minimal reproducer!wrote on 16 Dec 2023, 16:51 last edited by@Axel-Spoerl Here is a simple example that can reproduce the glitch: https://mega.nz/file/EHoWXZjK#8D81AYaX_c0CZy-YbOD8uigdBqCBbYEULecNQfggkuo
When quickly click the fold/unfold button of widget 2, I can make the glitch happen.
Please take a look. Many thanks!
1/7