Results 1 to 3 of 3

Thread: Default size of window on different platforms

  1. #1
    Join Date
    Mar 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Default size of window on different platforms

    Hi,

    I've searched the forum and tried different things to solve this to no avail.

    I have an application that shows a QDialog derived dialog from a QMainWindow derived class. I'm building on a mac with a high res display and the dialog shows fine. When I build on a linux box with a lower resolution display, the top and bottom of the dialog extends above and below the screen respectively. If I use setFixedSize() on my dialog I can display the whole thing on this lower res display fine but then I can't re-size if I want to. Also, this is a ham handed way of sizing a window. Obviously using setMaximumHeight() or setMaximumWidth() won't work because they just restrict re-sizing. How can I use the dimensions of my display, which I can retrieve with a call to availableGeometry(), to size my dialog properly? What function can I plug these values into to achieve this? What am I missing here, this should be simple.

    Thanks for the consideration in advance. Much appreciated.

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

    Default Re: Default size of window on different platforms

    Does it help if right after calling show() on your widget you call this line?

    Qt Code:
    1. widget->resize(widget->sizeHint());
    To copy to clipboard, switch view to plain text mode 
    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
    Mar 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Default size of window on different platforms

    Thanks for your response. Unfortunately, this seems to have no effect.

    One clue is that if instead of using widget->show(), I use widget->showMaximized(), the whole dialog will show and fill up the entire screen. The layouts in the dialog appear to be a little crowded, so maybe due to the size of the layouts in my dialog and the resolution of my display, it's not possible to fit properly? Hence, I can not get resize() to work right?


    Added after 20 minutes:


    Sorry all. It looks like my problem all along was that my dialog with all of its layouts was just too big for the resolution of the monitor that I was attempting to display it on. I suppose that sizeHint() can only help so much. What I did was reorganized my layouts so that my dialog extended in a more horizontal fashion which helped.

    Thanks to all who looked at this post. Much appreciated.
    Last edited by guitargentlyweeps; 13th March 2012 at 14:55.

Similar Threads

  1. QTableWidget remains at default size
    By CoderMan in forum Qt Programming
    Replies: 6
    Last Post: 7th March 2012, 19:10
  2. QDockWidget default size ?
    By pl01 in forum Newbie
    Replies: 2
    Last Post: 20th December 2010, 09:10
  3. Replies: 4
    Last Post: 20th November 2009, 12:25
  4. Default size of a QListWidget inside a QDockWidget
    By rakuco in forum Qt Programming
    Replies: 0
    Last Post: 25th July 2007, 08:01
  5. Replies: 2
    Last Post: 29th May 2007, 13:55

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
  •  
Qt is a trademark of The Qt Company.