Source: Http://blog.csdn.net/dbzhang800/article/details/6741344?reload Operation:
Framegeometry ()
|
Geometric dimensions (position + size)
|
For Windows, including window decorators
|
X () y () POS ()
|
Contains location information only (upper-left coordinate)
|
Move ()
|
Move position only
|
Geometry ()
|
Geometric dimensions (position + size)
|
Window Adorner not included
|
Width () height () rect () size ()
|
Contains only size information
|
Setgeometry ()
|
Change position + size
|
Resize ()
|
Change size only
|
have been thinking about how to make the center window in the main window after the full screen, the center window is also scaled. This includes, center window size adaptation, center window 1. Create your UI, which uses your top-level layout, check Widget window-right-click-Layout-Grid layout.
2. In the constructor
Copy code centralwidget = new Qwidget; Qwidget * a = new Qwidget (centralwidget); Ui1->setupui (a); A->hide (); Qwidget * b = new Qwidget (centralwidget); Ui2->setupui (b); B->hide (); Setcentralwidget (Centralwidget)//The advantage is that you can make a lot of UI, you want to use which UI directly Uin->setupui (WIDGETN), and then Widgetn->show ().
3. However, if you want to drag the main window, you can make the window components can also be scaled with the window, you need to rewrite resizeevent, because after the construction, the size of the child window is fixed.
Copy code void Resizeevent (qresizeevent* size) { Centralwidget->resize (Framegeometry (). Size ()); Whether to use size () or framegeometry.size () according to your own needs. }
What is the problem, please leave a message to explain, we communicate and solve together.
Additional device-related screen size information, if you rewrite resizeevent words, I think this is unnecessary. qdesktopwidget* desktopwidget = qapplication::d esktop (); Get Customer Area Rectangle Qrect clientrect = Desktopwidget->availablegeometry (); Get the application Rectangle Qrect applicationrect = Desktopwidget->screengeometry ();
|