void TitleWidget::initAction() { m_menu = new QMenu(this); m_menu->setObjectName("MainMenu"); QAction *searchAction = new QAction("搜索", m_menu); searchAction->setIcon(QIcon(":/menu_icon/search")); searchAction->setShortcut(tr("Ctrl+S")); searchAction->setStatusTip("搜索单曲,歌单..."); connect(searchAction, SIGNAL(triggered()), this, SIGNAL(search())); QAction *logOutAction = new QAction("注销", m_menu); logOutAction->setIcon(QIcon(":/menu_icon/logout")); logOutAction->setShortcut(tr("Ctrl+E")); logOutAction->setStatusTip("退出登录..."); connect(logOutAction, SIGNAL(triggered()), this, SIGNAL(logOut())); allLoopAction = new QAction("列表循环", m_menu); //allLoopAction->setIcon(QIcon(":/menu_icon/list_loop")); allLoopAction->setShortcut(tr("Ctrl+A")); allLoopAction->setCheckable(true); allLoopAction->setChecked(true); allLoopAction->setStatusTip("列表循环播放歌曲..."); connect(allLoopAction, SIGNAL(triggered()), this, SLOT(setAllLoopChecked())); oneLoopAction = new QAction("单曲循环", m_menu); //oneLoopAction->setIcon(QIcon(":/menu_icon/one_loop")); oneLoopAction->setShortcut(tr("Ctrl+O")); oneLoopAction->setCheckable(true); oneLoopAction->setChecked(false); oneLoopAction->setStatusTip("单曲循环播放歌曲..."); connect(oneLoopAction, SIGNAL(triggered()), this, SLOT(setOneLoopChecked())); randomLoopAction = new QAction("随机循环", m_menu); //randomLoopAction->setIcon(QIcon(":/menu_icon/random_loop")); randomLoopAction->setCheckable(true); randomLoopAction->setChecked(false); randomLoopAction->setShortcut(tr("Ctrl+R")); randomLoopAction->setStatusTip("随机循环播放歌曲..."); connect(randomLoopAction, SIGNAL(triggered()), this, SLOT(setRandomLoopChecked())); QAction *exitAction = new QAction("退出软件", m_menu); exitAction->setIcon(QIcon(":/menu_icon/exit")); exitAction->setShortcut(tr("Ctrl+Q")); connect(exitAction, SIGNAL(triggered()), this, SIGNAL(exitWidget())); m_menu->addAction(searchAction); m_menu->addSeparator(); m_menu->addAction(oneLoopAction); m_menu->addAction(allLoopAction); m_menu->addAction(randomLoopAction); m_menu->addSeparator(); m_menu->addAction(logOutAction); m_menu->addSeparator(); m_menu->addAction(exitAction); m_menu->adjustSize(); m_menu->setVisible(false); }
QAction* RS_ActionOrder::createGUIAction(RS2::ActionType type, QObject* /*parent*/) { QAction* action; switch (type) { case RS2::ActionOrderBottom: action = new QAction(tr("move to bottom"), NULL); action->setIcon(QIcon(":/extui/order_bottom.png")); action->setStatusTip(tr("set to bottom")); break; case RS2::ActionOrderLower: action = new QAction(tr("lower after entity"), NULL); action->setIcon(QIcon(":/extui/order_lower.png")); action->setStatusTip(tr("lower over entity")); break; case RS2::ActionOrderRaise: action = new QAction(tr("raise over entity"), NULL); action->setIcon(QIcon(":/extui/order_raise.png")); action->setStatusTip(tr("raise over entity")); break; // case RS2::ActionOrderTop: default: action = new QAction(tr("move to top"), NULL); action->setIcon(QIcon(":/extui/order_top.png")); action->setStatusTip(tr("set to top")); break; } return action; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QAction *openAction = new QAction(tr("打开文件"),this); openAction->setStatusTip(tr("open file")); QAction *saveAction = new QAction(tr("保存文件"),this); saveAction->setStatusTip(tr("save file")); QMenu *file = menuBar()->addMenu(tr("选择")); file->addAction(openAction); file->addAction(saveAction); QToolBar *toolbar =addToolBar(tr("工具栏")); toolbar->addAction(openAction); toolbar->addAction(saveAction); textedit = new QTextEdit(this); setCentralWidget(textedit);//可以在中间显示textedit connect(openAction,&QAction::triggered,this,&MainWindow::openFile);//点击事件是triggered connect(saveAction,&QAction::triggered,this,&MainWindow::saveFile); }
bool AMAppController::startupInstallActions() { if(AMDatamanAppControllerForActions3::startupInstallActions()) { QAction *changeRunAction = new QAction("Change Run...", mw_); changeRunAction->setStatusTip("Change the current run, or create a new one"); connect(changeRunAction, SIGNAL(triggered()), this, SLOT(showChooseRunDialog())); QAction *openScanActionsViewAction = new QAction("See Scan Actions...", mw_); openScanActionsViewAction->setStatusTip("Open the view to see all actions done by scans"); connect(openScanActionsViewAction, SIGNAL(triggered()), this, SLOT(showScanActionsView())); QAction *automaticLaunchScanEditorAction = new QAction("Launch New Scans in Editors", mw_); automaticLaunchScanEditorAction->setStatusTip("Launch all new scans in an new scan editor to view them"); automaticLaunchScanEditorAction->setCheckable(true); automaticLaunchScanEditorAction->setChecked(true); connect(automaticLaunchScanEditorAction, SIGNAL(toggled(bool)), this, SLOT(onActionAutomaticLaunchScanEditorToggled(bool))); fileMenu_->addSeparator(); fileMenu_->addAction(changeRunAction); viewMenu_->addAction(openScanActionsViewAction); viewMenu_->addAction(automaticLaunchScanEditorAction); return true; } else return false;
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); }
/////////////////////////////////////////////////////////// // // // File Menu // // // /////////////////////////////////////////////////////////// void WinImage::setupFileMenu() { // Actions QAction* open = new QAction( "&Open", this ); open->setShortcut( Qt::CTRL + Qt::Key_O ); open->setStatusTip( "This will open a file"); connect( open, SIGNAL( triggered() ), this, SLOT( slotOpen() ) ); //QAction* save = new QAction( "&Save", this ); //connect( save, SIGNAL( triggered() ), this, SLOT( save() ) ); QAction* saveAs = new QAction( "Save &As", this ); saveAs->setShortcut( Qt::CTRL + Qt::Key_A ); connect( saveAs, SIGNAL( triggered() ), this, SLOT( slotSaveAs() ) ); QAction* quit = new QAction( "&Quit", this ); quit->setShortcut( Qt::CTRL + Qt::Key_Q ); quit->setStatusTip("This will quit the application unconditionally"); quit->setWhatsThis("This is a button, stupid!"); connect( quit, SIGNAL( triggered() ), qApp, SLOT( quit() ) ); // Menubarvoid Test::paintEvent( QPaintEvent* ) QMenu* file = new QMenu( "&File", menuBar()); menuBar()->addMenu( file); file->addAction( open); //file->addAction( save); file->addAction( saveAs); file->addAction( quit); }
void MainWindow::createHelpMenu() { // Help menu QAction* manualAct = new QAction(QIcon(QString::fromLatin1(":/images/help.png")), tr("Open &Manual"), this); manualAct->setStatusTip(tr("Show the help file for this application")); manualAct->setShortcut(QKeySequence::HelpContents); connect(manualAct, &QAction::triggered, this, &MainWindow::showHelp); QAction* aboutAct = new QAction(tr("&About %1").arg(appName()), this); aboutAct->setStatusTip(tr("Show information about this application")); aboutAct->setMenuRole(QAction::AboutRole); connect(aboutAct, &QAction::triggered, this, &MainWindow::showAbout); QAction* aboutQtAct = new QAction(tr("About &Qt"), this); aboutQtAct->setStatusTip(tr("Show information about Qt")); aboutQtAct->setMenuRole(QAction::AboutQtRole); connect(aboutQtAct, &QAction::triggered, qApp, QApplication::aboutQt); if (show_menu) { QMenu* helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addAction(manualAct); helpMenu->addAction(QWhatsThis::createAction(this)); helpMenu->addSeparator(); helpMenu->addAction(aboutAct); helpMenu->addAction(aboutQtAct); } }
void lcTimelineWidget::CustomMenuRequested(QPoint Pos) { QMenu* Menu = new QMenu(this); QTreeWidgetItem* TreeItem = itemAt(Pos); lcObject* FocusObject = lcGetActiveModel()->GetFocusObject(); if (FocusObject && FocusObject->IsPiece()) { lcPiece* Piece = (lcPiece*)FocusObject; if (Piece->mPieceInfo->IsModel()) { Menu->addAction(gMainWindow->mActions[LC_MODEL_EDIT_FOCUS]); Menu->addSeparator(); } } // look for step headings if (TreeItem && TreeItem->data(0, Qt::UserRole).isNull()) { { QAction* Action = new QAction(tr("Move selection here"), this); Action->setStatusTip(tr("Move the selected parts into this step")); Action->setData(qVariantFromValue((void *) TreeItem)); Action->setEnabled(selectedItems().count() != 0); connect(Action, SIGNAL(triggered()), this, SLOT(MoveSelectionTo())); Menu->addAction(Action); } { QAction* Action = new QAction(tr("Set as current step"), this); Action->setStatusTip(tr("View the model at this point in the timeline")); Action->setData(qVariantFromValue((void *) TreeItem)); connect(Action, SIGNAL(triggered()), this, SLOT(UpdateCurrentStep())); Menu->addAction(Action); } Menu->addSeparator(); } QAction* InsertStepAction = Menu->addAction(gMainWindow->mActions[LC_VIEW_TIME_INSERT]->text(), this, SLOT(InsertStep())); InsertStepAction->setStatusTip(gMainWindow->mActions[LC_VIEW_TIME_INSERT]->statusTip()); QAction* RemoveStepAction = Menu->addAction(gMainWindow->mActions[LC_VIEW_TIME_DELETE]->text(), this, SLOT(RemoveStep())); RemoveStepAction->setStatusTip(gMainWindow->mActions[LC_VIEW_TIME_DELETE]->statusTip()); Menu->addSeparator(); Menu->addAction(gMainWindow->mActions[LC_PIECE_HIDE_SELECTED]); Menu->addAction(gMainWindow->mActions[LC_PIECE_HIDE_UNSELECTED]); Menu->addAction(gMainWindow->mActions[LC_PIECE_UNHIDE_SELECTED]); Menu->addAction(gMainWindow->mActions[LC_PIECE_UNHIDE_ALL]); Menu->popup(viewport()->mapToGlobal(Pos)); }
AboutUIComponent::AboutUIComponent(Corrade::PluginManager::AbstractPluginManager* manager, const std::string& plugin): AbstractUIComponent(manager, plugin) { /* About */ QAction* aboutAction = new QAction(QIcon(":/logo-16.png"), tr("About Kompas"), this); aboutAction->setStatusTip(tr("Show information about this application")); connect(aboutAction, SIGNAL(triggered(bool)), SLOT(aboutDialog())); _actions << aboutAction; /* About Qt */ QAction* aboutQtAction = new QAction(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png"), tr("About Qt"), this); aboutQtAction->setStatusTip(tr("Show information about Qt")); connect(aboutQtAction, SIGNAL(triggered(bool)), qApp, SLOT(aboutQt())); _actions << aboutQtAction; }
Interface::Interface(): QMainWindow() { setAttribute(Qt::WA_AcceptTouchEvents); QString dataPath("/sdcard/polar/data/"); QString dir = dataPath + "icons/"; // Create a Viewer with shadows management viewer = new PoLAR::Viewer(this, "viewer", 0, true); //viewer->setShadowsOn(); setCentralWidget(viewer); toolbar = new QToolBar(this); addToolBar(Qt::LeftToolBarArea, toolbar); toolbar->setOrientation(Qt::Vertical); toolbar->setAttribute(Qt::WA_AcceptTouchEvents); toolbar->setIconSize(QSize(128,128)); qApp->setAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents, true); QAction *editImgAct = new QAction(QIcon(dir+"img.png"), tr("Edit image"), this); editImgAct->setStatusTip(tr("Edit Image")); QObject::connect(editImgAct, SIGNAL(triggered()), viewer, SLOT(startEditImageSlot())); //QObject::connect(editImgAct, SIGNAL(triggered()), this, SLOT(editImg())); toolbar->addAction(editImgAct); QAction *sceneManipAct = new QAction(QIcon(dir+"scene.png"), tr("Manipulate Scene"), this); sceneManipAct->setStatusTip(tr("Manipulate Scene")); QObject::connect(sceneManipAct, SIGNAL(triggered()), viewer, SLOT(startManipulateSceneSlot())); //QObject::connect(sceneManipAct, SIGNAL(triggered()), this, SLOT(sceneManip())); toolbar->addAction(sceneManipAct); toolbar->addAction(QIcon(dir+"edit.png"), QString("Edit Markers"), this, SLOT(newSpline())); toolbar->addAction(QIcon(dir+"exit.png"), QString("Remove Markers"), this, SLOT(deleteMarker())); toolbar->addAction(QIcon(dir+"valid.png"), QString("Calculate matrix"), this, SLOT(computeMatrix())); toolbar->addAction(QIcon(dir+"log.png"), QString("Print info"), this, SLOT(debugInfo())); for(auto it : toolbar->children()) { if(QWidget* w = dynamic_cast<QWidget*>(it)) { w->setAttribute(Qt::WA_AcceptTouchEvents); } } // add focus to this interface in order to get the keyboard events this->setFocusPolicy(Qt::StrongFocus); // remove the focus from the Viewer, otherwise it will bypass the interface's events viewer->setFocusPolicy(Qt::NoFocus); viewer->startEditImageSlot(); }
void ArbitrationWidget::populateResultsMenu(QMenu &iMenu, const QPoint &iPoint) { const QModelIndex &index = treeViewResults->indexAt(iPoint); if (!index.isValid()) return; const Move &move = getSelectedMove(); // Action to display the word definition const QModelIndex &wordIndex = m_resultsModel->index(index.row(), 0); QString selectedWord = m_resultsModel->data(wordIndex).toString(); QAction *showDefAction = m_resultsPopup->getShowDefinitionEntry(selectedWord); iMenu.addAction(showDefAction); if (!move.isValid()) showDefAction->setEnabled(false); // Action to select as master move QAction *setAsMasterAction = new QAction(_q("Use as master move"), this); setAsMasterAction->setStatusTip(_q("Use the selected move (%1) as master move") .arg(formatMove(move))); setAsMasterAction->setShortcut(Qt::SHIFT + Qt::Key_M); QObject::connect(setAsMasterAction, SIGNAL(triggered()), m_assignmentsWidget, SLOT(setMasterMove())); iMenu.addAction(setAsMasterAction); if (!m_assignmentsWidget->isSetMasterAllowed()) setAsMasterAction->setEnabled(false); // Action to select all the players QAction *selectAllAction = new QAction(_q("Select all players"), this); selectAllAction->setStatusTip(_q("Select all the players")); selectAllAction->setShortcut(Qt::SHIFT + Qt::Key_A); QObject::connect(selectAllAction, SIGNAL(triggered()), m_assignmentsWidget, SLOT(selectAllPlayers())); iMenu.addAction(selectAllAction); // Action to assign the selected move QAction *assignSelMoveAction = new QAction(_q("Assign selected move (%1)").arg(formatMove(move)), this); assignSelMoveAction->setStatusTip(_q("Assign move (%1) to the selected player(s)") .arg(formatMove(move))); assignSelMoveAction->setShortcut(Qt::Key_Enter); QObject::connect(assignSelMoveAction, SIGNAL(triggered()), m_assignmentsWidget, SLOT(assignSelectedMove())); iMenu.addAction(assignSelMoveAction); if (!m_assignmentsWidget->isAssignMoveAllowed()) assignSelMoveAction->setEnabled(false); }
//---------------------------------------------------------------------------------------------- void GraphScene::CreateSceneMenu() { QAction *pNewNodeAction = new QAction(tr("N&ew Node"), this); pNewNodeAction->setStatusTip(tr("Creates new plan graph node")); connect(pNewNodeAction, SIGNAL(triggered()), this, SLOT(NewNode())); QAction *pLayoutGraph = new QAction(tr("L&ayout Plan"), this); pLayoutGraph->setStatusTip(tr("Layout plan graph in the scene")); connect(pLayoutGraph, SIGNAL(triggered()), this, SLOT(OnGraphStructureChange())); m_pSceneMenu = new QMenu(tr("Scene Menu")); m_pSceneMenu->setTearOffEnabled(true); m_pSceneMenu->addAction(pNewNodeAction); m_pSceneMenu->addAction(pLayoutGraph); }
void GLScene::contextMenuEvent(QContextMenuEvent *event) { QAction *start = new QAction(tr("&Start"), this); start->setStatusTip(tr("Start")); connect(start, SIGNAL(triggered()), this, SLOT(start())); QAction *stop = new QAction(tr("&Stop"), this); start->setStatusTip(tr("Stop")); connect(stop, SIGNAL(triggered()), this, SLOT(stop())); QMenu menu(this); menu.addAction(start); menu.addAction(stop); menu.exec(event->globalPos()); }
void MilkMainWindow::createPanelToolBar() { toolbarPanel = addToolBar(tr("Panels")); QAction* action = toolbarPanel->toggleViewAction(); action->setStatusTip(tr("Show/Hide Panels Toolbar")); menuView->addAction(action); }
QAction* RS_ActionPolylineSegment::createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/) { QAction* action = new QAction(tr("Create Polyline from Existing &Segments"), NULL); action->setShortcut(QKeySequence()); action->setIcon(QIcon(":/extui/polylinesegment.png")); action->setStatusTip(tr("Create Polyline from Existing Segments")); return action; }
void DisplayLabel::contextMenuEvent(QContextMenuEvent *event) { if (_slideshowimage == nullptr || _slideshowimage->path().isEmpty()) { return; } emit rightMouseSucces(true); QMenu menu(this); QAction *openFolderAction = new QAction(tr("Open &folder"), this); connect(openFolderAction, &QAction::triggered, this, [this]() {this->openFolder(true);}); menu.addAction(openFolderAction); QAction *openImageAction = new QAction(tr("Open &image"), this); openImageAction->setStatusTip(tr("Open image in the default viewer")); connect(openImageAction, &QAction::triggered, this, [this]() {this->openImage();}); menu.addAction(openImageAction); QAction *openDetailsAction = new QAction(tr("&Details"), this); //connect(openDetailsAction, &QAction::triggered, this, [this]() {qDebug() << "clicked open details";}); menu.addAction(openDetailsAction); QAction *result = menu.exec(event->globalPos()); if (!result) { // this starts the slideshow if no item was selected //emit rightMouseSucces(false); // it is not influenced by the fact that the slideshow was paused before the right click return; } else if (result == openDetailsAction) { emit openDetails(_slideshowimage); //DetailsDialog *detailsDialog = new DetailsDialog(); //detailsDialog->show(); //detailsDialog->setImage(_slideshowimage); } }
QAction* RS_ActionModifyExplodeText::createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/) { QAction* action = new QAction(tr("Explode Text"), tr("&Explode Text into Letters"), QKeySequence(), NULL); action->setStatusTip(tr("Explodes Text Entities into single Letters")); return action; }
QAction* RS_ActionDimLeader::createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/) { QAction* action = new QAction(tr("Leader"), tr("&Leader"), QKeySequence(), NULL); action->setStatusTip(tr("Leader Dimension")); return action; }
JournalPlugin::JournalPlugin(KontactInterface::Core *core, const QVariantList &) : KontactInterface::Plugin(core, core, "korganizer", "journal"), mIface(Q_NULLPTR) { setComponentName(QStringLiteral("korganizer"), QStringLiteral("korganizer")); KIconLoader::global()->addAppDir(QStringLiteral("korganizer")); QAction *action = new QAction(QIcon::fromTheme(QStringLiteral("journal-new")), i18nc("@action:inmenu", "New Journal..."), this); actionCollection()->addAction(QStringLiteral("new_journal"), action); actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_J)); QString str = i18nc("@info:status", "Create a new journal"); action->setStatusTip(str); action->setToolTip(str); action->setWhatsThis( i18nc("@info:whatsthis", "You will be presented with a dialog where you can create " "a new journal entry.")); connect(action, &QAction::triggered, this, &JournalPlugin::slotNewJournal); insertNewAction(action); mUniqueAppWatcher = new KontactInterface::UniqueAppWatcher( new KontactInterface::UniqueAppHandlerFactory<KOrganizerUniqueAppHandler>(), this); }
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); }
QAction* RS_ActionPolylineEquidistant::createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/) { QAction* action = new QAction(tr("Create &Equidistant Polylines"), NULL); action->setShortcut(QKeySequence()); action->setIcon(QIcon(":/extui/polylineequidstant.png")); action->setStatusTip(tr("Create Equidistant Polylines")); return action; }
QAction* RS_ActionPolylineTrim::createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/) { QAction* action = new QAction(tr("&Trim segments"), NULL); action->setShortcut(QKeySequence()); action->setIcon(QIcon(":/extui/polylinetrim.png")); action->setStatusTip(tr("Trim polyline's segments")); return action; }
QAction* RS_ActionBlocksRemove::createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/) { QAction* action = new QAction(tr("Remove Block"), tr("&Remove Block"), QKeySequence(), NULL); action->setStatusTip(tr("Remove Block")); return action; }
QAction* RS_ActionDrawArc3P::createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/) { QAction* action = new QAction(tr("Arc: 3 Points"), tr("&3 Points"), QKeySequence(), NULL); action->setStatusTip(tr("Draw arcs with 3 points")); return action; }
QAction* RS_ActionPolylineDel::createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/) { QAction* action = new QAction(tr("&Delete node"), NULL); action->setShortcut(QKeySequence()); action->setIcon(QIcon(":/extui/polylinedel.png")); action->setStatusTip(tr("Delete polyline's node")); return action; }
QAction* ActionResource::toQAction() const { Log log( Log::LT_TRACE, Log::MOD_MAIN, "QAction* ActionResource::toQAction() const" ); if( !( m_Type == AT_ITEM || m_Type == AT_SEPARATOR ) ) { return NULL; }; log.write( Log::LT_TRACE, "Produce item %s", getText() ); QAction* act = new QAction( getText(), NULL ); act->setAutoRepeat( getAutoRepeat() ); act->setCheckable( getCheckable() ); act->setChecked( getChecked() ); act->setData( getData() ); act->setFont( getFont() ); act->setIcon( getIcon() ); act->setIconVisibleInMenu( getIconVisibleInMenu() ); act->setMenuRole( getMenuRole() ); act->setSeparator( m_Type == AT_SEPARATOR ); act->setShortcut( getShortcut() ); act->setShortcutContext( getShortcutContext() ); act->setStatusTip( getStatusTip() ); act->setToolTip( getTooltip() ); act->setVisible( getVisible() ); act->setWhatsThis( getWhatsThis() ); return act; };
void FileHistoryHandler::updateMenu() { recentMenu->clear(); int i = 1; for(const QString& filepath : filePaths) { QString fname = QFileInfo(filepath).fileName(); // Add number for selection if(i < 10) fname = "&" + QString::number(i) + " " + fname; else if(i == 10) fname = "&0 " + fname; QAction *fileAction = recentMenu->addAction(fname); fileAction->setToolTip(filepath); fileAction->setStatusTip(filepath); fileAction->setData(filepath); i++; } recentMenu->addSeparator(); clearAction->setEnabled(!filePaths.isEmpty()); recentMenu->addAction(clearAction); }
int entryPoint ( BlMainWindow *bges ) { BL_FUNC_DEBUG /// Inicializa el sistema de traducciones 'gettext'. setlocale ( LC_ALL, "" ); blBindTextDomain ( "pluginbl_importcsv", g_confpr->value( CONF_DIR_TRADUCCION ).toLatin1().constData() ); g_pluginbl_importcsv = bges; PluginBl_ImportCSV *mcont = new PluginBl_ImportCSV; /// Creamos el menú. QAction *accion = new QAction ( _ ( "&Importacion CSV" ), 0 ); accion->setStatusTip ( _ ( "Importacion CSV" ) ); accion->setWhatsThis ( _ ( "Importacion CSV" ) ); accion->setIcon ( QIcon ( QString::fromUtf8 ( ":/Images/document-import.png" ) ) ); mcont->connect ( accion, SIGNAL ( activated() ), mcont, SLOT ( elslot() ) ); /// Miramos si existe un menu Herramientas QMenu *pPluginMenu = bges->newMenu ( _("&Herramientas"), "menuHerramientas", "menuAcerca_de" ); pPluginMenu->addSeparator(); pPluginMenu->addAction ( accion ); return 0; }
void MediaView::updateSubscriptionAction(Video *video, bool subscribed) { QAction *subscribeAction = MainWindow::instance()->getAction("subscribeChannel"); QString subscribeTip; QString subscribeText; if (!video) { subscribeText = subscribeAction->property("originalText").toString(); subscribeAction->setEnabled(false); } else if (subscribed) { subscribeText = tr("Unsubscribe from %1").arg(video->getChannelTitle()); subscribeTip = subscribeText; subscribeAction->setEnabled(true); } else { subscribeText = tr("Subscribe to %1").arg(video->getChannelTitle()); subscribeTip = subscribeText; subscribeAction->setEnabled(true); } subscribeAction->setText(subscribeText); subscribeAction->setStatusTip(subscribeTip); if (subscribed) { subscribeAction->setIcon(IconUtils::icon("bookmark-remove")); } else { subscribeAction->setIcon(IconUtils::icon("bookmark-new")); } MainWindow::instance()->setupAction(subscribeAction); }
PopupButton::PopupButton(QWidget* parent) { // this->setFrameStyle(QFrame::Box); QVBoxLayout* layout = new QVBoxLayout(this); layout->setMargin(0); this->setLayout(layout); // QToolButton* expandButton = new QToolButton(this); QToolButton* expandButton = new CXSmallToolButton(this); mShowHeaderButton = expandButton; this->setFixedSize(expandButton->sizeHint()); QAction* action = new QAction(QIcon(":icons/open_icon_library/layer-lower-3.png"), "Controls", this); QString tip = "Show Controls"; action->setStatusTip(tip); action->setWhatsThis(tip); action->setToolTip(tip); connect(action, SIGNAL(triggered()), this, SLOT(onTriggered())); mAction = action; mShowHeaderButton->setDefaultAction(action); layout->addWidget(mShowHeaderButton); action->setCheckable(true); }