void QQuickMenuPopupWindow::setParentWindow(QQuickWindow *parentWindow) { if (transientParent() != parentWindow) setTransientParent(parentWindow); if (parentWindow) { connect(parentWindow, SIGNAL(destroyed()), this, SLOT(dismissPopup())); if (QQuickMenuPopupWindow *pw = qobject_cast<QQuickMenuPopupWindow *>(parentWindow)) connect(pw, SIGNAL(popupDismissed()), this, SLOT(dismissPopup())); } }
void QQuickPopupWindow::forwardEventToTransientParent(QMouseEvent *e) { if (!qobject_cast<QQuickPopupWindow*>(transientParent()) && ((m_mouseMoved && e->type() == QEvent::MouseButtonRelease) || e->type() == QEvent::MouseButtonPress)) { // Clicked outside any popup dismissPopup(); } else if (transientParent()) { QPoint parentPos = transientParent()->mapFromGlobal(mapToGlobal(e->pos())); QMouseEvent pe = QMouseEvent(e->type(), parentPos, e->button(), e->buttons(), e->modifiers()); QGuiApplication::sendEvent(transientParent(), &pe); } }
void QQuickPopupWindow::applicationStateChanged(Qt::ApplicationState state) { if (state != Qt::ApplicationActive) dismissPopup(); }
static void down_click_handler(ClickRecognizerRef recognizer, void *context) { text_layer_set_text(name_layer, "Neel"); text_layer_set_text(phone_layer, "Ready"); dismissPopup(); }
static void up_click_handler(ClickRecognizerRef recognizer, void *context) { text_layer_set_text(name_layer, "FETCHING CONTACT..."); send_cmd(); dismissPopup(); }