Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Backround-color for a styledpannel | sunken QLabel

Backround-color for a styledpannel | sunken QLabel

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.1k 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
    aCOSwt
    wrote on last edited by
    #1

    I would like to set a particular color to the sunken part of the design, that is to say a color following the inside part of the box.

    If I
    @ whateverqlabel->setStyleSheet("QLabel { background-color : red; color : blue; }");
    whateverqlabel->setFrameStyle(QFrame::StyledPanel|QFrame::Sunken);@
    Then I obtain the whole box drawn onto an evil bigger background-colored rectangle.

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      I'm not sure I understood correctly. You want to style the frame itself?
      If so, you can do a sunken frame entirely with stylesheet like that:
      @
      border-top: 2px solid qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1,
      stop:0 rgba(192, 192, 192, 255), stop:1 rgba(64, 64, 64, 255));
      border-left: 2px solid qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,
      stop:0 rgba(192, 192, 192, 255), stop:1 rgba(64, 64, 64, 255));
      border-right: 2px solid qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,
      stop:0 rgba(192, 192, 192, 255), stop:1 rgba(255, 255, 255, 255));
      border-bottom: 2px solid qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1,
      stop:0 rgba(192, 192, 192, 255), stop:1 rgba(255, 255, 255, 255));
      @
      Adjust the colors to your needs of course.

      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 Extensions
      • Unsolved