You code for the palette is fine. So try to use
QWidget::autoFillBackground
.
Qt Code:
#include <QtGui> int main ( int argc, char * argv [ ] ) { QWidget w; lcd. setAutoFillBackground ( true ); // see the different if you comment that line out. lcd. setPalette (Pal ); w. show ( ); return app. exec ( ); }
本文介绍如何在Qt中使用QWidget::autoFillBackground来改变组件的背景颜色,并通过实例展示了如何将LCDNumber组件的背景设置为黑色,文字颜色设置为绿色。
782

被折叠的 条评论
为什么被折叠?



