Archive

Posts Tagged ‘qt stylesheets’

setting Qt stylesheets

November 28, 2012 Leave a comment

For a single widget:

QFile file(":/qss/default.qss");
file.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(file.readAll());
setStyleSheet(styleSheet);

For whole app:

QApplication app( argc, argv );

// Load an application style
QFile styleFile( ":/style.qss" );
styleFile.open( QFile::ReadOnly );

// Apply the loaded stylesheet
QString style( styleFile.readAll() );
app.setStyleSheet( style );

Source

Categories: Uncategorized Tags: