void loadStyleSheets(QApplication& application) { QString stylesheet; QString theme = DatabaseManager::getInstance().getConfigurationByName("Theme").getValue(); // Load default stylesheet.. QFile defaultStylesheet(QString(":/Appearances/Stylesheets/%1/Default.css").arg(theme)); if (defaultStylesheet.open(QFile::ReadOnly)) { QTextStream stream(&defaultStylesheet); stylesheet = stream.readAll(); defaultStylesheet.close(); application.setStyleSheet(stylesheet); defaultStylesheet.close(); } // Load extended stylesheet. QFile extendedStylesheet(QString(":/Appearances/Stylesheets/%1/Extended.css").arg(theme)); if (extendedStylesheet.open(QFile::ReadOnly)) { QTextStream stream(&extendedStylesheet); stylesheet += stream.readAll(); extendedStylesheet.close(); application.setStyleSheet(stylesheet); extendedStylesheet.close(); } // Load platform stylesheet. #if defined(Q_OS_WIN) QFile platformStylesheet(QString(":/Appearances/Stylesheets/%1/Windows.css").arg(theme)); #elif defined(Q_OS_MAC) QFile platformStylesheet(QString(":/Appearances/Stylesheets/%1/Mac.css").arg(theme)); #elif defined(Q_OS_LINUX) QFile platformStylesheet(QString(":/Appearances/Stylesheets/%1/Linux.css").arg(theme)); #endif if (platformStylesheet.open(QFile::ReadOnly)) { QTextStream stream(&platformStylesheet); stylesheet += stream.readAll(); platformStylesheet.close(); application.setStyleSheet(stylesheet); platformStylesheet.close(); } }
void loadStyleSheets(QApplication& application) { QString stylesheet; // Load default stylesheet.. QFile defaultStylesheet(":/Appearances/Stylesheets/Default.css"); if (defaultStylesheet.open(QFile::ReadOnly)) { QTextStream stream(&defaultStylesheet); stylesheet = stream.readAll(); defaultStylesheet.close(); application.setStyleSheet(stylesheet); defaultStylesheet.close(); } // Load extended stylesheet. QFile extendedStylesheet(":/Appearances/Stylesheets/Extended.css"); if (extendedStylesheet.open(QFile::ReadOnly)) { QTextStream stream(&extendedStylesheet); stylesheet += stream.readAll(); extendedStylesheet.close(); application.setStyleSheet(stylesheet); extendedStylesheet.close(); } // Load platform stylesheet. #if defined(Q_OS_WIN) QFile platformStylesheet(":/Appearances/Stylesheets/Windows.css"); #elif defined(Q_OS_MAC) QFile platformStylesheet(":/Appearances/Stylesheets/Mac.css"); #elif defined(Q_OS_LINUX) QFile platformStylesheet(":/Appearances/Stylesheets/Linux.css"); #endif if (platformStylesheet.open(QFile::ReadOnly)) { QTextStream stream(&platformStylesheet); stylesheet += stream.readAll(); platformStylesheet.close(); application.setStyleSheet(stylesheet); platformStylesheet.close(); } }
void loadStyleSheets(QApplication& application) { QString stylesheet; QFile defaultStylesheet(":/Appearances/Stylesheets/Default.css"); if(defaultStylesheet.open(QFile::ReadOnly)) { QTextStream stream(&defaultStylesheet); stylesheet = stream.readAll(); defaultStylesheet.close(); application.setStyleSheet(stylesheet); } defaultStylesheet.close(); QFile extendedStylesheet(":/Appearances/Stylesheets/Extended.css"); if(extendedStylesheet.open(QFile::ReadOnly)) { QTextStream stream(&extendedStylesheet); stylesheet += stream.readAll(); extendedStylesheet.close(); application.setStyleSheet(stylesheet); } extendedStylesheet.close(); #ifdef Q_OS_UNIX QFile platformStylesheet(":/Appearances/Stylesheets/Unix.css"); #else QFile platformStylesheet(":/Appearances/Stylesheets/Windows.css"); #endif if(platformStylesheet.open(QFile::ReadOnly)) { QTextStream stream(&platformStylesheet); stylesheet += stream.readAll(); platformStylesheet.close(); application.setStyleSheet(stylesheet); } platformStylesheet.close(); }