Important: Please read the Qt Code of Conduct -

Chicken and Egg problem with Qt's QWidgets

  • 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).

  • Maybe calling "adjustSize": on your main widget could help you.

Log in to reply