aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-06 22:38:10 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-06 22:38:47 +0000
commit15579da15891a3d16ee9f4cd3cf64e6c723920d2 (patch)
treea4d224b4aa15df8bb1bd1471507d660d76821226 /src/templates
parentf60fafcd57af3cc387b623e1b185aec7ebc31cfd (diff)
QQuickPopup: add some missing properties
Change-Id: I7df64587bf3ba289ba027f6dbe9872362532ec41 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/templates')
-rw-r--r--src/templates/qquickpopup.cpp104
-rw-r--r--src/templates/qquickpopup_p.h30
2 files changed, 128 insertions, 6 deletions
diff --git a/src/templates/qquickpopup.cpp b/src/templates/qquickpopup.cpp
index 99525986..ddd1e9e4 100644
--- a/src/templates/qquickpopup.cpp
+++ b/src/templates/qquickpopup.cpp
@@ -396,6 +396,12 @@ void QQuickPopupItem::itemChange(ItemChange change, const ItemChangeData &data)
case ItemVisibleHasChanged:
emit d->popup->visibleChanged();
break;
+ case ItemActiveFocusHasChanged:
+ emit d->popup->activeFocusChanged();
+ break;
+ case ItemOpacityHasChanged:
+ emit d->popup->opacityChanged();
+ break;
default:
break;
}
@@ -727,6 +733,27 @@ void QQuickPopup::setY(qreal y)
}
/*!
+ \qmlproperty real Qt.labs.controls::Popup::z
+
+ This property holds the z-value of the popup. Z-value determines
+ the stacking order of popups. The default z-value is \c 0.
+*/
+qreal QQuickPopup::z() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->z();
+}
+
+void QQuickPopup::setZ(qreal z)
+{
+ Q_D(QQuickPopup);
+ if (qFuzzyCompare(z, d->popupItem->z()))
+ return;
+ d->popupItem->setZ(z);
+ emit zChanged();
+}
+
+/*!
\qmlproperty real Qt.labs.controls::Popup::width
This property holds the width of the popup.
@@ -856,6 +883,7 @@ void QQuickPopup::setContentHeight(qreal height)
/*!
\qmlproperty real Qt.labs.controls::Popup::availableWidth
+ \readonly
This property holds the width available after deducting horizontal padding.
@@ -868,6 +896,7 @@ qreal QQuickPopup::availableWidth() const
/*!
\qmlproperty real Qt.labs.controls::Popup::availableHeight
+ \readonly
This property holds the height available after deducting vertical padding.
@@ -1302,9 +1331,29 @@ QQmlListProperty<QQuickItem> QQuickPopup::contentChildren()
}
/*!
+ \qmlproperty bool Qt.labs.controls::Popup::clip
+
+ This property holds whether clipping is enabled. The default value is \c false.
+*/
+bool QQuickPopup::clip() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->clip();
+}
+
+void QQuickPopup::setClip(bool clip)
+{
+ Q_D(QQuickPopup);
+ if (clip == d->popupItem->clip())
+ return;
+ d->popupItem->setClip(clip);
+ emit clipChanged();
+}
+
+/*!
\qmlproperty bool Qt.labs.controls::Popup::focus
- This property holds whether the popup has focus.
+ This property holds whether the popup has focus. The default value is \c false.
*/
bool QQuickPopup::hasFocus() const
{
@@ -1322,9 +1371,21 @@ void QQuickPopup::setFocus(bool focus)
}
/*!
+ \qmlproperty bool Qt.labs.controls::Popup::activeFocus
+ \readonly
+
+ This property holds whether the popup has active focus.
+*/
+bool QQuickPopup::hasActiveFocus() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->hasActiveFocus();
+}
+
+/*!
\qmlproperty bool Qt.labs.controls::Popup::modal
- This property holds whether the popup is modal.
+ This property holds whether the popup is modal. The default value is \c false.
*/
bool QQuickPopup::isModal() const
{
@@ -1344,7 +1405,7 @@ void QQuickPopup::setModal(bool modal)
/*!
\qmlproperty bool Qt.labs.controls::Popup::visible
- This property holds whether the popup is visible.
+ This property holds whether the popup is visible. The default value is \c false.
*/
bool QQuickPopup::isVisible() const
{
@@ -1361,6 +1422,43 @@ void QQuickPopup::setVisible(bool visible)
}
/*!
+ \qmlproperty real Qt.labs.controls::Popup::opacity
+
+ This property holds the opacity of the popup. The default value is \c 1.0.
+*/
+qreal QQuickPopup::opacity() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->opacity();
+}
+
+void QQuickPopup::setOpacity(qreal opacity)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setOpacity(opacity);
+}
+
+/*!
+ \qmlproperty real Qt.labs.controls::Popup::scale
+
+ This property holds the scale factor of the popup. The default value is \c 1.0.
+*/
+qreal QQuickPopup::scale() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->scale();
+}
+
+void QQuickPopup::setScale(qreal scale)
+{
+ Q_D(QQuickPopup);
+ if (qFuzzyCompare(scale, d->popupItem->scale()))
+ return;
+ d->popupItem->setScale(scale);
+ emit scaleChanged();
+}
+
+/*!
\qmlproperty enumeration Qt.labs.controls::Popup::closePolicy
This property determines the circumstances under which the popup closes.
diff --git a/src/templates/qquickpopup_p.h b/src/templates/qquickpopup_p.h
index ac9a238a..eb52882c 100644
--- a/src/templates/qquickpopup_p.h
+++ b/src/templates/qquickpopup_p.h
@@ -69,6 +69,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickPopup : public QObject, public QQmlParserStat
Q_INTERFACES(QQmlParserStatus)
Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL)
Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL)
+ Q_PROPERTY(qreal z READ z WRITE setZ NOTIFY zChanged FINAL)
Q_PROPERTY(qreal width READ width WRITE setWidth RESET resetWidth NOTIFY widthChanged FINAL)
Q_PROPERTY(qreal height READ height WRITE setHeight RESET resetHeight NOTIFY heightChanged FINAL)
Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged FINAL)
@@ -92,9 +93,13 @@ class Q_LABSTEMPLATES_EXPORT QQuickPopup : public QObject, public QQmlParserStat
Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
- Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged)
- Q_PROPERTY(bool modal READ isModal WRITE setModal NOTIFY modalChanged)
- Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
+ Q_PROPERTY(bool clip READ clip WRITE setClip NOTIFY clipChanged FINAL)
+ Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL)
+ Q_PROPERTY(bool activeFocus READ hasActiveFocus NOTIFY activeFocusChanged FINAL)
+ Q_PROPERTY(bool modal READ isModal WRITE setModal NOTIFY modalChanged FINAL)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
+ Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL)
+ Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged FINAL)
Q_PROPERTY(ClosePolicy closePolicy READ closePolicy WRITE setClosePolicy NOTIFY closePolicyChanged FINAL)
Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin)
Q_PROPERTY(QQuickTransition *enter READ enter WRITE setEnter NOTIFY enterChanged FINAL)
@@ -111,6 +116,9 @@ public:
qreal y() const;
void setY(qreal y);
+ qreal z() const;
+ void setZ(qreal z);
+
qreal width() const;
void setWidth(qreal width);
void resetWidth();
@@ -188,15 +196,26 @@ public:
QQmlListProperty<QObject> contentData();
QQmlListProperty<QQuickItem> contentChildren();
+ bool clip() const;
+ void setClip(bool clip);
+
bool hasFocus() const;
void setFocus(bool focus);
+ bool hasActiveFocus() const;
+
bool isModal() const;
void setModal(bool modal);
bool isVisible() const;
void setVisible(bool visible);
+ qreal opacity() const;
+ void setOpacity(qreal opacity);
+
+ qreal scale() const;
+ void setScale(qreal scale);
+
enum ClosePolicyFlag {
NoAutoClose = 0x00,
OnPressOutside = 0x01,
@@ -237,6 +256,7 @@ public Q_SLOTS:
Q_SIGNALS:
void xChanged();
void yChanged();
+ void zChanged();
void widthChanged();
void heightChanged();
void implicitWidthChanged();
@@ -259,9 +279,13 @@ Q_SIGNALS:
void backgroundChanged();
void contentItemChanged();
void contentChildrenChanged();
+ void clipChanged();
void focusChanged();
+ void activeFocusChanged();
void modalChanged();
void visibleChanged();
+ void opacityChanged();
+ void scaleChanged();
void closePolicyChanged();
void enterChanged();
void exitChanged();