[Solved] Create a dialog box with QDesigner



  • Regards

    I am working with QDesigner to create a simple dialog box, as yet not allocate space to create the effect you want.

    I want to create a dialog box divided into two parts, where the first occupy at least two thirds of the area of the dialog box and the second the remaining space (at most one-third).

    In each of the two areas I want to put a QGroupBox empty, alone with his title.

    I've been testing with QHBoxLayout, QVBoxLayout and QGridLayout, but I can not do exactly what I want, the space of the dialog box always halved.

    My thanks in advance to who can give me some advice or suggestion.



  • Hello!

    Have you tried with a QSpacer? You can fix its length and position. A layout will always divide into equal parts the available amount of space. Once the spacer is introduced, then you could be able to use the layouts.

    Regards



  • Thanks for the advice, but I do not understand exactly what you suggest.

    Are you suggesting that I use a QSpacer within QLayout or am I misunderstanding?



  • In the designer under the smart/tools panel on the left you will find Horizontal/Vertical spacers, you can place them in your dialog as per your requirement.


  • Moderators

    The solution without additional elements would be to create QVBoxLayout and add those two QGroupBoxes there.
    Then, in the sizePolicy property group set vertical stretch to 2 in the first groupbox and to 1 in the second.



  • Like above, you a layout (doesn't really matter if a Hbox or Grid is used) and set the stretch factor and the sizeHint should have a 1 to 2 factor to get it started at the proper size! Should work nice then



  • I have successfully managed to create dialog box with space divided any way you want (actually I did several days ago, specifically January 13, 2013 ... I had forgotten to thank all of you).

    As I said, thank you all for your comments and help.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.