Introduce ViewWrapper - a non-owning view
In many cases we need to access widgets that weren't created by KDDW, in that case we have no View. Since all our APIs want to deal in View and not in QWidget, we need a way to wrap stuff like QWidget::window() and windowHandle() All methods are unimplemented. Will only implement those that are required/used.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "private/Utils_p.h"
|
||||
#include "Controller.h"
|
||||
#include "View.h"
|
||||
#include "ViewWrapper_qtwidgets.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QEvent>
|
||||
@@ -309,6 +310,12 @@ public:
|
||||
return QWidget::windowHandle();
|
||||
}
|
||||
|
||||
std::unique_ptr<ViewWrapper> window() const
|
||||
{
|
||||
ViewWrapper *wrapper = new ViewWrapper_qtwidgets(QWidget::window());
|
||||
return std::unique_ptr<ViewWrapper>(wrapper);
|
||||
}
|
||||
|
||||
protected:
|
||||
bool event(QEvent *e) override
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user