February 28, 2012

mikealfa mikealfa
Lab Rat
35 posts

Window

 

Can any body tell me how to make the application full screen when clicked on the maximize button ?

6 replies

February 28, 2012

Tobias Hunger Tobias Hunger
Mad Scientist
3125 posts

You don’t need to do anything. The application will be resized whenever the window size is changed.

February 29, 2012

mikealfa mikealfa
Lab Rat
35 posts

but what i am saying is i want my window without the title bar…..as in what happens when we double click in the vlc media player

February 29, 2012

pratik041 pratik041
Lab Rat
346 posts
mikealfa wrote:
but what i am saying is i want my window without the title bar…..as in what happens when we double click in the vlc media player

You can re implement the

  1. mouseDoubleclickevent()
and their you can call
  1. showmaximized()

function.

 Signature 

Pratik Agrawal

March 1, 2012

Lukas Geyer Lukas Geyer
Gene Splicer
2074 posts

Is think there is no platform-independent way of receiving system menu events, so you will have to reimplement the change event and modify the window state accordingly.

  1. void MainWindow::changeEvent(QEvent *event)
  2. {
  3.     if(event->type() == QEvent::WindowStateChange)
  4.     {
  5.         if(windowState() & Qt::WindowMaximized)
  6.         {
  7.             showFullscreen();
  8.         }
  9.     }
  10.  
  11.     QMainWindow::changeEvent(event);
  12. }

Brain to terminal. Not tested. Exemplary.

Two additions:

  • you are tinkering with default behaviour here; the user usually does not expect that a window goes into fullscreen when the maximize button is clicked
  • a fullscreen window has no system menu; you will have to provide other means to return from fullscreen, otherwise you are trapped in it

March 3, 2012

mikealfa mikealfa
Lab Rat
35 posts

@pratik
thanks

March 3, 2012

mikealfa mikealfa
Lab Rat
35 posts

@lukas
yep…i am doing so because i am developing a game and want it to be fullscreen when clicked on the maximize button

 
  ‹‹ [Solved] Mockup for C++ module      [Solved] Extension plugin ››

You must log in to post a reply. Not a member yet? Register here!