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. [SOLVED]Help with retaining only two sides of QLabel border
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Help with retaining only two sides of QLabel border

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 5.2k Views 1 Watching
  • 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.
  • H Offline
    H Offline
    holygirl
    wrote on last edited by
    #1

    Hey everybody!

            I just had a quick question. Is it possible for a _QLabel_ to have borders only on two sides (right and left or bottom and top)? I'm setting the stylesheet on my _QLabel_ as
    

    @
    lbl->setStyleSheet("border: 1px solid black");
    @

    Is it possible to specify on what sides do I want the border?
    Thank you.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      prady_80
      wrote on last edited by
      #2

      From "this":http://qt-project.org/doc/qt-4.8/stylesheet-customizing.html#box-model it does not seem possible. But If you carefully observe, you can set a border image to emulate what you want by providing a darktone on one side and a transitioned lighter tone on the other side to match the widget (Qlabel) color.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        holygirl
        wrote on last edited by
        #3

        Bummer! I was quite hopeful there would be a way to achieve this in Qt. Thanks for the idea of camouflaging the rest of the borders with the background but I'm afraid it wouldn't be of much use in this project because my background image is not permanent.
        Anyway, thanks for your help prady :)

        1 Reply Last reply
        0
        • B Offline
          B Offline
          b1gsnak3
          wrote on last edited by
          #4

          "Documentation":http://qt-project.org/doc/qt-4.8/stylesheet-reference.html of Qt Stylesheet says that you can use border-top border-left, however I have not tested and am not sure if they work. Go to Properties and after the first "border" the next properties are about top left bottom and right borders. :)

          1 Reply Last reply
          0
          • H Offline
            H Offline
            holygirl
            wrote on last edited by
            #5

            OMG! You're right. It works :) I read the documentation for QLabel but didn't find anything there. stylesheets documentation didn't even cross my mind. I'm gonna bookmark it right away. There's so much to learn in that.

            Thank you SO SO MUCH b1gsnak3 :)

            P.S. - I just got more reasons to stick to coding in Qt. There's nothing Qt can't do. Love it! And super love this forum. Cheers!

            1 Reply Last reply
            0
            • B Offline
              B Offline
              b1gsnak3
              wrote on last edited by
              #6

              tihi xD good luck

              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