From ae57a19432bc50318eb524a1a7f2c273725a0646 Mon Sep 17 00:00:00 2001 From: Olli Werwolff Date: Wed, 11 May 2011 14:04:09 +0200 Subject: Possibility to get available geometry from script Reviewed-by: ckamm --- src/other/deviceitem.cpp | 5 +++++ src/other/deviceitem.h | 1 + src/ui/viewui.cpp | 20 ++++++++++++++++++++ src/ui/viewui.h | 4 ++++ 4 files changed, 30 insertions(+) diff --git a/src/other/deviceitem.cpp b/src/other/deviceitem.cpp index e02bdd0..d0fb981 100644 --- a/src/other/deviceitem.cpp +++ b/src/other/deviceitem.cpp @@ -105,6 +105,11 @@ QList DeviceItem::supportedScreenOrientations() const return mDeviceData.menus.keys(); } +QRect DeviceItem::availableGeometry() const +{ + return mAvailableGeometry; +} + QRectF DeviceItem::boundingRect() const { return QRectF(QPointF(-mSize.width()/2, -mSize.height()/2), mSize); diff --git a/src/other/deviceitem.h b/src/other/deviceitem.h index e5d98da..37fb8d3 100644 --- a/src/other/deviceitem.h +++ b/src/other/deviceitem.h @@ -238,6 +238,7 @@ public: Orientation deviceOrientation() const; Orientation screenOrientation() const; QList supportedScreenOrientations() const; + QRect availableGeometry() const; virtual QRectF boundingRect() const; virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); diff --git a/src/ui/viewui.cpp b/src/ui/viewui.cpp index 617d59a..8fbf029 100644 --- a/src/ui/viewui.cpp +++ b/src/ui/viewui.cpp @@ -487,3 +487,23 @@ QStringList ViewScriptInterface::supportedScreenOrientations() const return ret; } +int ViewScriptInterface::availableGeometryX() const +{ + return ui->mDeviceItem->availableGeometry().x(); +} + +int ViewScriptInterface::availableGeometryY() const +{ + return ui->mDeviceItem->availableGeometry().y(); +} + +int ViewScriptInterface::availableGeometryWidth() const +{ + return ui->mDeviceItem->availableGeometry().width(); +} + +int ViewScriptInterface::availableGeometryHeight() const +{ + return ui->mDeviceItem->availableGeometry().height(); +} + diff --git a/src/ui/viewui.h b/src/ui/viewui.h index 23a92c5..d302541 100644 --- a/src/ui/viewui.h +++ b/src/ui/viewui.h @@ -122,6 +122,10 @@ public: Q_INVOKABLE QString screenOrientation() const; Q_INVOKABLE QStringList supportedScreenOrientations() const; Q_INVOKABLE bool setDeviceOrientation(QString orientation, bool rotateScreen); + Q_INVOKABLE int availableGeometryX() const; + Q_INVOKABLE int availableGeometryY() const; + Q_INVOKABLE int availableGeometryWidth() const; + Q_INVOKABLE int availableGeometryHeight() const; private: ViewUi *ui; -- cgit v1.2.3