本文整理汇总了C++中QMenu::setEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenu::setEnabled方法的具体用法?C++ QMenu::setEnabled怎么用?C++ QMenu::setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMenu
的用法示例。
在下文中一共展示了QMenu::setEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMenu
QMenu *CodeLineEdit::createVariablesMenu(QMenu *parentMenu, bool ignoreMultiline)
{
QMenu *variablesMenu = 0;
if(!ignoreMultiline && isMultiline())
{
variablesMenu = new QMenu(tr("Cannot insert in a multiline parameter"), parentMenu);
variablesMenu->setEnabled(false);
}
else
{
Q_ASSERT(mParameterContainer);
variablesMenu = mParameterContainer->createVariablesMenu(parentMenu);
if(variablesMenu)
{
variablesMenu->setTitle(tr("Insert variable"));
}
else
{
variablesMenu = new QMenu(tr("No variables to insert"), parentMenu);
variablesMenu->setEnabled(false);
}
}
variablesMenu->setIcon(QIcon(":/images/variable.png"));
return variablesMenu;
}
示例2: QMenu
void db_x509req::showContextMenu(QContextMenuEvent *e, const QModelIndex &index)
{
QMenu *menu = new QMenu(mainwin);
QMenu *subExport;
currentIdx = index;
pki_x509req *req = static_cast<pki_x509req*>(index.internalPointer());
menu->addAction(tr("New Request"), this, SLOT(newItem()));
menu->addAction(tr("Import"), this, SLOT(load()));
if (index != QModelIndex()) {
if (!req->getRefKey())
menu->addAction(tr("Extract public Key"),
this, SLOT(extractPubkey()));
menu->addAction(tr("Rename"), this, SLOT(edit()));
menu->addAction(tr("Show Details"), this, SLOT(showItem()));
menu->addAction(tr("Sign"), this, SLOT(signReq()));
subExport = menu->addMenu(tr("Export"));
subExport->addAction(tr("Clipboard"), this,
SLOT(pem2clipboard()));
subExport->addAction(tr("File"), this, SLOT(store()));
subExport->addAction(tr("Template"), this, SLOT(toTemplate()));
subExport->addAction(tr("OpenSSL config"), this,
SLOT(toOpenssl()));
menu->addAction(tr("Delete"), this, SLOT(delete_ask()));
subExport->setEnabled(!req->isSpki());
}
contextMenu(e, menu);
currentIdx = QModelIndex();
return;
}
示例3: createMenus
void MainWindow::createMenus()
{
// Map menu:
QMenu * file = menuBar()->addMenu(tr("&Map"));
file->addAction(m_actNewGen);
file->addAction(m_actOpenGen);
file->addSeparator();
QMenu * worlds = file->addMenu(tr("Open &existing"));
worlds->addActions(m_WorldActions);
if (m_WorldActions.empty())
{
worlds->setEnabled(false);
}
file->addAction(m_actOpenWorld);
file->addSeparator();
file->addAction(m_actReload);
file->addSeparator();
file->addAction(m_actExit);
// View menu:
QMenu * view = menuBar()->addMenu(tr("&View"));
view->addAction(m_actViewCenter);
view->addSeparator();
for (size_t i = 0; i < ARRAYCOUNT(m_actViewZoom); i++)
{
view->addAction(m_actViewZoom[i]);
}
}
示例4: initialize
/*! Initializes the plugin. Returns true on success.
Plugins want to register objects with the plugin manager here.
\a error_message can be used to pass an error message to the plugin system,
if there was any.
*/
bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *error_message)
{
Q_UNUSED(arguments)
Q_UNUSED(error_message)
// Get the primary access point to the workbench.
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
// Create a unique context id for our own view, that will be used for the
// menu entry later.
QList<int> context = QList<int>()
<< core->uniqueIDManager()->uniqueIdentifier(
QLatin1String("HelloWorld.MainView"));
// Create an action to be triggered by a menu entry
QAction *helloWorldAction = new QAction("Say \"&Hello World!\"", this);
connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld()));
// Register the action with the action manager
Core::ActionManagerInterface *actionManager = core->actionManager();
Core::ICommand *command =
actionManager->registerAction(
helloWorldAction, "HelloWorld.HelloWorldAction", context);
// Create our own menu to place in the Tools menu
Core::IActionContainer *helloWorldMenu =
actionManager->createMenu("HelloWorld.HelloWorldMenu");
QMenu *menu = helloWorldMenu->menu();
menu->setTitle(tr("&Hello World"));
menu->setEnabled(true);
// Add the Hello World action command to the menu
helloWorldMenu->addAction(command);
// Request the Tools menu and add the Hello World menu to it
Core::IActionContainer *toolsMenu =
actionManager->actionContainer(Core::Constants::M_TOOLS);
toolsMenu->addMenu(helloWorldMenu);
// Add a mode with a push button based on BaseMode. Like the BaseView,
// it will unregister itself from the plugin manager when it is deleted.
Core::BaseMode *baseMode = new Core::BaseMode;
baseMode->setUniqueModeName("HelloWorld.HelloWorldMode");
baseMode->setName(tr("Hello world!"));
baseMode->setIcon(QIcon());
baseMode->setPriority(0);
baseMode->setWidget(new QPushButton(tr("Hello World PushButton!")));
addAutoReleasedObject(baseMode);
// Add the Hello World action command to the mode manager (with 0 priority)
Core::ModeManager *modeManager = core->modeManager();
modeManager->addAction(command, 0);
return true;
}
示例5: initialize
bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
{
Q_UNUSED(arguments)
Q_UNUSED(error)
qRegisterMetaType<CppTools::CppCodeStyleSettings>("CppTools::CppCodeStyleSettings");
Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
m_settings = new CppToolsSettings(this); // force registration of cpp tools settings
// Objects
m_modelManager = new CppModelManager(this);
Core::VcsManager *vcsManager = core->vcsManager();
Core::FileManager *fileManager = core->fileManager();
connect(vcsManager, SIGNAL(repositoryChanged(QString)),
m_modelManager, SLOT(updateModifiedSourceFiles()));
connect(fileManager, SIGNAL(filesChangedInternally(QStringList)),
m_modelManager, SLOT(updateSourceFiles(QStringList)));
addAutoReleasedObject(m_modelManager);
addAutoReleasedObject(new CppCompletionAssistProvider);
addAutoReleasedObject(new CppLocatorFilter(m_modelManager));
addAutoReleasedObject(new CppClassesFilter(m_modelManager));
addAutoReleasedObject(new CppFunctionsFilter(m_modelManager));
addAutoReleasedObject(new CppCurrentDocumentFilter(m_modelManager, core->editorManager()));
addAutoReleasedObject(new CompletionSettingsPage);
addAutoReleasedObject(new CppFileSettingsPage(m_fileSettings));
addAutoReleasedObject(new SymbolsFindFilter(m_modelManager));
addAutoReleasedObject(new CppCodeStyleSettingsPage);
TextEditor::CodeStylePreferencesManager::instance()->registerFactory(
new CppTools::CppCodeStylePreferencesFactory());
// Menus
Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS);
Core::ActionContainer *mcpptools = am->createMenu(CppTools::Constants::M_TOOLS_CPP);
QMenu *menu = mcpptools->menu();
menu->setTitle(tr("&C++"));
menu->setEnabled(true);
mtools->addMenu(mcpptools);
// Actions
Core::Context context(CppEditor::Constants::C_CPPEDITOR);
QAction *switchAction = new QAction(tr("Switch Header/Source"), this);
Core::Command *command = am->registerAction(switchAction, Constants::SWITCH_HEADER_SOURCE, context, true);
command->setDefaultKeySequence(QKeySequence(Qt::Key_F4));
mcpptools->addAction(command);
connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource()));
return true;
}
示例6: QMenu
QMenu *VariableLineEdit::createResourcesMenu(QMenu *parentMenu, bool ignoreMultiline)
{
Q_UNUSED(ignoreMultiline)
//Do not allow inserting resources here, it doen't make any sense since we cannot overwrite resources
QMenu *resourceMenu = new QMenu(tr("Cannot insert resources here"), parentMenu);
resourceMenu->setEnabled(false);
resourceMenu->setIcon(QIcon(":/images/resource.png"));
return resourceMenu;
}
示例7: clear
void MainWindow::ExternalPopup::populate( DB::ImageInfoPtr current, const DB::FileNameList& imageList )
{
_list = imageList;
_currentInfo = current;
clear();
QAction *action;
QStringList list = QStringList() << i18n("Current Item") << i18n("All Selected Items") << i18n("Copy and Open");
for ( int which = 0; which < 3; ++which ) {
if ( which == 0 && !current )
continue;
const bool multiple = (_list.count() > 1);
const bool enabled = (which != 1 && _currentInfo ) || (which == 1 && multiple);
// Submenu
QMenu *submenu = addMenu( list[which] );
submenu->setEnabled(enabled);
// Fetch set of offers
OfferType offers;
if ( which == 0 )
offers = appInfos( DB::FileNameList() << current->fileName() );
else
offers = appInfos( imageList );
for ( OfferType::const_iterator offerIt = offers.begin(); offerIt != offers.end(); ++offerIt ) {
action = submenu->addAction( (*offerIt).first );
action->setObjectName( (*offerIt).first ); // Notice this is needed to find the application later!
action->setIcon( KIcon((*offerIt).second) );
action->setData( which );
action->setEnabled( enabled );
}
// A personal command
action = submenu->addAction( i18n("Open With...") );
action->setObjectName( i18n("Open With...") ); // Notice this is needed to find the application later!
// XXX: action->setIcon( KIcon((*offerIt).second) );
action->setData( which );
action->setEnabled( enabled );
// A personal command
// XXX: see kdialog.h for simple usage
action = submenu->addAction( i18n("Your Command Line") );
action->setObjectName( i18n("Your Command Line") ); // Notice this is needed to find the application later!
// XXX: action->setIcon( KIcon((*offerIt).second) );
action->setData( which );
action->setEnabled( enabled );
}
}
示例8: showInstanceContextMenu
void MainWindow::showInstanceContextMenu(const QPoint &pos)
{
QList<QAction *> actions;
QAction *actionSep = new QAction("", this);
actionSep->setSeparator(true);
bool onInstance = view->indexAt(pos).isValid();
if (onInstance)
{
actions = ui->instanceToolBar->actions();
QAction *actionVoid = new QAction(m_selectedInstance->name(), this);
actionVoid->setEnabled(false);
QAction *actionRename = new QAction(tr("Rename"), this);
actionRename->setToolTip(ui->actionRenameInstance->toolTip());
QAction *actionCopyInstance = new QAction(tr("Copy instance"), this);
actionCopyInstance->setToolTip(ui->actionCopyInstance->toolTip());
connect(actionRename, SIGNAL(triggered(bool)), SLOT(on_actionRenameInstance_triggered()));
connect(actionCopyInstance, SIGNAL(triggered(bool)), SLOT(on_actionCopyInstance_triggered()));
actions.replace(1, actionRename);
actions.prepend(actionSep);
actions.prepend(actionVoid);
actions.append(actionCopyInstance);
}
else
{
QAction *actionVoid = new QAction(tr("MultiMC"), this);
actionVoid->setEnabled(false);
QAction *actionCreateInstance = new QAction(tr("Create instance"), this);
actionCreateInstance->setToolTip(ui->actionAddInstance->toolTip());
connect(actionCreateInstance, SIGNAL(triggered(bool)), SLOT(on_actionAddInstance_triggered()));
actions.prepend(actionSep);
actions.prepend(actionVoid);
actions.append(actionCreateInstance);
}
QMenu myMenu;
myMenu.addActions(actions);
if(onInstance)
myMenu.setEnabled(m_selectedInstance->canLaunch());
myMenu.exec(view->mapToGlobal(pos));
}
示例9: initialize
bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
{
Q_UNUSED(arguments)
Q_UNUSED(error)
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/qmljstools/QmlJSTools.mimetypes.xml"));
m_settings = new QmlJSToolsSettings(this); // force registration of qmljstools settings
// Objects
m_modelManager = new ModelManager(this);
// VCSManager *vcsManager = core->vcsManager();
// DocumentManager *fileManager = core->fileManager();
// connect(vcsManager, SIGNAL(repositoryChanged(QString)),
// m_modelManager, SLOT(updateModifiedSourceFiles()));
// connect(fileManager, SIGNAL(filesChangedInternally(QStringList)),
// m_modelManager, SLOT(updateSourceFiles(QStringList)));
LocatorData *locatorData = new LocatorData;
addAutoReleasedObject(locatorData);
addAutoReleasedObject(new FunctionFilter(locatorData));
addAutoReleasedObject(new QmlJSCodeStyleSettingsPage);
addAutoReleasedObject(new BasicBundleProvider);
// Menus
ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS);
ActionContainer *mqmljstools = ActionManager::createMenu(Constants::M_TOOLS_QMLJS);
QMenu *menu = mqmljstools->menu();
menu->setTitle(tr("&QML/JS"));
menu->setEnabled(true);
mtools->addMenu(mqmljstools);
// Update context in global context
m_resetCodeModelAction = new QAction(tr("Reset Code Model"), this);
Command *cmd = ActionManager::registerAction(
m_resetCodeModelAction, Constants::RESET_CODEMODEL);
connect(m_resetCodeModelAction, &QAction::triggered,
m_modelManager, &ModelManager::resetCodeModel);
mqmljstools->addAction(cmd);
// watch task progress
connect(ProgressManager::instance(), SIGNAL(taskStarted(Core::Id)),
this, SLOT(onTaskStarted(Core::Id)));
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(Core::Id)),
this, SLOT(onAllTasksFinished(Core::Id)));
return true;
}
示例10: contextMenuEvent
void imageW::contextMenuEvent(QContextMenuEvent *ev) {
QMenu contMenu(this);
contMenu.addAction(paintMode);
contMenu.addSeparator();
// QMenu zoomM(this);
QMenu *zoomM = contMenu.addMenu("Zoom");
zoomM->addAction(xOneZoom);
zoomM->addAction(xTwoZoom);
zoomM->addAction(xThreeZoom);
zoomM->addAction(xFourZoom);
zoomM->addAction(xFiveZoom);
if (!loopMode) {
zoomM->setEnabled(false);
}
contMenu.exec(ev->globalPos());
}
示例11: initialize
bool MacrosPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments);
Q_UNUSED(errorMessage);
addAutoReleasedObject(new MacroOptionsPage);
addAutoReleasedObject(new MacroLocatorFilter);
Core::Context globalcontext(Core::Constants::C_GLOBAL);
Core::Context textContext(TextEditor::Constants::C_TEXTEDITOR);
m_macroManager = new MacroManager(this);
// Menus
Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
Core::ActionContainer *mmacrotools = Core::ActionManager::createMenu(Constants::M_TOOLS_MACRO);
QMenu *menu = mmacrotools->menu();
menu->setTitle(tr("&Macros"));
menu->setEnabled(true);
mtools->addMenu(mmacrotools);
QAction *startMacro = new QAction(tr("Record Macro"), this);
Core::Command *command = Core::ActionManager::registerAction(startMacro, Constants::START_MACRO, textContext);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Ctrl+(") : tr("Alt+(")));
mmacrotools->addAction(command);
connect(startMacro, SIGNAL(triggered()), m_macroManager, SLOT(startMacro()));
QAction *endMacro = new QAction(tr("Stop Recording Macro"), this);
endMacro->setEnabled(false);
command = Core::ActionManager::registerAction(endMacro, Constants::END_MACRO, globalcontext);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Ctrl+)") : tr("Alt+)")));
mmacrotools->addAction(command);
connect(endMacro, SIGNAL(triggered()), m_macroManager, SLOT(endMacro()));
QAction *executeLastMacro = new QAction(tr("Play Last Macro"), this);
command = Core::ActionManager::registerAction(executeLastMacro, Constants::EXECUTE_LAST_MACRO, textContext);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+R") : tr("Alt+R")));
mmacrotools->addAction(command);
connect(executeLastMacro, SIGNAL(triggered()), m_macroManager, SLOT(executeLastMacro()));
QAction *saveLastMacro = new QAction(tr("Save Last Macro"), this);
saveLastMacro->setEnabled(false);
command = Core::ActionManager::registerAction(saveLastMacro, Constants::SAVE_LAST_MACRO, textContext);
mmacrotools->addAction(command);
connect(saveLastMacro, SIGNAL(triggered()), m_macroManager, SLOT(saveLastMacro()));
return true;
}
示例12: menu
void ArrowPointCanvas::menu(const QPoint &)
{
QMenu m;
MenuFactory::createTitle(m, QObject::tr("Line break"));
m.addSeparator();
MenuFactory::addItem(m,QObject::tr("Remove from diagram"), 0);
m.setEnabled(lines.at(0)->may_join());
// m.actions().at(0)->setItemEnabled(0, lines.at(0)->may_join());
QAction *retAction = m.exec(QCursor::pos());
if(retAction)
switch (retAction->data().toInt()) {
case 0:
// removes the point replacing the lines around it by a single line
lines.at(0)->join(lines.at(1), this);
break;
default:
return;
}
package_modified();
}
示例13: initialize
bool ColorPickerPlugin::initialize(const QStringList &arguments,
QString *errorMessage)
{
Q_UNUSED(arguments);
Q_UNUSED(errorMessage);
auto optionsPage = new ColorPickerOptionsPage;
d->generalSettings = optionsPage->generalSettings();
connect(optionsPage, &ColorPickerOptionsPage::generalSettingsChanged,
this, &ColorPickerPlugin::onGeneralSettingsChanged);
// Register the plugin actions
ActionContainer *toolsContainer = ActionManager::actionContainer(Core::Constants::M_TOOLS);
ActionContainer *myContainer = ActionManager::createMenu("ColorPicker");
QMenu *myMenu = myContainer->menu();
myMenu->setTitle(tr("&ColorPicker"));
myMenu->setEnabled(true);
auto triggerColorEditAction = new QAction(tr(Constants::ACTION_NAME_TRIGGER_COLOR_EDIT), this);
Command *command = ActionManager::registerAction(triggerColorEditAction,
Constants::TRIGGER_COLOR_EDIT);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+C")));
myContainer->addAction(command);
connect(triggerColorEditAction, &QAction::triggered,
this, &ColorPickerPlugin::onColorEditTriggered);
toolsContainer->addMenu(myContainer);
// Register objects
addAutoReleasedObject(optionsPage);
return true;
}
示例14: on_insertPushButton_clicked
void CodeEditorDialog::on_insertPushButton_clicked()
{
QSet<QString> variables = ActionTools::ActionInstance::findVariables(text(), isCode());
for(QAction *action: mVariablesMenu->actions())
variables.insert(action->text());
QStringList variableList = variables.toList();
std::sort(variableList.begin(), variableList.end());
QMenu *variablesMenu = 0;
if(variableList.isEmpty())
{
variablesMenu = new QMenu(tr("No variables to insert"));
variablesMenu->setEnabled(false);
}
else
{
variablesMenu = new QMenu(tr("Insert variable"));
connect(variablesMenu, SIGNAL(triggered(QAction*)), this, SLOT(insertVariable(QAction*)));
for(const QString &variable: variableList)
variablesMenu->addAction(variable);
}
variablesMenu->setIcon(QIcon(":/images/variable.png"));
QMenu *menu = new QMenu;
menu->addMenu(variablesMenu);
menu->addMenu(mResourcesMenu);
menu->exec(QCursor::pos());
delete menu;
}
示例15: onContextMenu
void DesignerEventHandler::onContextMenu(QContextMenuEvent * e)
{
QMenu * menu = new QMenu(parentWidget);
QAction * copy_action = menu->addAction(tr("Copy"), this, SLOT(onCopy()));
menu->addAction(tr("Paste"), this, SLOT(onPaste()));
QAction * delete_action = menu->addAction(tr("Delete"), this, SLOT(onDelete()));
QAction * delete_with_s_action = menu->addAction(tr("Delete with sourcers"), this, SLOT(onDeleteWithSourcers()));
QMenu* go = menu->addMenu(tr("Geometry operations"));
go->addAction(tr("Align left") , this, SLOT(onAlignLeft()));
go->addAction(tr("Align top") , this, SLOT(onAlignTop()));
go->addAction(tr("Align right"), this, SLOT(onAlignRight()));
go->addAction(tr("Align bottom"),this, SLOT(onAlignBottom()));
go->addAction(tr("Align vertical"),this, SLOT(onAlignVertical()));
go->addAction(tr("Align horisontal"), this, SLOT (onAlignHorizontal()) );
go->addAction(tr("Queue x"), this, SLOT (onQuequeX()) );
go->addAction(tr("Queue y"), this, SLOT (onQuequeY()) );
go->insertSeparator();
go->addAction(tr("Same width"), this, SLOT(onSameWidth()));
go->addAction(tr("Same height"), this, SLOT(onSameHeight()));
QMenu* popupWindows = menu->addMenu(tr("Popup windows"));
QMenu* leftButtonPW = popupWindows->addMenu(tr("Left button"));
QAction * left_pw_add_action = leftButtonPW->addAction( tr("Add"), this, SLOT(onLeftPwAdd()));
QAction * left_pw_copy_action = leftButtonPW->addAction( tr("Copy"), this, SLOT(onLeftPwCopy()));
leftButtonPW->addAction( tr("Paste"), this, SLOT(onLeftPwPaste()));
QAction * left_pw_delete_action = leftButtonPW->addAction( tr("Delete"), this, SLOT(onLeftDelete()));
QMenu* rightButtonPW = popupWindows->addMenu (tr ("Right button"));
QAction * right_pw_add_action = rightButtonPW->addAction( tr("Add"), this, SLOT(onRightPwAdd()));
QAction * right_pw_copy_action = rightButtonPW->addAction( tr("Copy"), this, SLOT(onRightPwCopy()));
rightButtonPW->addAction( tr("Paste"), this, SLOT(onRightPwPaste()));
QAction * right_pw_delete_action = rightButtonPW->addAction( tr("Delete"), this, SLOT(onRightDelete()));
QAction* show_properties_action = menu->addAction(tr("Properties"), this, SLOT(showProps()));
QFont f = show_properties_action->font();
f.setBold(true);
show_properties_action->setFont(f);
menu->addAction( tr("Export lists"), this, SLOT(onExportLists()) );
//menu->insertSeparator();
QMenu * predef = menu->addMenu ("Predef windows");
QStringList names = PredefPw::Factory::availableNames();
for (QStringList::iterator iter = names.begin(); iter != names.end(); ++iter ) {
QAction * a = predef->addAction (*iter);
//a->setMenu (predef);
a->setData (12345);
}
menu->addAction ( "Find sourcer", this, SLOT (onFindSourcerByWidget() ) );
if (selected_widgets.count( ) == 0 ){
copy_action->setEnabled(false);
delete_action->setEnabled(false);
delete_with_s_action->setEnabled(false);
go->setEnabled(false);
popupWindows->setEnabled(false);
}
else {
VtlWidget * w = (VtlWidget*)checkWidget(e->pos());
if (w) {
if (w->isLbPopupCreated()) {
left_pw_add_action->setEnabled(false);
}
else {
left_pw_copy_action->setEnabled(false);
left_pw_delete_action->setEnabled(false);
}
if (w->isRbPopupCreated()) {
right_pw_add_action->setEnabled(false);
}
else {
right_pw_copy_action->setEnabled(false);
right_pw_delete_action->setEnabled(false);
}
}
}
if ( context_widget )
context_widget->prepareContextMenu (menu);
if (e->state() & Qt::ControlModifier )
control_modifier = true;
QAction * a = menu->exec(e->globalPos());
control_modifier = false;
if ( a && a->data().toInt() == 12345 ) {
QMessageBox box ( vtl::app );
QAbstractButton * left_btn = box.addButton ("Left" , QMessageBox::ActionRole );
QAbstractButton * right_btn = box.addButton ("Right", QMessageBox::ActionRole );
box.setWindowTitle ("Mouse button?");
box.exec ();
if ( box.clickedButton() == left_btn ) {
for (SWPtrList::iterator iter = selected_widgets.begin(); iter != selected_widgets.end(); ++iter ) {
(*iter)->createLbPredefPw ( a->text() );
}
}
else if (box.clickedButton() == right_btn ) {
for (SWPtrList::iterator iter = selected_widgets.begin(); iter != selected_widgets.end(); ++iter ) {
//.........这里部分代码省略.........