#include "widget.h" Widget::Widget(QWidget *parent) : QWidget(parent) { QPalette p; p.setColor( QPalette::Text, Qt::red ); QApplication::setPalette( p ); scene = new QGraphicsScene( this ); view = new QGraphicsView( scene, this ); text = new QGraphicsTextItem( "this text should be red", 0, scene ); b = new QPushButton( "Change app palette...", this ); connect( b, SIGNAL( clicked() ), this, SLOT( OnButtonClicked() ) ); QVBoxLayout* l = new QVBoxLayout( this ); l->addWidget( b ); l->addWidget( view ); } void Widget::OnButtonClicked() { text->setPlainText( "this text should be green" ); QPalette p; p.setColor( QPalette::Text, Qt::green ); QApplication::setPalette( p ); }