diff options
Diffstat (limited to 'src/controls/qquickbutton.cpp')
-rw-r--r-- | src/controls/qquickbutton.cpp | 48 |
1 files changed, 2 insertions, 46 deletions
diff --git a/src/controls/qquickbutton.cpp b/src/controls/qquickbutton.cpp index 4bf2c08a..f8aa426c 100644 --- a/src/controls/qquickbutton.cpp +++ b/src/controls/qquickbutton.cpp @@ -97,9 +97,7 @@ QT_BEGIN_NAMESPACE \image qtquickcontrols2-button-label.png - If the \l {Button::label}{label} delegate has no explicit size specified, - it automatically follows the control's size without padding. The following - snippet presents the default label delegate implementation. + The following snippet presents the default label delegate implementation. \snippet Button.qml label @@ -134,26 +132,10 @@ QT_BEGIN_NAMESPACE This signal is emitted when the button is clicked. */ -QQuickButtonPrivate::QQuickButtonPrivate() : - pressed(false), label(Q_NULLPTR), labelHasWidth(true), labelHasHeight(true) +QQuickButtonPrivate::QQuickButtonPrivate() : pressed(false), label(Q_NULLPTR) { } -void QQuickButtonPrivate::updateGeometry() -{ - Q_Q(QQuickButton); - if (label) { - if (!labelHasWidth) { - label->setX(q->leftPadding()); - label->setWidth(q->width() - q->leftPadding() - q->rightPadding()); - } - if (!labelHasHeight) { - label->setY(q->topPadding()); - label->setHeight(q->height() - q->topPadding() - q->bottomPadding()); - } - } -} - QQuickButton::QQuickButton(QQuickItem *parent) : QQuickControl(*(new QQuickButtonPrivate), parent) { @@ -218,9 +200,6 @@ void QQuickButton::setPressed(bool isPressed) This property holds the label delegate. - If the label delegate has no explicit size specified, it - automatically follows the control's size without padding. - The implicit size of the label delegate is used to calculate the implicit size of the control. @@ -315,27 +294,4 @@ void QQuickButton::mouseUngrabEvent() } } -void QQuickButton::componentComplete() -{ - Q_D(QQuickButton); - QQuickControl::componentComplete(); - d->labelHasWidth = d->label && QQuickItemPrivate::get(d->label)->widthValid; - d->labelHasHeight = d->label && QQuickItemPrivate::get(d->label)->heightValid; - d->updateGeometry(); -} - -void QQuickButton::paddingChange() -{ - Q_D(QQuickButton); - QQuickControl::paddingChange(); - d->updateGeometry(); -} - -void QQuickButton::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) -{ - Q_D(QQuickButton); - QQuickControl::geometryChanged(newGeometry, oldGeometry); - d->updateGeometry(); -} - QT_END_NAMESPACE |