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

Repaint problem using QStyleSheet and QGraphicsEffect on KDE Plasma 5

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.5.1, 5.9.1
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Description

      When setting graphic effect on QGroupBox and custom style sheet on the application if the group box contains editable QComboBox and QLineEdit, the UI does not seem to repaint itself and there is no visible cursor in the QLineEdit and the typing of the text is not visible even though is there.

      The problem seems to come from the creation of the QLineEdit inside the QComboBox.

      The problem can somehow be mitigated if the parents of the widgets are carefully set, but if we add QDateEdit with dropdown enabled when the internal QCalendarWidget is open the problem also appears.

      The problem seems to be present only on KDE, I have tested the same on LXDE and it does not appear.

       

      The following sample code represents the problem:

      main.cpp:

       

      // main.cpp
      #include <QApplication>
      #include <QFile>
      #include "testshadow.h"
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          a.setStyleSheet( "QWidget { background: white; color: dimgray; }" );
      
          testShadow *t = new testShadow();
          t->setWindowTitle("Test Shadow");
          t->show();
      
          return a.exec();
      }
      

      testshadow.h:

       

      // testshadow.h
      #ifndef TESTSHADOW_H
      #define TESTSHADOW_H
      
      #include <QWidget>
      
      class testShadow : public QWidget
      {
          Q_OBJECT
      public:
          explicit testShadow(QWidget *parent = 0);
      };
      
      #endif // TESTSHADOW_H
      

      testshadow.cpp

      // testshadow.cpp
      #include "testshadow.h"
      #include <QDateEdit>
      #include <QGraphicsDropShadowEffect>
      #include <QLabel>
      #include <QCalendarWidget>
      #include <QBoxLayout>
      #include <QGroupBox>
      #include <QPushButton>
      #include <QLineEdit>
      #include <QComboBox>
      
      testShadow::testShadow(QWidget *parent) : QWidget(parent)
      {
          QVBoxLayout *mLayout = new QVBoxLayout();
      
          QVBoxLayout *vbl = new QVBoxLayout();
          QGridLayout *gLayout = new QGridLayout();
      
          QGraphicsDropShadowEffect* tt = new QGraphicsDropShadowEffect(this);
          tt->setBlurRadius( 15 );
          tt->setXOffset ( 0 );
          tt->setYOffset ( 0 );
      
          QGroupBox *myGroup = new QGroupBox(this);
          myGroup->setGraphicsEffect(tt);
      
          //Uncoment this to see the problem with editable QComboBox
      //    QLineEdit *m_leTest = new QLineEdit(this);
      //    QPushButton *m_pbTest = new QPushButton(this);
      //    QComboBox *m_cbTest = new QComboBox(this);
      //    QDateEdit *de = new QDateEdit(this);
      
          //When myGroup is set as parrent instead of this, the problem with QLineEdit is resolved (in this simple sceanrio)
          //but upon opening the QDateEdit popup the problem appears again
          QLineEdit *leTest = new QLineEdit(myGroup);
          QPushButton *pbTest = new QPushButton(myGroup);
          QComboBox *cbTest = new QComboBox(myGroup);
          QDateEdit *deTest = new QDateEdit(myGroup);
          deTest->setCalendarPopup(true);
          deTest->setDate(QDate::currentDate());
          cbTest->setEditable(true);
      
          //test content
          pbTest->setText("Button");
          cbTest->addItem("Item 1");
          cbTest->addItem("Item 2");
      
          gLayout->addWidget(leTest);
          gLayout->addWidget(pbTest);
          gLayout->addWidget(cbTest);
          gLayout->addWidget(deTest);
          vbl->addLayout(gLayout);
      
          myGroup->setLayout(vbl);
          mLayout->addStretch(1);
          mLayout->addWidget(myGroup);
          mLayout->addStretch(1);
      
          setLayout(mLayout);
          setFixedSize(500, 500);
      }
      

       

       

        Attachments

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

          Activity

            People

            Assignee:
            sletta Gunnar Sletta
            Reporter:
            dimeptr Dimitar Petrovski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes