+}
+
+bool Popup::eventFilter(QObject *obj, QEvent *event)
+{
+ QKeyEvent *keyEvent;
+
+ (void)obj;
+
+ if (event->type() == QEvent::KeyPress) {
+ keyEvent = static_cast<QKeyEvent*>(event);
+ if (keyEvent->key() == Qt::Key_Enter ||
+ keyEvent->key() == Qt::Key_Return) {
+ close();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void Popup::show()
+{
+ QLineEdit* le;
+
+ QWidget::show();
+
+ // We want to close the popup when the Enter key was
+ // pressed and the first editable widget had focus.
+ if ((le = this->findChild<QLineEdit*>())) {