Reputation: 5434
I have a *.ui definition I'm loading and running. A certain sub-widget there has the rectangle of (x=0,y=88,w=400,h=200). When I instantiate the QWidget class based on the *.ui, and show() it, everything is fine.
I need to be able to get this rectangle BEFORE I show the widget.
When I just instantiate the class, the geometry object always returns (0,0,100,30). Only after I "show()" the widget, I'll get the correct geometry. I may be able to use the sizeHint for this sub-widget, but what about the "hint-X" or "hint-Y"? how do I get to my (x=0,y=88,w=400,h=200) BEFORE showing the widget? This is critical for one of my applications (this is a 3rd party component requirement, it cannot change).
Upvotes: 1
Views: 273
Reputation: 22272
The resize event will tell you what you need to know but there are a number of different ways to intercept it, depending on your situation.
If you are dealing with a QWidget subclass of your own, you can override resizeEvent(). If not, you can install an event filter on the object.
There are a couple of other options that are variations of these. The important parts of the documentation are The Event System and QCoreApplication::notify
Upvotes: 1