Home > Back-end >  QT creator in the UI for a QWidget area after full screen out of the realization of the full screen
QT creator in the UI for a QWidget area after full screen out of the realization of the full screen

Time:12-06




As shown in figure after click the Max button, full screen on the left side area, according to the online method code is as follows:
Copy the code
Void frommain: : on_BtnMax_clicked ()
{
The UI - & gt; Videowidget - & gt; SetWindowFlag (Qt: : Windows);//Window
The UI - & gt; Videowidget - & gt; SetWindowFlag (Qt: : FramelessWindowHint);//to border
The UI - & gt; Videowidget - & gt; ShowFullScreen ();
}



Then bind the ESC key, exit full screen: exit code is as follows:
Copy the code
Void frommain: : keyPressEvent (QKeyEvent * event)
{
If (event - & gt; The key ()==Qt: : Key_Escape)
{
QDebug () & lt; <"Esc" down!" The UI - & gt; Videowidget - & gt; SetWindowFlags (Qt: : SubWindow);//SubWindow
The UI - & gt; Videowidget - & gt; ShowNormal ();
}
}


The result: according to the "Max" can enter the full screen, full screen press ESC has no reaction, after the ALT + F4, after being forced to quit the Qwidget part of the main interface gone



CodePudding user response:

Focus in the window? You order the button focus is not in this window?
  • Related