Results 1 to 5 of 5

Thread: QDockWidget showFullScreen() only works on Windows

  1. #1
    Join Date
    Feb 2013
    Posts
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Android

    Default QDockWidget showFullScreen() only works on Windows

    Hello,

    i figured out that the showFullScreen() method of an undocked (floated) QDockWidget behaves unhandy/different under Windows XP compared to OSX and Linux. Only under XP it behaves as i aspected - appears maximized without title bar. OSX (lion) just maximizes it and ubuntu gnome seems to do just nothing.

    So how can i achieve a real fullscreen mode for a floated QDockWidget under Linux aswell as under OSX and Windows?

    I additionally created an stack overflow question with this concern: stckoerflw, here you can see a simple example how to reproduce this different (in my p.o.v. wrong) behaviour of qt4.8. Please have a look, there you'll find some additional informations.

    Any suggestions are wellcome - shure the OS'es have different window managing systems - but that's why i think this may be a bug or unwanted behaviour within qt!?

    I am very interested in a linux (ubuntu gnome shell) solution, because this the major plattform my app is running on.
    Nevertheless a plattform independant solution is the reason why i choose qt for gui develepment...

    Thanks a lot

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDockWidget showFullScreen() only works on Windows

    Move the widget content out of the dock widget and then make it full screen.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2013
    Posts
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Android

    Default Re: QDockWidget showFullScreen() only works on Windows

    What exactly do you mean by:
    Move the widget content out of the dock widget and then make it full screen
    I'm unsure how to do this. Maybe you could be more precise or provide a simple example how to move the content of a floated dockwidget out of it and make it full screen (and vice versa).

    Nevertheless i found a quick work around using style sheets. Actually it's all right for my purpose but it's not really a solution to the problem:

    Qt Code:
    1. // Set full screen:
    2. dockflags = dw->windowFlags();
    3. styleSheet = dw->styleSheet();
    4. geometry = dw->geometry();
    5.  
    6. dw->setWindowFlags( Qt::Window );
    7.  
    8. dw->setStyleSheet(
    9. QString("QDockWidget{ border: 0px; color: #000099; background-color: black; margin: 0px; padding: 0px }") +
    10. QString("QDockWidget::title{ text-align: center; background-color: black; padding: 0px; margin: 0px; }") +
    11. QString("QDockWidget::close-button, QDockWidget::float-button { border: 0px solid black; background: black; padding: 0px; }") +
    12. QString("QDockWidget::close-button:hover, QDockWidget::float-button:hover { background: gray; }") +
    13. QString("QDockWidget::close-button:pressed, QDockWidget::float-button:pressed { padding: 1px -1px -1px 1px; }") );
    14.  
    15. dw->showFullScreen();
    16. ...
    17. // Reset from fullscreen:
    18. dw->setWindowFlags( dockflags );
    19. dw->setStyleSheet( styleSheet );
    20. dw->setGeometry(geometry);
    21.  
    22. dw->show();
    To copy to clipboard, switch view to plain text mode 
    The title bar of the dock widget is still there but it's simply "hidden"; colored black.

    Finally this is not the full screen behaviour i'm happy with, but it kinda works for now. (I'm displaying video and/or 3D models within the window). Furthermore i'm still searching for a better/real solution wich is not a hack like this. Maybe i have to think about not using QDockWidgets at all, due to the lack of identic behaviour at different OSs (especially in that case of the showFullScreen method). Actually i am just a little "satisfied" - so i'm still searching for a more convenient solution. Any more hints are welcome, thnx so far...
    Last edited by xam; 23rd April 2013 at 01:14.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDockWidget showFullScreen() only works on Windows

    I mean reparent content of the widget to null so that it becomes a top-level window and then make it full screen.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jul 2014
    Posts
    46
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: QDockWidget showFullScreen() only works on Windows

    I am facing issues with the reparenting method.
    I have a MainWIndow which has a horizontal layout with certain number of widgets in it in the form of a stackedwidget, of which only one is visible at a time.
    I am checking for condition on mouseReleaseEvent.
    This is the code I have used:
    Qt Code:
    1. if (maxMode== false)
    2. {
    3. m_enOrigWindowFlags = this->windowFlags();
    4. m_pSize = this->size();
    5. this->setParent(0);
    6. this->setWindowFlags( Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
    7. this->showMaximized();
    8. maxMode = true;
    9. }
    10. else
    11. {
    12. this->setParent(m_pParent);
    13. this ->resize(m_pSize);
    14. this->overrideWindowFlags(m_enOrigWindowFlags);
    15. this->move(280,40);
    16. this->show();
    17. maxMode = false;
    18. }
    To copy to clipboard, switch view to plain text mode 

    Normal mode:
    prob1.jpg

    On clicking on the first camera:
    prob2.jpg

    If i use fullscreen in case of maximized then my widget disappears on coming back. I want it to be fullscreen with a black background.
    THe top part with buttons is the MainWindow. The 4 cameras are a widget inside the horizontal layout of the MainWindow.
    Please help!
    Last edited by antweb; 15th April 2015 at 12:38.

Similar Threads

  1. Replies: 5
    Last Post: 8th June 2012, 14:14
  2. Setting fonts on Windows works, but not on Mac
    By mtnbiker66 in forum Qt Programming
    Replies: 0
    Last Post: 17th January 2012, 22:06
  3. Replies: 4
    Last Post: 10th November 2011, 16:49
  4. Does anyone have works with qoauth in windows?
    By MorrisLiang in forum Qt Programming
    Replies: 1
    Last Post: 11th December 2010, 11:02
  5. Works well on Windows but fails on Linux
    By utkuaydin in forum Qt Programming
    Replies: 3
    Last Post: 11th January 2010, 14:22

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.