allow to define custom background images

This commit is contained in:
wmayer
2019-03-06 11:09:14 +01:00
parent 55160676d3
commit c3fb5edc41
3 changed files with 14 additions and 5 deletions

View File

@@ -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);

View File

@@ -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());

View File

@@ -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");