diff options
author | Olli Werwolff <qt-info@nokia.com> | 2011-05-11 14:04:09 +0200 |
---|---|---|
committer | Olli Werwolff <qt-info@nokia.com> | 2011-05-16 13:29:02 +0200 |
commit | ae57a19432bc50318eb524a1a7f2c273725a0646 (patch) | |
tree | 7a588910eff58bbe4f4c150190f33ccf8deb2ef3 | |
parent | 3c737a1c24374b3f31d3455fac1c854b40c8c8c8 (diff) |
Possibility to get available geometry from script
Reviewed-by: ckamm
-rw-r--r-- | src/other/deviceitem.cpp | 5 | ||||
-rw-r--r-- | src/other/deviceitem.h | 1 | ||||
-rw-r--r-- | src/ui/viewui.cpp | 20 | ||||
-rw-r--r-- | src/ui/viewui.h | 4 |
4 files changed, 30 insertions, 0 deletions
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<Orientation> 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<Orientation> 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; |