tests: Construct QCoreApplication earlier

The global event filter wasn't being set as it didn't have
a qGuiApp at that point
This commit is contained in:
Sergio Martins
2022-07-02 12:37:38 +01:00
parent c72fdf3586
commit 5639b5632a
5 changed files with 33 additions and 14 deletions

View File

@@ -205,12 +205,17 @@ void Platform_qtwidgets::ungrabMouse()
#ifdef DOCKS_DEVELOPER_MODE
inline QCoreApplication *createCoreApplication(int &argc, char **argv)
{
Platform_qt::maybeSetOffscreenQPA(argc, argv);
return new QApplication(argc, argv);
}
Platform_qtwidgets::Platform_qtwidgets(int &argc, char **argv)
: Platform_qt(argc, argv)
: Platform_qt(createCoreApplication(argc, argv))
, m_globalEventFilter(new Platform_qtwidgets::GlobalEventFilter())
{
qputenv("KDDOCKWIDGETS_SHOW_DEBUG_WINDOW", "");
new QApplication(argc, argv);
qApp->setStyle(QStyleFactory::create(QStringLiteral("fusion")));
init();
}