Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Q: Qt - [c++] toolTip padding gets lost when showing second time.
Forum Updated to NodeBB v4.3 + New Features

Q: Qt - [c++] toolTip padding gets lost when showing second time.

Scheduled Pinned Locked Moved Solved Game Development
7 Posts 5 Posters 739 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.
  • K Offline
    K Offline
    kevin_d
    wrote on last edited by
    #1

    Hello!

    I am using a QPushButton->setToolTip("...") with a padding defined in a css stylesheet.

    This padding is eg: 10 pixel in size at each border.

    This is shown fine, when i move the mouse over the element the first time.

    But when moving out and in again, the padding is not shown anymore, and the text sticks to the border of the tooltip.

    Any suggestions to preserve these tooltip paddings?

    best regards, kevin_d

    SGaistS 1 Reply Last reply
    0
    • K kevin_d

      Hello!

      I am using a QPushButton->setToolTip("...") with a padding defined in a css stylesheet.

      This padding is eg: 10 pixel in size at each border.

      This is shown fine, when i move the mouse over the element the first time.

      But when moving out and in again, the padding is not shown anymore, and the text sticks to the border of the tooltip.

      Any suggestions to preserve these tooltip paddings?

      best regards, kevin_d

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Which version of Qt are you using ?
      On which OS ?

      Please provide a minimal compilable example that shows this behavior.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • K Offline
        K Offline
        kevin_d
        wrote on last edited by
        #3

        I am using Qt 5.15.12 on Windows 11.

        QString css = "QToolTip { font-size:24px; color:white; background-color:#808080; border:1px solid black; padding: 10px 10px 10px 10px; } "
        
        auto* button = new QPushButton();
        button->setText("Click me");
        buttons->setStylesheet(css);
        
        1 Reply Last reply
        0
        • jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @kevin_d This is not "minimal compilable example that shows this behavior"...

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          KH-219DesignK 1 Reply Last reply
          1
          • jsulmJ jsulm

            @kevin_d This is not "minimal compilable example that shows this behavior"...

            KH-219DesignK Offline
            KH-219DesignK Offline
            KH-219Design
            wrote on last edited by KH-219Design
            #5

            There is a bug that seems to describe the issue described in this thread:

            https://bugreports.qt.io/browse/QTBUG-119752

            Since @kevin_d did not state which Qt version, it is impossible to know whether we expect to see that documented bug in the version kevin is using or not.

            @kevin_d is using using Qt 5.15.12 , whereas the bug QTBUG-119752 is reported against Qt 6.5 (and the fix is not yet released? Am I reading the bug ticket right?). It seems possible that this is the same bug, but I don't know whether the Qt team would check the 5.15 branch and list it as affected if a bug is reported against 6.5.

            I also noticed in the Qt bugtracker that when searching for tooltip bugs, the Windows OS is clearly a hotbed of these bugs (more than any other OS).

            There must be something really tricky about how the underlying Windows API(s) for tooltip styles work, making it seemingly impossible for Qt to wrap and produce styled tooltips without bugs on Windows.

            If QTBUG-119752 is not the cause of the original post here, then it would not surprise me if it is another windows Qt tooltip style bug (or a regression).

            In that case, it would make sense to report it on the bugtracker.

            To report it, a prerequisite would still be: a minimal compilable example. (I am echoing @SGaist and @jsulm on this point.)

            @kevin_d , your provided code snippet doesn't even use setToolTip

            www.219design.com
            Software | Electrical | Mechanical | Product Design

            1 Reply Last reply
            1
            • K Offline
              K Offline
              kevin_d
              wrote on last edited by
              #6

              Hello!

              Thanks for answering.

              Yes, the snippet is wrong:

              // can also contain button styles
              QString css = "QToolTip { font-size:24px; color:white; background-color:#808080; border:1px solid black; padding: 10px 10px 10px 10px; } "
              
              auto* button = new QPushButton();
              button->setStyleSheet(css);
              button->setToolTip("This button is clickable.");
              button->setText("Click me");
              

              Good, that I know it is not solvable atm.

              kind regards, kevin

              Christian EhrlicherC 1 Reply Last reply
              0
              • K kevin_d

                Hello!

                Thanks for answering.

                Yes, the snippet is wrong:

                // can also contain button styles
                QString css = "QToolTip { font-size:24px; color:white; background-color:#808080; border:1px solid black; padding: 10px 10px 10px 10px; } "
                
                auto* button = new QPushButton();
                button->setStyleSheet(css);
                button->setToolTip("This button is clickable.");
                button->setText("Click me");
                

                Good, that I know it is not solvable atm.

                kind regards, kevin

                Christian EhrlicherC Online
                Christian EhrlicherC Online
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @kevin_d said in Q: Qt - [c++] toolTip padding gets lost when showing second time.:

                Good, that I know it is not solvable atm.

                QTBUG-119752 fixed the problem - it works fine for me with Qt 6.8

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply
                0
                • K kevin_d has marked this topic as solved on

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved