Remove QTimer hacks from Platform

It's now instantiated after qApp, so it's safe
This commit is contained in:
Sergio Martins
2022-04-11 01:48:48 +01:00
parent 037140b980
commit 432ff65cc2
4 changed files with 6 additions and 30 deletions

View File

@@ -19,7 +19,6 @@
#include <QQuickWindow>
#include <QGuiApplication>
#include <QTimer>
#include <QWindow>
using namespace KDDockWidgets;
@@ -30,9 +29,9 @@ Platform_qtquick::Platform_qtquick()
// KDDockWidgets::registerQmlTypes(); // TODOv2
QQuickWindow::setDefaultAlphaBuffer(true);
// Delay call to init(), so we have a QApplication
QTimer::singleShot(0, [this] {
init();
qApp->connect(qApp, &QGuiApplication::focusObjectChanged, qApp, [this](QObject *obj) {
ViewWrapper *wrapper = obj ? new Views::ViewWrapper_qtquick(obj) : nullptr;
focusedViewChanged.emit(std::shared_ptr<ViewWrapper>(wrapper));
});
}
@@ -40,14 +39,6 @@ Platform_qtquick::~Platform_qtquick()
{
}
void Platform_qtquick::init()
{
qApp->connect(qApp, &QGuiApplication::focusObjectChanged, qApp, [this](QObject *obj) {
ViewWrapper *wrapper = obj ? new Views::ViewWrapper_qtquick(obj) : nullptr;
focusedViewChanged.emit(std::shared_ptr<ViewWrapper>(wrapper));
});
}
const char *Platform_qtquick::name() const
{
return "qtquick";