diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-10-22 21:18:52 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-10-26 09:17:20 +0000 |
commit | 52e933ce2b10b0e1b48afa9ce048552830309da7 (patch) | |
tree | 4fa2775aeaac86bbf083b0d477b4919004a55fe4 /src/imports/controls/material/Dialog.qml | |
parent | fa71ef5a2ccfa4666db9338c4ba8f34d19f2faf1 (diff) |
Add QQuickDialog::title
Dialog is incomplete without built-in support for title. All dialogs in
the examples, screenshots, webinars, and blog posts have had a custom
title. The Material and Universal designs both have specs for dialog
titles. This commit adds support for dialog titles with appropriate
looks (padding & font) out of the box.
Task-number: QTBUG-56711
Change-Id: I248150313f1ce629a7105fdbe1c70c8fcd69e1cc
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls/material/Dialog.qml')
-rw-r--r-- | src/imports/controls/material/Dialog.qml | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/imports/controls/material/Dialog.qml b/src/imports/controls/material/Dialog.qml index 7e9fafbe..ddc80895 100644 --- a/src/imports/controls/material/Dialog.qml +++ b/src/imports/controls/material/Dialog.qml @@ -55,6 +55,7 @@ T.Dialog { contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) padding: 24 + topPadding: 20 Material.elevation: 24 @@ -80,6 +81,23 @@ T.Dialog { } } + header: Label { + text: control.title + visible: control.title + elide: Label.ElideRight + padding: 24 + bottomPadding: 0 + // TODO: QPlatformTheme::TitleBarFont + font.bold: true + font.pixelSize: 16 + background: PaddedRectangle { + radius: 2 + color: control.Material.dialogColor + bottomPadding: -2 + clip: true + } + } + footer: DialogButtonBox { visible: count > 0 } |