![Benjamin Bihler's picture Benjamin Bihler's picture](https://dev.opencascade.org/sites/default/files/styles/user/public/pictures/picture-1543-1625557678.jpg?itok=PTl5hC3F)
Fri, 06/26/2015 - 17:18
Hello,
I have tried to port the OCC bottle example (samples/qt/tutorial) to Qt 5.4. Since there is no QWorkspace anymore, I have replaced it by QMdiArea. The windows for a document (in the sample called MDIWindow) inherit from QMainWindow (then I can add a tool bar). I add them to the QMdiArea with addSubWindow(QWidget*).
The code works quite fine, but I have a problem with maximizing these document windows. When I change their size by clicking onto the frame and dragging the frame, the 3D view (the OpenGL view) resizes perfectly. But when I maximize the document window (by clicking onto the maximize frame button), the resizeEvent method of my QWidget containing the 3D view is called, but the 3D view covers only a small part of the actual window (actually exactly the area defined by "QSize sizeHint();" - see screenshot). When I maximize the application window instead, the 3D view is correctly resized.
The only difference I was able to find, is the order of resize events. When the document window (MDIWindow) receives the resize event first and the widget containing the V3d_View (in the sample called View) receives the resize event later, then the 3D view is not correctly displayed. This happens when maximizing or unmaximizing the document window (MDIWindow). When I manually resize the document window or I maximize/unmaximize the application window (where the document window is maximal), then first the View widget receives the resize event and later the document window. In this case the 3D view is correctly displayed afterwards.
Has anyone ported the bottle example to Qt 5? Did you also have resizing troubles? How can they be solved?
Could there be a problem with the order of resize events? Can I define Qt event orders?
Thank you for any help!
Benjamin
Mon, 06/29/2015 - 13:37
I have asked my question the wrong way. Please let me try again:
The bottle sample had already been ported to Qt 5 and my code is almost identical to the sample code in OCC 6.9.0. But when I actually use Qt 5.4.1 instead of 4.8.7, the display error described above does appear. When I link the same code against Qt 4.8.7, resizing document windows works great without display errors!
Therefore I would have liked to ask you whether anyone has already been using code similar to the bottle sample with Qt 5. Have you also experienced display errors when resizing document windows? Have you found a solution for that?
Thank you!
Tue, 06/30/2015 - 16:19
Hmmmm, is nobody using OCC+Qt5 with code similar to the samples or is nobody experiencing troubles with such a configuration?
Sat, 07/04/2015 - 17:04
Hi Benjamin Bihler,
I write a simple demo 'occQt' by using OpenCASCADE6.9.0+Qt5.4, and do not
come across your problem. I put occQt in the github, you can have a look:
https://github.com/eryar/occQt
Best Regards,
Shing Liu
Mon, 07/06/2015 - 12:41
Hi Shing Liu,
there is no MdiArea in your example and therefore there is no document window (QMdiSubWindow) resizing problem. The troubles I have seem to have something to do with how QMdiArea and QMdiSubWindow widgets play together. But anyway thank you for the example.
Best regards,
Benjamin
Fri, 09/04/2015 - 11:14
Dear Benjamin,
For your information, we have registered an OCCT Mantis issue for this problem, see http://tracker.dev.opencascade.org/view.php?id=26603.
You can try the first draft version of the patch and tell us if it corrects the problem at your side.
Best regards
FSR
Fri, 09/11/2015 - 18:21
Thank you for caring for this issue. I will write my comments to the issue tracker.