From c3fb5edc41a760a5904053f282d6f9c8d02ff1be Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 6 Mar 2019 11:09:14 +0100 Subject: [PATCH] allow to define custom background images --- src/Gui/Application.cpp | 14 ++++++++++++-- src/Gui/DlgGeneralImp.cpp | 2 +- src/Gui/MainWindow.cpp | 3 +-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 711404820f..4d36537fed 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -1727,6 +1727,13 @@ void Application::runApplication(void) << QLatin1String(":/stylesheets"); QDir::setSearchPaths(QString::fromLatin1("qss"), qssPaths); + // set search paths for images + QStringList imagePaths; + imagePaths << QString::fromUtf8((App::Application::getUserAppDataDir() + "Gui/images").c_str()) + << QString::fromUtf8((App::Application::getUserAppDataDir() + "pixmaps").c_str()) + << QLatin1String(":/icons"); + QDir::setSearchPaths(QString::fromLatin1("images"), imagePaths); + // register action style event type ActionStyleEvent::EventType = QEvent::registerEventType(QEvent::User + 1); @@ -1949,8 +1956,11 @@ void Application::runApplication(void) qApp->sendEvent(&mw, &e); } } -#if QT_VERSION == 0x050600 && defined(Q_OS_WIN32) else { + if (hGrp->GetBool("TiledBackground", false)) { + mdi->setBackground(QPixmap(QLatin1String("images:background.png"))); + } +#if QT_VERSION == 0x050600 && defined(Q_OS_WIN32) // Under Windows the tree indicator branch gets corrupted after a while. // For more details see also https://bugreports.qt.io/browse/QTBUG-52230 // and https://codereview.qt-project.org/#/c/154357/2//ALL,unified @@ -1964,8 +1974,8 @@ void Application::runApplication(void) " image: url(:/icons/style/windows_branch_open.png);\n" "}\n"); qApp->setStyleSheet(qss); - } #endif + } //initialize spaceball. mainApp.initSpaceball(&mw); diff --git a/src/Gui/DlgGeneralImp.cpp b/src/Gui/DlgGeneralImp.cpp index e41279b653..274caadaa9 100644 --- a/src/Gui/DlgGeneralImp.cpp +++ b/src/Gui/DlgGeneralImp.cpp @@ -162,7 +162,7 @@ void DlgGeneralImp::saveSettings() qApp->setStyleSheet(QString()); ActionStyleEvent e(ActionStyleEvent::Restore); qApp->sendEvent(getMainWindow(), &e); - mdi->setBackground(QPixmap(QLatin1String(":/icons/background.png"))); + mdi->setBackground(QPixmap(QLatin1String("images:background.png"))); } else { qApp->setStyleSheet(QString()); diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index f9cf97926c..2ce27c3b1d 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -1237,8 +1237,7 @@ QPixmap MainWindow::splashImage() const { // search in the UserAppData dir as very first QPixmap splash_image; - QDir dir(QString::fromUtf8(App::Application::Config()["UserAppData"].c_str())); - QFileInfo fi(dir.filePath(QString::fromLatin1("pixmaps/splash_image.png"))); + QFileInfo fi(QString::fromLatin1("images:splash_image.png")); if (fi.isFile() && fi.exists()) splash_image.load(fi.filePath(), "PNG");