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

QPushButton, On :hover the text-decoration: underline. Underline is obfuscated by all non-transparent background colors.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.10.1
    • Widgets: Style Sheets
    • None
    • Windows 10, XCB, Open Source

    Description

      The text-decoration:underline on QPushButton seems to be obfuscated by any background color. It works fine if the background is transparent.

      For example, this works:

      #printBtn:hover { background-color: transparent; text-decoration: underline; }
      

      This does not work:

      #printBtn:hover {  text-decoration: underline; }
      

      I originally brought this up on Stack Exchange here.

      Another user S.Monteleone offered this fix/advice to me.:

      It is indeed a Qt bug, I was able to obtain the same result with Qt 5.10.1.

      QPushButton does support font changes. That was not the case before, but it has been "fixed" (see "QPushButton: draw label using the stylesheet's font." b3c5d3dde9d554dcae0888e3fb4e583919cd102a  this commit).

      I guess the issue is at line 3484 of file qtbase/src/widgets/styles/qstylesheetstyle.cpp:

      if (rule.hasPosition() && rule.position()->textAlignment != 0) {
      

      because the else part of this if clause (line 3556) will call:

      ParentStyle::drawControl(ce, &butOpt, p, w);
      

      In fact, you can force it to work also by setting the text-align:

      #printBtn:hover {  text-align: center; text-decoration: underline; }
      

      I'm afraid there's not much we can do except filing a bug report at http://bugreports.qt.io.

      Attachments

        1. qtbug67740.jpg
          qtbug67740.jpg
          57 kB
        2. qtbug67740.zip
          2 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              dbrain Duncan Brain
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes