Results 1 to 1 of 1

Thread: QGridLayout scaling widgets

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2011
    Location
    Germany
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QGridLayout scaling widgets

    I'm having a problem about the scaling of widgets in a QGridLayout.
    I have a layout with 7 rows and 1 or 2 columns. There is a header in row 0.

    Then after I want to put a widget in row 1 (only 1 column) and a QwtPlot and a QLabel in row 2. And so forth in the next rows. I do not select any fixed height for my QwtPlot widgets and QLabels (in rows 2, 4 and 6). My pheader and the widgets in rows 1, 3 and 5 have a fixed width.

    Qt Code:
    1. QGridLayout *layout = new QGridLayout(this);
    2. if(layout != 0)
    3. {
    4. layout->addWidget(pheader, 0, 0);
    5. layout->addWidget(topWidget, 1, 0);
    6. layout->addWidget(topGraph, 2, 0);
    7. layout->addWidget(topGraphLabel, 2, 1);
    8. layout->addWidget(midWidget, 3, 0);
    9. layout->addWidget(midGraph, 4, 0);
    10. layout->addWidget(midGraphLabel, 4, 1);
    11. layout->addWidget(botWidget, 5, 0);
    12. layout->addWidget(botGraph, 6, 0);
    13. layout->addWidget(botGraphLabel, 6, 1);
    14. }
    15.  
    16. setLayout(layout);
    To copy to clipboard, switch view to plain text mode 
    It is strange that the widgets in row 4 are larger (in height) than those in row 2 and 6, but all should be of the same size.

    Before this I used a QVBoxLayout, because I didn't have the QLabel behind the QwtPlot, and all QwtPlot-Widgets had the same size.

    What can I do to make the QwtPlots to equal size?
    Last edited by Markus_AC; 24th November 2011 at 10:46.

Similar Threads

  1. Repositioning widgets in QGridLayout
    By Rayven in forum Qt Programming
    Replies: 8
    Last Post: 21st March 2011, 14:30
  2. Replies: 2
    Last Post: 16th December 2010, 11:52
  3. Widgets in QGridLayout placed at top left
    By anarion in forum Newbie
    Replies: 2
    Last Post: 2nd September 2010, 15:06
  4. qgridlayout and hiding widgets
    By Michael_Levin in forum Newbie
    Replies: 3
    Last Post: 21st May 2010, 17:47
  5. Zooming effect by scaling widgets
    By Cruz in forum Qt Programming
    Replies: 3
    Last Post: 1st February 2009, 09:43

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
  •  
Qt is a trademark of The Qt Company.