void TextureViewer::init() { control=0; shaderName=0; setMenuBar(new QMenuBar); QMenu *fileMenu = menuBar()->addMenu(tr("&File")); //Open action QAction *openAct = new QAction( tr("&Open"), this ); openAct->setShortcuts(QKeySequence::Open); openAct->setStatusTip(tr("Open")); connect(openAct, SIGNAL(triggered()), this, SLOT(openFile())); QAction *createControlsAct = new QAction( tr("&Controls"), this ); createControlsAct->setStatusTip(tr("Create Controls")); connect(createControlsAct, SIGNAL(triggered()), this, SLOT(createControls())); //Quit action QAction *quitAct = new QAction( tr("&Quit"), this ); quitAct->setShortcuts(QKeySequence::Quit); quitAct->setStatusTip(tr("Quit")); connect(quitAct, SIGNAL(triggered()), this, SLOT(close())); fileMenu->addAction(openAct); fileMenu->addAction(createControlsAct); fileMenu->addAction(quitAct); }
QMenu *BrowserWindow::createFileMenu(TabWidget *tabWidget) { QMenu *fileMenu = new QMenu(tr("&File")); fileMenu->addAction(tr("&New Window"), this, &BrowserWindow::handleNewWindowTriggered, QKeySequence::New); QAction *newTabAction = new QAction(QIcon(QLatin1String(":addtab.png")), tr("New &Tab"), this); newTabAction->setShortcuts(QKeySequence::AddTab); newTabAction->setIconVisibleInMenu(false); connect(newTabAction, &QAction::triggered, tabWidget, &TabWidget::createTab); fileMenu->addAction(newTabAction); fileMenu->addAction(tr("&Open File..."), this, &BrowserWindow::handleFileOpenTriggered, QKeySequence::Open); fileMenu->addSeparator(); QAction *closeTabAction = new QAction(QIcon(QLatin1String(":closetab.png")), tr("&Close Tab"), this); closeTabAction->setShortcuts(QKeySequence::Close); closeTabAction->setIconVisibleInMenu(false); connect(closeTabAction, &QAction::triggered, [tabWidget]() { tabWidget->closeTab(tabWidget->currentIndex()); }); fileMenu->addAction(closeTabAction); QAction *closeAction = new QAction(tr("&Quit"),this); closeAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q)); connect(closeAction, &QAction::triggered, this, &QWidget::close); fileMenu->addAction(closeAction); connect(fileMenu, &QMenu::aboutToShow, [closeAction]() { if (Browser::instance().windows().count() == 1) closeAction->setText(tr("&Quit")); else closeAction->setText(tr("&Close Window")); }); return fileMenu; }
//MainWindow::MainWindow(QWidget *parent):QWidget(parent) MainWindow::MainWindow() { this->resize(640,480); QMenu *fileMenu = menuBar()->addMenu(tr("&File")); QAction *newFileAction = new QAction(tr("&New"),this); newFileAction->setShortcuts(QKeySequence::New); connect(newFileAction, SIGNAL(triggered()), this, SLOT(newFile())); fileMenu->addAction(newFileAction); QAction *openAction = new QAction(tr("&Open"),this); openAction->setShortcuts(QKeySequence::Open); // connect(newAct, SIGNAL(triggered()), this, SLOT(newFile())); connect(openAction, SIGNAL(triggered()), this, SLOT(open())); fileMenu->addAction(openAction); QAction *saveAsAction = new QAction(tr("&Save As..."),this); saveAsAction->setShortcuts(QKeySequence::SaveAs); connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs())); fileMenu->addAction(saveAsAction); // ShapeContainer *cont = new ShapeContainer(); // cont->addCircle(150,150,75,100,122,122); // cont->setSelected(true); // this->shapeContainers.push_back(cont); // this->setCurrentContainer(cont); }
MainWindow::MainWindow() { QMenu *fileMenu = new QMenu(tr("&File"), this); QAction *openAction = fileMenu->addAction(tr("&Open...")); openAction->setShortcuts(QKeySequence::Open); QAction *saveAction = fileMenu->addAction(tr("&Save As...")); saveAction->setShortcuts(QKeySequence::SaveAs); QAction *quitAction = fileMenu->addAction(tr("E&xit")); quitAction->setShortcuts(QKeySequence::Quit); setupModel(); setupViews(); connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile())); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); menuBar()->addMenu(fileMenu); statusBar(); openFile(":/Charts/qtdata.cht"); setWindowTitle(tr("Chart")); resize(870, 550); }
LevelEditorWindow::LevelEditorWindow() { //QHBoxLayout *mainLayout = new QHBoxLayout(); //setLayout( mainLayout ); /*DebugMenus::menu = new DebugMenus(); DebugMenus::menu->setVisible( false ); DebugMenus::inject( layout() );*/ handle = new LevelEditorHandle(); setCentralWidget( handle ); QMenu* fileMenu = menuBar()->addMenu("File"); QAction* action; fileMenu->addAction(action = new QAction("Load Wavefront (.obj) File", this)); action->setShortcut(QKeySequence::New); connect(action, SIGNAL(triggered()), this, SLOT(loadObj())); fileMenu->addAction(action = new QAction("Save Level Binary", this)); action->setShortcuts(QKeySequence::Save); connect(action, SIGNAL(triggered()), this, SLOT(saveNative())); fileMenu->addAction(action = new QAction("Save Level Binary File as..", this)); action->setShortcuts(QKeySequence::SaveAs); connect(action, SIGNAL(triggered()), this, SLOT(saveNativeAs())); fileMenu->addAction(action = new QAction("Load Level Binary", this)); action->setShortcuts(QKeySequence::Open); connect(action, SIGNAL(triggered()), this, SLOT(loadNative())); }
void MainWindow::createActions() { QMenu *fileMenu = menuBar()->addMenu(tr("&File")); QToolBar *fileToolBar = addToolBar(tr("File")); const QIcon newIcon = QIcon::fromTheme("document-new", QIcon(":/images/new.png")); QAction *newLetterAct = new QAction(newIcon, tr("&New Letter"), this); newLetterAct->setShortcuts(QKeySequence::New); newLetterAct->setStatusTip(tr("Create a new form letter")); connect(newLetterAct, &QAction::triggered, this, &MainWindow::newLetter); fileMenu->addAction(newLetterAct); fileToolBar->addAction(newLetterAct); const QIcon saveIcon = QIcon::fromTheme("document-save", QIcon(":/images/save.png")); QAction *saveAct = new QAction(saveIcon, tr("&Save..."), this); saveAct->setShortcuts(QKeySequence::Save); saveAct->setStatusTip(tr("Save the current form letter")); connect(saveAct, &QAction::triggered, this, &MainWindow::save); fileMenu->addAction(saveAct); fileToolBar->addAction(saveAct); const QIcon printIcon = QIcon::fromTheme("document-print", QIcon(":/images/print.png")); QAction *printAct = new QAction(printIcon, tr("&Print..."), this); printAct->setShortcuts(QKeySequence::Print); printAct->setStatusTip(tr("Print the current form letter")); connect(printAct, &QAction::triggered, this, &MainWindow::print); fileMenu->addAction(printAct); fileToolBar->addAction(printAct); fileMenu->addSeparator(); QAction *quitAct = fileMenu->addAction(tr("&Quit"), this, &QWidget::close); quitAct->setShortcuts(QKeySequence::Quit); quitAct->setStatusTip(tr("Quit the application")); QMenu *editMenu = menuBar()->addMenu(tr("&Edit")); QToolBar *editToolBar = addToolBar(tr("Edit")); const QIcon undoIcon = QIcon::fromTheme("edit-undo", QIcon(":/images/undo.png")); QAction *undoAct = new QAction(undoIcon, tr("&Undo"), this); undoAct->setShortcuts(QKeySequence::Undo); undoAct->setStatusTip(tr("Undo the last editing action")); connect(undoAct, &QAction::triggered, this, &MainWindow::undo); editMenu->addAction(undoAct); editToolBar->addAction(undoAct); viewMenu = menuBar()->addMenu(tr("&View")); menuBar()->addSeparator(); QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); QAction *aboutAct = helpMenu->addAction(tr("&About"), this, &MainWindow::about); aboutAct->setStatusTip(tr("Show the application's About box")); QAction *aboutQtAct = helpMenu->addAction(tr("About &Qt"), qApp, &QApplication::aboutQt); aboutQtAct->setStatusTip(tr("Show the Qt library's About box")); }
void Logger::init(QTreeWidget* o, QCheckBox* w, QPlainTextEdit* d) { m_cmlog.clear(); m_cmtxt.clear(); if (m_treeOut) m_treeOut->disconnect(this); if (m_textOut) m_textOut->disconnect(this); if (m_chkWrite) m_chkWrite->disconnect(this); m_treeOut = o; m_textOut = d; m_chkWrite = w; if (m_treeOut && m_textOut && m_chkWrite) { QList<QKeySequence> ks; ks << QKeySequence(Qt::CTRL + Qt::Key_D); QAction* copy = new QAction(tr("Copy"), this); copy->setShortcuts(QKeySequence::Copy); connect(copy, SIGNAL(triggered()), this, SLOT(copy())); QAction* clear = new QAction(tr("Clear"), this); clear->setShortcuts(ks); connect(clear, SIGNAL(triggered()), this, SIGNAL(clearLog())); QAction* all = new QAction(tr("Select All"), this); all->setShortcuts(QKeySequence::SelectAll); connect(all, SIGNAL(triggered()), m_textOut, SLOT(selectAll())); m_cmlog.addAction(copy); m_cmlog.addSeparator(); m_cmlog.addAction(clear); m_cmtxt.addAction(copy); m_cmtxt.addSeparator(); m_cmtxt.addAction(all); QPalette pal = m_textOut->palette(); pal.setBrush(QPalette::Base, m_treeOut->palette().brush(QPalette::Window)); m_textOut->setPalette(pal); m_treeOut->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_treeOut, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ctxmenu(const QPoint&))); connect(m_treeOut, SIGNAL(itemSelectionChanged()), this, SLOT(syncOutput())); m_textOut->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_textOut, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ctxmenu(const QPoint&))); }
void MainWindow::setupMenus() { QMenu *fileMenu = menuBar()->addMenu(tr("&File")); QAction *openAction = fileMenu->addAction(tr("&Open..."), this, &MainWindow::openImage); openAction->setShortcuts(QKeySequence::Open); QAction *exitAction = fileMenu->addAction(tr("E&xit"), qApp, &QCoreApplication::quit); exitAction->setShortcuts(QKeySequence::Quit); QMenu *gameMenu = menuBar()->addMenu(tr("&Game")); gameMenu->addAction(tr("&Restart"), this, &MainWindow::setupPuzzle); }
void QInputOutputDicomdirWidget::createContextMenuQStudyTreeWidget() { QAction *action; action = m_contextMenuQStudyTreeWidget.addAction(QIcon(":/images/view.png"), tr("&View"), this, SLOT(view())); action->setShortcuts(ShortcutManager::getShortcuts(Shortcuts::ViewSelectedStudies)); (void) new QShortcut(action->shortcut(), this, SLOT(view())); action = m_contextMenuQStudyTreeWidget.addAction(QIcon(":/images/retrieve.png"), tr("&Import"), this, SLOT(retrieveSelectedStudies())); action->setShortcuts(ShortcutManager::getShortcuts(Shortcuts::ImportToLocalDatabaseSelectedDICOMDIRStudies)); (void) new QShortcut(action->shortcut(), this, SLOT(retrieveSelectedStudies())); // Especifiquem que es el menu del dicomdir m_studyTreeWidget->setContextMenu(& m_contextMenuQStudyTreeWidget); }
void MainWindow::createMenuBar() { QAction *addAction = new QAction(tr("&Add album..."), this); QAction *deleteAction = new QAction(tr("&Delete album..."), this); QAction *quitAction = new QAction(tr("&Quit"), this); QAction *aboutAction = new QAction(tr("&About"), this); QAction *aboutQtAction = new QAction(tr("About &Qt"), this); addAction->setShortcut(tr("Ctrl+A")); deleteAction->setShortcut(tr("Ctrl+D")); quitAction->setShortcuts(QKeySequence::Quit); QMenu *fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(addAction); fileMenu->addAction(deleteAction); fileMenu->addSeparator(); fileMenu->addAction(quitAction); QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addAction(aboutAction); helpMenu->addAction(aboutQtAction); connect(addAction, SIGNAL(triggered(bool)), this, SLOT(addAlbum())); connect(deleteAction, SIGNAL(triggered(bool)), this, SLOT(deleteAlbum())); connect(quitAction, SIGNAL(triggered(bool)), this, SLOT(close())); connect(aboutAction, SIGNAL(triggered(bool)), this, SLOT(about())); connect(aboutQtAction, SIGNAL(triggered(bool)), qApp, SLOT(aboutQt())); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { QSettings settings ("binaervarianz.de", "FollowMe"); restoreGeometry(settings.value("geometry", saveGeometry()).toByteArray()); restoreState(settings.value("windowState", saveState()).toByteArray()); mfilelist= new FMFileList(parent); model = new QFileSystemModel; QString extPath = settings.value("extPath",QDir::homePath()).toString(); model->setRootPath(extPath ); list = new QTreeView(this); updateFileBrowser(extPath); setCentralWidget(list); QAction *prefAct = new QAction(tr("&Preferences..."), this); prefAct->setShortcuts(QKeySequence::Preferences); prefAct->setStatusTip(tr("Open preference pane")); connect(prefAct, SIGNAL(triggered()), this, SLOT(openPreferences())); QMenuBar* menu = menuBar(); QMenu* fileMenu = menu->addMenu(tr("&File")); fileMenu->addAction(prefAct); ui = new PreferenceDialog2(this); }
void PropertiesDialog::saveShortcuts() { QMap<QString, QAction*> actions = QTerminalApp::Instance()->getWindowList()[0]->leaseActions(); QList< QString > shortcutKeys = actions.keys(); int shortcutCount = shortcutKeys.count(); shortcutsWidget->setRowCount( shortcutCount ); for( int x=0; x < shortcutCount; x++ ) { QString keyValue = shortcutKeys.at(x); QAction *keyAction = actions[keyValue]; QTableWidgetItem *item = shortcutsWidget->item(x, 1); QKeySequence sequence = QKeySequence(item->text()); QString sequenceString = sequence.toString(); QList<QKeySequence> shortcuts; const auto sequences = item->text().split(QLatin1Char('|')); for (const QKeySequence& sequenceString : sequences) shortcuts.append(QKeySequence(sequenceString)); keyAction->setShortcuts(shortcuts); } Properties::Instance()->saveSettings(); }
void ActionsEditor::loadFromConfig(QObject *o, QSettings *set) { qDebug("ActionsEditor::loadFromConfig"); set->beginGroup("actions"); QAction *action; QString accelText; QList<QAction *> actions = o->findChildren<QAction *>(); for (int n=0; n < actions.count(); n++) { action = static_cast<QAction*> (actions[n]); if (!action->objectName().isEmpty() && !action->inherits("QWidgetAction")) { #if USE_MULTIPLE_SHORTCUTS QString current = shortcutsToString(action->shortcuts()); accelText = set->value(action->objectName(), current).toString(); action->setShortcuts( stringToShortcuts( accelText ) ); #else accelText = set->value(action->objectName(), action->shortcut().toString()).toString(); action->setShortcut(QKeySequence(accelText)); #endif } } set->endGroup(); }
MainWindow::MainWindow() { QAction *exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); QMenu *fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addSeparator(); fileMenu->addAction(exitAct); columnsMenu = menuBar()->addMenu(tr("&Columns")); connect(columnsMenu, SIGNAL(aboutToShow()), this, SLOT(showColumnsMenu())); model = new PeerDrive::FolderModel(this); connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(modelRowsInserted(QModelIndex,int,int))); connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelDataChanged(QModelIndex,QModelIndex))); connect(model, SIGNAL(modelReset()), this, SLOT(modelReset())); treeView = new QTreeView; treeView->setModel(model); treeView->sortByColumn(0, Qt::AscendingOrder); treeView->setSortingEnabled(true); connect(treeView, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex))); setCentralWidget(treeView); setWindowTitle(QObject::tr("Simple Tree Model")); setUnifiedTitleAndToolBarOnMac(true); }
QAction *KeySequence::widget(QWidget *widget, const QList<QKeySequence> &shortcuts, const QObject *receiver, const char *member) { QAction *act = KeySequence::action(widget, receiver, member); act->setShortcuts(shortcuts); return act; }
YaTabWidget::YaTabWidget(QWidget* parent) : QTabWidget(parent) { YaTabWidgetStyle* style = new YaTabWidgetStyle(qApp->style()); style->setParent(this); setStyle(style); YaTabBarBaseClass* tabBar = new YaTabBarBaseClass(this); connect(tabBar, SIGNAL(closeTab(int)), SIGNAL(closeTab(int))); connect(tabBar, SIGNAL(aboutToShow(int)), SLOT(aboutToShow(int))); connect(tabBar, SIGNAL(reorderTabs(int, int)), SIGNAL(reorderTabs(int, int))); setTabBar(tabBar); setTabPosition(South); QSignalMapper* activateTabMapper_ = new QSignalMapper(this); connect(activateTabMapper_, SIGNAL(mapped(int)), tabBar, SLOT(setCurrentIndex(int))); for (int i = 0; i < 10; ++i) { QAction* action = new QAction(this); connect(action, SIGNAL(triggered()), activateTabMapper_, SLOT(map())); action->setShortcuts(QList<QKeySequence>() << QKeySequence(QString("Ctrl+%1").arg(i)) << QKeySequence(QString("Alt+%1").arg(i))); activateTabMapper_->setMapping(action, (i > 0 ? i : 10) - 1); addAction(action); } }
void BAMseek::setupFileMenu(){ QMenu *fileMenu = new QMenu(tr("&File"), this); menuBar()->addMenu(fileMenu); QAction *openAction = fileMenu->addAction(tr("&Open...")); openAction->setShortcuts(QKeySequence::Open); connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); QAction *dockAction = fileMenu->addAction(tr("&Dock/Undock Header")); dockAction->setShortcuts(QKeySequence::AddTab); connect(dockAction, SIGNAL(triggered()), this, SLOT(dockHeader())); QAction *copyAction = fileMenu->addAction(tr("&Copy Selected Cells")); copyAction->setShortcuts(QKeySequence::Copy); connect(copyAction, SIGNAL(triggered()), this, SLOT(copyCells())); }
void DkPaintToolBar::createLayout() { QList<QKeySequence> enterSc; enterSc.append(QKeySequence(Qt::Key_Enter)); enterSc.append(QKeySequence(Qt::Key_Return)); QAction* applyAction = new QAction(icons[apply_icon], tr("Apply (ENTER)"), this); applyAction->setShortcuts(enterSc); applyAction->setObjectName("applyAction"); QAction* cancelAction = new QAction(icons[cancel_icon], tr("Cancel (ESC)"), this); cancelAction->setShortcut(QKeySequence(Qt::Key_Escape)); cancelAction->setObjectName("cancelAction"); panAction = new QAction(icons[pan_icon], tr("Pan"), this); panAction->setShortcut(QKeySequence(Qt::Key_P)); panAction->setObjectName("panAction"); panAction->setCheckable(true); panAction->setChecked(false); // pen color penCol = QColor(0,0,0); penColButton = new QPushButton(this); penColButton->setObjectName("penColButton"); penColButton->setStyleSheet("QPushButton {background-color: " + nmc::DkUtils::colorToString(penCol) + "; border: 1px solid #888;}"); penColButton->setToolTip(tr("Background Color")); penColButton->setStatusTip(penColButton->toolTip()); // undo Button undoAction = new QAction(icons[undo_icon], tr("Undo (CTRL+Z)"), this); undoAction->setShortcut(QKeySequence::Undo); undoAction->setObjectName("undoAction"); colorDialog = new QColorDialog(this); colorDialog->setObjectName("colorDialog"); // pen width widthBox = new QSpinBox(this); widthBox->setObjectName("widthBox"); widthBox->setSuffix("px"); widthBox->setMinimum(1); widthBox->setMaximum(500); // huge sizes since images might have high resolutions // pen alpha alphaBox = new QSpinBox(this); alphaBox->setObjectName("alphaBox"); alphaBox->setSuffix("%"); alphaBox->setMinimum(0); alphaBox->setMaximum(100); addAction(applyAction); addAction(cancelAction); addSeparator(); addAction(panAction); addAction(undoAction); addSeparator(); addWidget(widthBox); addWidget(penColButton); addWidget(alphaBox); }
void MainWindow::setupActions() { QAction *newGame = new QAction(this); newGame->setShortcut(Qt::CTRL + Qt::Key_N); connect(newGame, SIGNAL(triggered()), this, SLOT(startNewGame())); this->addAction(newGame); QAction *quitAction = new QAction(this); QList<QKeySequence> quitKeys; quitKeys.append(Qt::CTRL + Qt::Key_C); quitKeys.append(Qt::Key_MediaPrevious); quitAction->setShortcuts(quitKeys); connect(quitAction, SIGNAL(triggered()), this, SLOT(close())); this->addAction(quitAction); QAction *fireAction = new QAction(this); fireAction->setShortcut(Qt::Key_Space); connect(fireAction, SIGNAL(triggered()), this, SLOT(fire())); this->addAction(fireAction); pauseAction = new QAction(this); QList<QKeySequence> pauseKeys; pauseKeys.append(Qt::Key_Escape); pauseKeys.append(Qt::Key_Pause); pauseKeys.append(Qt::Key_MediaNext); pauseAction->setShortcuts(pauseKeys); connect(pauseAction, SIGNAL(triggered()), this, SLOT(toggleGamePaused())); this->addAction(pauseAction); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); // menubar incantation QMenu *fileMenu = new QMenu(tr("&File"), this); menuBar()->addMenu(fileMenu); QAction *quitAction = fileMenu->addAction(tr("E&xit")); quitAction->setShortcuts(QKeySequence::Quit); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); //probably a better way to place the widget, but i'm using a layout for now QGridLayout *layout = new QGridLayout; QTimer *timer = new QTimer(this); //build the animated eclipse object Animated_Points eclipse(0,(new Generated_Ellipse(0,100,0,100,500))->get_points(), 500, 5); layout->addWidget(&eclipse, 0,0); connect(timer,SIGNAL(timeout()),&eclipse,SLOT(nextAnimationFrame())); QAction *updateAction = fileMenu->addAction(tr("&Update")); connect(updateAction, SIGNAL(triggered()), &eclipse, SLOT(nextAnimationFrame())); timer->start(100); setLayout(layout); setWindowTitle(tr("AnimatedEllipses")); }
QAction *KeySequence::widget(QWidget *widget, QKeySequence::StandardKey standardkey, const QObject *receiver, const char *member) { QAction *act = KeySequence::action(widget, receiver, member); act->setShortcuts(standardkey); return act; }
MainWindow::MainWindow() : QWidget(0, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint) { QAction *quitAction = new QAction(tr("E&xit"), this); quitAction->setShortcuts(QKeySequence::Quit); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); QAction *configAction = new QAction(tr("&Select station..."), this); configAction->setShortcut(tr("Ctrl+C")); connect(configAction, SIGNAL(triggered()), this, SLOT(configure())); addAction(configAction); addAction(quitAction); setContextMenuPolicy(Qt::ActionsContextMenu); setWindowTitle(tr("Traffic Info Oslo")); const QSettings settings("Qt Traffic Info", "trafficinfo"); m_station = StationInformation(settings.value("stationId", "03012130").toString(), settings.value("stationName", "Nydalen [T-bane] (OSL)").toString()); m_lines = settings.value("lines", QStringList()).toStringList(); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(updateTimeInformation())); timer->start(1000*60*5); QMetaObject::invokeMethod(this, SLOT(updateTimeInformation()), Qt::QueuedConnection); }
void QInputOutputPacsWidget::createContextMenuQStudyTreeWidget() { QAction *action; action = m_contextMenuQStudyTreeWidget.addAction(QIcon(":/images/retrieveAndView.png"), tr("Retrieve && &View"), this, SLOT(retrieveAndViewSelectedItemsFromQStudyTreeWidget())); action->setShortcuts(ShortcutManager::getShortcuts(Shortcuts::RetrieveAndViewSelectedStudies)); (void) new QShortcut(action->shortcut(), this, SLOT(retrieveAndViewSelectedItemsFromQStudyTreeWidget())); action = m_contextMenuQStudyTreeWidget.addAction(QIcon(":/images/retrieve.png"), tr("&Retrieve"), this, SLOT(retrieveSelectedItemsFromQStudyTreeWidget())); action->setShortcuts(ShortcutManager::getShortcuts(Shortcuts::RetrieveSelectedStudies)); (void) new QShortcut(action->shortcut(), this, SLOT(retrieveSelectedItemsFromQStudyTreeWidget())); // Especifiquem que es el menu del dicomdir m_studyTreeWidget->setContextMenu(& m_contextMenuQStudyTreeWidget); }
int Action::setShortcuts(lua_State * L) // ( const QKeySequence shortcuts, QKeySequence shortcuts ... ) // table {QKeySequence shortcuts, QKeySequence shortcuts ...} // ( QKeySequence::StandardKey key ) { QAction* obj = QtObject<QAction>::check( L, 1); int size=0; if (lua_istable(L,2)) {QList<QKeySequence> res; int i=0; lua_pushnil(L); while (lua_next(L, 2) != 0) { QKeySequence* r = QtValue<QKeySequence>::check( L, -1); res.append(*r); i++; lua_pop(L, 1); } //int k=res.size(); obj->setShortcuts(res); } else if( QtValue<QKeySequence>::cast( L, 2 )) { size=Util::top(L)-1; QList<QKeySequence> res; //rect_array=new QRect[size]; for(int i = 2; i <= size+1; ++i) { QKeySequence* r = QtValue<QKeySequence>::check( L, i ); res.append(*r); //rect_array[i-2]=r->toRect(); } //int j=res.size(); obj->setShortcuts(res); }else if( Util::isNum(L, 2) ) { QKeySequence::StandardKey f; int fInt = Util::toInt( L, 2 ); if( (fInt >= 0 && fInt <= 60) ) { f = (QKeySequence::StandardKey) fInt; obj ->setShortcuts( f ); } } return 0; }
MainWindow::MainWindow( QWidget * parent ) : QWidget( parent ),m_ui( new Ui::MainWindow ),m_handle( nullptr ) { m_ui->setupUi( this ) ; this->setFixedSize( this->size() ) ; m_ui->lineEditKey->setEchoMode( QLineEdit::Password ) ; this->setWindowIcon( QIcon( ":/default.png" ) ) ; //m_ui->pbKeyFile->setIcon( QIcon( QString( ":/default.png" ) ) ); connect( m_ui->pbCancel,SIGNAL( clicked() ),this,SLOT( pbCancel() ) ) ; connect( m_ui->pbOpen,SIGNAL( clicked() ),this,SLOT( pbOpen() ) ) ; connect( m_ui->pbKeyFile,SIGNAL( clicked() ),this,SLOT( pbKeyFile() ) ) ; m_ui->lineEditKey->setFocus() ; m_working = false ; m_requireKey = false ; m_requireKeyFile = true ; QAction * ac = new QAction( this ) ; QList<QKeySequence> keys ; keys.append( Qt::Key_Enter ) ; keys.append( Qt::Key_Return ) ; ac->setShortcuts( keys ) ; connect( ac,SIGNAL( triggered() ),this,SLOT( defaultButton() ) ) ; this->addAction( ac ) ; m_findExecutable = []( QVector<QString>& exe ){ if( exe.isEmpty() ){ return QString() ; } QString e ; for( auto& it : exe ){ auto _not_found = [&]( const char * path ){ e = path + it ; bool r = QFile::exists( e ) ; if( r ){ it = e ; } return r == false ; } ; if( _not_found( "/usr/local/bin/" ) ){ if( _not_found( "/usr/bin/" ) ){ if( _not_found( "/usr/sbin/" ) ){ return it ; } } } } return QString() ; } ; }
void MainWindow::setupMenus() { QMenu *fileMenu = menuBar()->addMenu(tr("&File")); QAction *openAction = fileMenu->addAction(tr("&Open...")); openAction->setShortcuts(QKeySequence::Open); QAction *exitAction = fileMenu->addAction(tr("E&xit")); exitAction->setShortcuts(QKeySequence::Quit); QMenu *gameMenu = menuBar()->addMenu(tr("&Game")); QAction *restartAction = gameMenu->addAction(tr("&Restart")); connect(openAction, SIGNAL(triggered()), this, SLOT(openImage())); connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(restartAction, SIGNAL(triggered()), this, SLOT(setupPuzzle())); }
GalaGV::GalaGV(QWidget *parent) : QGraphicsView(parent),mSelectedItem(NULL),mCalcitem(NULL) { setScene(new QGraphicsScene()); setSceneRect(-620,-620,1240,1240); QAction *openAct = new QAction("plus", this); openAct->setShortcuts(QKeySequence::ZoomIn); connect(openAct, SIGNAL(triggered()), this, SLOT(plus())); addAction(openAct); QAction *a = new QAction("minus", this); a->setShortcuts(QKeySequence::ZoomOut); connect(a, SIGNAL(triggered()), this, SLOT(minus())); addAction(a); connect(scene(),SIGNAL(selectionChanged()),this,SLOT(onSelectionChanged())); connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(onContextMenuRequest(QPoint))); mData = new SceneData(this); }
void MainWindow::addCommand(QMenu* menu, QCommand* cmd ){ //item QAction* action = new QAction(cmd->getName(), this); action->setShortcuts(QKeySequence::New); action->setStatusTip(cmd->getDescription()); connect(action, SIGNAL(triggered()), this, SLOT(execCmd())); //ajoute au menu menu->addAction(action); }
Radio::Radio(Module &module) : once(false), net(NULL), qmp2Icon(QMPlay2Core.getQMPlay2Pixmap()), wlasneStacje(tr("Own radio stations")) { SetModule(module); setContextMenuPolicy(Qt::CustomContextMenu); popupMenu.addAction(tr("Remove the radio station"), this, SLOT(removeStation())); dw = new DockWidget; dw->setWindowTitle(tr("Internet radios")); dw->setObjectName(RadioName); dw->setWidget(this); lW = new QListWidget; connect(lW, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(openLink())); lW->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); lW->setResizeMode(QListView::Adjust); lW->setWrapping(true); lW->setIconSize(QSize(32, 32)); QAction *act = new QAction(lW); act->setShortcuts(QList<QKeySequence>() << QKeySequence("Return") << QKeySequence("Enter")); connect(act, SIGNAL(triggered()), this, SLOT(openLink())); act->setShortcutContext(Qt::WidgetWithChildrenShortcut); lW->addAction(act); infoL = new QLabel; progressB = new QProgressBar; QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(lW); layout->addWidget(infoL); layout->addWidget(progressB); progressB->hide(); connect(dw, SIGNAL(visibilityChanged(bool)), this, SLOT(visibilityChanged(bool))); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(popup(const QPoint &))); addGroup(wlasneStacje); nowaStacjaLWI = new QListWidgetItem("-- " + tr("Add new radio station") + " --", lW); nowaStacjaLWI->setData(Qt::TextAlignmentRole, Qt::AlignCenter); Settings sets("Radio"); foreach (const QString &entry, sets.get("Radia").toStringList()) { const QStringList nazwa_i_adres = entry.split('\n'); if (nazwa_i_adres.count() == 2) addStation(nazwa_i_adres[0], nazwa_i_adres[1], wlasneStacje); } }
void Html_Viewer::createActions() { // 1 QMenu *fileMenu = menuBar()->addMenu(tr("&File")); QAction *openAct = new QAction(tr("&Open..."), this); openAct->setShortcuts(QKeySequence::Open); openAct->setStatusTip(tr("Open an existing HTML file")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); fileMenu->addAction(openAct); QAction *openUrlAct = new QAction(tr("&Open URL..."), this); openUrlAct->setShortcut(tr("Ctrl+U")); openUrlAct->setStatusTip(tr("Open a URL")); connect(openUrlAct, SIGNAL(triggered()), this, SLOT(openUrl())); fileMenu->addAction(openUrlAct); QAction *saveAct = new QAction(tr("&Save"), this); saveAct->setShortcuts(QKeySequence::Save); saveAct->setStatusTip(tr("Save the HTML file to disk")); connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); fileMenu->addAction(saveAct); fileMenu->addSeparator(); QAction *exitAct = new QAction(tr("E&xit"), this); exitAct->setStatusTip(tr("Exit Viewer")); exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(actionClose())); fileMenu->addAction(exitAct); menuBar()->addSeparator(); // 2 QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); QAction *aboutAct = new QAction(tr("&About"), this); aboutAct->setStatusTip(tr("Show the About box")); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); helpMenu->addAction(aboutAct); }