Full screen operation of Qt window and child window

API

     Full screen display (the top-level window is valid, the sub-window is invalid;)
          showFullScreen()

     Qt maximized display
          showMaximized()

Full screen for child windows

     Set the child window as the top-level window, and then display it in full screen, the order cannot be reversed.

     Implementation: call the function setWindowFlags(Qt::Dialog) for the child window in the Qt main window to be full screen, or call setWindowFlags(Qt::Window) to promote its type to the top-level window mode, and then call the showFullScreen() function to make the child window full screen display.

// 全屏时
ChildWidget->setWindowFlags(Qt::Window);
ChildWidget->showFullScreen();

// 退出全屏时:
ChildWidget->setWindowFlags(Qt::SubWindow);
ChildWidget->showNormal();

attention

Search " Qt_io_ " or " Qt Developer Center " on WeChat public account to learn more about Qt and C++ development knowledge.

Author-jxd

Guess you like

Origin blog.csdn.net/automoblie0/article/details/107671848