[Interest] QMdiSubWindow doesn't adjust its size

Tony Rietwyk tony at rightsoft.com.au
Wed Feb 5 00:32:42 CET 2014


Hi John, 

 

In the top level layout in the QMdiSubWindow, what is the sizeConstraint set
to?   Try Fixed.  

 

Hope that helps, 

 

Tony

 

 

 

From: interest-bounces+tony=rightsoft.com.au at qt-project.org
[mailto:interest-bounces+tony=rightsoft.com.au at qt-project.org] On Behalf Of
John Weeks
Sent: Wednesday, 5 February 2014 5:42 AM
To: Interest at qt-project.org Interest
Subject: [Interest] QMdiSubWindow doesn't adjust its size

 

I have a moderately complex compound widget contained within a
QMdiSubWindow. Certain user actions may cause the widgets to change size.
Since everything is contained within layouts, I would expect the
QMdiSubWindow to adjust its size, but it doesn't.

 

Initial appearance:



 

A user action causes changes:



 

I find that if I add a call to this code after any action that might change
the sizes of the widgets it works correctly:

          IgorApp()->processEvents(QEventLoop::ExcludeUserInputEvents);
          infoWindow->rootWidget()->adjustSize();
// rootWidget() returns a pointer to the QMdiSubWindow widget

 

Without the call to processEvents() it doesn't adjust correctly.

 

If the application is run as a SDI application (the window shown above is
then a top-level window) it works correctly.

 

Yes, it's a frameless window. That doesn't seem to affect the behavior.

 

I can create a very simple application with QMdiSubWindow that exhibits this
behavior. I don't think it's caused by forgetting to enclose something in a
layout at some level. A QMdiSubWindow, when resized adjusts the size of its
internal widget. But the internal widget changing size doesn't seem to be
noticed by QMdiSubWindow.

 

1) Is there a way to get a QMdiSubWindow to automagically adjust to its
internal widget? It would be better to not have to sprinkle that bit of code
all over the place.

2) What is processEvents() doing? Why is it necessary?

 

3) I don't like sprinkling calls to processEvents() all over my code. Is
there some other way to achieve this?

 

Thanks for any insight you can provide.

 

-John Weeks

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140205/e5a423f9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 7681 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140205/e5a423f9/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 8268 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140205/e5a423f9/attachment-0001.png>


More information about the Interest mailing list