Results 1 to 2 of 2

Thread: Layout messing up

  1. #1
    Join Date
    Feb 2006
    Posts
    87
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Layout messing up

    hey there i have a QHBox of my main widget, QHBox of buttons and then i have a QHBox of a QStatusBar but when i add them to my main layout the QStatusBar widget ends up taking half the space on my tab dialog....why is this happening? heres the code below and i attached the image of how it looks now...

    Qt Code:
    1. sortingBox = new SortingBox;
    2. QVBoxLayout *mainLayout = new QVBoxLayout;
    3.  
    4.  
    5. QHBoxLayout * buttonsLayout = new QHBoxLayout;
    6. QHBoxLayout * messageLayout = new QHBoxLayout;
    7. QGridLayout * gridLayout = new QGridLayout;
    8.  
    9.  
    10. QPushButton * clearButton = new QPushButton("Clear");
    11. connect(clearButton, SIGNAL(clicked()), sortingBox, SLOT(clear()));clearButton->setShortcut(tr("Ctrl+R"));
    12. buttonsLayout->addWidget(clearButton);
    13.  
    14. QPushButton * clearLinks = new QPushButton("Clear Links");
    15. connect(clearLinks, SIGNAL(clicked()), sortingBox, SLOT(clearLinks()));
    16. buttonsLayout->addWidget(clearLinks);
    17.  
    18. QPushButton * clearLastLink = new QPushButton("Clear Last Link");
    19. connect(clearLastLink, SIGNAL(clicked()), sortingBox, SLOT(clearLastLink()));
    20. buttonsLayout->addWidget(clearLastLink);
    21.  
    22. QPushButton * dijkstra = new QPushButton("Calc Shortest Path");
    23. connect(dijkstra, SIGNAL(clicked()), sortingBox, SLOT(startDijkstra()));
    24. buttonsLayout->addWidget(dijkstra);
    25.  
    26. QStatusBar * sbar = new QStatusBar();
    27. connect(sortingBox, SIGNAL(showStatus(QString)), sbar, SLOT(showMessage(QString)));
    28. messageLayout->addWidget(sbar);
    29.  
    30. //gridLayout->addLayout(buttonsLayout, 0, 0);
    31. //gridLayout->addWidget(sbar, 1, 0, 1, 0);
    32. mainLayout->addWidget(sortingBox);
    33. mainLayout->addLayout(buttonsLayout);
    34. mainLayout->addWidget(sbar);
    35. setLayout(mainLayout);
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Layout messing up

    Supposedly the "sorting box" should take the available space, instead?
    Change sorting box's vertical size policy to QSizePolicy::Expanding or QSizePolicy::MinimumExpanding.
    J-P Nurmi

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

    therealjag (10th April 2006)

Similar Threads

  1. changing layout of a widget
    By mikro in forum Qt Programming
    Replies: 10
    Last Post: 4th August 2009, 21:21
  2. Qt like Layout Manager available for .NET platform
    By vkhaitan in forum Qt Programming
    Replies: 0
    Last Post: 5th November 2008, 14:36
  3. Qt layout memory issue
    By bunjee in forum Qt Programming
    Replies: 9
    Last Post: 25th August 2007, 18:11
  4. Resizing problems when applying a layout
    By JimBrown in forum Newbie
    Replies: 1
    Last Post: 21st February 2007, 23:54
  5. "dynamic" layout
    By hulk in forum Qt Programming
    Replies: 2
    Last Post: 9th May 2006, 08:16

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.