Results 1 to 13 of 13

Thread: Groupbox has no borders ?

  1. #1
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Groupbox has no borders ?

    Hi All,

    Qt 4.5
    In Designer, In the StyleSheet dialog, I add a border color
    Qt Code:
    1. border-color: rgb(0, 0, 0);
    To copy to clipboard, switch view to plain text mode 
    and nothing ! zilch ! no border shows.
    What am I missing ?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Groupbox has no borders ?

    You also have to set the width:
    Qt Code:
    1. border: 1px solid #000;
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Groupbox has no borders ?

    Have you looked at the QGroupBox example in the style sheets documentation: http://doc.trolltech.com/4.5/stylesh...zing-qgroupbox ? They do it in a slightly different way.

  4. #4
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Groupbox has no borders ?

    Thanks, got a border but the results aren't acceptable at all. (Image attached)
    Attached Images Attached Images

  5. #5
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Groupbox has no borders ?

    You can prefix your border setting with QGroupBox, that would remove the borders arounds the inner widgets.

  6. #6
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Groupbox has no borders ?

    Quote Originally Posted by e8johan View Post
    You can prefix your border setting with QGroupBox, that would remove the borders arounds the inner widgets.
    How do you 'prefix' ?

  7. #7
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Groupbox has no borders ?

    You do something like this:

    Qt Code:
    1. QGroupBox: { border: ...; }
    To copy to clipboard, switch view to plain text mode 

  8. #8
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Groupbox has no borders ?

    Qt Code:
    1. QGroupBox: { border: 2px solid gray; }
    To copy to clipboard, switch view to plain text mode 

    I'm back to no border with this code

  9. #9
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Groupbox has no borders ?

    Ah, sorry, drop the colon

    Qt Code:
    1. QGroupBox { ... }
    To copy to clipboard, switch view to plain text mode 

  10. #10
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Groupbox has no borders ?

    Yes !
    now why is the break at the top left corner along the left side ?
    Isn't the break normally along the top and the text in between the break ? like this:

    +- groupbox heading ----------+
    | |
    | |
    | |
    +------------------------------------+

  11. #11
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Groupbox has no borders ?

    I get the text on the top... when using Qt 4.5.0.

  12. #12
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Groupbox has no borders ?

    Does it look like this attached image ? that's what I get QT 4.5 and QT Creator. ( btw: nice IDE ! )

    Oops, sorry, I should have taken a look at the example you pointed me to in the first place. don't understand the code, but it got me a good result and the heading is on the line.

    I did make one change,

    subcontrol-position: top center;
    to
    subcontrol-position: top left;

    and found the top left corner doesn't get drawn, and doesn't look right. For now, I'll settle for centred heading and read into the Style sheet usage further.

    Thanks for your help.
    Attached Images Attached Images

  13. #13
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Groupbox has no borders ?

    I only changed the border, that kept the text in place.

  14. The following user says thank you to e8johan for this useful post:

    vieraci (30th April 2009)

Similar Threads

  1. Replies: 5
    Last Post: 31st January 2009, 07:36
  2. A Shadow of my groupBox
    By baray98 in forum Qt Programming
    Replies: 1
    Last Post: 28th June 2008, 21:41
  3. how to enable borders in QGraphicsScene?
    By as001622 in forum Qt Programming
    Replies: 8
    Last Post: 3rd June 2008, 19:43
  4. Popup window with round borders
    By anderssonj in forum Qt Programming
    Replies: 1
    Last Post: 16th September 2007, 19:45
  5. Problems putting layouts inside groupbox
    By conexion2000 in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 10:01

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.