void MusicLrcSearchTableWidget::contextMenuEvent(QContextMenuEvent *event) { MusicQueryTableWidget::contextMenuEvent(event); QMenu rightClickMenu(this); createContextMenu(rightClickMenu); rightClickMenu.exec(QCursor::pos()); }
void DragLabel::contextMenuEvent( QContextMenuEvent * event ) { event->accept(); //if(!parent()->inherits("DragSquare")) { //separated const QAction* selectedAction = rightClickMenu()->exec(event->globalPos()); Q_UNUSED(selectedAction); // if (selectedAction == m_openAct) { //} }
void MusicMyDownloadRecordWidget::contextMenuEvent(QContextMenuEvent *event) { MusicAbstractTableWidget::contextMenuEvent(event); QMenu rightClickMenu(this); rightClickMenu.setStyleSheet(MusicUIObject::MMenuStyle02); rightClickMenu.addAction(QIcon(":/contextMenu/play"), tr("musicPlay"), this, SLOT(musicPlay())); rightClickMenu.addAction(tr("openFileDir"), this, SLOT(musicOpenFileDir())); rightClickMenu.addSeparator(); rightClickMenu.addAction(QIcon(":/contextMenu/delete"), tr("delete"), this, SLOT(setDeleteItemAt())); rightClickMenu.addAction(tr("deleteAll"), this, SLOT(setDeleteItemAll())); rightClickMenu.exec(QCursor::pos()); event->accept(); }
void MusicSongsListWidget::contextMenuEvent(QContextMenuEvent *event) { QTableWidget::contextMenuEvent(event); QMenu rightClickMenu(this); QMenu musicPlaybackMode(tr("playbackMode"), &rightClickMenu); bool empty; emit isSearchFileListEmpty(empty); rightClickMenu.setStyleSheet(MusicUIObject::MMenuStyle02); rightClickMenu.addAction(tr("changSongName"), this, SLOT(setChangSongName()))->setEnabled(empty); rightClickMenu.addAction(QIcon(":/contextMenu/play"), tr("musicPlay"), this, SLOT(musicPlayClicked())); rightClickMenu.addMenu(&musicPlaybackMode); QAction *order = musicPlaybackMode.addAction(tr("OrderPlay"), this, SIGNAL(musicPlayOrder())); QAction *random = musicPlaybackMode.addAction(tr("RandomPlay"), this, SIGNAL(musicPlayRandom())); QAction *lCycle = musicPlaybackMode.addAction(tr("ListCycle"), this, SIGNAL(musicPlayListLoop())); QAction *sCycle = musicPlaybackMode.addAction(tr("SingleCycle"), this, SIGNAL(musicPlayOneLoop())); QAction *once = musicPlaybackMode.addAction(tr("PlayOnce"), this, SIGNAL(musicPlayItemOnce())); (m_songplaymode == MusicObject::MC_PlayOrder) ? order->setIcon(QIcon(":/share/selected")) : order->setIcon(QIcon()); (m_songplaymode == MusicObject::MC_PlayRandom) ? random->setIcon(QIcon(":/share/selected")) : random->setIcon(QIcon()); (m_songplaymode == MusicObject::MC_PlayListLoop) ? lCycle->setIcon(QIcon(":/share/selected")) : lCycle->setIcon(QIcon()); (m_songplaymode == MusicObject::MC_PlayOneLoop) ? sCycle->setIcon(QIcon(":/share/selected")) : sCycle->setIcon(QIcon()); (m_songplaymode == MusicObject::MC_PlayOnce) ? once->setIcon(QIcon(":/share/selected")) : once->setIcon(QIcon()); rightClickMenu.addSeparator(); rightClickMenu.addAction(QIcon(":/contextMenu/love"), tr("addToLove"), this, SLOT(addMusicSongToLovestListAt())); QMenu musicAddNewFiles(tr("addNewFiles"), &rightClickMenu); rightClickMenu.addMenu(&musicAddNewFiles)->setIcon(QIcon(":/contextMenu/add")); musicAddNewFiles.addAction(tr("openOnlyFiles"), this, SIGNAL(musicAddNewFiles())); musicAddNewFiles.addAction(tr("openOnlyDir"), this, SIGNAL(musicAddNewDir())); QMenu musicToolMenu(tr("musicTool"), &rightClickMenu); musicToolMenu.addAction(tr("bell"), this, SLOT(musicMakeRingWidget())) #ifdef Q_OS_UNIX ->setEnabled(false); #endif ; musicToolMenu.addAction(tr("transform"), this, SLOT(musicTransformWidget())); rightClickMenu.addMenu(&musicToolMenu); rightClickMenu.addAction(tr("musicInfoD"), this, SLOT(musicFileInformation()))->setEnabled(empty); rightClickMenu.addAction(tr("openFileDir"), this, SLOT(musicOpenFileDir()))->setEnabled(empty); rightClickMenu.addSeparator(); rightClickMenu.addAction(QIcon(":/contextMenu/delete"), tr("delete"), this, SLOT(setDeleteItemAt()))->setEnabled(empty); rightClickMenu.addAction(tr("deleteWithFile"), this, SLOT(setDeleteItemWithFile()))->setEnabled(empty); rightClickMenu.addAction(tr("deleteAll"), this, SLOT(setDeleteItemAll()))->setEnabled(empty); rightClickMenu.exec(QCursor::pos()); //Menu location for the current mouse position event->accept(); }
void MusicSongSearchOnlineTableWidget::contextMenuEvent(QContextMenuEvent *event) { MusicQueryTableWidget::contextMenuEvent(event); QMenu rightClickMenu(this); createContextMenu(rightClickMenu); QAction *playAction = rightClickMenu.addAction(QIcon(":/contextMenu/play"), tr("musicPlay")); QAction *addAction = rightClickMenu.addAction(tr("musicAdd")); rightClickMenu.insertAction(rightClickMenu.actions().first(), addAction); rightClickMenu.insertAction(addAction, playAction); m_actionGroup->addAction( playAction ); m_actionGroup->addAction( addAction ); rightClickMenu.exec(QCursor::pos()); }
void MusicLocalSongSearchEdit::contextMenuEvent(QContextMenuEvent *) { QMenu rightClickMenu(this); rightClickMenu.setStyleSheet(MusicUIObject::MMenuStyle02); QAction *shearM = rightClickMenu.addAction(tr("Shear"), this, SLOT(cut())); QAction *copyM = rightClickMenu.addAction(tr("Copy"), this, SLOT(copy())); rightClickMenu.addAction(tr("Paste"), this, SLOT(paste())); QAction *deleteM = rightClickMenu.addAction(tr("Delete"), this, SLOT(clear())); rightClickMenu.addSeparator(); QAction *selectM = rightClickMenu.addAction(tr("SelectAll"), this, SLOT(selectAll())); bool state = hasSelectedText(); shearM->setEnabled(state); copyM->setEnabled(state); deleteM->setEnabled(state); selectM->setEnabled(!text().trimmed().isEmpty()); rightClickMenu.exec(QCursor::pos()); }
MainWindow::MainWindow(QWidget *parent):QMainWindow(parent),ui(new Ui::MainWindow) { ui->setupUi(this); ui->label_GenerationTime->setText("Current Generation Time: 00:00:00"); ui->progressBar->setValue(0); ui->progressBar->setAlignment(Qt::AlignRight); ui->list_LevelSet->setContextMenuPolicy(Qt::CustomContextMenu); ui->lineEdit_GeneratorSeed->setValidator(new QIntValidator(0,999999999,this)); ui->lineEdit_GeneratorSeed->setText(0000000000); ui->spin_TimeLimit->setValue(1.00); connect(&Generator, SIGNAL(changeProgressBar(float)), this, SLOT(changeProgressBar(float))); connect(&Generator, SIGNAL(addToList(int)), this, SLOT(addToList(int))); connect(&Generator, SIGNAL(regenFinished(int)), this, SLOT(displayLevel(int))); connect(&Generator, SIGNAL(regenFinished(int)), this, SLOT(displayLevelGenTime(int))); connect(&thread, SIGNAL(finished()), this, SLOT(stopTimer())); connect(&timer, SIGNAL(timeout()), this, SLOT(updateTimer())); connect(&Generator, SIGNAL(resetGUI()), this, SLOT(resetGUI())); connect(ui->list_LevelSet, SIGNAL(currentRowChanged(int)), this, SLOT(displayLevel(int))); connect(ui->combo_RoomH, SIGNAL(currentTextChanged(QString)), this, SLOT(disable3by3(QString))); connect(ui->combo_RoomW, SIGNAL(currentTextChanged(QString)), this, SLOT(disable3by3(QString))); connect(ui->list_LevelSet, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(rightClickMenu(QPoint))); connect(&Generator, SIGNAL(displayGenSeed()), this, SLOT(displayGenSeed())); scene = new QGraphicsScene(this); ui->graphicsView->setScene(scene); Generator.setupForThread(thread); Generator.moveToThread(&thread); }