Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Widget Styling
Qt 6.12 LTS is out! See what's new in the release blog

Widget Styling

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 425 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alfie Anil
    wrote on last edited by Alfie Anil
    #1

    Hello everyone,
    When I add a border to a widget with stylesheet, it adds it around each object (e.g. label). Is there anyway to get around this?
    Thanks
    Here is the code I am currently using:

    newWidget1->setStyleSheet(QString::fromUtf8(
                                                   "border-radius: 5px;"
                                                   "border: 1px solid black;"
                                                   "border: 2px solid black;"
                                                   ""));
    
    
    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You can specify the object type where the style should be applied to. See the documentation.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Alfie Anil
        wrote on last edited by
        #3

        Perfect. Thank you

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt
        • Unsolved