Add QDarkStyleSheet to Message Aggregator reference application

This commit is contained in:
Bill Somerville
2018-12-17 01:48:45 +00:00
parent 74112434f9
commit d241217737
3 changed files with 41 additions and 9 deletions
+21 -6
View File
@@ -63,14 +63,29 @@ int main (int argc, char * argv[])
QObject::connect (&app, SIGNAL (lastWindowClosed ()), &app, SLOT (quit ()));
{
QFile file {":/qss/default.qss"};
if (!file.open (QFile::ReadOnly))
QString ss;
auto sf = qApp->styleSheet ();
if (sf.size ())
{
throw std::runtime_error {
QString {"failed to open \"" + file.fileName () + "\": " + file.errorString ()}
.toLocal8Bit ().constData ()};
sf.remove ("file:///");
QFile file {sf};
if (!file.open (QFile::ReadOnly))
{
throw std::runtime_error {
QString {"failed to open \"" + file.fileName () + "\": " + file.errorString ()}.toStdString ()};
}
ss += file.readAll ();
}
app.setStyleSheet (file.readAll());
{
QFile file {":/qss/default.qss"};
if (!file.open (QFile::ReadOnly))
{
throw std::runtime_error {
QString {"failed to open \"" + file.fileName () + "\": " + file.errorString ()}.toStdString ()};
}
ss += file.readAll ();
}
app.setStyleSheet (ss);
}
MessageAggregatorMainWindow window;