Skip to content

Commit

Permalink
allow to define custom background images
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Mar 6, 2019
1 parent 5516067 commit c3fb5ed
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
14 changes: 12 additions & 2 deletions src/Gui/Application.cpp
Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/DlgGeneralImp.cpp
Expand Up @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions src/Gui/MainWindow.cpp
Expand Up @@ -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");

Expand Down

0 comments on commit c3fb5ed

Please sign in to comment.