I just ported my application from QT4.8.4 to QT 5.2.1. There is a problem with the flow layout class
as given in.
I have been docked with QMainWindow
a QDockWidget
below the central widget. With many children widgets, QDockWidget
is a flow layout
in QT4.8, it works like a magic, the shape of the hair widget is docwydt
Placed the standard size of However, in QT 5.2, DocWidgett tries to maximize its size (taking place from the center widget). Changing its layout prevents this unwanted behavior. But of course, I use the
flow layout
on purpose.
To illustrate the problem, I made a minimum example:
DocWidget constructor
:
QGroupBox * General box = new QGroupBox (""); GeneralBoxLayout = New Flow Layout; GeneralBox-> SetLayout (generalBoxLayout); For (int i = 0; i & lt; 10; ++ i) {QPushButton * button = new QPushButton ("Test", this); Button & gt; SetMinimumWidth (100); Button & gt; SetMinimumHeight (100); GeneralBoxLayout-> AddWidget (button); } This- & gt; Set visit (normal box); Do anyone know what the problem is and how can I solve it? Edit I have created a new minimalist example and unfortunately the discrepancies between QT 4.8 and Q5 5.2 can not be reproduced. The same problem has been shown in Qt4.8, so I would like to present it here: Initial view showing the down-docked dockwidhed carrying the entire vertical position: < Img src = "https://i.stack.imgur.com/06PQa.jpg" alt = "Initial view showing the down-docked docwdtd"> Dock with mouse, After resizing, see After changing the shape, see the main window with the mouse These screenshots show that DocWidgetts behaves as expected after manually changing the size of DockWidt. However, on initialization, the widget takes all available space from the central widget, which is not desired.
Is anyone aware of the solution / action?
This answer has been given by I'm keeping it here so the answer to this question is. For a very long time this has become a mask in the form of an unanswered question.
I'm seeing the problem now I have experimented and researched it looks like some bug in QT. Flow layout at the main window size independently: height width
value (in my case 103) and it leads to elevated height (usually the window is very wide). With this, when the width of the main window is changing (assuming that to update the height of the dock area).
Comments
Post a Comment