Results 1 to 7 of 7

Thread: Problem while using QFormlayout inside a QGroupbox

  1. #1
    Join Date
    Oct 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem while using QFormlayout inside a QGroupbox

    Hey,

    i've got a problem while using a qformlayout inside a qgroupbox..

    if my screenresolution is to small, i get a layout like this:

    clipboard02x2k30.jpg

    the code i'm using looks like this:

    Qt Code:
    1. QFormLayout *formLayout = new QFormLayout();
    2. formLayout->addRow(tr("Store Images"), myCheckbox);
    3. formLayout->addRow(tr("Store Image Path"), myLineEdit)
    4. QxtGroupBox* gb = new QxtGroupBox(tr("&Settings"), this);
    5. mainLayout->addWidget(gb);
    To copy to clipboard, switch view to plain text mode 

    Someone a idea how i can fix this problem?

    thanks already for your answer..

    regards.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,709
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem while using QFormlayout inside a QGroupbox

    Set margins and size policies to your widgets.
    Make sure that the overall size is not to large for your screen.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Oct 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem while using QFormlayout inside a QGroupbox

    hmm - ok i'll have a try, but setting all size policies by hand is a lot of work..

    i tried to use a scollarea, but this doesn't work either (or is a scrollarea just the wrong widget?)

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,709
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem while using QFormlayout inside a QGroupbox

    tried to use a scollarea, but this doesn't work either
    What do you mean by "doesn't work"?
    Show your code.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Oct 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem while using QFormlayout inside a QGroupbox

    like above, but before doing this:


    mainLayout->addWidget(gb);
    i've done this:

    QScrollArea* sa = new QScrollArea();
    QHBoxLayout* hl1 = new QHboxLayout();
    hl1->addWidget(sa);
    sa->setLayout(formLayout);
    gb->setLayout(hl1);

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,709
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem while using QFormlayout inside a QGroupbox

    Where is sa->setWidget()?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  7. #7
    Join Date
    Oct 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem while using QFormlayout inside a QGroupbox

    uuups..

    which widget is best for adding a layout before adding to scrollarea? i thought about a QFrame?

    this doesn't work..

    QWidget* w = new QWidget();
    w->setLayout(formLayout);
    sa->setWidget(w);
    then my box is just empty

    forget about it.. pebcak, its working fine
    Last edited by Schreihals; 11th July 2012 at 13:12.

Similar Threads

  1. remove row of QFormLayout
    By jorg in forum Newbie
    Replies: 1
    Last Post: 31st January 2011, 06:19
  2. QGroupBox enabling problem
    By Annihilator in forum Newbie
    Replies: 10
    Last Post: 16th April 2010, 17:58
  3. QGroupBox size problem
    By MarkoSan in forum Newbie
    Replies: 2
    Last Post: 22nd November 2009, 19:44
  4. QWidget inside QGroupbox semi transparent [Qt 4.3.1]
    By desch in forum Qt Programming
    Replies: 7
    Last Post: 26th February 2009, 11:00
  5. Replies: 2
    Last Post: 19th May 2007, 19:25

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.