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. QLabel text not visible
Forum Updated to NodeBB v4.3 + New Features

QLabel text not visible

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 646 Views 2 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by
    #1

    I have a QLabel whose stylesheet is set to:

    "background: qcolor(rgba(0,0,0,0))"

    When the text was set to:

    "<Click here to select the Monitored Folder>"
    

    it was visible.

    But when I changed the text to:

    "<a href='.' style='text-decoration: none; color: #0000ff'><Click here to select the Monitored Folder></a>"
    

    it was no longer visible.

    What have I missed?

    JonBJ 1 Reply Last reply
    0
    • PerdrixP Perdrix

      I have a QLabel whose stylesheet is set to:

      "background: qcolor(rgba(0,0,0,0))"

      When the text was set to:

      "<Click here to select the Monitored Folder>"
      

      it was visible.

      But when I changed the text to:

      "<a href='.' style='text-decoration: none; color: #0000ff'><Click here to select the Monitored Folder></a>"
      

      it was no longer visible.

      What have I missed?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Perdrix
      Your second case is definitely HTML/rich text (first case could be plain text only, QLabel does both). Are you sure that supplying literal text inside <...> is legit for HTML/Qt's rich text? You should really be HTML entitizing those, does that make any difference...?

      PerdrixP JonBJ 2 Replies Last reply
      1
      • JonBJ JonB

        @Perdrix
        Your second case is definitely HTML/rich text (first case could be plain text only, QLabel does both). Are you sure that supplying literal text inside <...> is legit for HTML/Qt's rich text? You should really be HTML entitizing those, does that make any difference...?

        PerdrixP Offline
        PerdrixP Offline
        Perdrix
        wrote on last edited by
        #3

        @JonB It was precisely that! Thank you.

        When I removed the <> from the original text it all worked. The background colour was a red herring!

        JonBJ Pl45m4P 2 Replies Last reply
        0
        • PerdrixP Perdrix has marked this topic as solved on
        • PerdrixP Perdrix

          @JonB It was precisely that! Thank you.

          When I removed the <> from the original text it all worked. The background colour was a red herring!

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Perdrix said in QLabel text not visible:

          The background colour was a red herring!

          Actually it was a blue herring....

          PerdrixP 1 Reply Last reply
          0
          • JonBJ JonB

            @Perdrix said in QLabel text not visible:

            The background colour was a red herring!

            Actually it was a blue herring....

            PerdrixP Offline
            PerdrixP Offline
            Perdrix
            wrote on last edited by
            #5

            @JonB ROFL

            1 Reply Last reply
            0
            • PerdrixP Perdrix

              @JonB It was precisely that! Thank you.

              When I removed the <> from the original text it all worked. The background colour was a red herring!

              Pl45m4P Offline
              Pl45m4P Offline
              Pl45m4
              wrote on last edited by
              #6

              @Perdrix said in QLabel text not visible:

              When I removed the <>

              If you still need < ... > around your text (which was also in your text before), I think it can be done by escaping the characters / replacing them with &lt; ( ' <' ) and &gt; ( '>' ).
              Not tested but should work.


              If debugging is the process of removing software bugs, then programming must be the process of putting them in.

              ~E. W. Dijkstra

              1 Reply Last reply
              0
              • JonBJ JonB

                @Perdrix
                Your second case is definitely HTML/rich text (first case could be plain text only, QLabel does both). Are you sure that supplying literal text inside <...> is legit for HTML/Qt's rich text? You should really be HTML entitizing those, does that make any difference...?

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                @Pl45m4

                escaping the characters / replacing them with

                @JonB said in QLabel text not visible:

                You should really be HTML entitizing those, does that make any difference...?

                That's what "entitizing" means :)

                Pl45m4P 1 Reply Last reply
                1
                • JonBJ JonB

                  @Pl45m4

                  escaping the characters / replacing them with

                  @JonB said in QLabel text not visible:

                  You should really be HTML entitizing those, does that make any difference...?

                  That's what "entitizing" means :)

                  Pl45m4P Offline
                  Pl45m4P Offline
                  Pl45m4
                  wrote on last edited by Pl45m4
                  #8

                  @JonB

                  Learning never stops :)
                  I knew that these exist, but there was no connection to the word "Entity" in my mind ;-)

                  • https://www.w3schools.com/html/html_entities.asp

                  If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                  ~E. W. Dijkstra

                  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