expose dockview local geometry to qml

pull/1/head
Michail Vourlakos 8 years ago
parent 0e5cf91a81
commit 70e3c2bb7a

@ -492,7 +492,12 @@ void DockView::resizeWindow(QRect availableScreenRect)
} }
} }
void DockView::setLocalDockGeometry(const QRect &geometry) QRect DockView::localGeometry() const
{
return m_localGeometry;
}
void DockView::setLocalGeometry(const QRect &geometry)
{ {
if (m_localGeometry == geometry) { if (m_localGeometry == geometry) {
return; return;
@ -500,6 +505,8 @@ void DockView::setLocalDockGeometry(const QRect &geometry)
m_localGeometry = geometry; m_localGeometry = geometry;
emit localGeometryChanged();
updateAbsDockGeometry(); updateAbsDockGeometry();
} }

@ -68,6 +68,7 @@ class DockView : public PlasmaQuick::ContainmentView {
Q_PROPERTY(VisibilityManager *visibility READ visibility NOTIFY visibilityChanged) Q_PROPERTY(VisibilityManager *visibility READ visibility NOTIFY visibilityChanged)
Q_PROPERTY(QQmlListProperty<QScreen> screens READ screens) Q_PROPERTY(QQmlListProperty<QScreen> screens READ screens)
Q_PROPERTY(QRect localGeometry READ localGeometry WRITE setLocalGeometry NOTIFY localGeometryChanged)
Q_PROPERTY(QRect screenGeometry READ screenGeometry NOTIFY screenGeometryChanged) Q_PROPERTY(QRect screenGeometry READ screenGeometry NOTIFY screenGeometryChanged)
public: public:
@ -117,6 +118,9 @@ public:
QString currentScreen() const; QString currentScreen() const;
QRect localGeometry() const;
void setLocalGeometry(const QRect &geometry);
VisibilityManager *visibility() const; VisibilityManager *visibility() const;
QQmlListProperty<QScreen> screens(); QQmlListProperty<QScreen> screens();
@ -131,7 +135,6 @@ public slots:
Q_INVOKABLE QList<int> freeEdges() const; Q_INVOKABLE QList<int> freeEdges() const;
Q_INVOKABLE QVariantList containmentActions(); Q_INVOKABLE QVariantList containmentActions();
Q_INVOKABLE int docksWithTasks(); Q_INVOKABLE int docksWithTasks();
Q_INVOKABLE void setLocalDockGeometry(const QRect &geometry);
Q_INVOKABLE bool setCurrentScreen(const QString id); Q_INVOKABLE bool setCurrentScreen(const QString id);
Q_INVOKABLE bool tasksPresent(); Q_INVOKABLE bool tasksPresent();
Q_INVOKABLE void updateEnabledBorders(); Q_INVOKABLE void updateEnabledBorders();
@ -161,6 +164,7 @@ signals:
void enabledBordersChanged(); void enabledBordersChanged();
void widthChanged(); void widthChanged();
void heightChanged(); void heightChanged();
void localGeometryChanged();
void maxLengthChanged(); void maxLengthChanged();
void maxThicknessChanged(); void maxThicknessChanged();
void normalThicknessChanged(); void normalThicknessChanged();

@ -126,8 +126,8 @@ Window{
} }
Text{ Text{
text: visibilityManager.localGeometry.x + ", " + visibilityManager.localGeometry.y + " " + text: dock.localGeometry.x + ", " + dock.localGeometry.y + " " +
visibilityManager.localGeometry.width + "x" + visibilityManager.localGeometry.height dock.localGeometry.width + "x" + dock.localGeometry.height
} }
Text{ Text{

@ -337,7 +337,7 @@ Item{
} }
//console.log("update geometry ::: "+tempGeometry); //console.log("update geometry ::: "+tempGeometry);
dock.setLocalDockGeometry(tempGeometry); dock.localGeometry = tempGeometry;
} }
} }

Loading…
Cancel
Save