Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.5.1, 5.9.1
-
None
-
OS:
Distributor ID: Ubuntu
Description: Ubuntu 17.10
Release: 17.10
plasmashell 5.10.5
Qt: 5.9.1
KDE Frameworks: 5.38.0
kf5-config: 1.0
Qt Creator 4.3.1
Based on Qt 5.9.1 (GCC 6.4.0 20170704, 64 bit)
Compiler:
gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0
The same problem appeared also on Ubuntu 17.06 using Qt: 5.5.1OS: Distributor ID: Ubuntu Description: Ubuntu 17.10 Release: 17.10 plasmashell 5.10.5 Qt: 5.9.1 KDE Frameworks: 5.38.0 kf5-config: 1.0 Qt Creator 4.3.1 Based on Qt 5.9.1 (GCC 6.4.0 20170704, 64 bit) Compiler: gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0 The same problem appeared also on Ubuntu 17.06 using Qt: 5.5.1
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); }