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

Regression with gradient as a QLineEdit background

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.11.3, 5.12.9, 5.15.1
    • GUI: Painting
    • None
    • macOS

      Hi there!

      I just have found error with QLineEdit background painting and it goes way back with Qt versions. This bug only present on MacOS. In my case it is High Sierra 10.13.6 and running in VM. But bug also present on real hardware.

      I use modified QLineEdit example (archive included). Problem arise as modified palette with QLinearGradient (or QRadialGradient) set as a brush for Base color group. So I added this code into example to show this bug:

       layout->activate();
       echoLayout->activate();
       QPalette mDefaultPalette = echoLineEdit->palette();
       QPalette mGreenGradientPalette = mDefaultPalette;
       QRect rect = echoLineEdit->geometry();
       QLinearGradient grad = QLinearGradient(QPointF(0, 0), QPointF(rect.width(), rect.height()));
       grad.setColorAt(0, Qt::white);
       grad.setColorAt(0.4, Qt::gray);
       grad.setColorAt(1, Qt::green);
       mGreenGradientPalette.setBrush(QPalette::Base, QBrush(grad));
       mGreenGradientPalette.setBrush(QPalette::Text, QBrush(Qt::blue));
      echoLineEdit->setPalette(mGreenGradientPalette);
      

      Results from MacOSX:

      Qt 5.10.1 looks fine:

      Qt 5.11.3 first sign of a problem, background seems untouched:

      Qt 5.12.9 get even worse, background gone full black:

      Qt 5.15.1 same deal as 5.12.9:

        1. image-2020-11-04-19-38-55-016.png
          34 kB
          Aleksandr Sbitnev
        2. image-2020-11-04-19-41-09-367.png
          34 kB
          Aleksandr Sbitnev
        3. image-2020-11-04-19-41-51-732.png
          31 kB
          Aleksandr Sbitnev
        4. image-2020-11-04-19-42-48-676.png
          34 kB
          Aleksandr Sbitnev
        5. lineedits.gradient.bug.tgz
          3 kB
          Aleksandr Sbitnev
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            shuras109 Aleksandr Sbitnev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes