Results 1 to 15 of 15

Thread: About Qt designer

  1. #1
    Join Date
    Feb 2009
    Location
    Guangzhou,China
    Posts
    89
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default About Qt designer

    Hi friends.

    I find the Qt designer is very difficult to use. It's very easy to run out of order. for example, I want to setup a dialog like this:

    Three QGroupBox in the leftverticallayout.
    two QPushButtons in the rightverticallayout
    I want to setup them as a mainlayout. But horizontallayout and gridlayout both fail, their size never meet my thinking.

    Do you have any good advises? Thanks

    I have attached my ui file.
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2008
    Location
    Houston, Texas, USA
    Posts
    277
    Thanks
    9
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: About Qt designer

    What I'd suggest would be to start a new form. drag a grid layout on to the empty form. and right click on the main form. Make sure you have it there. And click layout then go to grid layout and it will make that grid span to the whole form and then start working from there. Then you can simply add them how you like. And when you resize the form it will resize. You can have like say for instance two buttons on row 1. Then on the second row you can add another button and make it span the with of those two buttons. And like with your layout. Just create it normally. When you add the buttons just put them on the side and just stretch the other contents and push a horizontal spacer in.

    Oh and if you want on the example. To make the group boxes not expand from top to bottom just at a vertical spacer.

    And also like how I said, to make it expand all the widgets when you make the form maximised, just drop a grid onto the form and right click -> layout -> grid. You can do that also in groups, tab controls etc and it's the same process. Just look at the example for help. If you want to know more just ask and me or any other person can help you more =]
    Attached Files Attached Files
    Last edited by ComaWhite; 24th February 2009 at 04:50.
    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

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

    HelloDan (24th February 2009)

  4. #3
    Join Date
    Feb 2009
    Location
    Guangzhou,China
    Posts
    89
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: About Qt designer

    Thanks! I will try!

  5. #4
    Join Date
    Feb 2009
    Location
    Guangzhou,China
    Posts
    89
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: About Qt designer

    Thanks ComaWhite. Your ui form is very perfect.

    But I failed to do it for myself. Can you shoot some photos for me step by step to show me how to make it? For example, how can you make the two buttons in a cell, but mine will be splited into two. And also the QGroupBox, how to configure it.

    thanks very much!

  6. #5
    Join Date
    Feb 2009
    Location
    Guangzhou,China
    Posts
    89
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: About Qt designer

    At the same time, the two buttons in the same cell as a whole have the same objectname, but they should function different, for example, one OK, and the other Cancel.
    how to solve this problem?

    If you can help, Please send the photos to sysuor@gmail.com.

    Thanks!

  7. #6
    Join Date
    Feb 2009
    Location
    Guangzhou,China
    Posts
    89
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: About Qt designer

    I see, it's a buttonBox, but how i can make they receive different signals?

  8. #7
    Join Date
    Feb 2009
    Location
    Guangzhou,China
    Posts
    89
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: About Qt designer

    Qt Code:
    1. buttonBox = new QDialogButtonBox(QDialogButtonBox::Open
    2. | QDialogButtonBox::Cancel
    3. | QDialogButtonBox::Help);
    4. connect(buttonBox, SIGNAL(accepted()), this, SLOT(openFile()));
    5. connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    6. connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(help()));
    To copy to clipboard, switch view to plain text mode 

    I know how to use them now.

    still the problem, how to configure the Groupbox

  9. #8
    Join Date
    Feb 2009
    Location
    Guangzhou,China
    Posts
    89
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: About Qt designer

    Hello Friend, Thanks for your help. But I still fail to make my own layout. I don't know how to setup it. I must must one more( two in total) vertical spacer to make my one groupbox to have a comfortable enough space but not a line, while yours is only one can do. Can you give me more tips. Thanks very much!

    see the attachment, my own new UI file
    Attached Files Attached Files

  10. #9
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: About Qt designer

    If you want to prevent the boxes from expanding vertically, restrict it with one of the properties, don't use spacers. Is just neater and easier to work with.

  11. #10
    Join Date
    Feb 2009
    Location
    Guangzhou,China
    Posts
    89
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: About Qt designer

    If you want to prevent the boxes from expanding vertically, restrict it with one of the properties, don't use spacers. Is just neater and easier to work with.

    It's hard to understand. How to do? If I don't add one more spacer, the QGroupBox will be compressed to a line, but it will still add two more cells.

    Can anyone help?

  12. #11
    Join Date
    Mar 2008
    Location
    Houston, Texas, USA
    Posts
    277
    Thanks
    9
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: About Qt designer

    Sorry I didn't respond so quickly issues in RL.

    If you wanna do it without spacers. Just edit the minimumSize and maximumSize properties. But I use spacers like crazy ;P. The just resize the form in designer and it will fix. But yeah the spacer at the bottom of the form is forcing everything up. So when you add a new QGroupBox to the form it will make it into a single tiny thing. Just delete the spacer at the bottom and resize the form and when you are done just add another. But I don't recommand spacers because it limits stuff that shouldn't be. Especially when forms are resizeable.

    The reason for the splitting of the buttons is because the vertical sizePolicy was set to expanding. instead of fixed. So when you set it to fix it will not grown aka not have the gap between the OK and Cancel button. Oh in that little code you post. If you click on the ButtonBox and look through the properties you can see that you can add more buttons to it that way.
    Last edited by ComaWhite; 25th February 2009 at 08:28.
    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

  13. #12
    Join Date
    Feb 2009
    Location
    Guangzhou,China
    Posts
    89
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: About Qt designer

    Quote Originally Posted by ComaWhite View Post
    Sorry I didn't respond so quickly issues in RL.

    If you wanna do it without spacers. Just edit the minimumSize and maximumSize properties. But I use spacers like crazy ;P. The just resize the form in designer and it will fix. But yeah the spacer at the bottom of the form is forcing everything up. So when you add a new QGroupBox to the form it will make it into a single tiny thing. Just delete the spacer at the bottom and resize the form and when you are done just add another. But I don't recommand spacers because it limits stuff that shouldn't be. Especially when forms are resizeable.

    The reason for the splitting of the buttons is because the vertical sizePolicy was set to expanding. instead of fixed. So when you set it to fix it will not grown aka not have the gap between the OK and Cancel button. Oh in that little code you post. If you click on the ButtonBox and look through the properties you can see that you can add more buttons to it that way.
    Thanks!

    But that is one more problem. Compare with you example, the latter UI file i upload and do the same things with your example, but that is two cell in my Ui file, but your just one with a spacer. How I can merge my two cell into one just as you did.

    Thanks again!

  14. #13
    Join Date
    Mar 2008
    Location
    Houston, Texas, USA
    Posts
    277
    Thanks
    9
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: About Qt designer

    Depending on which one. Just pull on one of the ends that you want it to go into the next column or row and just pull on it and it will span to the next column|row
    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

  15. The following user says thank you to ComaWhite for this useful post:

    HelloDan (25th February 2009)

  16. #14
    Join Date
    Feb 2009
    Location
    Guangzhou,China
    Posts
    89
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: About Qt designer

    Quote Originally Posted by ComaWhite View Post
    Depending on which one. Just pull on one of the ends that you want it to go into the next column or row and just pull on it and it will span to the next column|row
    Oh, Thanks sincerely! I make it!

  17. #15
    Join Date
    Mar 2008
    Location
    Houston, Texas, USA
    Posts
    277
    Thanks
    9
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: About Qt designer

    That is good to know ^_^ Good job
    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

Similar Threads

  1. Threads in Designer plugins
    By hvengel in forum Qt Tools
    Replies: 2
    Last Post: 3rd January 2009, 19:19
  2. Replies: 1
    Last Post: 22nd January 2007, 12:13
  3. Replies: 13
    Last Post: 15th December 2006, 11:52
  4. Designer crashes when selecting some widgets
    By gwendal in forum Qt Tools
    Replies: 4
    Last Post: 21st July 2006, 13:18
  5. Adding slots in Designer
    By jamos in forum Qt Tools
    Replies: 5
    Last Post: 18th May 2006, 23:28

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.