diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-05-21 10:17:39 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-06-15 13:25:16 +0000 |
commit | bfb0a9ebe3b1dc6b0f06ec2d66469ba878fbe98b (patch) | |
tree | 984345e8bba2d1ba892f159971315b5f0dd786b3 /src/quicktemplates2/qquickpage.cpp | |
parent | bf82b95088f552a5f62d333662c7a9202d293359 (diff) |
Add DialogButtonBox
[ChangeLog][Controls] Added DialogButtonBox to provide convenience for
handling dialog buttons. DialogButtonBox is able to create a set of standard
buttons with a single line of QML code, and provides convenient accepted()
and rejected() signals.
Task-number: QTBUG-51090
Change-Id: I9b3c6ba1b2836dadf9a2ac9086be1eba214e7c4d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickpage.cpp')
-rw-r--r-- | src/quicktemplates2/qquickpage.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/quicktemplates2/qquickpage.cpp b/src/quicktemplates2/qquickpage.cpp index dd9bcc21..56a9f86e 100644 --- a/src/quicktemplates2/qquickpage.cpp +++ b/src/quicktemplates2/qquickpage.cpp @@ -38,6 +38,7 @@ #include "qquickcontrol_p_p.h" #include "qquicktoolbar_p.h" #include "qquicktabbar_p.h" +#include "qquickdialogbuttonbox_p.h" #include <QtQuick/private/qquickitemchangelistener_p.h> @@ -189,8 +190,9 @@ void QQuickPage::setTitle(const QString &title) This property holds the page header item. The header item is positioned to the top, and resized to the width of the page. The default value is \c null. - \note Assigning a ToolBar or TabBar as a page header sets the respective - \l ToolBar::position or \l TabBar::position property automatically to \c Header. + \note Assigning a ToolBar, TabBar, or DialogButtonBox as a page header + automatically sets the respective \l ToolBar::position, \l TabBar::position, + or \l DialogButtonBox::position property to \c Header. \sa footer, ApplicationWindow::header */ @@ -223,6 +225,8 @@ void QQuickPage::setHeader(QQuickItem *header) toolBar->setPosition(QQuickToolBar::Header); else if (QQuickTabBar *tabBar = qobject_cast<QQuickTabBar *>(header)) tabBar->setPosition(QQuickTabBar::Header); + else if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(header)) + buttonBox->setPosition(QQuickDialogButtonBox::Header); } if (isComponentComplete()) d->relayout(); @@ -235,8 +239,9 @@ void QQuickPage::setHeader(QQuickItem *header) This property holds the page footer item. The footer item is positioned to the bottom, and resized to the width of the page. The default value is \c null. - \note Assigning a ToolBar or TabBar as a page footer sets the respective - \l ToolBar::position or \l TabBar::position property automatically to \c Footer. + \note Assigning a ToolBar, TabBar, or DialogButtonBox as a page footer + automatically sets the respective \l ToolBar::position, \l TabBar::position, + or \l DialogButtonBox::position property to \c Footer. \sa header, ApplicationWindow::footer */ @@ -269,6 +274,8 @@ void QQuickPage::setFooter(QQuickItem *footer) toolBar->setPosition(QQuickToolBar::Footer); else if (QQuickTabBar *tabBar = qobject_cast<QQuickTabBar *>(footer)) tabBar->setPosition(QQuickTabBar::Footer); + else if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(footer)) + buttonBox->setPosition(QQuickDialogButtonBox::Header); } if (isComponentComplete()) d->relayout(); |