diff options
Diffstat (limited to 'src/quicktemplates/qquickdialogbuttonbox.cpp')
-rw-r--r-- | src/quicktemplates/qquickdialogbuttonbox.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/quicktemplates/qquickdialogbuttonbox.cpp b/src/quicktemplates/qquickdialogbuttonbox.cpp index 989c9b4506..b7c486c472 100644 --- a/src/quicktemplates/qquickdialogbuttonbox.cpp +++ b/src/quicktemplates/qquickdialogbuttonbox.cpp @@ -383,10 +383,8 @@ QQuickAbstractButton *QQuickDialogButtonBoxPrivate::createStandardButton(QPlatfo QQmlContext *creationContext = delegate->creationContext(); if (!creationContext) creationContext = qmlContext(q); - QQmlContext *context = new QQmlContext(creationContext, q); - context->setContextObject(q); - QObject *object = delegate->beginCreate(context); + QObject *object = delegate->beginCreate(creationContext); QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton*>(object); if (button) { QQuickDialogButtonBoxAttached *attached = qobject_cast<QQuickDialogButtonBoxAttached *>(qmlAttachedPropertiesObject<QQuickDialogButtonBox>(button, true)); @@ -457,6 +455,7 @@ QQuickDialogButtonBox::QQuickDialogButtonBox(QQuickItem *parent) Q_D(QQuickDialogButtonBox); d->changeTypes |= QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight; d->buttonLayout = platformButtonLayout(); + d->setSizePolicy(QLayoutPolicy::Preferred, QLayoutPolicy::Fixed); } QQuickDialogButtonBox::~QQuickDialogButtonBox() @@ -480,7 +479,7 @@ QQuickDialogButtonBox::~QQuickDialogButtonBox() Possible values: \value DialogButtonBox.Header The button box is at the top, as a window or page header. - \value DialogButtonBox.Footer The button box is at the bottom, as a window or page header. + \value DialogButtonBox.Footer The button box is at the bottom, as a window or page footer. The default value is \c Footer. @@ -515,6 +514,13 @@ void QQuickDialogButtonBox::setPosition(Position position) \value Qt.AlignTop The buttons are aligned to the top. \value Qt.AlignVCenter The buttons are vertically centered. \value Qt.AlignBottom The buttons are aligned to the bottom. + + The default value is \c undefined. + + \note This property assumes a horizontal layout of the buttons. The + DialogButtonBox for the \l {iOS Style}{iOS style} uses a vertical layout + when there are more than two buttons, and if set to a value other than + \c undefined, the layout of its buttons will be done horizontally. */ Qt::Alignment QQuickDialogButtonBox::alignment() const { |