summaryrefslogtreecommitdiff
path: root/src/dialogs
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-24 20:01:44 +0200
committerLiang Qi <liang.qi@qt.io>2016-05-24 20:14:23 +0200
commit60319de8e8023d75411fde05ff11d176874cf5b9 (patch)
treea551cb5ed4e473ec9b6db9f11927315067898e2c /src/dialogs
parent34fbd06f1b678375817badf33e87a43705c8d8f7 (diff)
parent94c78ddf7ddea751a8e816d26f341d54184056c6 (diff)
downloadqtquickcontrols-60319de8e8023d75411fde05ff11d176874cf5b9.tar.gz
Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: I2ee8bf8c1b79386c88134c985e5ef5751f38c054
Diffstat (limited to 'src/dialogs')
-rw-r--r--src/dialogs/DefaultDialogWrapper.qml22
-rw-r--r--src/dialogs/Private/dialogsprivateplugin.cpp2
-rw-r--r--src/dialogs/doc/qtquickdialogs.qdocconf4
-rw-r--r--src/dialogs/doc/src/qtquickdialogs-index.qdoc8
-rw-r--r--src/dialogs/plugin.cpp2
-rw-r--r--src/dialogs/qquickabstractdialog.cpp13
-rw-r--r--src/dialogs/qquickdialog.cpp2
-rw-r--r--src/dialogs/qquickplatformcolordialog.cpp2
-rw-r--r--src/dialogs/qquickplatformfiledialog.cpp2
-rw-r--r--src/dialogs/qquickplatformfontdialog.cpp2
-rw-r--r--src/dialogs/qquickplatformmessagedialog.cpp2
11 files changed, 34 insertions, 27 deletions
diff --git a/src/dialogs/DefaultDialogWrapper.qml b/src/dialogs/DefaultDialogWrapper.qml
index 6c2cae06..b446c316 100644
--- a/src/dialogs/DefaultDialogWrapper.qml
+++ b/src/dialogs/DefaultDialogWrapper.qml
@@ -53,13 +53,14 @@ AbstractDialog {
id: content
property real spacing: 6
property real outerSpacing: 12
- property real buttonsRowImplicitWidth: minimumWidth
+ property real buttonsRowImplicitHeight: 0
+ property real buttonsRowImplicitWidth: Screen.pixelDensity * 50
property bool buttonsInSingleRow: defaultContentItem.width >= buttonsRowImplicitWidth
property real minimumHeight: implicitHeight
- property real minimumWidth: Screen.pixelDensity * 50
- implicitHeight: defaultContentItem.implicitHeight + spacing + outerSpacing * 2 + buttonsRight.implicitHeight
+ property real minimumWidth: implicitWidth
+ implicitHeight: defaultContentItem.implicitHeight + spacing + outerSpacing * 2 + Math.max(buttonsRight.implicitHeight, buttonsRowImplicitHeight)
implicitWidth: Math.min(root.__maximumDimension, Math.max(
- defaultContentItem.implicitWidth, buttonsRowImplicitWidth, Screen.pixelDensity * 50) + outerSpacing * 2);
+ defaultContentItem.implicitWidth, buttonsRowImplicitWidth, Screen.pixelDensity * 50) + outerSpacing * 2)
color: palette.window
Keys.onPressed: {
event.accepted = true
@@ -85,9 +86,14 @@ AbstractDialog {
left: parent.left
right: parent.right
top: parent.top
+ bottom: buttonsLeft.implicitHeight ? buttonsLeft.top : buttonsRight.top
margins: content.outerSpacing
+ bottomMargin: buttonsLeft.implicitHeight + buttonsRight.implicitHeight > 0 ? content.spacing : 0
}
- implicitHeight: childrenRect.height
+ implicitHeight: children.length === 1 ? children[0].implicitHeight
+ : (children.length ? childrenRect.height : 0)
+ implicitWidth: children.length === 1 ? children[0].implicitWidth
+ : (children.length ? childrenRect.width : 0)
}
Flow {
@@ -138,7 +144,9 @@ AbstractDialog {
function setupButtons() {
buttonsLeftRepeater.model = root.__standardButtonsLeftModel()
buttonsRightRepeater.model = root.__standardButtonsRightModel()
- if (buttonsLeftRepeater.count + buttonsRightRepeater.count < 2)
+ if (buttonsRightRepeater.model && buttonsRightRepeater.model.length > 0)
+ content.buttonsRowImplicitHeight = buttonsRight.visibleChildren[0].implicitHeight
+ if (buttonsLeftRepeater.count + buttonsRightRepeater.count < 1)
return;
var calcWidth = 0;
@@ -153,7 +161,7 @@ AbstractDialog {
for (var i = 0; i < buttonsRight.visibleChildren.length; ++i)
calculateForButton(i, buttonsRight.visibleChildren[i])
- content.minimumWidth = calcWidth + content.outerSpacing * 2
+ content.minimumWidth = Math.max(calcWidth + content.outerSpacing * 2, content.implicitWidth)
for (i = 0; i < buttonsLeft.visibleChildren.length; ++i)
calculateForButton(i, buttonsLeft.visibleChildren[i])
content.buttonsRowImplicitWidth = calcWidth + content.spacing
diff --git a/src/dialogs/Private/dialogsprivateplugin.cpp b/src/dialogs/Private/dialogsprivateplugin.cpp
index e9b39e05..ba8aabe3 100644
--- a/src/dialogs/Private/dialogsprivateplugin.cpp
+++ b/src/dialogs/Private/dialogsprivateplugin.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
class QtQuick2DialogsPrivatePlugin : public QQmlExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
QtQuick2DialogsPrivatePlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
diff --git a/src/dialogs/doc/qtquickdialogs.qdocconf b/src/dialogs/doc/qtquickdialogs.qdocconf
index 30f3635a..ccb555a7 100644
--- a/src/dialogs/doc/qtquickdialogs.qdocconf
+++ b/src/dialogs/doc/qtquickdialogs.qdocconf
@@ -24,9 +24,9 @@ qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.sortPages = true
depends = qtqml qtquick qtgui qtwidgets qtdoc qtcore
-exampledirs += ../../../examples/quick/dialogs
+exampledirs += ../../../examples/quickcontrols/dialogs
-examplesinstallpath = qtquickcontrols/quick/dialogs
+examplesinstallpath = quickcontrols/dialogs
headerdirs += ..
diff --git a/src/dialogs/doc/src/qtquickdialogs-index.qdoc b/src/dialogs/doc/src/qtquickdialogs-index.qdoc
index a094a27a..0adf28af 100644
--- a/src/dialogs/doc/src/qtquickdialogs-index.qdoc
+++ b/src/dialogs/doc/src/qtquickdialogs-index.qdoc
@@ -26,12 +26,6 @@
****************************************************************************/
/*!
- \group dialogs
- \brief Dialog components
- \title Dialogs
-*/
-
-/*!
\page qtquickdialogs-index.html
\title Qt Quick Dialogs
@@ -41,7 +35,7 @@
\section1 Dialogs
- \annotatedlist dialogs
+ \annotatedlist qtquickdialogs
\section1 Related information
diff --git a/src/dialogs/plugin.cpp b/src/dialogs/plugin.cpp
index 1ab6b581..23eeac38 100644
--- a/src/dialogs/plugin.cpp
+++ b/src/dialogs/plugin.cpp
@@ -91,7 +91,7 @@ QT_BEGIN_NAMESPACE
class QtQuick2DialogsPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
QtQuick2DialogsPlugin() : QQmlExtensionPlugin(), m_useResources(true) { initResources(); }
diff --git a/src/dialogs/qquickabstractdialog.cpp b/src/dialogs/qquickabstractdialog.cpp
index afc27b77..65237652 100644
--- a/src/dialogs/qquickabstractdialog.cpp
+++ b/src/dialogs/qquickabstractdialog.cpp
@@ -138,7 +138,7 @@ void QQuickAbstractDialog::setVisible(bool v)
m_dialogWindow->setMinimumSize(minSize);
connect(win, SIGNAL(widthChanged(int)), this, SLOT(windowGeometryChanged()));
connect(win, SIGNAL(heightChanged(int)), this, SLOT(windowGeometryChanged()));
- qCDebug(lcWindow) << "created window" << win;
+ qCDebug(lcWindow) << "created window" << win << "with min size" << win->minimumSize() << "geometry" << win->geometry();
}
if (!m_dialogWindow) {
@@ -282,16 +282,21 @@ void QQuickAbstractDialog::windowGeometryChanged()
void QQuickAbstractDialog::minimumWidthChanged()
{
qreal min = m_contentItem->property("minimumWidth").toReal();
+ qreal implicitOrMin = qMax(m_contentItem->implicitWidth(), min);
qCDebug(lcWindow) << "content implicitWidth" << m_contentItem->implicitWidth() << "minimumWidth" << min;
- m_dialogWindow->setMinimumWidth(qMax(m_contentItem->implicitWidth(), min));
+ if (m_dialogWindow->width() < implicitOrMin)
+ m_dialogWindow->setWidth(implicitOrMin);
+ m_dialogWindow->setMinimumWidth(implicitOrMin);
}
void QQuickAbstractDialog::minimumHeightChanged()
{
qreal min = m_contentItem->property("minimumHeight").toReal();
+ qreal implicitOrMin = qMax(m_contentItem->implicitHeight(), min);
qCDebug(lcWindow) << "content implicitHeight" << m_contentItem->implicitHeight() << "minimumHeight" << min;
- m_dialogWindow->setMinimumHeight(qMax(m_contentItem->implicitHeight(),
- m_contentItem->property("minimumHeight").toReal()));
+ if (m_dialogWindow->height() < implicitOrMin)
+ m_dialogWindow->setHeight(implicitOrMin);
+ m_dialogWindow->setMinimumHeight(implicitOrMin);
}
void QQuickAbstractDialog::implicitHeightChanged()
diff --git a/src/dialogs/qquickdialog.cpp b/src/dialogs/qquickdialog.cpp
index c6f50df0..33e3b02b 100644
--- a/src/dialogs/qquickdialog.cpp
+++ b/src/dialogs/qquickdialog.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
\qmltype Dialog
\instantiates QQuickDialog
\inqmlmodule QtQuick.Dialogs
- \ingroup dialogs
+ \ingroup qtquickdialogs
\brief A generic QtQuick dialog wrapper with standard buttons.
\since 5.3
diff --git a/src/dialogs/qquickplatformcolordialog.cpp b/src/dialogs/qquickplatformcolordialog.cpp
index d10c444e..c002f322 100644
--- a/src/dialogs/qquickplatformcolordialog.cpp
+++ b/src/dialogs/qquickplatformcolordialog.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
\qmltype ColorDialog
\instantiates QQuickPlatformColorDialog
\inqmlmodule QtQuick.Dialogs
- \ingroup dialogs
+ \ingroup qtquickdialogs
\brief Dialog component for choosing a color.
\since 5.1
diff --git a/src/dialogs/qquickplatformfiledialog.cpp b/src/dialogs/qquickplatformfiledialog.cpp
index fe51cc48..d70c44d9 100644
--- a/src/dialogs/qquickplatformfiledialog.cpp
+++ b/src/dialogs/qquickplatformfiledialog.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
\qmltype FileDialog
\instantiates QQuickPlatformFileDialog
\inqmlmodule QtQuick.Dialogs
- \ingroup dialogs
+ \ingroup qtquickdialogs
\brief Dialog component for choosing files from a local filesystem.
\since 5.1
diff --git a/src/dialogs/qquickplatformfontdialog.cpp b/src/dialogs/qquickplatformfontdialog.cpp
index eb29fd0b..247e869e 100644
--- a/src/dialogs/qquickplatformfontdialog.cpp
+++ b/src/dialogs/qquickplatformfontdialog.cpp
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickPlatformFontDialog
\inqmlmodule QtQuick.Dialogs
\ingroup qtquick-visual
- \ingroup dialogs
+ \ingroup qtquickdialogs
\brief Dialog component for choosing a font.
\since 5.2
diff --git a/src/dialogs/qquickplatformmessagedialog.cpp b/src/dialogs/qquickplatformmessagedialog.cpp
index fcf30b2d..2e3afa48 100644
--- a/src/dialogs/qquickplatformmessagedialog.cpp
+++ b/src/dialogs/qquickplatformmessagedialog.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
\qmltype MessageDialog
\instantiates QQuickPlatformMessageDialog
\inqmlmodule QtQuick.Dialogs
- \ingroup dialogs
+ \ingroup qtquickdialogs
\brief Dialog component for displaying popup messages.
\since 5.2