Results 1 to 8 of 8

Thread: Main Window Size not Scaled Properly

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2012
    Posts
    17
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Main Window Size not Scaled Properly

    I have a very elementary problem and I think answer is going to be as simple only. But I seem not to hit it right.

    I had designed my mainwindow with multiple widgets and buttons.

    The Problem is that when I try to maximise it or use showMaximized(), all the items move to the left top side and does not scale to the whole page. How do i correct it?

    Please help.

    Thank You

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Main Window Size not Scaled Properly

    What are the widgets, and what size policies are set on them?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. The following user says thank you to Santosh Reddy for this useful post:

    alok9871 (11th January 2013)

  4. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Main Window Size not Scaled Properly

    My guess is you are missing a layout on your main window

  5. The following user says thank you to ChrisW67 for this useful post:

    alok9871 (11th January 2013)

  6. #4
    Join Date
    Dec 2012
    Posts
    17
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Main Window Size not Scaled Properly

    @Santosh : Just some combo boxes and list boxes and some buttons.

    @ ChrisW67 Guru : I know the problem may lie somewhere around that because a similar problem came up in the stackoverflow.com and had similar solution. But I couldnt quite follow the concept. I just dragged the items onto the mainWindow.ui and started working. In fact, I am quite far ahead with it. Can you please help me a way out of this problem? Many thanks

  7. #5
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Main Window Size not Scaled Properly

    What Layout did you set on the MainWidow? Try setting QGridLayout (Right Click->"Lay out"->"Lay out in Grid")
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  8. The following user says thank you to Santosh Reddy for this useful post:

    alok9871 (11th January 2013)

  9. #6
    Join Date
    Dec 2012
    Posts
    17
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Main Window Size not Scaled Properly

    Thanks Santosh!!

    It works!! . But it also re-arranges my widgets on the screen which doesn't look good. Any way out?

  10. #7
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Main Window Size not Scaled Properly

    You could use somthing like spacers (Horizontal / Vertical), to adjust the spacing between widgets, and restricting the widgets from growing.

    For better understanding read documentation of QGridLayout
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  11. The following user says thank you to Santosh Reddy for this useful post:

    alok9871 (21st January 2013)

  12. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Main Window Size not Scaled Properly

    More generally, read the information at Layout Management and how to use this in Designer.

  13. The following user says thank you to ChrisW67 for this useful post:

    alok9871 (21st January 2013)

Similar Threads

  1. main window gets wider than screen size
    By shanchathuranga in forum Qt Programming
    Replies: 1
    Last Post: 16th March 2012, 14:45
  2. Replies: 3
    Last Post: 30th December 2010, 15:34
  3. Main Window minimal size constraints
    By psih128 in forum Qt Programming
    Replies: 1
    Last Post: 3rd August 2010, 17:06
  4. How to get Scaled size
    By rogerholmes in forum Newbie
    Replies: 3
    Last Post: 20th March 2010, 16:12
  5. Main Window size problem
    By frenk_castle in forum Newbie
    Replies: 2
    Last Post: 20th December 2009, 10:49

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.