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] a:hover html css in QLabel not working.
Forum Updated to NodeBB v4.3 + New Features

[solved] a:hover html css in QLabel not working.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.9k 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.
  • A Offline
    A Offline
    abrakadobr
    wrote on last edited by
    #1

    @ ui->label->setText("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN' 'http://www.w3.org/TR/REC-html40/strict.dtd'>"
    "<html><head><style type=text/css>"
    "a {color:#55789b; text-decoration:none;}"
    "a:hover {color:#f9e699; text-decoration:underline;}"
    "</style></head><body><a href='http://google.com'>google</a></body></html>");
    @
    this code not working. why? and how to do correct?
    line "a { ... }" working, but on hover - no reaction about color changing and underliling.

    1 Reply Last reply
    0
    • BilbonSacquetB Offline
      BilbonSacquetB Offline
      BilbonSacquet
      wrote on last edited by
      #2

      Normally none of the mouse interaction affect the text, the only exception concerns the links.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        abrakadobr
        wrote on last edited by
        #3

        thnx. I got it and doing throw setCursor, Qss for label and eventFilter for click =(

        1 Reply Last reply
        0
        • J Offline
          J Offline
          johncharlesbgmail.com
          wrote on last edited by
          #4

          Hi,
          I'm also facing the same problem. Need to change the text color of the QLabel when I hover the text. Please see my below code:
          @
          mylabel->setText("<a > click here </a>");
          @
          I need to do it using qss file?

          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