本文整理汇总了C++中QAction::setSeparator方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::setSeparator方法的具体用法?C++ QAction::setSeparator怎么用?C++ QAction::setSeparator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAction
的用法示例。
在下文中一共展示了QAction::setSeparator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDesignerTaskMenu
ToolBarTaskMenu::ToolBarTaskMenu(QToolBar *toolbar, QObject *parent)
: QDesignerTaskMenu(toolbar, parent),
m_toolbar(toolbar),
m_editTextAction(new QAction(tr("Customize..."), this))
{
connect(m_editTextAction, SIGNAL(triggered()), this, SLOT(editToolBar()));
m_taskActions.append(m_editTextAction);
QAction *sep = new QAction(this);
sep->setSeparator(true);
m_taskActions.append(sep);
}
示例2: View
K3b::MovixView::MovixView( K3b::MovixDoc* doc, QWidget* parent )
:
View( doc, parent ),
m_doc( doc ),
m_model( new MovixProjectModel( m_doc, this ) ),
m_view( new QTreeView( this ) )
{
m_view->setModel( m_model );
m_view->setAcceptDrops( true );
m_view->setDragEnabled( true );
m_view->setDragDropMode( QTreeView::DragDrop );
m_view->setItemsExpandable( false );
m_view->setRootIsDecorated( false );
m_view->setSelectionMode( QTreeView::ExtendedSelection );
m_view->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
m_view->setContextMenuPolicy( Qt::ActionsContextMenu );
// FIXME: make QHeaderView::Interactive the default but connect to model changes and call header()->resizeSections( QHeaderView::ResizeToContents );
m_view->header()->setResizeMode( QHeaderView::ResizeToContents );
m_view->setEditTriggers( QAbstractItemView::NoEditTriggers );
setMainWidget( m_view );
// setup actions
m_actionProperties = K3b::createAction( this, i18n("Properties"), "document-properties",
0, this, SLOT(showPropertiesDialog()),
actionCollection(), "movix_show_props" );
m_actionRemove = K3b::createAction( this, i18n( "Remove" ), "edit-delete",
Qt::Key_Delete, this, SLOT(slotRemove()),
actionCollection(), "movix_remove_item" );
m_actionRemoveSubTitle = K3b::createAction( this, i18n( "Remove Subtitle File" ), "edit-delete",
0, this, SLOT(slotRemoveSubTitleItems()),
actionCollection(), "movix_remove_subtitle_item" );
m_actionAddSubTitle = K3b::createAction( this, i18n("Add Subtitle File..."), 0,
0, this, SLOT(slotAddSubTitleFile()),
actionCollection(), "movix_add_subtitle" );
connect( m_view->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(slotSelectionChanged()) );
QAction* separator = new QAction( this );
separator->setSeparator( true );
m_view->addAction( m_actionRemove );
m_view->addAction( m_actionRemoveSubTitle );
m_view->addAction( m_actionAddSubTitle );
m_view->addAction( separator );
m_view->addAction( m_actionProperties );
m_view->addAction( separator );
m_view->addAction( actionCollection()->action("project_burn") );
// Setup toolbar
toolBox()->addActions( createPluginsActions( m_doc->type() ) );
toolBox()->addWidget( new VolumeNameWidget( doc, toolBox() ) );
}
示例3: QTreeWidget
EntitiesTreeWidget::EntitiesTreeWidget(QWidget *parent) : QTreeWidget(parent)
{
applicationNode = new QTreeWidgetItem(this,QStringList() << "Application");
modulesNode = new QTreeWidgetItem(this,QStringList() << "Modules");
resourcesNode = new QTreeWidgetItem(this,QStringList() << "Resources");
templatesNode = new QTreeWidgetItem(this,QStringList() << "Templates");
applicationNode->setIcon(0,QIcon(":/images/folderapp_ico.png"));
modulesNode->setIcon(0,QIcon(":/images/foldermod_ico.png"));
resourcesNode->setIcon(0,QIcon(":/images/folderres_ico.png"));
templatesNode->setIcon(0,QIcon(":/images/folder_ico.png"));
addTopLevelItem(applicationNode);
addTopLevelItem(modulesNode);
addTopLevelItem(resourcesNode);
addTopLevelItem(templatesNode);
setExpandsOnDoubleClick(false);
setContextMenuPolicy(Qt::CustomContextMenu);
resizeColumnToContents(0);
connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),this,SLOT(onItemDoubleClicked(QTreeWidgetItem*,int)));
connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(onContext(QPoint)));
openFile = new QAction("Open File",this);
importFile = new QAction("Import Files...",this);
topLevelMenu.addAction(openFile);
topLevelMenu.addAction(importFile);
loadFiles = new QAction("Load",this);
QAction *separator = new QAction(this);
separator->setSeparator(true);
reopen = new QAction("Reopen",this);
remove = new QAction("Remove",this);
secondLevelMenu.addAction(loadFiles);
secondLevelMenu.addAction(separator);
secondLevelMenu.addAction(reopen);
secondLevelMenu.addAction(remove);
edit = new QAction("Edit",this);
leafLevelMenu.addAction(edit);
connect(loadFiles,SIGNAL(triggered()),this,SLOT(onLoadFile()));
connect(openFile,SIGNAL(triggered()),this,SIGNAL(openFiles()));
connect(importFile,SIGNAL(triggered()),this,SIGNAL(importFiles()));
connect(edit,SIGNAL(triggered()),this,SLOT(onEdit()));
connect(remove,SIGNAL(triggered()),this,SLOT(onRemove()));
}
示例4: Extension
ExampleSearchExtension::ExampleSearchExtension(QObject *parent) :
Extension(parent),
m_dialog(0)
{
QAction *action = new QAction( this );
action->setSeparator(true);
m_actions.append( action );
action = new QAction(this);
// This is the name of the menu entry:
action->setText(tr("&Example Search..."));
m_actions.append(action);
}
示例5: QDesignerTaskMenu
ComboBoxTaskMenu::ComboBoxTaskMenu(QComboBox *button, QObject *parent)
: QDesignerTaskMenu(button, parent),
m_comboBox(button)
{
m_editItemsAction = new QAction(this);
m_editItemsAction->setText(tr("Edit Items..."));
connect(m_editItemsAction, SIGNAL(triggered()), this, SLOT(editItems()));
m_taskActions.append(m_editItemsAction);
QAction *sep = new QAction(this);
sep->setSeparator(true);
m_taskActions.append(sep);
}
示例6: QAction
// Create a menu separator
static QAction *createSeparator(QObject *parent,
Core::ActionManager *am,
const Core::Context &context,
Core::ActionContainer *container,
const Core::Id &id,
const Core::Id &group = Core::Id())
{
QAction *actSeparator = new QAction(parent);
actSeparator->setSeparator(true);
Core::Command *command = am->registerAction(actSeparator, id, context);
container->addAction(command, group);
return actSeparator;
}
示例7: QAction
AccountWindow::AccountWindow(QWidget* parent, const QString &name, Qt::WindowFlags wflags)
:TableWindow(parent, name, wflags)
{
QStringList nameList;
QTableWidget *pTable;
QAction* pAction;
pTable = TableWindow::getTable();
m_pDb = ISql::pInstance();
pAction = new QAction(tr("&New..."), this);
connect(pAction, SIGNAL(triggered()), this, SLOT(file_new()));
MDIWindow::addAction(pAction);
pAction = new QAction(tr("&Edit..."), this);
connect(pAction, SIGNAL(triggered()), this, SLOT(file_edit()));
MDIWindow::addAction(pAction, true);
pAction = new QAction(tr("&Delete"), this);
connect(pAction, SIGNAL(triggered()), this, SLOT(file_delete()));
MDIWindow::addAction(pAction);
pAction = new QAction(this);
pAction->setSeparator(true);
MDIWindow::addAction(pAction);
pAction = new QAction(tr("&Export all..."), this);
connect(pAction, SIGNAL(triggered()), this, SLOT(exportTable()));
MDIWindow::addAction(pAction);
// configure the table
TableWindow::setWindowIcon(QIcon(":/document.xpm"));
pTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
pTable->setSelectionMode(QAbstractItemView::SingleSelection);
// header
nameList += tr("Username");
nameList += tr("Contest");
nameList += tr("Description");
setupHeader(nameList);
pTable->setColumnWidth(Username, 100);
pTable->setColumnWidth(Contest, 100);
pTable->setColumnWidth(Description, 200);
connect(m_pDb, SIGNAL(accountsChanged()), this, SLOT(file_update()));
file_update();
}
示例8: ConfigureContextMenu
void TFileAttachmentWidget::ConfigureContextMenu()
{
/** Register all actions to be displayed in ctx menu in a table widget (it should have configured
ContextMenuPolicy to ActionsContextMenu).
*/
ui->attachmentTable->addAction(ui->actionAdd);
ui->attachmentTable->addAction(ui->actionDel);
ui->attachmentTable->addAction(ui->actionSave);
ui->attachmentTable->addAction(ui->actionRename);
QAction* sep = new QAction(this);
sep->setSeparator(true);
ui->attachmentTable->addAction(sep);
ui->attachmentTable->addAction(ui->actionSelectAll);
}
示例9: 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));
}
示例10: QAction
QList<QAction *> QgsGeoPackageCollectionItem::actions( QWidget *parent )
{
QList<QAction *> lst = QgsDataCollectionItem::actions( parent );
if ( QgsOgrDbConnection::connectionList( QStringLiteral( "GPKG" ) ).contains( mName ) )
{
QAction *actionDeleteConnection = new QAction( tr( "Remove Connection" ), parent );
connect( actionDeleteConnection, &QAction::triggered, this, &QgsGeoPackageConnectionItem::deleteConnection );
lst.append( actionDeleteConnection );
}
else
{
// Add to stored connections
QAction *actionAddConnection = new QAction( tr( "Add Connection" ), parent );
connect( actionAddConnection, &QAction::triggered, this, &QgsGeoPackageCollectionItem::addConnection );
lst.append( actionAddConnection );
}
// Add table to existing DB
QAction *actionAddTable = new QAction( tr( "Create a New Layer or Table…" ), parent );
connect( actionAddTable, &QAction::triggered, this, &QgsGeoPackageCollectionItem::addTable );
lst.append( actionAddTable );
QAction *sep = new QAction( parent );
sep->setSeparator( true );
lst.append( sep );
QString message = QObject::tr( "Delete %1…" ).arg( mName );
QAction *actionDelete = new QAction( message, parent );
// IMPORTANT - we need to capture the stuff we need, and then hand the slot
// off to a static method. This is because it's possible for this item
// to be deleted in the background on us (e.g. by a parent directory refresh)
const QString path = mPath;
QPointer< QgsDataItem > parentItem( mParent );
connect( actionDelete, &QAction::triggered, this, [ path, parentItem ]
{
deleteGpkg( path, parentItem );
} );
lst.append( actionDelete );
// Run VACUUM
QAction *actionVacuumDb = new QAction( tr( "Compact Database (VACUUM)" ), parent );
connect( actionVacuumDb, &QAction::triggered, this, &QgsGeoPackageConnectionItem::vacuumGeoPackageDbAction );
lst.append( actionVacuumDb );
return lst;
}
示例11: QActionGroup
PreviewActionGroup::PreviewActionGroup(QDesignerFormEditorInterface *core, QObject *parent) :
QActionGroup(parent),
m_core(core)
{
/* Create a list of up to MaxDeviceActions invisible actions to be
* populated with device profiles (actiondata: index) followed by the
* standard style actions (actiondata: style name). */
connect(this, SIGNAL(triggered(QAction*)), this, SLOT(slotTriggered(QAction*)));
setExclusive(true);
const QString objNamePostfix = QStringLiteral("_action");
// Create invisible actions for devices. Set index as action data.
QString objNamePrefix = QStringLiteral("__qt_designer_device_");
for (int i = 0; i < MaxDeviceActions; i++) {
QAction *a = new QAction(this);
QString objName = objNamePrefix;
objName += QString::number(i);
objName += objNamePostfix;
a->setObjectName(objName);
a->setVisible(false);
a->setData(i);
addAction(a);
}
// Create separator at index MaxDeviceActions
QAction *sep = new QAction(this);
sep->setObjectName(QStringLiteral("__qt_designer_deviceseparator"));
sep->setSeparator(true);
sep->setVisible(false);
addAction(sep);
// Populate devices
updateDeviceProfiles();
// Add style actions
const QStringList styles = QStyleFactory::keys();
const QStringList::const_iterator cend = styles.constEnd();
// Make sure ObjectName is unique in case toolbar solution is used.
objNamePrefix = QStringLiteral("__qt_designer_style_");
// Create styles. Set style name string as action data.
for (QStringList::const_iterator it = styles.constBegin(); it != cend ;++it) {
QAction *a = new QAction(tr("%1 Style").arg(*it), this);
QString objName = objNamePrefix;
objName += *it;
objName += objNamePostfix;
a->setObjectName(objName);
a->setData(*it);
addAction(a);
}
}
示例12: QAction
QAction *ToolBarEventFilter::createAction(QDesignerFormWindowInterface *fw, const QString &objectName, bool separator)
{
QAction *action = new QAction(fw);
fw->core()->widgetFactory()->initialize(action);
if (separator)
action->setSeparator(true);
action->setObjectName(objectName);
fw->ensureUniqueObjectName(action);
qdesigner_internal::AddActionCommand *cmd = new qdesigner_internal::AddActionCommand(fw);
cmd->init(action);
fw->commandHistory()->push(cmd);
return action;
}
示例13: QAction
void Qtilities::CoreGui::MenuContainer::addSeperator(const QString &before) {
QAction* sep = new QAction(d->this_menu);
sep->setSeparator(true);
// Find the action with the given string.
QList<QString> actions = d->id_action_map.keys();
int count = actions.count();
for (int i = 0; i < count; ++i) {
if (actions.at(i) == before) {
d->this_menu->insertAction(d->id_action_map[actions.at(i)],sep);
return;
}
}
d->this_menu->addSeparator();
}
示例14: QDesignerTaskMenu
LabelTaskMenu::LabelTaskMenu(QLabel *label, QObject *parent)
: QDesignerTaskMenu(label, parent),
m_label(label),
m_editRichTextAction(new QAction(tr("Change rich text..."), this)),
m_editPlainTextAction(new QAction(tr("Change plain text..."), this))
{
LabelTaskMenuInlineEditor *editor = new LabelTaskMenuInlineEditor(label, this);
connect(m_editPlainTextAction, SIGNAL(triggered()), editor, SLOT(editText()));
m_taskActions.append(m_editPlainTextAction);
connect(m_editRichTextAction, SIGNAL(triggered()), this, SLOT(editRichText()));
m_taskActions.append(m_editRichTextAction);
QAction *sep = new QAction(this);
sep->setSeparator(true);
m_taskActions.append(sep);
}
示例15: initActions
void RobotsPlugin::initActions()
{
m2dModelAction = new QAction(QIcon(":/icons/kcron.png"), QObject::tr("2d model"), NULL);
ActionInfo d2ModelActionInfo(m2dModelAction, "interpreters", "tools");
QObject::connect(m2dModelAction, SIGNAL(triggered()), this, SLOT(show2dModel()));
mRunAction = new QAction(QIcon(":/icons/robots_run.png"), QObject::tr("Run"), NULL);
ActionInfo runActionInfo(mRunAction, "interpreters", "tools");
QObject::connect(mRunAction, SIGNAL(triggered()), &mInterpreter, SLOT(interpret()));
mStopRobotAction = new QAction(QIcon(":/icons/robots_stop.png"), QObject::tr("Stop robot"), NULL);
ActionInfo stopRobotActionInfo(mStopRobotAction, "interpreters", "tools");
QObject::connect(mStopRobotAction, SIGNAL(triggered()), &mInterpreter, SLOT(stopRobot()));
mConnectToRobotAction = new QAction(QIcon(":/icons/robots_connect.png"), QObject::tr("Connect to robot"), NULL);
mConnectToRobotAction->setCheckable(true);
ActionInfo connectToRobotActionInfo(mConnectToRobotAction, "interpreters", "tools");
mInterpreter.setConnectRobotAction(mConnectToRobotAction);
QObject::connect(mConnectToRobotAction, SIGNAL(triggered()), &mInterpreter, SLOT(connectToRobot()));
mRobotSettingsAction = new QAction(QIcon(":/icons/robots_settings.png"), QObject::tr("Robot settings"), NULL);
ActionInfo robotSettingsActionInfo(mRobotSettingsAction, "interpreters", "tools");
QObject::connect(mRobotSettingsAction, SIGNAL(triggered()), this, SLOT(showRobotSettings()));
mTitlesAction = new QAction(tr("Text under pictogram"), NULL);
mTitlesAction->setCheckable(true);
connect(mTitlesAction, SIGNAL(toggled(bool)), this, SLOT(titlesVisibilityChecked(bool)));
ActionInfo titlesActionInfo(mTitlesAction, "", "settings");
QAction *separator = new QAction(NULL);
ActionInfo separatorActionInfo(separator, "interpreters", "tools");
separator->setSeparator(true);
mActionInfos << d2ModelActionInfo << runActionInfo
<< stopRobotActionInfo << connectToRobotActionInfo
<< separatorActionInfo << robotSettingsActionInfo
<< titlesActionInfo;
// Set tabs, unused at the opening, enabled
bool isTabEnable = false;
QList<ActionInfo> unusedTab;
unusedTab << d2ModelActionInfo << runActionInfo << stopRobotActionInfo
<< connectToRobotActionInfo << titlesActionInfo;
changeActiveTab(unusedTab, isTabEnable);
}