Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-59119

Customized QToolTip with padding has additional padding

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.6.2, 5.8.0
    • Widgets: Style Sheets
    • None
    • Windows 10, Windows 7, Qt 5.5 - Qt 5.8, MSVC2015 and MinGW 5.3
    • daa39f84996700d2459d8e570ac1b3f2f2cdffd0

    Description

      When you create a stylesheet for tooltips that contains paddings (like this one here)

      QToolTip

      { padding: 3px; color: #000000; background-color: #F4F4F4; border: 1px solid #C0C0C0; }

      There is an issue when the tooltip is displayed at the first time (see attached images). When you move the mouse on to other widgets and the tooltip changes without being hidden, the tooltip is correct for further widgets. But once the tooltip is hidden, the problem reappears the next time a tooltip is displayed.

      This issue only appears on Windows, not on Linux.

      Example program:

      #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();
      }

      Attachments

        1. qtooltip_linux.png
          10 kB
          stvokr
        2. qtooltip_windows.png
          14 kB
          stvokr
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            stvokr stvokr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes