From 591e25eb4431e44e8ae28da299e2f024a95c2c03 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 4 May 2018 21:03:14 +0200 Subject: Stylesheet load setting --- src/main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index bfe4ecd..548aec8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,11 +12,15 @@ #include "webengine/webprofile.h" #include #include +#include int main(int argc, char **argv) { Browser app(argc, argv); + // set this, otherwise the webview becomes black when using a stylesheet + app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true); + // create and load configuration std::shared_ptr config = std::make_shared(); if(!config->parseCommandLine(argc, argv)) { @@ -37,6 +41,15 @@ int main(int argc, char **argv) // if we are the only instance, set up the browser if(isSingleInstance) { + auto stylesheet = config->value("browser.stylesheet"); + if(stylesheet) { + QFile f(QString::fromStdString(stylesheet.value())); + if(f.open(QIODevice::ReadOnly)) { + app.setStyleSheet(f.readAll()); + f.close(); + } + } + app.setup(QString::fromStdString(config->value("profile.default").value())); QObject::connect(&app, &Browser::messageAvailable, &app, &Browser::createSession); } -- cgit v1.2.1