Results 1 to 4 of 4

Thread: Fixed QMainwindow size, Layout question

  1. #1
    Join Date
    Jan 2013
    Posts
    23
    Qt products
    Qt4
    Platforms
    Windows

    Question Fixed QMainwindow size, Layout question

    Hello there,

    I'm a complete newbie when it comes to QT (only heard about it a week ago when i started a new job). I'm originally a web designer (HTML/CSS, sadly bad in javascript) so the company i started working thought it would be a great idea to let me work on the UI's of their applications as well. Now i've been messing around with QT Designer and have been busy on a general theme-stylesheet that can be used on all future projects. Thought it would be easy since it's a lot like CSS, but much harder since so many stuff like widgets and frames are linked together.

    Anyway, drifting offtopic...after getting the stylesheet ready for all the elements, i've been trying to build some User Interfaces for some small tools that the development team is working on and found out that the LayOut component of QT is another..... hard thing to get used too. Usually clicking the GRID layout button makes my UI explode in unexpected ways. So clearly I need some learning to do before i get the hang of it, but there are some deadlines getting close for some of the tools.

    Now to my question: I've been working on a small dialog tool and have some trouble getting the layout to work. The layout i build with just drag and dropping looks fine, but when i try to get the layout to work when you resize the mainwindow, it all gets broken. So I thought, why would the enduser even want to resize this window? Why can't I just set the minsize and maxsize the same so the user CAN'T resize it and leave the layout like i drag/dropped it?
    This ofcourse would be a (in my opinion) a short-term solution for our small tool applications, but would be an issue when we start to work on our main application which is fullscreen.


    TL;DR If I set a fixed window size, do i still need to define the LayOut with the "Layout in a grid" or "Layout horizontally"? Or can i leave it like that for small tools....

  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: Fixed QMainwindow size, Layout question

    TL;DR If I set a fixed window size, do i still need to define the LayOut with the "Layout in a grid" or "Layout horizontally"? Or can i leave it like that for small tools....
    If you plan for fixed widget/window size, there is no need to have Layout in widget (QGridLayout/QHorizontalLayout etc). you can just manually position each of the child-widgets inside the parent-widget (from Qt Designer)
    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. #3
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,461
    Thanked 271 Times in 266 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Fixed QMainwindow size, Layout question

    Quote Originally Posted by Nyte View Post
    Why can't I just set the minsize and maxsize the same so the user CAN'T resize it and leave the layout like i drag/dropped it?
    Because on another computer with different defined fonts may look bad. Especially when the default font is larger in size. For example, the caption on the button may be higher than the button.

  4. #4
    Join Date
    Jan 2013
    Posts
    23
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Fixed QMainwindow size, Layout question

    Quote Originally Posted by Santosh Reddy View Post
    If you plan for fixed widget/window size, there is no need to have Layout in widget (QGridLayout/QHorizontalLayout etc). you can just manually position each of the child-widgets inside the parent-widget (from Qt Designer)
    Thank you for the quick answer

    Quote Originally Posted by Lesiok View Post
    Because on another computer with different defined fonts may look bad. Especially when the default font is larger in size. For example, the caption on the button may be higher than the button.
    This is something I could think about. thanks


    All in all, this is a short term solution. When i got a better understanding how the layout system works, i will most likely recreate the tool with a variable layout.

Similar Threads

  1. QMainWindow with fixed area + Dockarea
    By trallallero in forum Qt Programming
    Replies: 2
    Last Post: 16th March 2012, 09:25
  2. Replies: 0
    Last Post: 14th February 2012, 15:43
  3. Fixed-height layout question
    By TheJim01 in forum Newbie
    Replies: 1
    Last Post: 16th March 2010, 20:37
  4. Replies: 4
    Last Post: 20th November 2009, 12:25
  5. How to make a QMainWindow fixed sized?
    By Goldmmbr in forum Newbie
    Replies: 2
    Last Post: 18th November 2009, 08:52

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.