qml: Layout the drop area and title bar inside the FloatingWindow
We could just control geometry of the c++ title bar and geometry,
but then the user wouldn't be able to style it, and users rather
style things in QML than subclassing FloatingWindow and writing C++.
So instance some .qml files to represent the drop area and floating
window, so user can muck with.
Hierarchy looks like this now:
-QQuickWindow
--FloatingWindowQuick (C++ QQuickItem)
---FloatingWindow.qml
----TitleBar.qml (reads state from TitleBar c++)
----DropArea.qml
-----DropArea (C++ QQuickItem)
------Frame
etc
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
#include <QResizeEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QWindow>
|
||||
#include <QQmlComponent>
|
||||
#include <QQuickItem>
|
||||
#include <QQmlEngine>
|
||||
|
||||
using namespace KDDockWidgets;
|
||||
|
||||
@@ -211,6 +214,18 @@ Qt::WindowFlags QWidgetAdapter::windowFlags() const
|
||||
return m_requestedWindowFlags;
|
||||
}
|
||||
|
||||
QQuickItem *QWidgetAdapter::createItem(QQmlEngine *engine, const QString &filename) const
|
||||
{
|
||||
QQmlComponent component(engine, filename);
|
||||
QObject *obj = component.create();
|
||||
if (!obj) {
|
||||
qWarning() << Q_FUNC_INFO << component.errorString();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return qobject_cast<QQuickItem*>(obj);
|
||||
}
|
||||
|
||||
void QWidgetAdapter::setFlag(Qt::WindowType f, bool on)
|
||||
{
|
||||
if (QWindow *w = windowHandle()) {
|
||||
|
||||
Reference in New Issue
Block a user