2) Consider calling showNormal() first to set the window to its original size, and then set the window to sub-window mode. There are two problems: 1) showNormal() is only valid for top-level windows.
Someone mentioned that when exiting the full screen, call showNormal() and then setWindowFlags(Qt::SubWindow). That is, first call setWindowFlags (Qt::Dialog) or setWindowFlags (Qt::SubWindow) call the move and resize functions. Then move the window to the desired position. You need to set the child window to non-window mode first. In QT, directly using move and resize to position the window has no effect.
You can directly call the SetWindowPos() function to display the child window to a predetermined position. In MFC, the method for the child window to exit the full screen is simple and straightforward. If you want to restore to a normal window, call setWindowFlags(Qt::subwindow) to set the child window as a non-top-level window, and then call showNormal() to display the subwindow.Ĭompared to the full-screen display method of the child window, I have to mention the method of exiting the full screen of the child window. By calling the child window: setWindowFlags(Qt::Dialog) or setWindowFlags(Qt::Window) after setting it to window mode, you can call showFullScreen() to display the full screen. Therefore, calling showFullScreen() on it has no effect. The feature of the subwindow is Qt::SubWindow, not an independent window. The QWidget member function showFullScreen() is used to display the widget in full screen in QT, but it is only useful for widgets in window mode. Qt fixed size display function window.resize(x,y) Qt minimized display function window.showMinimized() Qt maximized display function window.showMaximized() (The first Qt::window indicates that the widget is a window type, and the second parameter uses no frame, which means there is no title, status bar and border) yourwidget->setWindowFlags(Qt::window | Qt::FramelessWindowHint) window.showFullScreen()//This method is only valid for top-level windows, not for child windowsĢ. W.setWindowFlags(w.windowFlags() &~ (Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint)) ġ. Also prohibit the maximize and minimize buttons The "&~" here means bitwise AND after inverted, and the following "|" means bitwise OR W.setWindowFlags(w.windowFlags()& ~Qt::WindowMaximizeButtonHint& ~Qt::WindowMinimizeButtonHint) CVWINDOWFREERATIO The image expends as much as it can (no ratio constraint) CVWINDOWKEEPRATIO The. Qt main window is not minimized, maximize button and maximize display CVWINDOWFULLSCREEN Change the window to fullscreen. Summary of some small technologies in the Qt window Qt program window maximum and minimum related setting methods. How does QT maximize the initial window- Ģ.