aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-09-15 16:50:16 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-09-19 14:34:12 +0000
commitfbe806c544a45c83f091109e04fab5d86620183f (patch)
tree830ccaec547d1ea44f4c73afb5ea157819cbe637 /src
parent541a7a8e785476e2e93f88f770715f25ce7e6dc8 (diff)
Fix Popup to respect explicit size
[ChangeLog][Controls][Popup] Fixed to respect explicitly set width and height. Task-number: QTBUG-56025 Change-Id: I7c8b0dcf59459a313c4c52eda44de45f1ab648ea Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quicktemplates2/qquickpopup.cpp12
-rw-r--r--src/quicktemplates2/qquickpopup_p_p.h2
2 files changed, 11 insertions, 3 deletions
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 0eab6ad5..d3280040 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -125,6 +125,8 @@ QQuickPopupPrivate::QQuickPopupPrivate()
, hasDim(false)
, visible(false)
, complete(false)
+ , hasWidth(false)
+ , hasHeight(false)
, hasTopMargin(false)
, hasLeftMargin(false)
, hasRightMargin(false)
@@ -587,7 +589,7 @@ void QQuickPopupPrivate::reposition()
bool widthAdjusted = false;
bool heightAdjusted = false;
- QRectF rect(x, y, iw > 0 ? iw : w, ih > 0 ? ih : h);
+ QRectF rect(x, y, !hasWidth && iw > 0 ? iw : w, !hasHeight && ih > 0 ? ih : h);
if (parentItem) {
rect = parentItem->mapRectToScene(rect);
@@ -681,9 +683,9 @@ void QQuickPopupPrivate::reposition()
emit q->yChanged();
}
- if (widthAdjusted && rect.width() > 0)
+ if (!hasWidth && widthAdjusted && rect.width() > 0)
popupItem->setWidth(rect.width());
- if (heightAdjusted && rect.height() > 0)
+ if (!hasHeight && heightAdjusted && rect.height() > 0)
popupItem->setHeight(rect.height());
}
@@ -907,12 +909,14 @@ qreal QQuickPopup::width() const
void QQuickPopup::setWidth(qreal width)
{
Q_D(QQuickPopup);
+ d->hasWidth = true;
d->popupItem->setWidth(width);
}
void QQuickPopup::resetWidth()
{
Q_D(QQuickPopup);
+ d->hasWidth = false;
d->popupItem->resetWidth();
}
@@ -930,12 +934,14 @@ qreal QQuickPopup::height() const
void QQuickPopup::setHeight(qreal height)
{
Q_D(QQuickPopup);
+ d->hasHeight = true;
d->popupItem->setHeight(height);
}
void QQuickPopup::resetHeight()
{
Q_D(QQuickPopup);
+ d->hasHeight = false;
d->popupItem->resetHeight();
}
diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h
index b828edc1..745a7f83 100644
--- a/src/quicktemplates2/qquickpopup_p_p.h
+++ b/src/quicktemplates2/qquickpopup_p_p.h
@@ -183,6 +183,8 @@ public:
bool hasDim;
bool visible;
bool complete;
+ bool hasWidth;
+ bool hasHeight;
bool hasTopMargin;
bool hasLeftMargin;
bool hasRightMargin;