You code for the palette is fine. So try to use QWidget::autoFillBackground.
#include <QtGui>
int main(int argc, char* argv[])
{
lcd.setAutoFillBackground(true);// see the different if you comment that line out.
lcd.setPalette(Pal);
w.show();
return app.exec();
}
#include <QtGui>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QWidget w;
QLCDNumber lcd(&w);
lcd.setAutoFillBackground(true);// see the different if you comment that line out.
QPalette Pal = lcd.palette();
Pal.setColor(QPalette::Normal, QPalette::WindowText, Qt::green);
Pal.setColor(QPalette::Normal, QPalette::Window, Qt::black);
lcd.setPalette(Pal);
w.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks