本文整理汇总了C++中KMenu::addSeparator方法的典型用法代码示例。如果您正苦于以下问题:C++ KMenu::addSeparator方法的具体用法?C++ KMenu::addSeparator怎么用?C++ KMenu::addSeparator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KMenu
的用法示例。
在下文中一共展示了KMenu::addSeparator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contextMenu
void TabBar::contextMenu(int tab, const QPoint &pos)
{
KActionMenu *closedTabsMenu = setupHistoryActions();
m_actualIndex = tab;
KMenu menu;
MainWindow *mainWindow = rApp->mainWindow();
menu.addAction(mainWindow->actionByName(QL1S("new_tab")));
menu.addAction(mainWindow->actionByName(QL1S("clone_tab")));
if (count() > 1)
{
menu.addAction(mainWindow->actionByName(QL1S("detach_tab")));
}
menu.addAction(mainWindow->actionByName(QL1S("open_last_closed_tab")));
menu.addAction(closedTabsMenu);
menu.addSeparator();
menu.addAction(mainWindow->actionByName(QL1S("close_tab")));
if (count() > 1)
{
menu.addAction(mainWindow->actionByName(QL1S("close_other_tabs")));
}
menu.addSeparator();
menu.addAction(mainWindow->actionByName(QL1S("reload_tab")));
if (count() > 1)
{
menu.addAction(mainWindow->actionByName(QL1S("reload_all_tabs")));
}
menu.exec(pos);
}
示例2: KStatusNotifierItem
/** class Tray
* Reimplementation of the KStatusNotifierItem class
*/
Tray::Tray(MainWindow * parent)
: KStatusNotifierItem(parent)
{
// set up the context menu
KMenu * cm = contextMenu();
cm->addAction( parent->actionCollection()->action("new_download") );
cm->addAction( parent->actionCollection()->action("import_links") );
cm->addSeparator();
cm->addAction( parent->actionCollection()->action("start_all_download") );
cm->addAction( parent->actionCollection()->action("stop_all_download") );
cm->addSeparator();
cm->addAction( parent->actionCollection()->action("konqueror_integration") );
cm->addAction( parent->actionCollection()->action("options_configure") );
// Set up basic tray parameters
setCategory(ApplicationStatus);
setIconByName("kget");
setTitle(i18n("KGet"));
setContextMenu(cm);
setAssociatedWidget(parent);
setToolTipIconByName("kget");
setToolTipTitle(i18n("Download Manager"));
// Not of much use atm, but maybe we want to set this later?
// setToolTipSubTitle("[..]");
// filter middle mouse clicks to ask scheduler to paste URL
connect( this, SIGNAL(secondaryActivateRequested(QPoint)),
this, SLOT(slotActivated()) );
}
示例3: setupMenuFile
void KUI_project::setupMenuFile()
{
KMenu *fileMenu = new KMenu(i18n("&File"),this);
KAction *action = KStandardAction::openNew(this, SLOT(newProjectDialogSlot()), collection);
fileMenu->addAction(collection->addAction("new_file", action));
fileMenu->addSeparator();
action = KStandardAction::open(this, SLOT(openFileSlot()), collection);
fileMenu->addAction(collection->addAction("open_file", action));
action = KStandardAction::save(this, SLOT(saveFileSlot()), collection);
action->setEnabled(false);
//fileMenu->addAction(collection->addAction("save_file", action));
action = KStandardAction::saveAs(this, SLOT(saveAsFileSlot()), collection);
action->setEnabled(false);
//fileMenu->addAction(collection->addAction("save_as_file", action));
fileMenu->addSeparator();
action = KStandardAction::quit(this, SLOT(close()), collection);
fileMenu->addAction(collection->addAction("quit", action));
menuBar->addMenu(fileMenu);
}
示例4: setServiceMenu
void Configuration::setServiceMenu()
{
KMenu *menu = qobject_cast<KMenu*>(sender());
if (menu->actions().count() > 1)
{
return;
}
KServiceGroup::Ptr rootGroup = KServiceGroup::group(menu->actions()[0]->data().toString());
if (!rootGroup || !rootGroup->isValid() || rootGroup->noDisplay())
{
return;
}
KServiceGroup::List list = rootGroup->entries(true, true, true, true);
QAction *action = menu->addAction(KIcon("list-add"), i18n("Add This Menu"));
action->setData(rootGroup->relPath());
menu->addSeparator();
for (int i = 0; i < list.count(); ++i)
{
if (list.at(i)->isType(KST_KService))
{
const KService::Ptr service = KService::Ptr::staticCast(list.at(i));
action = menu->addAction(KIcon(service->icon()), service->name());
action->setEnabled(false);
}
else if (list.at(i)->isType(KST_KServiceGroup))
{
const KServiceGroup::Ptr group = KServiceGroup::Ptr::staticCast(list.at(i));
if (group->noDisplay() || group->childCount() == 0)
{
continue;
}
KMenu *subMenu = new KMenu(menu);
QAction *action = subMenu->addAction(QString());
action->setData(group->relPath());
action->setVisible(false);
action = menu->addAction(KIcon(group->icon()), group->caption());
action->setMenu(subMenu);
connect(subMenu, SIGNAL(aboutToShow()), this, SLOT(setServiceMenu()));
}
else if (list.at(i)->isType(KST_KServiceSeparator))
{
menu->addSeparator();
}
}
}
示例5: KMenu
void
BlockAnalyzer::contextMenuEvent( QContextMenuEvent * )
{
KMenu *menu = new KMenu( this );
menu->setTitle( i18n( "Framerate" ) );
QAction *a = menu->addAction( i18n("50 fps"), this, SLOT( set50fps() ) );
if( timeout() == 50 ) a->setChecked( true );
a = menu->addAction( i18n("33 fps"), this, SLOT( set33fps() ) );
if( timeout() == 33 ) a->setChecked( true );
a = menu->addAction( i18n("25 fps"), this, SLOT( set25fps() ) );
if( timeout() == 25 ) a->setChecked( true );
a = menu->addAction( i18n("20 fps"), this, SLOT( set20fps() ) );
if( timeout() == 20 ) a->setChecked( true );
a = menu->addAction( i18n("10 fps"), this, SLOT( set10fps() ) );
if( timeout() == 10 ) a->setChecked( true );
#if defined HAVE_LIBVISUAL
menu->addSeparator();
menu->addAction( Amarok::actionCollection()->action( "visualizations" ) );
#endif
menu->exec();
}
示例6: contextMenu
void Container::contextMenu( int currentTab, QPoint pos )
{
KMenu menu;
emit tabContextMenuRequested(viewForWidget(widget(currentTab)), &menu);
menu.addSeparator();
QAction* closeTabAction = menu.addAction( KIcon("document-close"), i18n( "Close File" ) );
QAction* closeOtherTabsAction = menu.addAction( KIcon("document-close"), i18n( "Close Other Files" ) );
QAction* closeAllTabsAction = menu.addAction( KIcon("document-close"), i18n( "Close All Files" ) );
QAction* triggered = menu.exec(pos);
if (triggered) {
if ( triggered == closeTabAction ) {
closeRequest(currentTab);
} else if ( triggered == closeOtherTabsAction ) {
// activate the remaining tab
widgetActivated(currentTab);
// first get the widgets to be closed since otherwise the indices will be wrong
QList<QWidget*> otherTabs;
for ( int i = 0; i < count(); ++i ) {
if ( i != currentTab ) {
otherTabs << widget(i);
}
}
// finally close other tabs
foreach( QWidget* tab, otherTabs ) {
closeRequest(tab);
}
} else if ( triggered == closeAllTabsAction ) {
示例7: themeMenuAboutToShow
void Widget::themeMenuAboutToShow()
{
if ( !d->mStorageModel )
return;
KMenu * menu = dynamic_cast< KMenu * >( sender() );
if ( !menu )
return;
menu->clear();
menu->addTitle( i18n( "Theme" ) );
QActionGroup * grp = new QActionGroup( menu );
const QHash< QString, Theme * > & themes = Manager::instance()->themes();
QAction * act;
QList< const Theme * > sortedThemes;
for ( QHash< QString, Theme * >::ConstIterator ci = themes.constBegin(); ci != themes.constEnd(); ++ci )
{
int idx = 0;
int cnt = sortedThemes.count();
while ( idx < cnt )
{
if ( sortedThemes.at( idx )->name() > ( *ci )->name() )
{
sortedThemes.insert( idx, *ci );
break;
}
idx++;
}
if ( idx == cnt )
sortedThemes.append( *ci );
}
for ( QList< const Theme * >::ConstIterator it = sortedThemes.constBegin(); it != sortedThemes.constEnd(); ++it )
{
act = menu->addAction( ( *it )->name() );
act->setCheckable( true );
grp->addAction( act );
act->setChecked( d->mLastThemeId == ( *it )->id() );
act->setData( QVariant( ( *it )->id() ) );
connect( act, SIGNAL( triggered( bool ) ),
SLOT( themeSelected( bool ) ) );
}
menu->addSeparator();
act = menu->addAction( i18n( "Configure..." ) );
connect( act, SIGNAL( triggered( bool ) ),
SLOT( configureThemes() ) );
}
示例8: DemoWidget
DemoWidget() : QWidget()
{
menu = new KMenu("Popup Menu:");
menu->addAction( "Item1" );
menu->addAction( "Item2" );
menu->addSeparator();
QAction *a = new QAction( "Quit", this );
menu->addAction( a );
connect( a, SIGNAL(triggered()), qApp, SLOT(quit()));
}
示例9: contextMenuEvent
void KTNEFMain::contextMenuEvent( QContextMenuEvent *event )
{
QList<KTNEFAttach *> list = mView->getSelection();
if ( !list.count() ) {
return;
}
QAction *view = 0;
QAction *viewWith = 0;
QAction *prop = 0;
KMenu *menu = new KMenu();
if ( list.count() == 1 ) {
view = menu->addAction( KIcon( "document-open" ),
i18nc( "@action:inmenu", "View" ) );
viewWith = menu->addAction( i18nc( "@action:inmenu", "View With..." ) );
menu->addSeparator();
}
QAction *extract = menu->addAction( i18nc( "@action:inmenu", "Extract" ) );
QAction *extractTo = menu->addAction( KIcon( "archive-extract" ),
i18nc( "@action:inmenu", "Extract To..." ) );
if ( list.count() == 1 ) {
menu->addSeparator();
prop = menu->addAction( KIcon( "document-properties" ),
i18nc( "@action:inmenu", "Properties" ) );
}
QAction *a = menu->exec( event->globalPos(), 0 );
if ( a ) {
if ( a == view ) {
viewFile();
} else if ( a == viewWith ) {
viewFileAs();
} else if ( a == extract ) {
extractFile();
} else if ( a == extractTo ) {
extractFileTo();
} else if ( a == prop ) {
propertiesFile();
}
}
delete menu;
}
示例10: KAction
void
AlbumsView::contextMenuEvent( QGraphicsSceneContextMenuEvent *event )
{
KAction *appendAction = new KAction( KIcon( "media-track-add-amarok" ), i18n( "&Append to Playlist" ), this );
KAction *loadAction = new KAction( KIcon( "folder-open" ), i18nc( "Replace the currently loaded tracks with these", "&Load" ), this );
KAction *queueAction = new KAction( KIcon( "media-track-queue-amarok" ), i18n( "&Queue" ), this );
KAction *editAction = new KAction( KIcon( "media-track-edit-amarok" ), i18n( "Edit Track Details" ), this );
connect( appendAction, SIGNAL( triggered() ), this, SLOT( slotAppendSelected() ) );
connect( loadAction , SIGNAL( triggered() ), this, SLOT( slotPlaySelected() ) );
connect( queueAction , SIGNAL( triggered() ), this, SLOT( slotQueueSelected() ) );
connect( editAction , SIGNAL( triggered() ), this, SLOT( slotEditSelected() ) );
KMenu menu;
menu.addAction( appendAction );
menu.addAction( loadAction );
menu.addAction( queueAction );
menu.addSeparator();
menu.addAction( editAction );
QModelIndex index = nativeWidget()->indexAt( event->pos().toPoint() );
if( index.isValid() )
{
QStandardItem *item = static_cast<QStandardItemModel*>( model() )->itemFromIndex( index );
AlbumItem *album = dynamic_cast<AlbumItem*>(item);
if( album )
{
Meta::AlbumPtr albumPtr = album->album();
Meta::CustomActionsCapability *cac = albumPtr->create<Meta::CustomActionsCapability>();
if( cac )
{
QList<PopupDropperAction *> actions = cac->customActions();
menu.addSeparator();
foreach( PopupDropperAction *action, actions )
menu.addAction( action );
}
}
}
menu.exec( event->screenPos() );
}
示例11: addMenuSeparator
QAction* addMenuSeparator(long widget, long menu)
{
Karamba* currTheme = (Karamba*)widget;
KMenu* tmp = (KMenu*)menu;
QAction *sep = 0;
if (menuExists(currTheme, tmp)) {
sep = tmp->addSeparator();
}
return sep;
}
示例12: selectedIndexes
void
ServiceCollectionTreeView::contextMenuEvent( QContextMenuEvent * event )
{
if ( m_playableTracks )
CollectionTreeView::contextMenuEvent( event );
else
{
QModelIndexList indices = selectedIndexes();
if( filterModel() )
{
QModelIndexList tmp;
foreach( const QModelIndex &idx, indices )
{
tmp.append( filterModel()->mapToSource( idx ) );
}
indices = tmp;
}
if( !indices.isEmpty() )
{
KMenu menu;
if( indices.count() == 1 )
{
if( indices.first().isValid() && indices.first().internalPointer() )
{
Meta::DataPtr data = static_cast<CollectionTreeItem*>( indices.first().internalPointer() )->data();
if( data )
{
Meta::CustomActionsCapability *cac = data->create<Meta::CustomActionsCapability>();
if( cac )
{
QList<PopupDropperAction*> actions = cac->customActions();
if( actions.count() )
menu.addSeparator();
foreach( PopupDropperAction *action, actions )
menu.addAction( action );
delete cac;
}
}
}
}
if( menu.actions().count() > 0 )
{
(void)menu.exec( event->globalPos() );
QSet<CollectionTreeItem*> items;
foreach( const QModelIndex &index, indices )
{
if( index.isValid() && index.internalPointer() )
items.insert( static_cast<CollectionTreeItem*>( index.internalPointer() ) );
}
}
示例13: customContextMenuRequested
void ArchiveMailWidget::customContextMenuRequested(const QPoint&)
{
const QList<QTreeWidgetItem *> listItems = mWidget->treeWidget->selectedItems();
KMenu menu;
menu.addAction(i18n("Add..."),this,SLOT(slotAddItem()));
if( !listItems.isEmpty() ) {
if( listItems.count() == 1) {
menu.addAction(i18n("Open Containing Folder..."),this,SLOT(slotOpenFolder()));
}
menu.addSeparator();
menu.addAction(i18n("Delete"),this,SLOT(slotRemoveItem()));
}
menu.exec(QCursor::pos());
}
示例14: selectedIndexes
void
FileView::contextMenuEvent( QContextMenuEvent *e )
{
if( !model() )
return;
//trying to do fancy stuff while showing places only leads to tears!
if( model()->objectName() == "PLACESMODEL" )
{
e->accept();
return;
}
QModelIndexList indices = selectedIndexes();
// Abort if nothing is selected
if( indices.isEmpty() )
return;
KMenu menu;
foreach( QAction *action, actionsForIndices( indices, PlaylistAction ) )
menu.addAction( action );
menu.addSeparator();
// Create Copy/Move to menu items
// ported from old filebrowser
QList<Collections::Collection*> writableCollections;
QHash<Collections::Collection*, CollectionManager::CollectionStatus> hash =
CollectionManager::instance()->collections();
QHash<Collections::Collection*, CollectionManager::CollectionStatus>::const_iterator it =
hash.constBegin();
while( it != hash.constEnd() )
{
Collections::Collection *coll = it.key();
if( coll && coll->isWritable() )
writableCollections.append( coll );
++it;
}
if( !writableCollections.isEmpty() )
{
QMenu *copyMenu = new QMenu( i18n( "Copy to Collection" ), &menu );
copyMenu->setIcon( KIcon( "edit-copy" ) );
foreach( Collections::Collection *coll, writableCollections )
{
CollectionAction *copyAction = new CollectionAction( coll, &menu );
connect( copyAction, SIGNAL(triggered()), this, SLOT(slotPrepareCopyTracks()) );
copyMenu->addAction( copyAction );
}
示例15: popupMenu
KMenu* Contact::popupMenu()
{
KMenu *menu = new KMenu();
QString titleText;
const QString nick = nickName();
if( nick == contactId() )
titleText = QString::fromLatin1( "%1 (%2)" ).arg( contactId(), onlineStatus().description() );
else
titleText = QString::fromLatin1( "%1 <%2> (%3)" ).arg( nick, contactId(), onlineStatus().description() );
menu->addTitle( titleText );
if( metaContact() && metaContact()->isTemporary() && contactId() != account()->myself()->contactId() )
{
KAction *actionAddContact = new KAction( KIcon("list-add-user"), i18n( "&Add to Your Contact List" ), menu );
connect( actionAddContact, SIGNAL(triggered(bool)), this, SLOT(slotAddContact()) );
menu->addAction(actionAddContact);
menu->addSeparator();
}