Por all usages of QWindop/windowHandle to KDDockWidgets::Window
Removes a lot of asQWidget() code and is also prepared for non-Qt views.
This commit is contained in:
@@ -10,7 +10,9 @@
|
||||
*/
|
||||
|
||||
#include "Platform_qt.h"
|
||||
#include "Window_qt.h"
|
||||
|
||||
#include <QWindow>
|
||||
#include <QGuiApplication>
|
||||
|
||||
using namespace KDDockWidgets;
|
||||
@@ -28,3 +30,22 @@ std::shared_ptr<ViewWrapper> Platform_qt::focusedView() const
|
||||
{
|
||||
return qobjectAsView(qApp->focusObject());
|
||||
}
|
||||
|
||||
Window::List Platform_qt::windows() const
|
||||
{
|
||||
Window::List windows;
|
||||
const auto qtwindows = qApp->topLevelWindows();
|
||||
windows.reserve(qtwindows.size());
|
||||
for (QWindow *qtwindow : qtwindows) {
|
||||
windows << windowFromQWindow(qtwindow);
|
||||
}
|
||||
|
||||
return windows;
|
||||
}
|
||||
|
||||
std::shared_ptr<Window> Platform_qt::qobjectAsWindow(QObject *obj) const
|
||||
{
|
||||
if (auto window = qobject_cast<QWindow *>(obj))
|
||||
return windowFromQWindow(window);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user