Results 1 to 5 of 5

Thread: QGroupBox frame

  1. #1
    Join Date
    Nov 2009
    Posts
    29
    Thanks
    10

    Default QGroupBox frame

    Hello!

    I have created a QGroupBox but there is no frame. I have looked in the documentation and tried several things but I cannot succeed in making the frame appear.

    Thank you!

    Here is the piece of code I have written:

    QGridLayout *widgetLayout=new QGridLayout();
    QGridLayout *groupBoxLayout=new QGridLayout();
    QGroupBox *gb=new QGroupBox("test");
    QLineEdit *le=new QLineEdit();
    groupBoxLayout->addWidget(le,0,0);
    gb->setLayout(groupBoxLayout);
    layout->addWidget(gb,0,1);
    setLayout(layout);

  2. #2
    Join Date
    Oct 2009
    Posts
    105
    Thanked 4 Times in 2 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QGroupBox frame

    I faced same problem. used setStylesheet to customised the style sheet. N it worked.

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

    pippo42 (15th January 2010)

  4. #3
    Join Date
    Nov 2009
    Posts
    29
    Thanks
    10

    Default Re: QGroupBox frame

    Thank you!

    I try...

  5. #4
    Join Date
    Nov 2009
    Posts
    29
    Thanks
    10

    Default Re: QGroupBox frame

    It works... but it pushes the title downwards where it crashes onto the other widgets. I was trying to achieve the situation we see in every example where the title is on the line that is interrupted to let it appear.

  6. #5
    Join Date
    Nov 2009
    Posts
    29
    Thanks
    10

    Default Re: QGroupBox frame

    Now it works!
    Thank you.

    The solution is something like that:


    groupBox->setStyleSheet("QGroupBox{border:2px solid gray;border-radius:5px;margin-top: 1ex;} QGroupBox::title{subcontrol-origin: margin;subcontrol-position:top center;padding:0 3px;}");

Similar Threads

  1. QGroupBox
    By Devoraz in forum Newbie
    Replies: 1
    Last Post: 30th July 2009, 04:49
  2. QGroupBox
    By merry in forum Qt Programming
    Replies: 2
    Last Post: 22nd August 2007, 13:11
  3. Previous frame inner to this frame(corrupt stack?)
    By coralbird in forum Qt Programming
    Replies: 1
    Last Post: 28th May 2007, 01:35
  4. how to change QGroupBox frame color? (Qt4)
    By high_flyer in forum Qt Programming
    Replies: 7
    Last Post: 9th May 2006, 13:48
  5. Previous frame inner to this frame(corrupt stack?)
    By coralbird in forum Qt Programming
    Replies: 17
    Last Post: 29th April 2006, 01:42

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.