| 659 | } |
| 660 | |
| 661 | void BaseApplication::initializeQt() |
| 662 | { |
| 663 | if (nullptr != qApp) |
| 664 | return; |
| 665 | |
| 666 | #ifdef Q_OS_LINUX |
| 667 | const auto& argv = this->argv(); |
| 668 | |
| 669 | if (std::find(argv.cbegin(), argv.cend(), "-platform") == argv.cend()) |
| 670 | { |
| 671 | // If not set explicitly otherwise, prefer xcb as platform on Linux, as we had issues |
| 672 | // with wayland in combination with VTK and GLEW. Note that the shell scripts for |
| 673 | // executables in our installers also set the platform to xcb. |
| 674 | if (qEnvironmentVariableIsEmpty("QT_QPA_PLATFORM")) |
| 675 | qputenv("QT_QPA_PLATFORM", "xcb"); |
| 676 | } |
| 677 | |
| 678 | // qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--single-process"); // See T29332 |
| 679 | #endif |
| 680 | |
| 681 | #ifdef Q_OS_MACOS |
| 682 | // macOS reports 72 logical DPI, so point-based font sizes render about |
| 683 | // 25% smaller than on Windows and Linux (96 DPI). Pin the font DPI to 96 |
| 684 | // for a consistent cross-platform text size. Respect an explicit user |
| 685 | // override. |
| 686 | if (qEnvironmentVariableIsEmpty("QT_FONT_DPI")) |
| 687 | qputenv("QT_FONT_DPI", "96"); |
| 688 | |
| 689 | // Force the Fusion style on macOS. The native macOS style uses larger |
| 690 | // toolbar icons and layout spacing and does not fully honor our style |
| 691 | // sheet, so the Workbench looks inconsistent with Windows and Linux. |
| 692 | // Fusion is built into Qt Widgets, so no style plugin has to be deployed. |
| 693 | // A -style command-line argument still takes precedence. |
| 694 | if (qEnvironmentVariableIsEmpty("QT_STYLE_OVERRIDE")) |
| 695 | qputenv("QT_STYLE_OVERRIDE", "Fusion"); |
| 696 | #endif |
| 697 | |
| 698 | // Prevent conflicts between native OpenGL applications and QWebEngine |
| 699 | if (qEnvironmentVariableIsEmpty("QSG_RHI_BACKEND")) |
| 700 | #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)) |
| 701 | QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL); |
| 702 | #else |
| 703 | QQuickWindow::setGraphicsApi(QSGRendererInterface::Software); |
| 704 | #endif |
| 705 | |
| 706 | // If parameters have been set before, we have to store them to hand them |
| 707 | // through to the application |
| 708 | auto appName = this->getApplicationName(); |
| 709 | auto orgName = this->getOrganizationName(); |
| 710 | auto orgDomain = this->getOrganizationDomain(); |
| 711 | |
| 712 | // Create a QCoreApplication instance |
| 713 | this->getQApplication(); |
| 714 | |
| 715 | // Provide parameters to QCoreApplication |
| 716 | this->setApplicationName(appName); |
| 717 | this->setOrganizationName(orgName); |
| 718 | this->setOrganizationDomain(orgDomain); |
no test coverage detected