Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.3, 4.7.0
-
None
-
Windows (should happen on other platforms as well)
-
7b63ce043dfaec5ec83d938b1cea8ee0ead614ff
Description
Style sheet keeps track of the widgets in cache using the destroyed() signal from QObject. In this example the style sheet recreates the QStyleSheetStyle internally and keeps the old cache, but those objects were connected to the destroyed QStyleSheetStyle object. So if one of those widgets are destroyed, the cache wont get updated.
#include <QtGui> #include <qdebug.h> class Widget : public QWidget { public: Widget(QWidget *parent = 0); ~Widget(); }; const char* pszStyleSheet = "* { color: red; }"; Widget::Widget(QWidget *parent) : QWidget(parent) { QVBoxLayout* pLayout = new QVBoxLayout(this); QCheckBox* pCheckBox = new QCheckBox(this); pLayout->addWidget(pCheckBox); setLayout(pLayout); QString szStyleSheet = QLatin1String(pszStyleSheet); qApp->setStyleSheet(szStyleSheet); qApp->setStyle(QStyleFactory::create(QLatin1String("Windows"))); } Widget::~Widget() { } int main(int argc, char *argv[]) { QApplication a(argc, argv); Widget *w = new Widget(); delete w; w = new Widget(); w->show(); return a.exec(); }