From cd0c04c630b6924d444f0e84e1b63477e4346aeb Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 11 Dec 2015 15:34:55 +0100 Subject: Popup: rename show()/hide() to open()/close() QML popups have traditionally used more explicit open() and close(). Renaming them to show() and hide() at this stage doesn't seem to have any real advantages. Change-Id: I1e7c8c4817c67e62cef965525e00f5bf125a7d76 Reviewed-by: Mitch Curtis --- src/templates/qquickcombobox.cpp | 4 ++-- src/templates/qquickmenu.cpp | 10 +++++----- src/templates/qquickmenuitem.cpp | 2 +- src/templates/qquickpopup.cpp | 26 +++++++++++++------------- src/templates/qquickpopup_p.h | 6 +++--- 5 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src/templates') diff --git a/src/templates/qquickcombobox.cpp b/src/templates/qquickcombobox.cpp index f95dd357..4465d5dc 100644 --- a/src/templates/qquickcombobox.cpp +++ b/src/templates/qquickcombobox.cpp @@ -166,7 +166,7 @@ bool QQuickComboBoxPrivate::isPopupVisible() const void QQuickComboBoxPrivate::showPopup() { if (popup && !popup->isVisible()) - popup->show(); + popup->open(); setHighlightedIndex(currentIndex); } @@ -174,7 +174,7 @@ void QQuickComboBoxPrivate::hidePopup(bool accept) { Q_Q(QQuickComboBox); if (popup && popup->isVisible()) - popup->hide(); + popup->close(); if (accept) { q->setCurrentIndex(highlightedIndex); emit q->activated(currentIndex); diff --git a/src/templates/qquickmenu.cpp b/src/templates/qquickmenu.cpp index 27c7094d..d6c6e1cb 100644 --- a/src/templates/qquickmenu.cpp +++ b/src/templates/qquickmenu.cpp @@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE Button { id: fileButton text: "File" - onClicked: menu.show() + onClicked: menu.open() } Menu { id: menu @@ -267,7 +267,7 @@ void QQuickMenuPrivate::contentData_append(QQmlListProperty *prop, QObj QQuickMenuItem *menuItem = qobject_cast(item); if (menuItem) { QObjectPrivate::connect(menuItem, &QQuickMenuItem::pressed, p, &QQuickMenuPrivate::onItemPressed); - QObject::connect(menuItem, &QQuickMenuItem::triggered, q, &QQuickPopup::hide); + QObject::connect(menuItem, &QQuickMenuItem::triggered, q, &QQuickPopup::close); QObjectPrivate::connect(menuItem, &QQuickItem::activeFocusChanged, p, &QQuickMenuPrivate::onItemActiveFocusChanged); } } @@ -298,8 +298,8 @@ QQuickMenu::QQuickMenu(QObject *parent) : QQuickPopup(*(new QQuickMenuPrivate), parent) { Q_D(QQuickMenu); - connect(this, &QQuickMenu::pressedOutside, this, &QQuickMenu::hide); - connect(this, &QQuickMenu::releasedOutside, this, &QQuickMenu::hide); + connect(this, &QQuickMenu::pressedOutside, this, &QQuickMenu::close); + connect(this, &QQuickMenu::releasedOutside, this, &QQuickMenu::close); QObjectPrivate::connect(this, &QQuickMenu::contentItemChanged, d, &QQuickMenuPrivate::onContentItemChanged); } @@ -445,7 +445,7 @@ bool QQuickMenu::eventFilter(QObject *object, QEvent *event) QMetaObject::invokeMethod(d->contentItem, "incrementCurrentIndex"); return true; } else if (keyEvent->key() == Qt::Key_Escape) { - hide(); + close(); return true; } diff --git a/src/templates/qquickmenuitem.cpp b/src/templates/qquickmenuitem.cpp index 74a093f8..f6cfda4c 100644 --- a/src/templates/qquickmenuitem.cpp +++ b/src/templates/qquickmenuitem.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE Button { id: fileButton text: "File" - onClicked: menu.show() + onClicked: menu.open() } Menu { id: menu diff --git a/src/templates/qquickpopup.cpp b/src/templates/qquickpopup.cpp index 54ca6df2..f1d71ebf 100644 --- a/src/templates/qquickpopup.cpp +++ b/src/templates/qquickpopup.cpp @@ -132,11 +132,11 @@ QQuickPopup::~QQuickPopup() } /*! - \qmlmethod void Qt.labs.controls::Popup::show() + \qmlmethod void Qt.labs.controls::Popup::open() - Shows the popup. + Opens the popup. */ -void QQuickPopup::show() +void QQuickPopup::open() { Q_D(QQuickPopup); if (!d->contentItem) { @@ -145,7 +145,7 @@ void QQuickPopup::show() } if (d->overlay) { // FIXME qmlInfo needs to know about QQuickWindow and/or QObject - static_cast(qmlInfo(this) << "popup already showing in window") << d->overlay->window(); + static_cast(qmlInfo(this) << "popup already open in window") << d->overlay->window(); return; } @@ -163,7 +163,7 @@ void QQuickPopup::show() } } if (!win) { - qmlInfo(this) << "cannot find any window to show popup."; + qmlInfo(this) << "cannot find any window to open popup in."; return; } @@ -171,7 +171,7 @@ void QQuickPopup::show() d->overlay = static_cast(appWin->overlay()); d->contentItem->setParentItem(d->overlay); } else { - // FIXME Maybe try to show it somehow on that window + // FIXME Maybe try to open it in that window somehow qmlInfo(this) << "is not in an ApplicationWindow."; return; } @@ -182,17 +182,17 @@ void QQuickPopup::show() } /*! - \qmlmethod void Qt.labs.controls::Popup::hide() + \qmlmethod void Qt.labs.controls::Popup::close() - Hides the popup. + Closes the popup. */ -void QQuickPopup::hide() +void QQuickPopup::close() { Q_D(QQuickPopup); if (!d->overlay) { - // TODO This could mean we showed the popup item on a plain QQuickWindow - qmlInfo(this) << "trying to hide non-visible Popup."; + // TODO This could mean we opened the popup item in a plain QQuickWindow + qmlInfo(this) << "trying to close non-visible Popup."; return; } @@ -289,7 +289,7 @@ bool QQuickPopup::isVisible() const \qmlproperty Transition Qt.labs.controls::Popup::showTransition This property holds the transition that is applied to the content item - when the popup is shown. + when the popup is opened. */ QQuickTransition *QQuickPopup::showTransition() const { @@ -309,7 +309,7 @@ void QQuickPopup::setShowTransition(QQuickTransition *t) \qmlproperty Transition Qt.labs.controls::Popup::hideTransition This property holds the transition that is applied to the content item - when the popup is hidden. + when the popup is closed. */ QQuickTransition *QQuickPopup::hideTransition() const { diff --git a/src/templates/qquickpopup_p.h b/src/templates/qquickpopup_p.h index a2edbf6b..a7e402ec 100644 --- a/src/templates/qquickpopup_p.h +++ b/src/templates/qquickpopup_p.h @@ -65,7 +65,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickPopup : public QObject Q_PROPERTY(bool modal READ isModal WRITE setModal NOTIFY modalChanged) Q_PROPERTY(bool visible READ isVisible NOTIFY visibleChanged) Q_PROPERTY(QQuickTransition *showTransition READ showTransition WRITE setShowTransition NOTIFY showTransitionChanged FINAL) - Q_PROPERTY(QQuickTransition *hideTransition READ showTransition WRITE setHideTransition NOTIFY hideTransitionChanged FINAL) + Q_PROPERTY(QQuickTransition *hideTransition READ hideTransition WRITE setHideTransition NOTIFY hideTransitionChanged FINAL) public: explicit QQuickPopup(QObject *parent = Q_NULLPTR); @@ -105,8 +105,8 @@ Q_SIGNALS: public Q_SLOTS: - void show(); - void hide(); + void open(); + void close(); protected: QQuickPopup(QQuickPopupPrivate &dd, QObject *parent); -- cgit v1.2.3