aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-06-29 12:09:17 +0200
committerIgor Bugaev <freedbrt@gmail.com>2021-07-07 23:35:17 +0300
commit2a4ff847e8c018f31b14ecffd229d3793138ab1b (patch)
tree152451ec1f797c433a6020f35be95f28843b7f24 /src/quicktemplates2
parent7ac7ffac8582aea6c8d4a6f8de8543e6f15974a4 (diff)
Adjust to QQuickItemPrivate::{width,height}Valid becoming a function
Task-number: QTBUG-94703 Pick-to: 6.2 Change-Id: I2c48f1cc94b8dd94cddab1d833f62299d35fe5d9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp12
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp14
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp4
-rw-r--r--src/quicktemplates2/qquicklabel.cpp14
-rw-r--r--src/quicktemplates2/qquickmenu.cpp4
-rw-r--r--src/quicktemplates2/qquickstackelement.cpp4
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp4
-rw-r--r--src/quicktemplates2/qquicktabbar.cpp12
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp14
-rw-r--r--src/quicktemplates2/qquicktextfield.cpp26
10 files changed, 54 insertions, 54 deletions
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index bf309389..eb1d12c9 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -191,9 +191,9 @@ static void layoutItem(QQuickItem *item, qreal y, qreal width)
item->setY(y);
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- if (!p->widthValid) {
+ if (!p->widthValid()) {
item->setWidth(width);
- p->widthValid = false;
+ p->widthValidFlag = false;
}
}
@@ -219,13 +219,13 @@ void QQuickApplicationWindowPrivate::relayout()
if (background) {
QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (!p->widthValid && qFuzzyIsNull(background->x())) {
+ if (!p->widthValid() && qFuzzyIsNull(background->x())) {
background->setWidth(q->width());
- p->widthValid = false;
+ p->widthValidFlag = false;
}
- if (!p->heightValid && qFuzzyIsNull(background->y())) {
+ if (!p->heightValid() && qFuzzyIsNull(background->y())) {
background->setHeight(q->height());
- p->heightValid = false;
+ p->heightValidFlag = false;
}
}
}
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index 56e7e935..072b6f4c 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -381,12 +381,12 @@ void QQuickControlPrivate::resizeBackground()
resizingBackground = true;
QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (((!p->widthValid || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
+ if (((!p->widthValid() || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
|| (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
background->setX(getLeftInset());
background->setWidth(width - getLeftInset() - getRightInset());
}
- if (((!p->heightValid || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
+ if (((!p->heightValid() || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
|| (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
background->setY(getTopInset());
background->setHeight(height - getTopInset() - getBottomInset());
@@ -833,9 +833,9 @@ void QQuickControlPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryC
// Only set hasBackgroundWidth/Height if it was a width/height change,
// otherwise we're prevented from setting a width/height in the future.
if (change.widthChange())
- extra.value().hasBackgroundWidth = p->widthValid;
+ extra.value().hasBackgroundWidth = p->widthValid();
if (change.heightChange())
- extra.value().hasBackgroundHeight = p->heightValid;
+ extra.value().hasBackgroundHeight = p->heightValid();
resizeBackground();
}
@@ -1531,9 +1531,9 @@ void QQuickControl::setBackground(QQuickItem *background)
if (qFuzzyIsNull(background->z()))
background->setZ(-1);
QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (p->widthValid || p->heightValid) {
- d->extra.value().hasBackgroundWidth = p->widthValid;
- d->extra.value().hasBackgroundHeight = p->heightValid;
+ if (p->widthValid() || p->heightValid()) {
+ d->extra.value().hasBackgroundWidth = p->widthValid();
+ d->extra.value().hasBackgroundHeight = p->heightValid();
}
if (isComponentComplete())
d->resizeBackground();
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index b6b9ed84..a4b3313b 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -266,7 +266,7 @@ void QQuickDialogButtonBoxPrivate::updateLayout()
QQuickItem *item = q->itemAt(i);
if (item) {
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- if (!p->widthValid) {
+ if (!p->widthValid()) {
if (!halign)
item->setWidth(itemWidth);
else
@@ -275,7 +275,7 @@ void QQuickDialogButtonBoxPrivate::updateLayout()
item->setHeight(contentHeight);
else
item->resetHeight();
- p->widthValid = false;
+ p->widthValidFlag = false;
}
}
buttons += static_cast<QQuickAbstractButton *>(item);
diff --git a/src/quicktemplates2/qquicklabel.cpp b/src/quicktemplates2/qquicklabel.cpp
index 2cf3be16..d5d9146a 100644
--- a/src/quicktemplates2/qquicklabel.cpp
+++ b/src/quicktemplates2/qquicklabel.cpp
@@ -149,12 +149,12 @@ void QQuickLabelPrivate::resizeBackground()
resizingBackground = true;
QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (((!p->widthValid || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
+ if (((!p->widthValid() || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
|| (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
background->setX(getLeftInset());
background->setWidth(width - getLeftInset() - getRightInset());
}
- if (((!p->heightValid || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
+ if (((!p->heightValid() || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
|| (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
background->setY(getTopInset());
background->setHeight(height - getTopInset() - getBottomInset());
@@ -271,8 +271,8 @@ void QQuickLabelPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryCha
return;
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- extra.value().hasBackgroundWidth = p->widthValid;
- extra.value().hasBackgroundHeight = p->heightValid;
+ extra.value().hasBackgroundWidth = p->widthValid();
+ extra.value().hasBackgroundHeight = p->heightValid();
resizeBackground();
}
@@ -378,9 +378,9 @@ void QQuickLabel::setBackground(QQuickItem *background)
if (qFuzzyIsNull(background->z()))
background->setZ(-1);
QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (p->widthValid || p->heightValid) {
- d->extra.value().hasBackgroundWidth = p->widthValid;
- d->extra.value().hasBackgroundHeight = p->heightValid;
+ if (p->widthValid() || p->heightValid()) {
+ d->extra.value().hasBackgroundWidth = p->widthValid();
+ d->extra.value().hasBackgroundHeight = p->heightValid();
}
if (isComponentComplete())
d->resizeBackground();
diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp
index 561e1037..887f802c 100644
--- a/src/quicktemplates2/qquickmenu.cpp
+++ b/src/quicktemplates2/qquickmenu.cpp
@@ -337,9 +337,9 @@ void QQuickMenuPrivate::resizeItem(QQuickItem *item)
return;
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- if (!p->widthValid) {
+ if (!p->widthValid()) {
item->setWidth(contentItem->width());
- p->widthValid = false;
+ p->widthValidFlag = false;
}
}
diff --git a/src/quicktemplates2/qquickstackelement.cpp b/src/quicktemplates2/qquickstackelement.cpp
index 1b4ac476..b275f96b 100644
--- a/src/quicktemplates2/qquickstackelement.cpp
+++ b/src/quicktemplates2/qquickstackelement.cpp
@@ -194,9 +194,9 @@ void QQuickStackElement::initialize()
return;
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- if (!(widthValid = p->widthValid))
+ if (!(widthValid = p->widthValid()))
item->setWidth(view->width());
- if (!(heightValid = p->heightValid))
+ if (!(heightValid = p->heightValid()))
item->setHeight(view->height());
item->setParentItem(view);
p->addItemChangeListener(this, QQuickItemPrivate::Destroyed);
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp
index 5e208fb9..817704ba 100644
--- a/src/quicktemplates2/qquickswipedelegate.cpp
+++ b/src/quicktemplates2/qquickswipedelegate.cpp
@@ -731,11 +731,11 @@ void QQuickSwipeDelegatePrivate::resizeBackground()
QQuickItemPrivate *p = QQuickItemPrivate::get(background);
const bool extraAllocated = extra.isAllocated();
// Don't check for or set the x here since it will just be overwritten by reposition().
- if (((!p->widthValid || !extraAllocated || !extra->hasBackgroundWidth))
+ if (((!p->widthValid() || !extraAllocated || !extra->hasBackgroundWidth))
|| (extraAllocated && (extra->hasLeftInset || extra->hasRightInset))) {
background->setWidth(width - getLeftInset() - getRightInset());
}
- if (((!p->heightValid || !extraAllocated || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
+ if (((!p->heightValid() || !extraAllocated || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
|| (extraAllocated && (extra->hasTopInset || extra->hasBottomInset))) {
background->setY(getTopInset());
background->setHeight(height - getTopInset() - getBottomInset());
diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp
index b38699df..f8810581 100644
--- a/src/quicktemplates2/qquicktabbar.cpp
+++ b/src/quicktemplates2/qquicktabbar.cpp
@@ -165,7 +165,7 @@ void QQuickTabBarPrivate::updateLayout()
QQuickItem *item = q->itemAt(i);
if (item) {
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- if (!p->widthValid)
+ if (!p->widthValid())
++resizableCount;
else
reservedWidth += item->width();
@@ -179,13 +179,13 @@ void QQuickTabBarPrivate::updateLayout()
updatingLayout = true;
for (QQuickItem *item : qAsConst(allItems)) {
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- if (!p->widthValid) {
+ if (!p->widthValid()) {
item->setWidth(itemWidth);
- p->widthValid = false;
+ p->widthValidFlag = false;
}
- if (!p->heightValid) {
+ if (!p->heightValid()) {
item->setHeight(contentHeight);
- p->heightValid = false;
+ p->heightValidFlag = false;
} else {
item->setY((contentHeight - item->height()) / 2);
}
@@ -202,7 +202,7 @@ qreal QQuickTabBarPrivate::getContentWidth() const
QQuickItem *item = q->itemAt(i);
if (item) {
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- if (!p->widthValid)
+ if (!p->widthValid())
totalWidth += item->implicitWidth();
else
totalWidth += item->width();
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index 183c929e..f1ea24d8 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -226,14 +226,14 @@ void QQuickTextAreaPrivate::resizeBackground()
const auto flickable = qobject_cast<QQuickFlickable *>(background->parentItem());
QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (((!p->widthValid || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
+ if (((!p->widthValid() || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
|| (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
const qreal bgWidth = flickable ? flickable->width() : width;
background->setX(getLeftInset());
background->setWidth(bgWidth - getLeftInset() - getRightInset());
}
- if (((!p->heightValid || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
+ if (((!p->heightValid() || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
|| (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
const qreal bgHeight = flickable ? flickable->height() : height;
background->setY(getTopInset());
@@ -416,9 +416,9 @@ void QQuickTextAreaPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometry
// Only set hasBackgroundWidth/Height if it was a width/height change,
// otherwise we're prevented from setting a width/height in the future.
if (change.widthChange())
- extra.value().hasBackgroundWidth = p->widthValid;
+ extra.value().hasBackgroundWidth = p->widthValid();
if (change.heightChange())
- extra.value().hasBackgroundHeight = p->heightValid;
+ extra.value().hasBackgroundHeight = p->heightValid();
}
if (flickable)
@@ -617,9 +617,9 @@ void QQuickTextArea::setBackground(QQuickItem *background)
if (background) {
QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (p->widthValid || p->heightValid) {
- d->extra.value().hasBackgroundWidth = p->widthValid;
- d->extra.value().hasBackgroundHeight = p->heightValid;
+ if (p->widthValid() || p->heightValid()) {
+ d->extra.value().hasBackgroundWidth = p->widthValid();
+ d->extra.value().hasBackgroundHeight = p->heightValid();
}
if (d->flickable)
background->setParentItem(d->flickable);
diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp
index 06cbd5a2..32e447d7 100644
--- a/src/quicktemplates2/qquicktextfield.cpp
+++ b/src/quicktemplates2/qquicktextfield.cpp
@@ -184,22 +184,22 @@ void QQuickTextFieldPrivate::resizeBackground()
resizingBackground = true;
QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (((!p->widthValid || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
+ if (((!p->widthValid() || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
|| (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
- const bool wasWidthValid = p->widthValid;
+ const bool wasWidthValid = p->widthValid();
background->setX(getLeftInset());
background->setWidth(width - getLeftInset() - getRightInset());
// If the user hadn't previously set the width, that shouldn't change when we set it for them.
if (!wasWidthValid)
- p->widthValid = false;
+ p->widthValidFlag = false;
}
- if (((!p->heightValid || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
+ if (((!p->heightValid() || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
|| (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
- const bool wasHeightValid = p->heightValid;
+ const bool wasHeightValid = p->heightValid();
background->setY(getTopInset());
background->setHeight(height - getTopInset() - getBottomInset());
if (!wasHeightValid)
- p->heightValid = false;
+ p->heightValidFlag = false;
}
resizingBackground = false;
@@ -361,10 +361,10 @@ void QQuickTextFieldPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometr
// QTBUG-71875: only allocate the extra data if we have to.
// resizeBackground() relies on the value of extra.isAllocated()
// as part of its checks to see whether it should resize the background or not.
- if (p->widthValid || extra.isAllocated())
- extra.value().hasBackgroundWidth = p->widthValid;
- if (p->heightValid || extra.isAllocated())
- extra.value().hasBackgroundHeight = p->heightValid;
+ if (p->widthValid() || extra.isAllocated())
+ extra.value().hasBackgroundWidth = p->widthValid();
+ if (p->heightValid() || extra.isAllocated())
+ extra.value().hasBackgroundHeight = p->heightValid();
resizeBackground();
}
@@ -476,9 +476,9 @@ void QQuickTextField::setBackground(QQuickItem *background)
if (qFuzzyIsNull(background->z()))
background->setZ(-1);
QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (p->widthValid || p->heightValid) {
- d->extra.value().hasBackgroundWidth = p->widthValid;
- d->extra.value().hasBackgroundHeight = p->heightValid;
+ if (p->widthValid() || p->heightValid()) {
+ d->extra.value().hasBackgroundWidth = p->widthValid();
+ d->extra.value().hasBackgroundHeight = p->heightValid();
}
if (isComponentComplete())
d->resizeBackground();