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. How to easily set the background colour of a tooltip?
Forum Updated to NodeBB v4.3 + New Features

How to easily set the background colour of a tooltip?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 8.6k Views 3 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.
  • V Offline
    V Offline
    Vadi2
    wrote on last edited by
    #1

    I'm playing around with the html and the original colour is still bleeding though. Code:

        QString tooltip = QStringLiteral(R"(
    <p style="background-color: #2F3135">
        <img src=":/icons/discord-rich-presence.png"/>
        <p style="color: #C79698; background-color: #66373A">%1 (detail)</p>
    </p>
        )").arg(mudlet->mDiscord.getDetailText(mpHost));
        checkBox_discordServerAccessToDetail->setToolTip(tooltip);
    

    How it looks:
    alt text

    I'd rather not go the complicated way of having to create my own QToolTip.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Using stylesheet should do it
      qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #000000; border: 0px; }");

      alt text

      1 Reply Last reply
      3
      • V Offline
        V Offline
        Vadi2
        wrote on last edited by
        #3

        It would, but I don't want to do it for the entire application. I know I can give my widget an ID and only use that, but since I allow my users to skin the application using setStyleSheet, it's gonna be fragile. Any other way?

        mrjjM 1 Reply Last reply
        0
        • V Vadi2

          It would, but I don't want to do it for the entire application. I know I can give my widget an ID and only use that, but since I allow my users to skin the application using setStyleSheet, it's gonna be fragile. Any other way?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Vadi2
          Ok. if user can skin the app , it will be messy to maintain
          that extra line for QToolTip, i agree.

          Sadly i found no other way to address it.

          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