//nand window right-clicked void NandWindow::on_treeWidget_customContextMenuRequested( QPoint pos ) { QPoint globalPos = ui->treeWidget->viewport()->mapToGlobal( pos ); QTreeWidgetItem* item = ui->treeWidget->itemAt( pos ); if( !item )//right-clicked in the partition window, but not on an item { qDebug() << "no item selected"; return; } QMenu myMenu( this ); QAction extractA( tr( "Extract" ), &myMenu ); myMenu.addAction( &extractA ); QAction* s = myMenu.exec( globalPos ); //respond to what was selected if( s ) { // something was chosen, do stuff if( s == &extractA )//extract a file { QString path = QFileDialog::getExistingDirectory( this, tr("Select a destination") ); if( path.isEmpty() ) return; ui->progressBar->setVisible( true ); nThread.Extract( item, path ); } } }
int afficheMenu(char* dic[]) { switch (myMenu()) { case 1: printf("\nComparaison de 2 mots :\n\n"); wordIhm(); break; case 2: printf("Comparaison et tri\n\n"); sortMyArr(); case 3: printf("Rechercher un mot dans le dictionnaire\n\n"); compareWords(dic); break; case 4: printf("Ajouter un mot dans le dictionnaire\n\n"); addWord(dic); break; case 5: printf("Supprimer un mot\n\n"); removeWord(dic); break; case 6: printf("Trier un tableau\n\n"); sortAnArr(); case 7: printf("Quitter"); return 1; default: printf("Quitter"); return 1; } return 0; }
//<<<<<<<<<<<<<<<<<<<<<<<< main >>>>>>>>>>>>>>>>>>>>>> int main(int argc, char** argv) { // initialize the toolkit glutInit(&argc, argv); // set display mode glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); // set window size glutInitWindowSize(WIDTH, HEIGHT); // set window position on screen glutInitWindowPosition(100, 150); // open the screen window glutCreateWindow("Solar System - CP411 Final Assignment"); // register redraw function glutDisplayFunc(myDisplay); // Set up the callback function for resizing windows glutReshapeFunc(ResizeWindow); glutSpecialFunc(mySpecialKeyFunc); glutKeyboardFunc(myKeyboard); // set view port glViewport(0, 0, 2028, 1536); // Call myInit function myInit(); // Create Menu myMenu(); // Attach Menu glutAttachMenu(GLUT_RIGHT_BUTTON); // go into a perpetual loop glutMainLoop(); }
bool MdiChild::event ( QEvent * e ){ if(e->type() == QEvent::MouseButtonPress){ if( ((QMouseEvent*)e)->button() == Qt::RightButton){ QPoint globalPos = this->mapToGlobal(((QMouseEvent*)e)->pos()); QMenu myMenu(this); if(FaceObject->getLabel() == ""){ myMenu.addAction("add label"); QAction* selectedItem = myMenu.exec(globalPos); if(selectedItem->text() == "add label"){ int a = 5; } }else{ } } } if(e->type() == QEvent::MouseButtonDblClick){ QImage *img = new QImage ( FaceObject->getPath().c_str() ); // popupDisplay* popup = new popupDisplay(img); // popup->show(); // QFrame* frm = new QFrame(this,Qt::Popup|Qt::Window); // frm->setWindowState(Qt::WindowState::WindowFullScreen); // popupDisplay* popup = new popupDisplay(img); // popup->setParent(frm); // popup->show(); // frm->show(); } return QWidget::event(e); }