PDA

View Full Version : Issues getting correct size of Widget on main window maximization



tallan
24th March 2015, 21:11
Hello everyone. I'm having a strange issue that I can't figure out and was hoping someone here might know what the problem is.

I have a few Widgets wrapping OpenGL canvases which are initialized in the Main window Constructor using QQidget::CreateWindowContainer and then added to an HBox layout.

When I modify the main window dimensions manually, the resize event is triggered on the Widgets, in which case width() and height() give the correct dimensions of the widgets and every works as expected. However, when the window is maximized via the maximize button, the event does not trigger for the Widgets.

I tried calling the resize even handler for the Widgets from the main windows resize event handler. This works as far as ensuring that the Widgets resizeEvent method is called. However, calling width()/height() then gives the width/height of the main window instead of the Widgets. Calling width()/height() from the same method gives the Widgets dimensions when the event is triggered by manually drag adjusting the size of the window.

Anyone have any idea what is going on here?

I am working with QT 5.2 on Ubuntu 13.06 with the Gnome 3 desktop manager.

Thanks in Advance.

ChrisW67
25th March 2015, 22:34
If resizing the container widget is not resizing the contained widgets then the most likely cause is that the horizontal layout has not been applied to the container. We would need to see your setup code to be more specific.