Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3444010
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:51:44+00:00 2026-05-18T08:51:44+00:00

After searching for a while I saw that they way to set a visible

  • 0

After searching for a while I saw that they way to set a visible border on a groupbox is to use the StyleSheet property. I added:

border: 2px solid gray;

but there are a couple of problems.

1) Everything inside the groupbox also inherits this setting!

2) The border has a little hole/piece missing near the title.

Here is a picture of what I’m talking about:
alt text

Anyone know how to do this properly?

Thanks,

David

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:51:44+00:00Added an answer on May 18, 2026 at 8:51 am

    The first problem is simple enough When you add a stylesheet to a control it automatically propagates the style to all child widgets. However, you can restrict the use of the style sheet in a couple of ways. You can specify the type of control you want the style sheet to apply to. Example:

    QGroupBox { 
         border: 2px solid gray; 
         border-radius: 3px; 
     } 
    

    This style sheet will only be set on Group boxes. However, if you put a second group box inside this one, the style will propagate to this one as well. Which may be good or bad.

    Another way is to specifically the objectName of the widget you are applying the style to. Example:

    QGroupBox#MyGroupBox { 
         border: 2px solid gray; 
         border-radius: 3px; 
     } 
    

    This will only apply the style to a group box with an object name of MyGroupBox.

    As for the space, it is happening because the title is being drawn on top of your border. You can also add a section to your style sheet to change your groupbox title. This includes setting it’s background to transparent, and to move the title around to your hearts content.

    Example: This will set your title to the top left corner of the group box just inside your border, with no gap.

    QGroupBox::title { 
        background-color: transparent;
         subcontrol-position: top left; /* position at the top left*/ 
         padding:2 13px;
     } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

after searching for a while I found the SQL query that gives me the
After searching, I dont find the appropriate way to resolve following problem. After activating
First attempt to use this cool site - after searching for 2 hours: So
I'm sure this is discussed somewhere, but after searching for a while I can't
I'm not sure that this is a bug since after searching I can't find
After searching for a while in books, here on stackoverflow and on the general
After searching around for quite a while and trying to come up with a
(I have just answered this question after searching for a while, so I am
While searching mail in Google, we use the sytax like from:devcoder hasattachments:true mySearchString on:11-aug
Spent a while searching on this and found nothing that related directly. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.