void UserInfoButton::showPopup() { if ( UserInfoPopup::instance() && UserInfoPopup::instance()->parent() != this ) destroyPopup(); if ( !UserInfoPopup::instance() ) UserInfoPopup::instantiate( status, this, Qt::Popup ); if ( UserInfoPopup::instance() ) { connect( UserInfoPopup::instance(), SIGNAL(closed()), this, SLOT(destroyPopup()) ); UserInfoPopup::instance()->move( QCursor::pos() ); UserInfoPopup::instance()->show(); } }
long GUISUMOAbstractView::onRightBtnPress(FXObject*, FXSelector , void* data) { destroyPopup(); myChanger->onRightBtnPress(data); grab(); return 1; }
long GUISUMOAbstractView::onLeftBtnPress(FXObject*, FXSelector , void* data) { destroyPopup(); setFocus(); FXEvent* e = (FXEvent*) data; // check whether the selection-mode is activated if ((e->state & CONTROLMASK) != 0) { // try to get the object-id if so if (makeCurrent()) { unsigned int id = getObjectUnderCursor(); if (id != 0) { gSelected.toggleSelection(id); } makeNonCurrent(); if (id != 0) { // possibly, the selection-colouring is used, // so we should update the screen again... update(); } } } myChanger->onLeftBtnPress(data); grab(); return 1; }
void QtFallbackWebPopup::show(const QWebSelectData& data) { if (!pageClient()) return; destroyPopup(); m_combo = new QtFallbackWebPopupCombo(*this); connect(m_combo, SIGNAL(activated(int)), SLOT(activeChanged(int)), Qt::QueuedConnection); populate(data); QRect rect = geometry(); #ifndef QT_NO_GRAPHICSVIEW if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) { QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget(webView); proxy->setWidget(m_combo); proxy->setGeometry(rect); } else { m_combo->setParent(pageClient()->ownerWidget()); m_combo->setGeometry(QRect(rect.left(), rect.top(), rect.width(), m_combo->sizeHint().height())); } #else m_combo->setParent(pageClient()->ownerWidget()); m_combo->setGeometry(QRect(rect.left(), rect.top(), rect.width(), m_combo->sizeHint().height())); #endif QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::sendEvent(m_combo, &event); }
/** * @brief Slot connected to MarblePopupHeader::disposeRenameMarkerSignal * @param p_marker_id */ void MarbleMap::disposeRenameMarkerSlot(int p_marker_id) { #ifdef DBG_MARBLE_MAP qDebug() << "MarbleMap::disposeRenameMarkerSlot(" << p_marker_id << ")"; #endif destroyPopup(); emit disposeRenameMarker(p_marker_id); }
/** * @brief Slot connected to MarblePopupItem::cancelAlbumEditSignal */ void MarbleMap::disposeAlbumEditSlot() { #ifdef DBG_MARBLE_MAP qDebug() << "MarbleMap::disposeAlbumEditSlot()"; #endif destroyPopup(); showPopup(m_current_marker); }
/** * @brief Slot connected to MarblePopupItem::editAlbumSignal * @param p_marker_id * @param p_album_id */ void MarbleMap::editAlbumSlot(int p_marker_id, int p_album_id) { #ifdef DBG_MARBLE_MAP qDebug() << "MarbleMap::editAlbumSlot(" << p_marker_id << "," << p_album_id << ")"; #endif destroyPopup(); showPopup(m_current_marker, EDIT_ALBUM, p_album_id); }
/** * @brief Slot connected to MarblePopupHeader::newAlbumSignal * @param p_marker_id */ void MarbleMap::newAlbumSlot(int p_marker_id) { #ifdef DBG_MARBLE_MAP qDebug() << "MarbleMap::newAlbumSlot(" << p_marker_id << ")"; #endif destroyPopup(); showPopup(m_current_marker, EDIT_NEW_ALBUM, m_current_marker->getAlbumsCount()); }
long GUISUMOAbstractView::onRightBtnRelease(FXObject*, FXSelector , void* data) { destroyPopup(); if (!myChanger->onRightBtnRelease(data) && !myApp->isGaming()) { openObjectDialog(); } ungrab(); return 1; }
long GUISUMOAbstractView::onLeftBtnRelease(FXObject*, FXSelector , void* data) { destroyPopup(); myChanger->onLeftBtnRelease(data); if (myApp->isGaming()) { onGamingClick(getPositionInformation()); } ungrab(); return 1; }
/** * @brief Slot connected to MarblePopupItem::saveAlbumEditSignal * @param p_marker_id * @param p_album_id * @param p_title * @param p_date * @param p_path * @param p_note */ void MarbleMap::saveAlbumEditSlot(int p_marker_id, int p_album_id, QString p_title, QString p_date, QString p_path, QString p_note) { #ifdef DBG_MARBLE_MAP qDebug() << "MarbleMap::saveAlbumEditSlot(" << p_marker_id << "," << p_album_id << ")"; #endif destroyPopup(); emit saveAlbumSignal(p_marker_id, p_album_id, p_title, p_date, p_path, p_note); }
/** * @brief Default deconstructor */ MarbleMap::~MarbleMap() { #ifdef DBG_MARBLE_MAP qDebug() << "MarbleMap::~MarbleMap()"; #endif if(m_current_marker) { delete m_current_marker; m_current_marker = NULL; } destroyPopup(); }
void QtFallbackWebPopup::show(const QWebSelectData& data) { if (!pageClient()) return; #if ENABLE(SYMBIAN_DIALOG_PROVIDERS) TRAP_IGNORE(showS60BrowserDialog()); #else destroyPopup(); m_combo = new QtFallbackWebPopupCombo(*this); connect(m_combo, SIGNAL(activated(int)), SLOT(activeChanged(int)), Qt::QueuedConnection); populate(data); QColor backgroundColor = data.backgroundColor(); QColor foregroundColor = data.foregroundColor(); QPalette palette = m_combo->palette(); if (backgroundColor.isValid()) palette.setColor(QPalette::Background, backgroundColor); if (foregroundColor.isValid()) palette.setColor(QPalette::Foreground, foregroundColor); m_combo->setPalette(palette); QRect rect = geometry(); if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) { QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget(webView); proxy->setWidget(m_combo); proxy->setGeometry(rect); } else { m_combo->setParent(pageClient()->ownerWidget()); m_combo->setGeometry(QRect(rect.left(), rect.top(), rect.width(), m_combo->sizeHint().height())); } QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::sendEvent(m_combo, &event); #endif }
/** * @brief Creates a popup with the contents of p_marker * @param p_marker * @note For each album in p_marker, a MarblePopupItem is created */ void MarbleMap::showPopup(Marker* p_marker, EDIT_TYPE p_edit, int p_album_to_edit_id) { #ifdef DBG_MARBLE_MAP qDebug() << "MarbleMap::showPopup() p_edit = " << p_edit << " p_album_to_edit_id = " << p_album_to_edit_id; #endif m_current_marker = p_marker; bool l_edit_marker = (p_edit == EDIT_MARKER ? true:false); bool l_edit_album = (p_edit == EDIT_ALBUM ? true:false); bool l_new_album = (p_edit == EDIT_NEW_ALBUM ? true:false); QMenu* l_menu = new QMenu(this); l_menu->setObjectName(g_popup_obj_name); l_menu->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); QVBoxLayout* l_layout = new QVBoxLayout(l_menu); l_layout->setContentsMargins(0, 0, 0, 0); l_layout->setSpacing(0); l_menu->setLayout(l_layout); MarblePopupHeader* l_header = new MarblePopupHeader(p_marker, l_menu, l_edit_marker, l_edit_album); l_layout->addWidget(l_header); connect(l_header, SIGNAL(newAlbumSignal(int)), this, SLOT(newAlbumSlot(int))); connect(l_header, SIGNAL(deleteMarkerSignal(int)), this, SLOT(deleteMarkerSlot(int))); connect(l_header, SIGNAL(beginRenameMarkerSignal(int)), this, SLOT(renameMarkerSlot(int))); connect(l_header, SIGNAL(saveRenameMarkerSignal(int, QString)), this, SLOT(saveRenamedMarkerSlot(int, QString))); connect(l_header, SIGNAL(disposeRenameMarkerSignal(int)), this, SLOT(disposeRenameMarkerSlot(int))); int l_max_w = 0; // need width and height to re-position popup if outside of the screen ** int l_tot_h = l_header->height(); QList<Marker::S_Album*> l_albums = p_marker->getAlbums(); int l_s = l_albums.size(); MarblePopupItem* l_item = NULL; for(int i = 0; i < l_s; i++) { if(i == p_album_to_edit_id) { l_item = new MarblePopupItem(l_albums.at(i), p_marker, l_menu, true); } else { l_item = new MarblePopupItem(l_albums.at(i), p_marker, l_menu, false); } connect(l_item, SIGNAL(editAlbumSignal(int, int)), this, SLOT(editAlbumSlot(int,int))); connect(l_item, SIGNAL(deleteAlbumSignal(int, int)), this, SLOT(deleteAlbumSlot(int,int))); connect(l_item, SIGNAL(cancelAlbumEditSignal()), this, SLOT(disposeAlbumEditSlot())); connect(l_item, SIGNAL(saveAlbumEditSignal(int, int, QString, QString, QString, QString)), this, SLOT(saveAlbumEditSlot(int, int, QString, QString, QString, QString))); if(l_max_w < l_item->width()) // ** { l_max_w = l_item->width(); } l_tot_h += l_item->height(); // if((i == l_s -1) && (false == l_edit_album)) // { // l_item->hideSeparator(); // } l_layout->addWidget(l_item); } if(l_new_album) { #ifdef DBG_MARBLE_MAP qDebug() << "MarbleMap::showPopup() l_new_album = " << l_new_album << " l_edit_album = " << l_edit_album; #endif if(-1 == p_album_to_edit_id) { l_item = new MarblePopupItem(NULL, p_marker, l_menu, l_new_album); } else { l_item = new MarblePopupItem(p_marker->getAlbumById(p_album_to_edit_id), p_marker, l_menu, l_new_album); } connect(l_item, SIGNAL(editAlbumSignal(int, int)), this, SLOT(editAlbumSlot(int,int))); connect(l_item, SIGNAL(deleteAlbumSignal(int, int)), this, SLOT(deleteAlbumSlot(int,int))); connect(l_item, SIGNAL(cancelAlbumEditSignal()), this, SLOT(disposeAlbumEditSlot())); connect(l_item, SIGNAL(saveAlbumEditSignal(int, int, QString, QString, QString, QString)), this, SLOT(saveAlbumEditSlot(int, int, QString, QString, QString, QString))); l_layout->addWidget(l_item); } QPoint l_pos = mapToGlobal(QPoint(m_curr_popup_x, m_curr_popup_y)); #if 0 int l_right_corner = l_pos.x() + l_max_w; int l_bottom_corner = l_pos.y() + l_tot_h; int l_screen_w = QApplication::desktop()->width(); int l_screen_h = QApplication::desktop()->height(); qDebug() << "l_max_w = " << l_max_w << " l_right_corner " << l_right_corner << " > " << l_screen_w; if(l_right_corner > l_screen_w) { int l_new_x = l_right_corner - 2.3*l_max_w; qDebug() << "l_right_corner " << l_right_corner << " new x " << l_new_x; l_pos.setX(l_new_x); } qDebug() << "l_tot_h = " << l_tot_h << " l_bottom_corner " << l_bottom_corner << " > " << l_screen_h; if(l_bottom_corner > l_screen_h) { int l_new_y = l_bottom_corner - 1.8*l_tot_h; qDebug() << "l_bottom_corner " << l_bottom_corner << " new y " << l_new_y; l_pos.setY(l_new_y); } #endif l_menu->exec(l_pos); destroyPopup(); }
QtFallbackWebPopup::~QtFallbackWebPopup() { destroyPopup(); }