From ef653b41f5959bbbe0f405e765844a9b388ae805 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 29 Dec 2015 09:50:47 -0800 Subject: QML UI: obtain a reasonable margin from QML This will be used later in the positioning of the profile. Signed-off-by: Dirk Hohndel --- qt-mobile/qml/DiveDetailsView.qml | 3 +++ qt-mobile/qmlprofile.cpp | 8 +++++++- qt-mobile/qmlprofile.h | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/qt-mobile/qml/DiveDetailsView.qml b/qt-mobile/qml/DiveDetailsView.qml index e81aabb4f..c75fc91df 100644 --- a/qt-mobile/qml/DiveDetailsView.qml +++ b/qt-mobile/qml/DiveDetailsView.qml @@ -213,4 +213,7 @@ GridLayout { Layout.fillWidth: true Layout.minimumHeight: MobileComponents.Units.gridUnit * 3 } + Component.onCompleted: { + qmlProfile.setMargin(MobileComponents.Units.smallSpacing) + } } diff --git a/qt-mobile/qmlprofile.cpp b/qt-mobile/qmlprofile.cpp index 51fddb4ba..276da7495 100644 --- a/qt-mobile/qmlprofile.cpp +++ b/qt-mobile/qmlprofile.cpp @@ -4,7 +4,8 @@ #include QMLProfile::QMLProfile(QQuickItem *parent) : - QQuickPaintedItem(parent) + QQuickPaintedItem(parent), + m_margin(0) { m_profileWidget = new ProfileWidget2(0); m_profileWidget->setProfileState(); @@ -23,6 +24,11 @@ void QMLProfile::paint(QPainter *painter) m_profileWidget->render(painter); } +void QMLProfile::setMargin(int margin) +{ + m_margin = margin; +} + QString QMLProfile::diveId() const { return m_diveId; diff --git a/qt-mobile/qmlprofile.h b/qt-mobile/qmlprofile.h index 6cbdd62ff..8a1c63fe6 100644 --- a/qt-mobile/qmlprofile.h +++ b/qt-mobile/qmlprofile.h @@ -17,9 +17,11 @@ public: QString diveId() const; void setDiveId(const QString &diveId); - +public slots: + void setMargin(int margin); private: QString m_diveId; + int m_margin; ProfileWidget2 *m_profileWidget; signals: void rightAlignedChanged(); -- cgit v1.2.3-70-g09d2