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. QToolTip StyleSheet with padding produces additional padding
QtWS25 Last Chance

QToolTip StyleSheet with padding produces additional padding

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 3.8k Views
  • 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.
  • S Offline
    S Offline
    stvokr
    wrote on last edited by
    #1

    I have found a strange thing concerning QToolTip. I use Qt 5.6 and above on Windows 10.
    I use a stylesheet for QToolTips with a padding. And now the first ToolTip has an additional padding. When I directly move on to the next widget and the tooltip changes without being hidden the next tooltip is correct and all other upcoming tooltips.
    But when I move the mouse away from the widgets and then back to one of the widgets with a tooltip, this issue shows again.

    Can someone confirm this?
    Regards
    Oliver

    #include <QApplication>
    #include "mainwindow.h"
    #include <QPushButton>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
    
        QWidget widget;
        widget.setStyleSheet( "QToolTip \
                               { \
                                   padding: 3px; \
                                   color: #000000; \
                                   background-color: #F4F4F4; \
                                   border: 1px solid #C0C0C0; \
                               }" );
    
        QGridLayout layout;
        widget.setLayout( &layout );
    
        for( int i = 1; i <= 5; i++ )
        {
            QPushButton* button = new QPushButton( QString::number( i ), &widget );
            button->setToolTip( QString( "My Button %1" ).arg( i ) );
    
            layout.addWidget( button );
        }
    
        widget.show();
        return a.exec();
    }
    
    1 Reply Last reply
    1
    • M Offline
      M Offline
      mostefa
      wrote on last edited by mostefa
      #2

      Hi @stvokr

      After test ,

      Under Windows 7 with Qt 5.5 , i confirm that i have the same behavior,

      alt text

      But in linux with Qt 5.4 there is no padding ,

      I do not know if it is a bug , or if it is just related to the OS style,

      Maybe other people can advise you more,

      But it could be a good idea to upgrade your qt version to 5.8 and to see if the problem is still present,

      Hope this can help !

      J.HilkJ 1 Reply Last reply
      2
      • M mostefa

        Hi @stvokr

        After test ,

        Under Windows 7 with Qt 5.5 , i confirm that i have the same behavior,

        alt text

        But in linux with Qt 5.4 there is no padding ,

        I do not know if it is a bug , or if it is just related to the OS style,

        Maybe other people can advise you more,

        But it could be a good idea to upgrade your qt version to 5.8 and to see if the problem is still present,

        Hope this can help !

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @mostefa @stvokr

        sadly, with Qt 5.8 on Win10 x64 same behavoir


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        1
        • S Offline
          S Offline
          stvokr
          wrote on last edited by stvokr
          #4

          Hi,

          I have tested it on Linux, Qt 5.6, and on Windows 10 with Qt 5.8 msvc2015 and mingw.
          It works on Linux (see below), but still the same behavior on Windows 10.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            It might be a bug in the custom rendering of QToolTip when using a style sheet. You should check the bug report system to see it it's something known.

            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
            • S Offline
              S Offline
              stvokr
              wrote on last edited by
              #6

              Hi,

              I have committed a new bug report.
              https://bugreports.qt.io/browse/QTBUG-59119

              regards
              Oliver

              1 Reply Last reply
              1

              • Login

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