void PdfViewer::showToolBarStylePopupMenu(const QPoint &pos) { QMenu *popupMenu = new QMenu(this); popupMenu->setAttribute(Qt::WA_DeleteOnClose); popupMenu->move(mapToGlobal(QPoint(0,0)) + pos); QWidgetAction *iconOnlyAction = new QWidgetAction(popupMenu); QRadioButton *iconOnlyRadio = new QRadioButton(tr("&Icons Only"), popupMenu); iconOnlyAction->setDefaultWidget(iconOnlyRadio); QWidgetAction *textOnlyAction = new QWidgetAction(popupMenu); QRadioButton *textOnlyRadio = new QRadioButton(tr("&Text Only"), popupMenu); textOnlyAction->setDefaultWidget(textOnlyRadio); QWidgetAction *textBesideIconAction = new QWidgetAction(popupMenu); QRadioButton *textBesideIconRadio = new QRadioButton(tr("Text &Alongside Icons"), popupMenu); textBesideIconAction->setDefaultWidget(textBesideIconRadio); QWidgetAction *textUnderIconAction = new QWidgetAction(popupMenu); QRadioButton *textUnderIconRadio = new QRadioButton(tr("Text &Under Icons"), popupMenu); textUnderIconAction->setDefaultWidget(textUnderIconRadio); QButtonGroup *popupButtonGroup = new QButtonGroup(popupMenu); popupButtonGroup->addButton(iconOnlyRadio); popupButtonGroup->addButton(textOnlyRadio); popupButtonGroup->addButton(textBesideIconRadio); popupButtonGroup->addButton(textUnderIconRadio); popupButtonGroup->setId(iconOnlyRadio, 0); popupButtonGroup->setId(textOnlyRadio, 1); popupButtonGroup->setId(textBesideIconRadio, 2); popupButtonGroup->setId(textUnderIconRadio, 3); connect(popupButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotChangeToolBarStyle(int))); popupMenu->addAction(iconOnlyAction); popupMenu->addAction(textOnlyAction); popupMenu->addAction(textBesideIconAction); popupMenu->addAction(textUnderIconAction); popupMenu->setContentsMargins(5, 0, 5, 0); QSettings settings; settings.beginGroup("MainWindow"); const int toolBarStyleNumber = settings.value("ToolBarStyle", 0).toInt(); switch (toolBarStyleNumber) { case 0: iconOnlyRadio->setChecked(true); break; case 1: textOnlyRadio->setChecked(true); break; case 2: textBesideIconRadio->setChecked(true); break; case 3: textUnderIconRadio->setChecked(true); break; } settings.endGroup(); popupMenu->show(); // make sure that the popupMenu stays completely inside the screen (must be done after popupMenu->show() in order to have the correct width) const int desktopWidth = QApplication::desktop()->availableGeometry(this).width(); if (popupMenu->x() + popupMenu->width() > desktopWidth) popupMenu->move(desktopWidth - popupMenu->width(), popupMenu->y()); }
void Frequencies::contextMenuRequest(QPoint pos) { QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); menu->addAction("Save PNG", this, SLOT(savePNG())); menu->popup(m_customPlot->mapToGlobal(pos)); }
void QtSE::itemsTabTreeContextMenu( QPoint point ) { std::cout << "lol" << std::endl; int index = itemsTab->tabBar()->tabAt( itemsTab->tabBar()->mapFromGlobal( QCursor::pos() ) ); if( index >= 0 ) { QMenu *menu = new QMenu(); menu->setAttribute( Qt::WA_DeleteOnClose , true ); /* if( itemsTab->tabText( index ) == "Project" ) { // } else */ if( itemsTab->tabText( index ) == "Filesystem" ) { menu->addAction( "Refresh" , this , SLOT(fsRefresh()) ); } else { delete menu; return; } menu->popup( QCursor::pos() , NULL ); } }
void QtSE::projectTreeContextMenu( QPoint point ) { CProjectTreeItem *item = (CProjectTreeItem*)projectTree->itemAt( point ); if( item ) { QMenu *menu = new QMenu(); menu->setAttribute( Qt::WA_DeleteOnClose , true ); switch( item->getPartType() ) { case CProjectTreeItem::stage: menu->addAction( "Add Stage" , this , SLOT(addStage()) ); break; case CProjectTreeItem::framebuffer: menu->addAction( "Add Framebuffer" , this , SLOT(addFramebuffer()) ); break; case CProjectTreeItem::shader: menu->addAction( "Add Shader" , this , SLOT(addShader()) ); break; case CProjectTreeItem::texture: menu->addAction( "Add Texture" , this , SLOT(addTexture()) ); break; case CProjectTreeItem::model: menu->addAction( "Add Model" , this , SLOT(addModel()) ); break; default: delete menu; return; } menu->popup( QCursor::pos() , NULL ); } }
void SongInfoTextView::contextMenuEvent(QContextMenuEvent* e) { QMenu* menu = createStandardContextMenu(e->pos()); menu->setAttribute(Qt::WA_DeleteOnClose); menu->addAction(tr("Change font size..."), this, SIGNAL(ShowSettingsDialog())); menu->popup(e->globalPos()); }
void FramePlaybackWindow::contextMenuFilters(QPoint pos) { QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); menu->addAction(tr("Save filter definition to file"), this, SLOT(saveFilters())); menu->addAction(tr("Load filter definition from file"), this, SLOT(loadFilters())); menu->popup(ui->listID->mapToGlobal(pos)); }
QMenu *EC_MediaPlayer::GetContextMenu() { QMenu *actionMenu = new QMenu(0); actionMenu->setAttribute(Qt::WA_DeleteOnClose, true); actionMenu->addAction(QIcon(":/images/playpause.png"), "Play/Pause", this, SLOT(PlayPauseToggle())); actionMenu->addAction(QIcon(":/images/stop.png"), "Stop", this, SLOT(Stop())); actionMenu->addAction("Show Player", this, SLOT(ShowPlayer())); return actionMenu; }
void Presupuesto_Widget::contextMenuRequestPresupuesto(QPoint pos) { QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); menu->addAction(QIcon(":/imagenes/Imagenes/add.png"),"Añadir registro", this, SLOT(on_addRegPresupuesto_clicked())); if(ui->tablePresupuesto->currentIndex().isValid()) menu->addAction(QIcon(":/imagenes/Imagenes/quit.png"),"Remover registro", this, SLOT(on_removeRegPresupuesto_clicked())); menu->popup(ui->tablePresupuesto->mapToGlobal(pos)); }
void qBicWin::contextPlot(QPoint pos) { QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); menu->addAction("Save heatmap", this, SLOT(saveHeat())); menu->popup(plot->mapToGlobal(pos)); }
void DBCSignalEditor::onCustomMenuValues(QPoint point) { QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); menu->addAction(tr("Delete currently selected value"), this, SLOT(deleteCurrentValue())); menu->popup(ui->valuesTable->mapToGlobal(point)); }
void FlowViewWindow::contextMenuRequestGraph(QPoint pos) { QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); menu->addAction(tr("Save image to file"), this, SLOT(saveFileGraph())); menu->popup(ui->graphView->mapToGlobal(pos)); }
void viewGVpropertieslayout::contextMenuRequest(QPoint pos) { // first get a pointer to the current plot! QCustomPlot * currPlot = (QCustomPlot *) currentSubWindow->widget(); QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); if (currPlot->legend->selectTest(pos, false) >= 0) // context menu on legend requested { /*menu->addAction("Move to top left", this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignLeft)); menu->addAction("Move to top center", this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignHCenter)); menu->addAction("Move to top right", this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignRight)); menu->addAction("Move to bottom right", this, SLOT(moveLegend()))->setData((int)(Qt::AlignBottom|Qt::AlignRight)); menu->addAction("Move to bottom left", this, SLOT(moveLegend()))->setData((int)(Qt::AlignBottom|Qt::AlignLeft));*/ } else if (currPlot->xAxis->selectTest(pos, false) >= 0 || \ currPlot->xAxis2->selectTest(pos, false) >= 0) { // enable / disable zoom if (currPlot->axisRect()->rangeZoom() & Qt::Horizontal) menu->addAction("Disable zoom on axis", this, SLOT(toggleHorizontalZoom())); else menu->addAction("Enable zoom on axis", this, SLOT(toggleHorizontalZoom())); // enable / diable drag if (currPlot->axisRect()->rangeDrag() & Qt::Horizontal) menu->addAction("Disable drag on axis", this, SLOT(toggleHorizontalDrag())); else menu->addAction("Enable drag on axis", this, SLOT(toggleHorizontalDrag())); } else if (currPlot->yAxis->selectTest(pos, false) >= 0 || \ currPlot->yAxis2->selectTest(pos, false) >= 0) { // enable / disable zoom if (currPlot->axisRect()->rangeZoom() & Qt::Vertical) menu->addAction("Disable zoom on axis", this, SLOT(toggleVerticalZoom())); else menu->addAction("Enable zoom on axis", this, SLOT(toggleVerticalZoom())); // enable / diable drag if (currPlot->axisRect()->rangeDrag() & Qt::Vertical) menu->addAction("Disable drag on axis", this, SLOT(toggleVerticalDrag())); else menu->addAction("Enable drag on axis", this, SLOT(toggleVerticalDrag())); } else { if (currPlot->graphCount() > 0) menu->addAction("Scale axes to fit", this, SLOT(rescaleAxes())); if (currPlot->selectedGraphs().size() > 0) menu->addAction("Remove selected graph", this, SLOT(removeSelectedGraph())); if (currPlot->graphCount() > 0) menu->addAction("Remove all graphs", this, SLOT(removeAllGraphs())); } menu->popup(currPlot->mapToGlobal(pos)); }
void DBCSignalEditor::onCustomMenuSignals(QPoint point) { QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); menu->addAction(tr("Add a new signal"), this, SLOT(addNewSignal())); menu->addAction(tr("Delete currently selected signal"), this, SLOT(deleteCurrentSignal())); menu->popup(ui->signalsList->mapToGlobal(point)); }
void KBookmarkMenu::slotCustomContextMenu(const QPoint &pos) { QAction *action = m_parentMenu->actionAt(pos); QMenu *menu = contextMenu(action); if (!menu) { return; } menu->setAttribute(Qt::WA_DeleteOnClose); menu->popup(m_parentMenu->mapToGlobal(pos)); }
void LocationBar::contextMenuEvent(QContextMenuEvent* event) { QMenu* menu = createContextMenu(); menu->setAttribute(Qt::WA_DeleteOnClose); // Prevent choosing first option with double rightclick QPoint pos = event->globalPos(); pos.setY(pos.y() + 1); menu->popup(pos); }
void VideosWindow::onContextMenuRequested(const QPoint &pos) { if (ui->objectList->currentIndex().data(UserRoleHeader).toBool()) return; QMenu *contextMenu = new KbMenu(this); contextMenu->setAttribute(Qt::WA_DeleteOnClose); contextMenu->addAction(tr("Delete"), this, SLOT(onDeleteClicked())); contextMenu->addAction(tr("Share"), this, SLOT(onShareClicked())); contextMenu->addAction(tr("Details"), this, SLOT(onDetailsClicked())); contextMenu->exec(this->mapToGlobal(pos)); }
void CustomPlotRegression::contextMenuRequest(QPoint pos) { // std::cout << "Right Click" << std::endl; QMenu *menu = new QMenu(m_CustomPlot); menu->setAttribute(Qt::WA_DeleteOnClose); menu->addAction("Add random graph", this, SLOT(addRandomGraph())); // if (m_CustomPlot->selectedGraphs().size() > 0) // menu->addAction("Remove selected graph", this, SLOT(removeSelectedGraph())); // if (m_CustomPlot->graphCount() > 0) // menu->addAction("Remove all graphs", this, SLOT(removeAllGraphs())); menu->popup(m_CustomPlot->mapToGlobal(pos)); }
void MainWindow::contextMenuRequest(QPoint pos) { if (ui->customPlot->legend->selectTest(pos, false) >= 0) // context menu on legend requested { QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); menu->addAction("Move to top left", this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignLeft)); menu->addAction("Move to top center", this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignHCenter)); menu->addAction("Move to top right", this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignRight)); menu->addAction("Move to bottom right", this, SLOT(moveLegend()))->setData((int)(Qt::AlignBottom|Qt::AlignRight)); menu->addAction("Move to bottom left", this, SLOT(moveLegend()))->setData((int)(Qt::AlignBottom|Qt::AlignLeft)); menu->popup(ui->customPlot->mapToGlobal(pos)); } }
void graphWidget::on_plotter_customContextMenuRequested(const QPoint &pos) { subfunction* selFunc = ui->transitionEditor->getSelectedFunc(); if(selFunc == NULL) return; QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); menu->addAction("Append Transition", ui->transitionEditor, SLOT(on_appendButton_released())); menu->addAction("Prepend Transition", ui->transitionEditor, SLOT(on_prependButton_released())); if(selFunc->parent->funcList.size() > 1) { menu->addAction("Remove Transition", ui->transitionEditor, SLOT(on_removeButton_released())); } menu->popup(ui->plotter->mapToGlobal(pos)); }
/*!\reimp */ void QLabel::contextMenuEvent(QContextMenuEvent *ev) { Q_D(QLabel); if (!d->isTextLabel) { ev->ignore(); return; } QMenu *menu = d->createStandardContextMenu(ev->pos()); if (!menu) { ev->ignore(); return; } ev->accept(); menu->setAttribute(Qt::WA_DeleteOnClose); menu->popup(ev->globalPos()); }
void LocationBar::contextMenuEvent(QContextMenuEvent* event) { if (!m_pasteAndGoAction) { m_pasteAndGoAction = new QAction(QIcon::fromTheme("edit-paste"), tr("Paste And &Go"), this); m_pasteAndGoAction->setShortcut(QKeySequence("Ctrl+Shift+V")); connect(m_pasteAndGoAction, SIGNAL(triggered()), this, SLOT(pasteAndGo())); } QMenu* menu = createContextMenu(m_pasteAndGoAction); menu->setAttribute(Qt::WA_DeleteOnClose); // Prevent choosing first option with double rightclick QPoint pos = event->globalPos(); pos.setY(pos.y() + 1); menu->popup(pos); }
void MainWindow::contextMenuRequest(QPoint pos) { QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); if (this->isPaused == true) { menu->addAction("Unpause", this, SLOT(unpause())); } else { menu->addAction("Pause", this, SLOT(pause())); } menu->addAction("Reset settings", this, SLOT(reset())); menu->addAction("Clear all graphs", this, SLOT(clear())); menu->addSeparator(); menu->addAction("Settings", this, SLOT(settings())); menu->popup(ui->plot->mapToGlobal(pos)); }
//----------------------------------------------------------------------------- void qtSqueezedLabel::contextMenuEvent(QContextMenuEvent* e) { if (this->contextMenuPolicy() == Qt::DefaultContextMenu) { QMenu* menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); QAction* action = menu->addAction("&Copy Full Text"); action->setEnabled(!this->fullText().isEmpty()); connect(action, SIGNAL(triggered()), this, SLOT(copy())); menu->popup(e->globalPos()); e->accept(); return; } QLabel::contextMenuEvent(e); }
/*!\reimp */ void QLabel::contextMenuEvent(QContextMenuEvent *ev) { #ifdef QT_NO_CONTEXTMENU Q_UNUSED(ev); #else Q_D(QLabel); if (!d->isTextLabel) { ev->ignore(); return; } QMenu *menu = d->createStandardContextMenu(ev->pos()); if (!menu) { ev->ignore(); return; } ev->accept(); menu->setAttribute(Qt::WA_DeleteOnClose); menu->popup(ev->globalPos()); #endif }
void LXQtTaskGroup::contextMenuEvent(QContextMenuEvent *event) { setPopupVisible(false, true); mPreventPopup = true; if (windowId()) { LXQtTaskButton::contextMenuEvent(event); return; } QMenu * menu = new QMenu(tr("Group")); menu->setAttribute(Qt::WA_DeleteOnClose); QAction *a = menu->addAction(XdgIcon::fromTheme("process-stop"), tr("Close group")); connect(a, SIGNAL(triggered()), this, SLOT(closeGroup())); connect(menu, &QMenu::aboutToHide, [this] { mPreventPopup = false; }); menu->setGeometry(mPlugin->panel()->calculatePopupWindowPos(mapToGlobal(event->pos()), menu->sizeHint())); mPlugin->willShowWindow(menu); menu->show(); }
void WebSearchBar::contextMenuEvent(QContextMenuEvent* event) { Q_UNUSED(event) QMenu* menu = createContextMenu(); menu->setAttribute(Qt::WA_DeleteOnClose); menu->addSeparator(); QAction* act = menu->addAction(tr("Show suggestions")); act->setCheckable(true); act->setChecked(qzSettings->showSearchSuggestions); connect(act, SIGNAL(triggered(bool)), this, SLOT(enableSearchSuggestions(bool))); QAction* instantSearch = menu->addAction(tr("Search when engine changed")); instantSearch->setCheckable(true); instantSearch->setChecked(qzSettings->searchOnEngineChange); connect(instantSearch, SIGNAL(triggered(bool)), this, SLOT(instantSearchChanged(bool))); // Prevent choosing first option with double rightclick QPoint pos = event->globalPos(); pos.setY(pos.y() + 1); menu->popup(pos); }
void AggregatorTab::handleFeedsContextMenuRequested (const QPoint& pos) { bool enable = Ui_.Feeds_->indexAt (pos).isValid (); const QList<QAction*> toToggle { ChannelActions_->ActionMarkChannelAsRead_, ChannelActions_->ActionMarkChannelAsUnread_, ChannelActions_->ActionRemoveFeed_, ChannelActions_->ActionChannelSettings_, ChannelActions_->ActionUpdateSelectedFeed_ }; for (const auto act : toToggle) act->setEnabled (enable); QMenu *menu = new QMenu; menu->setAttribute (Qt::WA_DeleteOnClose, true); menu->addActions (Ui_.Feeds_->actions ()); menu->exec (Ui_.Feeds_->viewport ()->mapToGlobal (pos)); for (const auto act : toToggle) act->setEnabled (true); }
void QtSE::fsProjectTreeContextMenu( QPoint point ) { activeProjectItem = (CProjectTreeItem*)fsProjectTree->itemAt( point ); if( activeProjectItem ) { QMenu *menu = new QMenu(); menu->setAttribute( Qt::WA_DeleteOnClose , true ); switch( activeProjectItem->getPartType() ) { case CProjectTreeItem::dir: { //activeFilePath.clear(); //activeProjectItem->getRelativePath( activeFilePath ); //activeFilePath.prepend( projectPath.getPath( true ) ); menu->addAction( "Add Folder" , this , SLOT(addFolder()) ); menu->addSeparator(); menu->addAction( "Add Stage" , this , SLOT(addStage()) ); menu->addAction( "Add Framebuffer" , this , SLOT(addFramebuffer()) ); menu->addAction( "Add Shader" , this , SLOT(addShader()) ); menu->addAction( "Add Model" , this , SLOT(addModel()) ); menu->addAction( "Add Texture" , this , SLOT(addTexture()) ); menu->addSeparator(); menu->addAction( "Delete Folder" , this , SLOT(deleteItem()) ); break; } default: delete menu; return; } menu->popup( QCursor::pos() , NULL ); } }
void Tray::onActivated() { QMenu * menu = new WindowMenu(&d->mNmModel); menu->setAttribute(Qt::WA_DeleteOnClose); menu->popup(QCursor::pos()); }
void LXQtTaskButton::contextMenuEvent(QContextMenuEvent* event) { if (event->modifiers().testFlag(Qt::ControlModifier)) { event->ignore(); return; } KWindowInfo info(mWindow, 0, NET::WM2AllowedActions); unsigned long state = KWindowInfo(mWindow, NET::WMState).state(); QMenu * menu = new QMenu(tr("Application")); menu->setAttribute(Qt::WA_DeleteOnClose); QAction* a; /* KDE menu ******* + To &Desktop > + &All Desktops + --- + &1 Desktop 1 + &2 Desktop 2 + &To Current Desktop &Move Re&size + Mi&nimize + Ma&ximize + &Shade Ad&vanced > Keep &Above Others Keep &Below Others Fill screen &Layer > Always on &top &Normal Always on &bottom --- + &Close */ /********** Desktop menu **********/ int deskNum = KWindowSystem::numberOfDesktops(); if (deskNum > 1) { int winDesk = KWindowInfo(mWindow, NET::WMDesktop).desktop(); QMenu* deskMenu = menu->addMenu(tr("To &Desktop")); a = deskMenu->addAction(tr("&All Desktops")); a->setData(NET::OnAllDesktops); a->setEnabled(winDesk != NET::OnAllDesktops); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveApplicationToDesktop())); deskMenu->addSeparator(); for (int i = 0; i < deskNum; ++i) { a = deskMenu->addAction(tr("Desktop &%1").arg(i + 1)); a->setData(i + 1); a->setEnabled(i + 1 != winDesk); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveApplicationToDesktop())); } int curDesk = KWindowSystem::currentDesktop(); a = menu->addAction(tr("&To Current Desktop")); a->setData(curDesk); a->setEnabled(curDesk != winDesk); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveApplicationToDesktop())); }