diff options
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/main/main.cpp b/main/main.cpp index e31c8a00..a8969b11 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -41,7 +41,7 @@ * @return */ int main(int argc, char *argv[]) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); #endif @@ -84,7 +84,8 @@ int main(int argc, char *argv[]) { // locale = "nl_NL"; // locale = "he_IL"; // locale = "ar_MA"; - if (translator.load(QString(":localization/localization_%1.qm").arg(locale))) { + if (translator.load( + QString(":localization/localization_%1.qm").arg(locale))) { SingleApplication::installTranslator(&translator); SingleApplication::setLayoutDirection( QObject::tr("LTR") == "RTL" ? Qt::RightToLeft : Qt::LeftToRight); @@ -93,21 +94,24 @@ int main(int argc, char *argv[]) { MainWindow w(text); SingleApplication::setActiveWindow(&w); + +#ifndef Q_OS_OSX SingleApplication::setWindowIcon(QIcon(":artwork/icon.png")); +#endif #if SINGLE_APP QObject::connect(&app, &SingleApplication::messageAvailable, &w, &MainWindow::messageAvailable); #endif -#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) QGuiApplication::setDesktopFileName("qtpass.desktop"); -#endif - //Center the MainWindow on the screen the mouse pointer is currently on -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - static int cursorScreen = app.desktop()->screenNumber(app.desktop()->cursor().pos()); - QPoint cursorScreenCenter = app.desktop()->screenGeometry(cursorScreen).center(); + // Center the MainWindow on the screen the mouse pointer is currently on +#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0) + static int cursorScreen = + app.desktop()->screenNumber(app.desktop()->cursor().pos()); + QPoint cursorScreenCenter = + app.desktop()->screenGeometry(cursorScreen).center(); #else QScreen *screen = QGuiApplication::screenAt(QCursor::pos()); QPoint cursorScreenCenter = screen->geometry().center(); |