aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/qquickcombobox.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-27 17:27:39 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-28 09:29:25 +0000
commit39af88a8da473afe039201164a4c2a7980f7c2f9 (patch)
tree7457eca707ac31e0522bcaf1530ae0064742935b /src/templates/qquickcombobox.cpp
parentde74c0ee3eab435f2a95849216129ac8e7043972 (diff)
Replace Popup::pressed|releasedOutside with close policy flags
Change-Id: I3e09c4e2b6cbbe39bdf9e943905664e5dc1fe954 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/templates/qquickcombobox.cpp')
-rw-r--r--src/templates/qquickcombobox.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/templates/qquickcombobox.cpp b/src/templates/qquickcombobox.cpp
index 8a0028c4..f4cb17af 100644
--- a/src/templates/qquickcombobox.cpp
+++ b/src/templates/qquickcombobox.cpp
@@ -155,7 +155,7 @@ class QQuickComboBoxPrivate : public QQuickControlPrivate
public:
QQuickComboBoxPrivate() : pressed(false), ownModel(false), hasDisplayText(false),
- hideTimer(0), highlightedIndex(-1), currentIndex(-1), delegateModel(Q_NULLPTR),
+ highlightedIndex(-1), currentIndex(-1), delegateModel(Q_NULLPTR),
delegate(Q_NULLPTR), popup(Q_NULLPTR) { }
bool isPopupVisible() const;
@@ -163,7 +163,6 @@ public:
void hidePopup(bool accept);
void togglePopup(bool accept);
- void pressedOutside();
void itemClicked();
void initItem(int index, QObject *object);
@@ -178,7 +177,6 @@ public:
bool pressed;
bool ownModel;
bool hasDisplayText;
- int hideTimer;
int highlightedIndex;
int currentIndex;
QVariant model;
@@ -226,13 +224,6 @@ void QQuickComboBoxPrivate::togglePopup(bool accept)
showPopup();
}
-void QQuickComboBoxPrivate::pressedOutside()
-{
- Q_Q(QQuickComboBox);
- if (hideTimer <= 0)
- hideTimer = q->startTimer(0);
-}
-
void QQuickComboBoxPrivate::itemClicked()
{
Q_Q(QQuickComboBox);
@@ -619,7 +610,7 @@ void QQuickComboBox::setPopup(QQuickPopup *popup)
if (d->popup != popup) {
delete d->popup;
if (popup)
- QObjectPrivate::connect(popup, &QQuickPopup::pressedOutside, d, &QQuickComboBoxPrivate::pressedOutside);
+ popup->setClosePolicy(QQuickPopup::OnEscape | QQuickPopup::OnPressOutsideParent);
d->popup = popup;
emit popupChanged();
}
@@ -803,18 +794,6 @@ void QQuickComboBox::mouseUngrabEvent()
setPressed(false);
}
-void QQuickComboBox::timerEvent(QTimerEvent *event)
-{
- Q_D(QQuickComboBox);
- QQuickControl::timerEvent(event);
- if (event->timerId() == d->hideTimer) {
- killTimer(d->hideTimer);
- d->hideTimer = 0;
- if (!d->pressed)
- d->hidePopup(false);
- }
-}
-
void QQuickComboBox::componentComplete()
{
Q_D(QQuickComboBox);