aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2018-04-10 15:52:01 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2018-04-11 11:12:57 +0000
commit086dc4316b1008453ac190bab414a1c46cde79ef (patch)
treedf469b5166244af0239451812a18b64f99c6443f /src
parent52990db1f07bdf8f236dcb9b2ac06480c39437f7 (diff)
Promote contentWidth and contentHeight to QQuickContainer
Now we have contentWidth and contentHeight promoted/unified to QQuickPane and QQuickContainer, and all relevant types inherit the properties from there. The next step is to promote read-only versions all the way up to the QQuickControl base class. Change-Id: Ic6ed5d7b7852b0c7faaa59b9a261c360bc63fb6a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/controls/Container.qml4
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp2
-rw-r--r--src/quicktemplates2/qquickcontainer.cpp163
-rw-r--r--src/quicktemplates2/qquickcontainer_p.h16
-rw-r--r--src/quicktemplates2/qquickcontainer_p_p.h13
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp138
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox_p.h14
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox_p_p.h12
-rw-r--r--src/quicktemplates2/qquickmenubar.cpp134
-rw-r--r--src/quicktemplates2/qquickmenubar_p.h14
-rw-r--r--src/quicktemplates2/qquickmenubar_p_p.h12
-rw-r--r--src/quicktemplates2/qquickswipeview.cpp150
-rw-r--r--src/quicktemplates2/qquickswipeview_p.h15
-rw-r--r--src/quicktemplates2/qquicktabbar.cpp144
-rw-r--r--src/quicktemplates2/qquicktabbar_p.h16
15 files changed, 240 insertions, 607 deletions
diff --git a/src/imports/controls/Container.qml b/src/imports/controls/Container.qml
index 896091d8..f43342be 100644
--- a/src/imports/controls/Container.qml
+++ b/src/imports/controls/Container.qml
@@ -41,7 +41,7 @@ T.Container {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding)
+ contentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding)
+ contentHeight + topPadding + bottomPadding)
}
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index 72e76b02..0bc5c9fc 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -334,11 +334,11 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
// QtQuick.Templates 2.5 (new types and revisions in Qt 5.12)
qmlRegisterType<QQuickDialogButtonBox, 5>(uri, 2, 5, "DialogButtonBox");
qmlRegisterType<QQuickControl, 5>(uri, 2, 5, "Control");
+ qmlRegisterType<QQuickContainer, 5>(uri, 2, 5, "Container");
qmlRegisterType<QQuickPopup, 5>(uri, 2, 5, "Popup");
qmlRegisterType<QQuickPopupAnchors>();
qmlRegisterType<QQuickRangeSlider, 5>(uri, 2, 5, "RangeSlider");
qmlRegisterType<QQuickSlider, 5>(uri, 2, 5, "Slider");
- qmlRegisterType<QQuickSwipeView, 5>(uri, 2, 5, "SwipeView");
qmlRegisterType<QQuickTextArea, 5>(uri, 2, 5, "TextArea");
qmlRegisterType<QQuickTextField, 5>(uri, 2, 5, "TextField");
qmlRegisterType<QQuickToolTip, 5>(uri, 2, 5, "ToolTip");
diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp
index 048cfdfa..06c1b092 100644
--- a/src/quicktemplates2/qquickcontainer.cpp
+++ b/src/quicktemplates2/qquickcontainer.cpp
@@ -193,7 +193,11 @@ static QQuickItem *effectiveContentItem(QQuickItem *item)
}
QQuickContainerPrivate::QQuickContainerPrivate()
- : contentModel(nullptr),
+ : hasContentWidth(false),
+ hasContentHeight(false),
+ contentWidth(0),
+ contentHeight(0),
+ contentModel(nullptr),
currentIndex(-1),
updatingCurrent(false),
changeTypes(Destroyed | Parent | SiblingOrder)
@@ -379,6 +383,18 @@ void QQuickContainerPrivate::itemDestroyed(QQuickItem *item)
removeItem(index, item);
}
+void QQuickContainerPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ if (item == contentItem)
+ updateContentWidth();
+}
+
+void QQuickContainerPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ if (item == contentItem)
+ updateContentHeight();
+}
+
void QQuickContainerPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObject *obj)
{
QQuickContainer *q = static_cast<QQuickContainer *>(prop->object);
@@ -436,6 +452,67 @@ void QQuickContainerPrivate::contentChildren_clear(QQmlListProperty<QQuickItem>
return QQuickContainerPrivate::get(q)->contentModel->clear();
}
+qreal QQuickContainerPrivate::getContentWidth() const
+{
+ return contentItem ? contentItem->implicitWidth() : 0;
+}
+
+qreal QQuickContainerPrivate::getContentHeight() const
+{
+ return contentItem ? contentItem->implicitHeight() : 0;
+}
+
+void QQuickContainerPrivate::updateContentWidth()
+{
+ Q_Q(QQuickContainer);
+ if (hasContentWidth)
+ return;
+
+ const qreal oldContentWidth = contentWidth;
+ contentWidth = getContentWidth();
+ if (qFuzzyCompare(contentWidth, oldContentWidth))
+ return;
+
+ emit q->contentWidthChanged();
+}
+
+void QQuickContainerPrivate::updateContentHeight()
+{
+ Q_Q(QQuickContainer);
+ if (hasContentHeight)
+ return;
+
+ const qreal oldContentHeight = contentHeight;
+ contentHeight = getContentHeight();
+ if (qFuzzyCompare(contentHeight, oldContentHeight))
+ return;
+
+ emit q->contentHeightChanged();
+}
+
+void QQuickContainerPrivate::updateContentSize()
+{
+ Q_Q(QQuickContainer);
+ if (hasContentWidth && hasContentHeight)
+ return;
+
+ const qreal oldContentWidth = contentWidth;
+ if (!hasContentWidth)
+ contentWidth = getContentWidth();
+
+ const qreal oldContentHeight = contentHeight;
+ if (!hasContentHeight)
+ contentHeight = getContentHeight();
+
+ const bool widthChanged = !qFuzzyCompare(contentWidth, oldContentWidth);
+ const bool heightChanged = !qFuzzyCompare(contentHeight, oldContentHeight);
+
+ if (widthChanged)
+ emit q->contentWidthChanged();
+ if (heightChanged)
+ emit q->contentHeightChanged();
+}
+
QQuickContainer::QQuickContainer(QQuickItem *parent)
: QQuickControl(*(new QQuickContainerPrivate), parent)
{
@@ -751,6 +828,84 @@ QQuickItem *QQuickContainer::currentItem() const
return itemAt(d->currentIndex);
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Container::contentWidth
+
+ This property holds the content width. It is used for calculating the total
+ implicit width of the container.
+
+ Unless explicitly overridden, the content width is automatically calculated
+ based on the implicit width of the items in the container.
+
+ \sa contentHeight
+*/
+qreal QQuickContainer::contentWidth() const
+{
+ Q_D(const QQuickContainer);
+ return d->contentWidth;
+}
+
+void QQuickContainer::setContentWidth(qreal width)
+{
+ Q_D(QQuickContainer);
+ d->hasContentWidth = true;
+ if (qFuzzyCompare(d->contentWidth, width))
+ return;
+
+ d->contentWidth = width;
+ emit contentWidthChanged();
+}
+
+void QQuickContainer::resetContentWidth()
+{
+ Q_D(QQuickContainer);
+ if (!d->hasContentWidth)
+ return;
+
+ d->hasContentWidth = false;
+ d->updateContentWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Container::contentHeight
+
+ This property holds the content height. It is used for calculating the total
+ implicit height of the container.
+
+ Unless explicitly overridden, the content height is automatically calculated
+ based on the implicit height of the items in the container.
+
+ \sa contentWidth
+*/
+qreal QQuickContainer::contentHeight() const
+{
+ Q_D(const QQuickContainer);
+ return d->contentHeight;
+}
+
+void QQuickContainer::setContentHeight(qreal height)
+{
+ Q_D(QQuickContainer);
+ d->hasContentHeight = true;
+ if (qFuzzyCompare(d->contentHeight, height))
+ return;
+
+ d->contentHeight = height;
+ emit contentHeightChanged();
+}
+
+void QQuickContainer::resetContentHeight()
+{
+ Q_D(QQuickContainer);
+ if (!d->hasContentHeight)
+ return;
+
+ d->hasContentHeight = false;
+ d->updateContentHeight();
+}
+
void QQuickContainer::componentComplete()
{
Q_D(QQuickContainer);
@@ -776,7 +931,7 @@ void QQuickContainer::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem
static const int slotIndex = metaObject()->indexOfSlot("_q_currentIndexChanged()");
if (oldItem) {
- QQuickItemPrivate::get(oldItem)->removeItemChangeListener(d, QQuickItemPrivate::Children);
+ QQuickItemPrivate::get(oldItem)->removeItemChangeListener(d, QQuickItemPrivate::Children | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
QQuickItem *oldContentItem = effectiveContentItem(oldItem);
if (oldContentItem != oldItem)
QQuickItemPrivate::get(oldContentItem)->removeItemChangeListener(d, QQuickItemPrivate::Children);
@@ -787,7 +942,7 @@ void QQuickContainer::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem
}
if (newItem) {
- QQuickItemPrivate::get(newItem)->addItemChangeListener(d, QQuickItemPrivate::Children);
+ QQuickItemPrivate::get(newItem)->addItemChangeListener(d, QQuickItemPrivate::Children | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
QQuickItem *newContentItem = effectiveContentItem(newItem);
if (newContentItem != newItem)
QQuickItemPrivate::get(newContentItem)->addItemChangeListener(d, QQuickItemPrivate::Children);
@@ -796,6 +951,8 @@ void QQuickContainer::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem
if (signalIndex != -1)
QMetaObject::connect(newItem, signalIndex, this, slotIndex);
}
+
+ d->updateContentSize();
}
bool QQuickContainer::isContent(QQuickItem *item) const
diff --git a/src/quicktemplates2/qquickcontainer_p.h b/src/quicktemplates2/qquickcontainer_p.h
index 030497cf..5248d787 100644
--- a/src/quicktemplates2/qquickcontainer_p.h
+++ b/src/quicktemplates2/qquickcontainer_p.h
@@ -64,6 +64,9 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickContainer : public QQuickControl
Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL REVISION 5)
Q_CLASSINFO("DefaultProperty", "contentData")
public:
@@ -87,6 +90,15 @@ public:
int currentIndex() const;
QQuickItem *currentItem() const;
+ // 2.5 (Qt 5.12)
+ qreal contentWidth() const;
+ void setContentWidth(qreal width);
+ void resetContentWidth();
+
+ qreal contentHeight() const;
+ void setContentHeight(qreal height);
+ void resetContentHeight();
+
public Q_SLOTS:
void setCurrentIndex(int index);
// 2.1 (Qt 5.8)
@@ -98,6 +110,10 @@ Q_SIGNALS:
void contentChildrenChanged();
void currentIndexChanged();
void currentItemChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void buttonLayoutChanged();
+ Q_REVISION(5) void contentWidthChanged();
+ Q_REVISION(5) void contentHeightChanged();
protected:
QQuickContainer(QQuickContainerPrivate &dd, QQuickItem *parent);
diff --git a/src/quicktemplates2/qquickcontainer_p_p.h b/src/quicktemplates2/qquickcontainer_p_p.h
index 7791b69c..9ec5b206 100644
--- a/src/quicktemplates2/qquickcontainer_p_p.h
+++ b/src/quicktemplates2/qquickcontainer_p_p.h
@@ -82,6 +82,8 @@ public:
void itemSiblingOrderChanged(QQuickItem *item) override;
void itemParentChanged(QQuickItem *item, QQuickItem *parent) override;
void itemDestroyed(QQuickItem *item) override;
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj);
static int contentData_count(QQmlListProperty<QObject> *prop);
@@ -93,6 +95,17 @@ public:
static QQuickItem *contentChildren_at(QQmlListProperty<QQuickItem> *prop, int index);
static void contentChildren_clear(QQmlListProperty<QQuickItem> *prop);
+ virtual qreal getContentWidth() const;
+ virtual qreal getContentHeight() const;
+
+ void updateContentWidth();
+ void updateContentHeight();
+ void updateContentSize();
+
+ bool hasContentWidth;
+ bool hasContentHeight;
+ qreal contentWidth;
+ qreal contentHeight;
QObjectList contentData;
QQmlObjectModel *contentModel;
int currentIndex;
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index fb07f587..bc5b51d9 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -198,11 +198,7 @@ static QQuickDialogButtonBox::ButtonLayout platformButtonLayout()
}
QQuickDialogButtonBoxPrivate::QQuickDialogButtonBoxPrivate()
- : hasContentWidth(false),
- hasContentHeight(false),
- contentWidth(0),
- contentHeight(0),
- alignment(0),
+ : alignment(0),
position(QQuickDialogButtonBox::Footer),
standardButtons(QPlatformDialogHelper::NoButton),
buttonLayout(platformButtonLayout()),
@@ -212,6 +208,7 @@ QQuickDialogButtonBoxPrivate::QQuickDialogButtonBoxPrivate()
void QQuickDialogButtonBoxPrivate::itemImplicitWidthChanged(QQuickItem *item)
{
+ QQuickContainerPrivate::itemImplicitWidthChanged(item);
if (item == contentItem)
resizeContent();
else
@@ -220,6 +217,7 @@ void QQuickDialogButtonBoxPrivate::itemImplicitWidthChanged(QQuickItem *item)
void QQuickDialogButtonBoxPrivate::itemImplicitHeightChanged(QQuickItem *item)
{
+ QQuickContainerPrivate::itemImplicitHeightChanged(item);
if (item == contentItem)
resizeContent();
else
@@ -360,57 +358,6 @@ qreal QQuickDialogButtonBoxPrivate::getContentHeight() const
return maxHeight;
}
-void QQuickDialogButtonBoxPrivate::updateContentWidth()
-{
- Q_Q(QQuickDialogButtonBox);
- if (hasContentWidth)
- return;
-
- const qreal oldContentWidth = contentWidth;
- contentWidth = getContentWidth();
- if (qFuzzyCompare(contentWidth, oldContentWidth))
- return;
-
- emit q->contentWidthChanged();
-}
-
-void QQuickDialogButtonBoxPrivate::updateContentHeight()
-{
- Q_Q(QQuickDialogButtonBox);
- if (hasContentHeight)
- return;
-
- const qreal oldContentHeight = contentHeight;
- contentHeight = getContentHeight();
- if (qFuzzyCompare(contentHeight, oldContentHeight))
- return;
-
- emit q->contentHeightChanged();
-}
-
-void QQuickDialogButtonBoxPrivate::updateContentSize()
-{
- Q_Q(QQuickDialogButtonBox);
- if (hasContentWidth && hasContentHeight)
- return;
-
- const qreal oldContentWidth = contentWidth;
- if (!hasContentWidth)
- contentWidth = getContentWidth();
-
- const qreal oldContentHeight = contentHeight;
- if (!hasContentHeight)
- contentHeight = getContentHeight();
-
- const bool widthChanged = !qFuzzyCompare(contentWidth, oldContentWidth);
- const bool heightChanged = !qFuzzyCompare(contentHeight, oldContentHeight);
-
- if (widthChanged)
- emit q->contentWidthChanged();
- if (heightChanged)
- emit q->contentHeightChanged();
-}
-
void QQuickDialogButtonBoxPrivate::handleClick()
{
Q_Q(QQuickDialogButtonBox);
@@ -734,85 +681,6 @@ void QQuickDialogButtonBox::resetButtonLayout()
setButtonLayout(platformButtonLayout());
}
-/*!
- \since QtQuick.Controls 2.5 (Qt 5.12)
- \qmlproperty real QtQuick.Controls::DialogButtonBox::contentWidth
-
- This property holds the content width. It is used for calculating the total
- implicit width of the button box.
-
- Unless explicitly overridden, the content width is automatically calculated
- based on the total implicit width of the buttons and the \l {Control::}{spacing}
- of the button box.
-
- \sa contentHeight
-*/
-qreal QQuickDialogButtonBox::contentWidth() const
-{
- Q_D(const QQuickDialogButtonBox);
- return d->contentWidth;
-}
-
-void QQuickDialogButtonBox::setContentWidth(qreal width)
-{
- Q_D(QQuickDialogButtonBox);
- d->hasContentWidth = true;
- if (qFuzzyCompare(d->contentWidth, width))
- return;
-
- d->contentWidth = width;
- emit contentWidthChanged();
-}
-
-void QQuickDialogButtonBox::resetContentWidth()
-{
- Q_D(QQuickDialogButtonBox);
- if (!d->hasContentWidth)
- return;
-
- d->hasContentWidth = false;
- d->updateContentWidth();
-}
-
-/*!
- \since QtQuick.Controls 2.5 (Qt 5.12)
- \qmlproperty real QtQuick.Controls::DialogButtonBox::contentHeight
-
- This property holds the content height. It is used for calculating the total
- implicit height of the button box.
-
- Unless explicitly overridden, the content height is automatically calculated
- based on the maximum implicit height of the buttons.
-
- \sa contentWidth
-*/
-qreal QQuickDialogButtonBox::contentHeight() const
-{
- Q_D(const QQuickDialogButtonBox);
- return d->contentHeight;
-}
-
-void QQuickDialogButtonBox::setContentHeight(qreal height)
-{
- Q_D(QQuickDialogButtonBox);
- d->hasContentHeight = true;
- if (qFuzzyCompare(d->contentHeight, height))
- return;
-
- d->contentHeight = height;
- emit contentHeightChanged();
-}
-
-void QQuickDialogButtonBox::resetContentHeight()
-{
- Q_D(QQuickDialogButtonBox);
- if (!d->hasContentHeight)
- return;
-
- d->hasContentHeight = false;
- d->updateContentHeight();
-}
-
void QQuickDialogButtonBox::updatePolish()
{
Q_D(QQuickDialogButtonBox);
diff --git a/src/quicktemplates2/qquickdialogbuttonbox_p.h b/src/quicktemplates2/qquickdialogbuttonbox_p.h
index 0edc671d..e1a85f00 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox_p.h
+++ b/src/quicktemplates2/qquickdialogbuttonbox_p.h
@@ -68,8 +68,6 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDialogButtonBox : public QQuickCont
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
// 2.5 (Qt 5.12)
Q_PROPERTY(ButtonLayout buttonLayout READ buttonLayout WRITE setButtonLayout RESET resetButtonLayout NOTIFY buttonLayoutChanged FINAL REVISION 5)
- Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL REVISION 5)
- Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL REVISION 5)
Q_FLAGS(QPlatformDialogHelper::StandardButtons)
public:
@@ -116,14 +114,6 @@ public:
void setButtonLayout(ButtonLayout layout);
void resetButtonLayout();
- qreal contentWidth() const;
- void setContentWidth(qreal width);
- void resetContentWidth();
-
- qreal contentHeight() const;
- void setContentHeight(qreal height);
- void resetContentHeight();
-
Q_SIGNALS:
void accepted();
void rejected();
@@ -137,10 +127,6 @@ Q_SIGNALS:
Q_REVISION(3) void applied();
Q_REVISION(3) void reset();
Q_REVISION(3) void discarded();
- // 2.5 (Qt 5.12)
- Q_REVISION(5) void buttonLayoutChanged();
- Q_REVISION(5) void contentWidthChanged();
- Q_REVISION(5) void contentHeightChanged();
protected:
void updatePolish() override;
diff --git a/src/quicktemplates2/qquickdialogbuttonbox_p_p.h b/src/quicktemplates2/qquickdialogbuttonbox_p_p.h
index b9cbe5b7..5633d880 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox_p_p.h
+++ b/src/quicktemplates2/qquickdialogbuttonbox_p_p.h
@@ -72,22 +72,14 @@ public:
void updateLayout();
- qreal getContentWidth() const;
- qreal getContentHeight() const;
-
- void updateContentWidth();
- void updateContentHeight();
- void updateContentSize();
+ qreal getContentWidth() const override;
+ qreal getContentHeight() const override;
void handleClick();
QQuickAbstractButton *createStandardButton(QPlatformDialogHelper::StandardButton button);
void removeStandardButtons();
- bool hasContentWidth;
- bool hasContentHeight;
- qreal contentWidth;
- qreal contentHeight;
Qt::Alignment alignment;
QQuickDialogButtonBox::Position position;
QPlatformDialogHelper::StandardButtons standardButtons;
diff --git a/src/quicktemplates2/qquickmenubar.cpp b/src/quicktemplates2/qquickmenubar.cpp
index 1133ecb0..ca43f5af 100644
--- a/src/quicktemplates2/qquickmenubar.cpp
+++ b/src/quicktemplates2/qquickmenubar.cpp
@@ -79,10 +79,6 @@ QT_BEGIN_NAMESPACE
QQuickMenuBarPrivate::QQuickMenuBarPrivate()
: popupMode(false),
triggering(false),
- hasContentWidth(false),
- hasContentHeight(false),
- contentWidth(0),
- contentHeight(0),
delegate(nullptr)
{
changeTypes |= ImplicitWidth | ImplicitHeight;
@@ -249,65 +245,18 @@ qreal QQuickMenuBarPrivate::getContentHeight() const
return maxHeight;
}
-void QQuickMenuBarPrivate::updateContentWidth()
+void QQuickMenuBarPrivate::itemImplicitWidthChanged(QQuickItem *item)
{
- Q_Q(QQuickMenuBar);
- if (hasContentWidth)
- return;
-
- const qreal oldContentWidth = contentWidth;
- contentWidth = getContentWidth();
- if (qFuzzyCompare(contentWidth, oldContentWidth))
- return;
-
- emit q->contentWidthChanged();
-}
-
-void QQuickMenuBarPrivate::updateContentHeight()
-{
- Q_Q(QQuickMenuBar);
- if (hasContentHeight)
- return;
-
- const qreal oldContentHeight = contentHeight;
- contentHeight = getContentHeight();
- if (qFuzzyCompare(contentHeight, oldContentHeight))
- return;
-
- emit q->contentHeightChanged();
-}
-
-void QQuickMenuBarPrivate::updateContentSize()
-{
- Q_Q(QQuickMenuBar);
- if (hasContentWidth && hasContentHeight)
- return;
-
- const qreal oldContentWidth = contentWidth;
- if (!hasContentWidth)
- contentWidth = getContentWidth();
-
- const qreal oldContentHeight = contentHeight;
- if (!hasContentHeight)
- contentHeight = getContentHeight();
-
- const bool widthChanged = !qFuzzyCompare(contentWidth, oldContentWidth);
- const bool heightChanged = !qFuzzyCompare(contentHeight, oldContentHeight);
-
- if (widthChanged)
- emit q->contentWidthChanged();
- if (heightChanged)
- emit q->contentHeightChanged();
-}
-
-void QQuickMenuBarPrivate::itemImplicitWidthChanged(QQuickItem *)
-{
- updateContentWidth();
+ QQuickContainerPrivate::itemImplicitWidthChanged(item);
+ if (item != contentItem)
+ updateContentWidth();
}
-void QQuickMenuBarPrivate::itemImplicitHeightChanged(QQuickItem *)
+void QQuickMenuBarPrivate::itemImplicitHeightChanged(QQuickItem *item)
{
- updateContentHeight();
+ QQuickContainerPrivate::itemImplicitHeightChanged(item);
+ if (item != contentItem)
+ updateContentHeight();
}
void QQuickMenuBarPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObject *obj)
@@ -457,81 +406,30 @@ QQuickMenu *QQuickMenuBar::takeMenu(int index)
}
/*!
+ \since QtQuick.Controls 2.3 (Qt 5.10)
\qmlproperty real QtQuick.Controls::MenuBar::contentWidth
This property holds the content width. It is used for calculating the total
implicit width of the menu bar.
- Unless explicitly overridden, the content width is automatically calculated
- based on the total implicit width of the items and the \l {Control::}{spacing}
- of the menu bar.
+ \note This property is available in MenuBar since QtQuick.Controls 2.3 (Qt 5.10),
+ but it was promoted to the Container base type in QtQuick.Controls 2.5 (Qt 5.12).
- \sa contentHeight
+ \sa Container::contentWidth
*/
-qreal QQuickMenuBar::contentWidth() const
-{
- Q_D(const QQuickMenuBar);
- return d->contentWidth;
-}
-
-void QQuickMenuBar::setContentWidth(qreal width)
-{
- Q_D(QQuickMenuBar);
- d->hasContentWidth = true;
- if (qFuzzyCompare(d->contentWidth, width))
- return;
-
- d->contentWidth = width;
- emit contentWidthChanged();
-}
-
-void QQuickMenuBar::resetContentWidth()
-{
- Q_D(QQuickMenuBar);
- if (!d->hasContentWidth)
- return;
-
- d->hasContentWidth = false;
- d->updateContentWidth();
-}
/*!
+ \since QtQuick.Controls 2.3 (Qt 5.10)
\qmlproperty real QtQuick.Controls::MenuBar::contentHeight
This property holds the content height. It is used for calculating the total
implicit height of the menu bar.
- Unless explicitly overridden, the content height is automatically calculated
- based on the maximum implicit height of the items.
+ \note This property is available in MenuBar since QtQuick.Controls 2.3 (Qt 5.10),
+ but it was promoted to the Container base type in QtQuick.Controls 2.5 (Qt 5.12).
- \sa contentWidth
+ \sa Container::contentHeight
*/
-qreal QQuickMenuBar::contentHeight() const
-{
- Q_D(const QQuickMenuBar);
- return d->contentHeight;
-}
-
-void QQuickMenuBar::setContentHeight(qreal height)
-{
- Q_D(QQuickMenuBar);
- d->hasContentHeight = true;
- if (qFuzzyCompare(d->contentHeight, height))
- return;
-
- d->contentHeight = height;
- emit contentHeightChanged();
-}
-
-void QQuickMenuBar::resetContentHeight()
-{
- Q_D(QQuickMenuBar);
- if (!d->hasContentHeight)
- return;
-
- d->hasContentHeight = false;
- d->updateContentHeight();
-}
/*!
\qmlproperty list<Menu> QtQuick.Controls::MenuBar::menus
diff --git a/src/quicktemplates2/qquickmenubar_p.h b/src/quicktemplates2/qquickmenubar_p.h
index da7bb542..af37d0f2 100644
--- a/src/quicktemplates2/qquickmenubar_p.h
+++ b/src/quicktemplates2/qquickmenubar_p.h
@@ -59,8 +59,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuBar : public QQuickContainer
{
Q_OBJECT
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
- Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL)
- Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL)
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL) // re-declare QQuickContainer::contentWidth (REV 5)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL) // re-declare QQuickContainer::contentHeight (REV 5)
Q_PRIVATE_PROPERTY(QQuickMenuBar::d_func(), QQmlListProperty<QQuickMenu> menus READ menus NOTIFY menusChanged FINAL)
Q_PRIVATE_PROPERTY(QQuickMenuBar::d_func(), QQmlListProperty<QObject> contentData READ contentData FINAL)
@@ -76,18 +76,8 @@ public:
Q_INVOKABLE void removeMenu(QQuickMenu *menu);
Q_INVOKABLE QQuickMenu *takeMenu(int index);
- qreal contentWidth() const;
- void setContentWidth(qreal width);
- void resetContentWidth();
-
- qreal contentHeight() const;
- void setContentHeight(qreal height);
- void resetContentHeight();
-
Q_SIGNALS:
void delegateChanged();
- void contentWidthChanged();
- void contentHeightChanged();
void menusChanged();
protected:
diff --git a/src/quicktemplates2/qquickmenubar_p_p.h b/src/quicktemplates2/qquickmenubar_p_p.h
index 409c7123..e11580e2 100644
--- a/src/quicktemplates2/qquickmenubar_p_p.h
+++ b/src/quicktemplates2/qquickmenubar_p_p.h
@@ -85,12 +85,8 @@ public:
void onItemTriggered();
void onMenuAboutToHide();
- qreal getContentWidth() const;
- qreal getContentHeight() const;
-
- void updateContentWidth();
- void updateContentHeight();
- void updateContentSize();
+ qreal getContentWidth() const override;
+ qreal getContentHeight() const override;
void itemImplicitWidthChanged(QQuickItem *item) override;
void itemImplicitHeightChanged(QQuickItem *item) override;
@@ -104,10 +100,6 @@ public:
bool popupMode;
bool triggering;
- bool hasContentWidth;
- bool hasContentHeight;
- qreal contentWidth;
- qreal contentHeight;
QQmlComponent *delegate;
QPointer<QQuickMenuBarItem> currentItem;
};
diff --git a/src/quicktemplates2/qquickswipeview.cpp b/src/quicktemplates2/qquickswipeview.cpp
index b1ca36bc..4031513a 100644
--- a/src/quicktemplates2/qquickswipeview.cpp
+++ b/src/quicktemplates2/qquickswipeview.cpp
@@ -110,10 +110,6 @@ class QQuickSwipeViewPrivate : public QQuickContainerPrivate
public:
QQuickSwipeViewPrivate()
: interactive(true),
- hasContentWidth(false),
- hasContentHeight(false),
- contentWidth(0),
- contentHeight(0),
orientation(Qt::Horizontal)
{
changeTypes |= ImplicitWidth | ImplicitHeight;
@@ -127,18 +123,10 @@ public:
void itemImplicitWidthChanged(QQuickItem *item) override;
void itemImplicitHeightChanged(QQuickItem *item) override;
- qreal getContentWidth() const;
- qreal getContentHeight() const;
-
- void updateContentWidth();
- void updateContentHeight();
- void updateContentSize();
+ qreal getContentWidth() const override;
+ qreal getContentHeight() const override;
bool interactive;
- bool hasContentWidth;
- bool hasContentHeight;
- qreal contentWidth;
- qreal contentHeight;
Qt::Orientation orientation;
};
@@ -199,6 +187,7 @@ QQuickSwipeViewPrivate *QQuickSwipeViewPrivate::get(QQuickSwipeView *view)
void QQuickSwipeViewPrivate::itemImplicitWidthChanged(QQuickItem *item)
{
Q_Q(QQuickSwipeView);
+ QQuickContainerPrivate::itemImplicitWidthChanged(item);
if (item == q->currentItem())
updateContentWidth();
}
@@ -206,6 +195,7 @@ void QQuickSwipeViewPrivate::itemImplicitWidthChanged(QQuickItem *item)
void QQuickSwipeViewPrivate::itemImplicitHeightChanged(QQuickItem *item)
{
Q_Q(QQuickSwipeView);
+ QQuickContainerPrivate::itemImplicitHeightChanged(item);
if (item == q->currentItem())
updateContentHeight();
}
@@ -224,64 +214,13 @@ qreal QQuickSwipeViewPrivate::getContentHeight() const
return currentItem ? currentItem->implicitHeight() : 0;
}
-void QQuickSwipeViewPrivate::updateContentWidth()
-{
- Q_Q(QQuickSwipeView);
- if (hasContentWidth)
- return;
-
- const qreal oldContentWidth = contentWidth;
- contentWidth = getContentWidth();
- if (qFuzzyCompare(contentWidth, oldContentWidth))
- return;
-
- emit q->contentWidthChanged();
-}
-
-void QQuickSwipeViewPrivate::updateContentHeight()
-{
- Q_Q(QQuickSwipeView);
- if (hasContentHeight)
- return;
-
- const qreal oldContentHeight = contentHeight;
- contentHeight = getContentHeight();
- if (qFuzzyCompare(contentHeight, oldContentHeight))
- return;
-
- emit q->contentHeightChanged();
-}
-
-void QQuickSwipeViewPrivate::updateContentSize()
-{
- Q_Q(QQuickSwipeView);
- if (hasContentWidth && hasContentHeight)
- return;
-
- const qreal oldContentWidth = contentWidth;
- if (!hasContentWidth)
- contentWidth = getContentWidth();
-
- const qreal oldContentHeight = contentHeight;
- if (!hasContentHeight)
- contentHeight = getContentHeight();
-
- const bool widthChanged = !qFuzzyCompare(contentWidth, oldContentWidth);
- const bool heightChanged = !qFuzzyCompare(contentHeight, oldContentHeight);
-
- if (widthChanged)
- emit q->contentWidthChanged();
- if (heightChanged)
- emit q->contentHeightChanged();
-}
-
QQuickSwipeView::QQuickSwipeView(QQuickItem *parent)
: QQuickContainer(*(new QQuickSwipeViewPrivate), parent)
{
Q_D(QQuickSwipeView);
setFlag(ItemIsFocusScope);
setActiveFocusOnTab(true);
- QObjectPrivate::connect(this, &QQuickContainer::currentItemChanged, d, &QQuickSwipeViewPrivate::updateContentSize);
+ QObjectPrivate::connect(this, &QQuickContainer::currentItemChanged, d, &QQuickContainerPrivate::updateContentSize);
}
/*!
@@ -374,85 +313,6 @@ QQuickSwipeViewAttached *QQuickSwipeView::qmlAttachedProperties(QObject *object)
return new QQuickSwipeViewAttached(object);
}
-/*!
- \since QtQuick.Controls 2.5 (Qt 5.12)
- \qmlproperty real QtQuick.Controls::SwipeView::contentWidth
-
- This property holds the content width. It is used for calculating the total
- implicit width of the button box.
-
- Unless explicitly overridden, the content width is automatically calculated
- based on the total implicit width of the buttons and the \l {Control::}{spacing}
- of the button box.
-
- \sa contentHeight
-*/
-qreal QQuickSwipeView::contentWidth() const
-{
- Q_D(const QQuickSwipeView);
- return d->contentWidth;
-}
-
-void QQuickSwipeView::setContentWidth(qreal width)
-{
- Q_D(QQuickSwipeView);
- d->hasContentWidth = true;
- if (qFuzzyCompare(d->contentWidth, width))
- return;
-
- d->contentWidth = width;
- emit contentWidthChanged();
-}
-
-void QQuickSwipeView::resetContentWidth()
-{
- Q_D(QQuickSwipeView);
- if (!d->hasContentWidth)
- return;
-
- d->hasContentWidth = false;
- d->updateContentWidth();
-}
-
-/*!
- \since QtQuick.Controls 2.5 (Qt 5.12)
- \qmlproperty real QtQuick.Controls::SwipeView::contentHeight
-
- This property holds the content height. It is used for calculating the total
- implicit height of the button box.
-
- Unless explicitly overridden, the content height is automatically calculated
- based on the maximum implicit height of the buttons.
-
- \sa contentWidth
-*/
-qreal QQuickSwipeView::contentHeight() const
-{
- Q_D(const QQuickSwipeView);
- return d->contentHeight;
-}
-
-void QQuickSwipeView::setContentHeight(qreal height)
-{
- Q_D(QQuickSwipeView);
- d->hasContentHeight = true;
- if (qFuzzyCompare(d->contentHeight, height))
- return;
-
- d->contentHeight = height;
- emit contentHeightChanged();
-}
-
-void QQuickSwipeView::resetContentHeight()
-{
- Q_D(QQuickSwipeView);
- if (!d->hasContentHeight)
- return;
-
- d->hasContentHeight = false;
- d->updateContentHeight();
-}
-
void QQuickSwipeView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
Q_D(QQuickSwipeView);
diff --git a/src/quicktemplates2/qquickswipeview_p.h b/src/quicktemplates2/qquickswipeview_p.h
index f19ccce2..03f6cefa 100644
--- a/src/quicktemplates2/qquickswipeview_p.h
+++ b/src/quicktemplates2/qquickswipeview_p.h
@@ -65,9 +65,6 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeView : public QQuickContainer
// 2.3 (Qt 5.10)
Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION 3)
Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION 3)
- // 2.5 (Qt 5.12)
- Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL REVISION 5)
- Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL REVISION 5)
public:
explicit QQuickSwipeView(QQuickItem *parent = nullptr);
@@ -86,23 +83,11 @@ public:
bool isHorizontal() const;
bool isVertical() const;
- // 2.5 (Qt 5.12)
- qreal contentWidth() const;
- void setContentWidth(qreal width);
- void resetContentWidth();
-
- qreal contentHeight() const;
- void setContentHeight(qreal height);
- void resetContentHeight();
-
Q_SIGNALS:
// 2.1 (Qt 5.8)
Q_REVISION(1) void interactiveChanged();
// 2.2 (Qt 5.9)
Q_REVISION(2) void orientationChanged();
- // 2.5 (Qt 5.12)
- Q_REVISION(5) void contentWidthChanged();
- Q_REVISION(5) void contentHeightChanged();
protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp
index 7e6eff79..ff5bc1a8 100644
--- a/src/quicktemplates2/qquicktabbar.cpp
+++ b/src/quicktemplates2/qquicktabbar.cpp
@@ -106,22 +106,14 @@ public:
void updateCurrentIndex();
void updateLayout();
- qreal getContentWidth() const;
- qreal getContentHeight() const;
-
- void updateContentWidth();
- void updateContentHeight();
- void updateContentSize();
+ qreal getContentWidth() const override;
+ qreal getContentHeight() const override;
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
void itemImplicitWidthChanged(QQuickItem *item) override;
void itemImplicitHeightChanged(QQuickItem *item) override;
bool updatingLayout;
- bool hasContentWidth;
- bool hasContentHeight;
- qreal contentWidth;
- qreal contentHeight;
QQuickTabBar::Position position;
};
@@ -149,10 +141,6 @@ public:
QQuickTabBarPrivate::QQuickTabBarPrivate()
: updatingLayout(false),
- hasContentWidth(false),
- hasContentHeight(false),
- contentWidth(0),
- contentHeight(0),
position(QQuickTabBar::Header)
{
changeTypes |= Geometry | ImplicitWidth | ImplicitHeight;
@@ -249,57 +237,6 @@ qreal QQuickTabBarPrivate::getContentHeight() const
return maxHeight;
}
-void QQuickTabBarPrivate::updateContentWidth()
-{
- Q_Q(QQuickTabBar);
- if (hasContentWidth)
- return;
-
- const qreal oldContentWidth = contentWidth;
- contentWidth = getContentWidth();
- if (qFuzzyCompare(contentWidth, oldContentWidth))
- return;
-
- emit q->contentWidthChanged();
-}
-
-void QQuickTabBarPrivate::updateContentHeight()
-{
- Q_Q(QQuickTabBar);
- if (hasContentHeight)
- return;
-
- const qreal oldContentHeight = contentHeight;
- contentHeight = getContentHeight();
- if (qFuzzyCompare(contentHeight, oldContentHeight))
- return;
-
- emit q->contentHeightChanged();
-}
-
-void QQuickTabBarPrivate::updateContentSize()
-{
- Q_Q(QQuickTabBar);
- if (hasContentWidth && hasContentHeight)
- return;
-
- const qreal oldContentWidth = contentWidth;
- if (!hasContentWidth)
- contentWidth = getContentWidth();
-
- const qreal oldContentHeight = contentHeight;
- if (!hasContentHeight)
- contentHeight = getContentHeight();
-
- const bool widthChanged = !qFuzzyCompare(contentWidth, oldContentWidth);
- const bool heightChanged = !qFuzzyCompare(contentHeight, oldContentHeight);
-
- if (widthChanged)
- emit q->contentWidthChanged();
- if (heightChanged)
- emit q->contentHeightChanged();
-}
-
void QQuickTabBarPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange change, const QRectF &)
{
if (!updatingLayout) {
@@ -309,14 +246,18 @@ void QQuickTabBarPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange
}
}
-void QQuickTabBarPrivate::itemImplicitWidthChanged(QQuickItem *)
+void QQuickTabBarPrivate::itemImplicitWidthChanged(QQuickItem *item)
{
- updateContentWidth();
+ QQuickContainerPrivate::itemImplicitWidthChanged(item);
+ if (item != contentItem)
+ updateContentWidth();
}
-void QQuickTabBarPrivate::itemImplicitHeightChanged(QQuickItem *)
+void QQuickTabBarPrivate::itemImplicitHeightChanged(QQuickItem *item)
{
- updateContentHeight();
+ QQuickContainerPrivate::itemImplicitHeightChanged(item);
+ if (item != contentItem)
+ updateContentHeight();
}
QQuickTabBar::QQuickTabBar(QQuickItem *parent)
@@ -366,38 +307,11 @@ void QQuickTabBar::setPosition(Position position)
This property holds the content width. It is used for calculating the total
implicit width of the tab bar.
- Unless explicitly overridden, the content width is automatically calculated
- based on the total implicit width of the tabs and the \l {Control::}{spacing}
- of the tab bar.
+ \note This property is available in TabBar since QtQuick.Controls 2.2 (Qt 5.9),
+ but it was promoted to the Container base type in QtQuick.Controls 2.5 (Qt 5.12).
- \sa contentHeight
+ \sa Container::contentWidth
*/
-qreal QQuickTabBar::contentWidth() const
-{
- Q_D(const QQuickTabBar);
- return d->contentWidth;
-}
-
-void QQuickTabBar::setContentWidth(qreal width)
-{
- Q_D(QQuickTabBar);
- d->hasContentWidth = true;
- if (qFuzzyCompare(d->contentWidth, width))
- return;
-
- d->contentWidth = width;
- emit contentWidthChanged();
-}
-
-void QQuickTabBar::resetContentWidth()
-{
- Q_D(QQuickTabBar);
- if (!d->hasContentWidth)
- return;
-
- d->hasContentWidth = false;
- d->updateContentWidth();
-}
/*!
\since QtQuick.Controls 2.2 (Qt 5.9)
@@ -406,37 +320,11 @@ void QQuickTabBar::resetContentWidth()
This property holds the content height. It is used for calculating the total
implicit height of the tab bar.
- Unless explicitly overridden, the content height is automatically calculated
- based on the maximum implicit height of the tabs.
+ \note This property is available in TabBar since QtQuick.Controls 2.2 (Qt 5.9),
+ but it was promoted to the Container base type in QtQuick.Controls 2.5 (Qt 5.12).
- \sa contentWidth
+ \sa Container::contentHeight
*/
-qreal QQuickTabBar::contentHeight() const
-{
- Q_D(const QQuickTabBar);
- return d->contentHeight;
-}
-
-void QQuickTabBar::setContentHeight(qreal height)
-{
- Q_D(QQuickTabBar);
- d->hasContentHeight = true;
- if (qFuzzyCompare(d->contentHeight, height))
- return;
-
- d->contentHeight = height;
- emit contentHeightChanged();
-}
-
-void QQuickTabBar::resetContentHeight()
-{
- Q_D(QQuickTabBar);
- if (!d->hasContentHeight)
- return;
-
- d->hasContentHeight = false;
- d->updateContentHeight();
-}
QQuickTabBarAttached *QQuickTabBar::qmlAttachedProperties(QObject *object)
{
diff --git a/src/quicktemplates2/qquicktabbar_p.h b/src/quicktemplates2/qquicktabbar_p.h
index e87ae133..5367118c 100644
--- a/src/quicktemplates2/qquicktabbar_p.h
+++ b/src/quicktemplates2/qquicktabbar_p.h
@@ -61,8 +61,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTabBar : public QQuickContainer
Q_OBJECT
Q_PROPERTY(Position position READ position WRITE setPosition NOTIFY positionChanged FINAL)
// 2.2 (Qt 5.9)
- Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL REVISION 2)
- Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL REVISION 2)
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL REVISION 2) // re-declare QQuickContainer::contentWidth (REV 5)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL REVISION 2) // re-declare QQuickContainer::contentHeight (REV 5)
public:
explicit QQuickTabBar(QQuickItem *parent = nullptr);
@@ -76,22 +76,10 @@ public:
Position position() const;
void setPosition(Position position);
- // 2.2 (Qt 5.9)
- qreal contentWidth() const;
- void setContentWidth(qreal width);
- void resetContentWidth();
-
- qreal contentHeight() const;
- void setContentHeight(qreal height);
- void resetContentHeight();
-
static QQuickTabBarAttached *qmlAttachedProperties(QObject *object);
Q_SIGNALS:
void positionChanged();
- // 2.2 (Qt 5.9)
- Q_REVISION(2) void contentWidthChanged();
- Q_REVISION(2) void contentHeightChanged();
protected:
void updatePolish() override;