本文整理汇总了C++中QPopupMenu::insertSeparator方法的典型用法代码示例。如果您正苦于以下问题:C++ QPopupMenu::insertSeparator方法的具体用法?C++ QPopupMenu::insertSeparator怎么用?C++ QPopupMenu::insertSeparator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPopupMenu
的用法示例。
在下文中一共展示了QPopupMenu::insertSeparator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupFileActions
void TextEdit::setupFileActions()
{
QToolBar *tb = new QToolBar( this );
QPopupMenu *menu = new QPopupMenu( this );
menuBar()->insertItem( tr( "&File" ), menu );
QAction *a;
a = new QAction( tr( "New" ), QPixmap( "textdrawing/filenew.png" ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" );
connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
a->addTo( tb );
a->addTo( menu );
a = new QAction( tr( "Open" ), QPixmap( "textdrawing/fileopen.png" ), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" );
connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
a->addTo( tb );
a->addTo( menu );
menu->insertSeparator();
a = new QAction( tr( "Save" ), QPixmap( "textdrawing/filesave.png" ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" );
connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
a->addTo( tb );
a->addTo( menu );
a = new QAction( tr( "Save As" ), QPixmap(), tr( "Save &As..." ), 0, this, "fileSaveAs" );
connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
a->addTo( menu );
menu->insertSeparator();
a = new QAction( tr( "Print" ), QPixmap( "textdrawing/print.png" ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
a->addTo( tb );
a->addTo( menu );
a = new QAction( tr( "Close" ), QPixmap(), tr( "&Close" ), 0, this, "fileClose" );
connect( a, SIGNAL( activated() ), this, SLOT( fileClose() ) );
a->addTo( menu );
}
示例2: context
void CoverageView::context(QListViewItem* i, const QPoint & p, int c)
{
QPopupMenu popup;
TraceFunction* f = 0;
if (i) {
f = _showCallers ?
((CallerCoverageItem*)i)->function() :
((CalleeCoverageItem*)i)->function();
}
if (f) {
QString name = f->name();
if ((int)name.length()>Configuration::maxSymbolLength())
name = name.left(Configuration::maxSymbolLength()) + "...";
popup.insertItem(i18n("Go to '%1'").arg(name), 93);
popup.insertSeparator();
}
if ((c == 0) || (!_showCallers && c == 1)) {
addCostMenu(&popup, false);
popup.insertSeparator();
}
addGoMenu(&popup);
int r = popup.exec(p);
if (r == 93) activated(f);
}
示例3: showPopupMenu
void KonqSidebarBookmarkModule::showPopupMenu()
{
KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem*>( tree()->selectedItem() );
if (!bi)
return;
bool tabSupported = tree()->tabSupport();
QPopupMenu *menu = new QPopupMenu;
if (bi->bookmark().isGroup()) {
if (tabSupported) {
m_collection->action("folder_open_tabs")->plug(menu);
menu->insertSeparator();
}
m_collection->action("create_folder")->plug(menu);
m_collection->action("delete_folder")->plug(menu);
} else {
m_collection->action("open_window")->plug(menu);
if (tabSupported)
m_collection->action("open_tab")->plug(menu);
m_collection->action("copy_location")->plug(menu);
menu->insertSeparator();
m_collection->action("create_folder")->plug(menu);
m_collection->action("delete_bookmark")->plug(menu);
}
menu->insertSeparator();
m_collection->action("item_properties")->plug(menu);
menu->exec( QCursor::pos() );
delete menu;
}
示例4: context
void SourceView::context(QListViewItem* i, const QPoint & p, int c)
{
QPopupMenu popup;
// Menu entry:
TraceLineCall* lc = i ? ((SourceItem*) i)->lineCall() : 0;
TraceLineJump* lj = i ? ((SourceItem*) i)->lineJump() : 0;
TraceFunction* f = lc ? lc->call()->called() : 0;
TraceLine* line = lj ? lj->lineTo() : 0;
if (f) {
QString name = f->name();
if ((int)name.length()>Configuration::maxSymbolLength())
name = name.left(Configuration::maxSymbolLength()) + "...";
popup.insertItem(i18n("Go to '%1'").arg(name), 93);
popup.insertSeparator();
}
else if (line) {
popup.insertItem(i18n("Go to Line %1").arg(line->name()), 93);
popup.insertSeparator();
}
if ((c == 1) || (c == 2)) {
addCostMenu(&popup);
popup.insertSeparator();
}
addGoMenu(&popup);
int r = popup.exec(p);
if (r == 93) {
if (f) activated(f);
if (line) activated(line);
}
}
示例5: contextMenuEvent
void dnd::contextMenuEvent ( QContextMenuEvent * )
{
QString path = INSTALLDIR"images/";
QString snewtask = path + "add.png";
QString soptions = path + "preferences.png";
QString sabout = path + "about.png";
QString sexit = path + "exit.png";
QPixmap pix_newtask(snewtask);
QPixmap pix_options(soptions);
QPixmap pix_about(sabout);
QPixmap pix_exit(sexit);
QPopupMenu* contextMenu = new QPopupMenu( this );
Q_CHECK_PTR( contextMenu );
QLabel *caption = new QLabel(tr("<font color=darkblue><u><b>wdget</b></u></font>"), this );
caption->setAlignment( Qt::AlignCenter );
contextMenu->insertSeparator();
contextMenu->insertItem( caption );
contextMenu->insertSeparator();
contextMenu->insertItem(pix_newtask, tr("New task"), dmw, SLOT(fileNewUrl()) );
contextMenu->insertItem(pix_options, tr("Setting..."), dmw, SLOT(filePref()) );
contextMenu->insertItem(pix_about, tr("About..."), dmw, SLOT(helpAbout()) );
contextMenu->insertItem(pix_exit, tr("Quit"), dmw, SLOT(fileExit()) );
contextMenu->exec( QCursor::pos() );
delete contextMenu;
}
示例6: QMainWindow
SoundPlayer::SoundPlayer() :
QMainWindow(),
bucket3("sounds/3.wav"),
bucket4("sounds/4.wav")
{
if (!QSound::available()) {
// Bail out. Programs in which sound is not critical
// could just silently (hehe) ignore the lack of a server.
//
QMessageBox::warning(this,"No Sound",
"<p><b>Sorry, you are not running the Network Audio System.</b>"
"<p>If you have the `au' command, run it in the background before this program. "
"The latest release of the Network Audio System can be obtained from:"
"<pre>\n"
" \n"
" ftp.ncd.com:/pub/ncd/technology/src/nas\n"
" ftp.x.org:/contrib/audio/nas\n"
"</pre>"
"<p>Release 1.2 of NAS is also included with the X11R6"
"contrib distribution."
"<p>After installing NAS, you will then need to reconfigure Qt with NAS sound support");
}
QPopupMenu *file = new QPopupMenu;
file->insertItem("Play &1", this, SLOT(doPlay1()), CTRL+Key_1);
file->insertItem("Play &2", this, SLOT(doPlay2()), CTRL+Key_2);
file->insertItem("Play from bucket &3", this, SLOT(doPlay3()), CTRL+Key_3);
file->insertItem("Play from bucket &4", this, SLOT(doPlay4()), CTRL+Key_4);
file->insertSeparator();
file->insertItem("Play 3 and 4 together", this, SLOT(doPlay34()));
file->insertItem("Play all together", this, SLOT(doPlay1234()));
file->insertSeparator();
file->insertItem("E&xit", qApp, SLOT(quit()));
menuBar()->insertItem("&File", file);
}
示例7: createPopupMenu
QPopupMenu* KDiffTextEdit::createPopupMenu( const QPoint& p )
{
QPopupMenu* popup = QTextEdit::createPopupMenu( p );
if ( !popup )
popup = new QPopupMenu( this );
int i = 0;
for ( QStringList::Iterator it = extPartsTranslated.begin(); it != extPartsTranslated.end(); ++it ) {
popup->insertItem( i18n( "Show in %1" ).arg( *it ), i + POPUP_BASE, i );
i++;
}
if ( !extPartsTranslated.isEmpty() )
popup->insertSeparator( i );
connect( popup, SIGNAL(activated(int)), this, SLOT(popupActivated(int)) );
popup->insertItem( SmallIconSet( "filesaveas" ), i18n( "&Save As..." ), this, SLOT(saveAs()), CTRL + Key_S, POPUP_BASE - 2, 0 );
popup->setItemEnabled( POPUP_BASE - 2, length() > 0 );
popup->insertSeparator( 1 );
popup->insertItem( i18n( "Highlight Syntax" ), this, SLOT(toggleSyntaxHighlight()), 0, POPUP_BASE - 1, 2 );
popup->setItemChecked( POPUP_BASE - 1, _highlight );
popup->insertSeparator( 3 );
popup->insertSeparator();
popup->insertItem( i18n("Hide view"), parent(), SLOT(hideView()) );
return popup;
}
示例8: showToplevelContextMenu
void KonqSidebarTree::showToplevelContextMenu()
{
KonqSidebarTreeTopLevelItem *item = 0;
KonqSidebarTreeItem *treeItem = currentItem();
if (treeItem && treeItem->isTopLevelItem())
item = static_cast<KonqSidebarTreeTopLevelItem *>(treeItem);
if (!m_collection)
{
m_collection = new KActionCollection( this, "bookmark actions" );
(void) new KAction( i18n("&Create New Folder..."), "folder_new", 0, this,
SLOT( slotCreateFolder() ), m_collection, "create_folder");
(void) new KAction( i18n("Delete Folder"), "editdelete", 0, this,
SLOT( slotDelete() ), m_collection, "delete_folder");
(void) new KAction( i18n("Rename"), 0, this,
SLOT( slotRename() ), m_collection, "rename");
(void) new KAction( i18n("Delete Link"), "editdelete", 0, this,
SLOT( slotDelete() ), m_collection, "delete_link");
(void) new KAction( i18n("Properties"), "edit", 0, this,
SLOT( slotProperties() ), m_collection, "item_properties");
(void) new KAction( i18n("Open in New Window"), "window_new", 0, this,
SLOT( slotOpenNewWindow() ), m_collection, "open_window");
(void) new KAction( i18n("Open in New Tab"), "tab_new", 0, this,
SLOT( slotOpenTab() ), m_collection, "open_tab");
(void) new KAction( i18n("Copy Link Address"), "editcopy", 0, this,
SLOT( slotCopyLocation() ), m_collection, "copy_location");
}
QPopupMenu *menu = new QPopupMenu;
if (item) {
if (item->isTopLevelGroup()) {
m_collection->action("rename")->plug(menu);
m_collection->action("delete_folder")->plug(menu);
menu->insertSeparator();
m_collection->action("create_folder")->plug(menu);
} else {
if (tabSupport())
m_collection->action("open_tab")->plug(menu);
m_collection->action("open_window")->plug(menu);
m_collection->action("copy_location")->plug(menu);
menu->insertSeparator();
m_collection->action("rename")->plug(menu);
m_collection->action("delete_link")->plug(menu);
}
menu->insertSeparator();
m_collection->action("item_properties")->plug(menu);
} else {
m_collection->action("create_folder")->plug(menu);
}
m_currentTopLevelItem = item;
menu->exec( QCursor::pos() );
delete menu;
m_currentTopLevelItem = 0;
}
示例9: slotContextMenuRequested
void KURLBar::slotContextMenuRequested(QListBoxItem *_item, const QPoint &pos)
{
if(m_isImmutable)
return;
KURLBarItem *item = dynamic_cast< KURLBarItem * >(_item);
static const int IconSize = 10;
static const int AddItem = 20;
static const int EditItem = 30;
static const int RemoveItem = 40;
KURL lastURL = m_activeItem ? m_activeItem->url() : KURL();
bool smallIcons = m_iconSize < KIcon::SizeMedium;
QPopupMenu *popup = new QPopupMenu();
popup->insertItem(smallIcons ? i18n("&Large Icons") : i18n("&Small Icons"), IconSize);
popup->insertSeparator();
if(item != 0L && item->isPersistent())
{
popup->insertItem(SmallIconSet("edit"), i18n("&Edit Entry..."), EditItem);
popup->insertSeparator();
}
popup->insertItem(SmallIconSet("filenew"), i18n("&Add Entry..."), AddItem);
if(item != 0L && item->isPersistent())
{
popup->insertItem(SmallIconSet("editdelete"), i18n("&Remove Entry"), RemoveItem);
}
int result = popup->exec(pos);
switch(result)
{
case IconSize:
setIconSize(smallIcons ? KIcon::SizeMedium : KIcon::SizeSmallMedium);
m_listBox->triggerUpdate(true);
break;
case AddItem:
addNewItem();
break;
case EditItem:
editItem(static_cast< KURLBarItem * >(item));
break;
case RemoveItem:
delete item;
m_isModified = true;
break;
default: // abort
break;
}
// reset current item
m_activeItem = 0L;
setCurrentItem(lastURL);
}
示例10: SLOT
void
SupplierAdmin::contextMenu(QPopupMenu& _menu)
{
_menu.insertItem("Create supplier", this, SLOT(createProxyPushConsumer()));
_menu.insertSeparator();
notifyPublish_->contextMenu(_menu);
_menu.insertSeparator();
_menu.insertItem("Destroy", this, SLOT(destroy()));
}
示例11: SLOT
void
ParameterXML::contextMenu(QPopupMenu& _menu)
{
_menu.insertItem("Set Parameters", this, SLOT(slotSetParameters()));
_menu.insertSeparator();
_menu.insertItem("Up", this, SLOT(up()));
_menu.insertItem("Down", this, SLOT(down()));
_menu.insertSeparator();
_menu.insertItem("Delete", this, SLOT(slotDelete()));
}
示例12: SmallIconSet
QPopupMenu *KLineEdit::createPopupMenu()
{
enum { IdUndo, IdRedo, IdSep1, IdCut, IdCopy, IdPaste, IdClear, IdSep2, IdSelectAll };
QPopupMenu *popup = QLineEdit::createPopupMenu();
int id = popup->idAt(0);
popup->changeItem( id - IdUndo, SmallIconSet("undo"), popup->text( id - IdUndo) );
popup->changeItem( id - IdRedo, SmallIconSet("redo"), popup->text( id - IdRedo) );
popup->changeItem( id - IdCut, SmallIconSet("editcut"), popup->text( id - IdCut) );
popup->changeItem( id - IdCopy, SmallIconSet("editcopy"), popup->text( id - IdCopy) );
popup->changeItem( id - IdPaste, SmallIconSet("editpaste"), popup->text( id - IdPaste) );
popup->changeItem( id - IdClear, SmallIconSet("editclear"), popup->text( id - IdClear) );
// If a completion object is present and the input
// widget is not read-only, show the Text Completion
// menu item.
if ( compObj() && !isReadOnly() && kapp->authorize("lineedit_text_completion") )
{
QPopupMenu *subMenu = new QPopupMenu( popup );
connect( subMenu, SIGNAL( activated( int ) ),
this, SLOT( completionMenuActivated( int ) ) );
popup->insertSeparator();
popup->insertItem( SmallIconSet("completion"), i18n("Text Completion"),
subMenu );
subMenu->insertItem( i18n("None"), NoCompletion );
subMenu->insertItem( i18n("Manual"), ShellCompletion );
subMenu->insertItem( i18n("Automatic"), AutoCompletion );
subMenu->insertItem( i18n("Dropdown List"), PopupCompletion );
subMenu->insertItem( i18n("Short Automatic"), ShortAutoCompletion );
subMenu->insertItem( i18n("Dropdown List && Automatic"), PopupAutoCompletion );
subMenu->setAccel( KStdAccel::completion(), ShellCompletion );
KGlobalSettings::Completion mode = completionMode();
subMenu->setItemChecked( NoCompletion,
mode == KGlobalSettings::CompletionNone );
subMenu->setItemChecked( ShellCompletion,
mode == KGlobalSettings::CompletionShell );
subMenu->setItemChecked( PopupCompletion,
mode == KGlobalSettings::CompletionPopup );
subMenu->setItemChecked( AutoCompletion,
mode == KGlobalSettings::CompletionAuto );
subMenu->setItemChecked( ShortAutoCompletion,
mode == KGlobalSettings::CompletionMan );
subMenu->setItemChecked( PopupAutoCompletion,
mode == KGlobalSettings::CompletionPopupAuto );
if ( mode != KGlobalSettings::completionMode() )
{
subMenu->insertSeparator();
subMenu->insertItem( i18n("Default"), Default );
}
}
示例13: unifont
Editor::Editor( QWidget * parent , const char * name )
: QWidget( parent, name, WDestructiveClose )
{
m = new QMenuBar( this, "menu" );
QPopupMenu * file = new QPopupMenu();
Q_CHECK_PTR( file );
m->insertItem( "&File", file );
file->insertItem( "&New", this, SLOT(newDoc()), ALT+Key_N );
file->insertItem( "&Open...", this, SLOT(load()), ALT+Key_O );
file->insertItem( "&Save...", this, SLOT(save()), ALT+Key_S );
file->insertSeparator();
open_as = new QPopupMenu();
file->insertItem( "Open &As", open_as );
save_as = new QPopupMenu();
file->insertItem( "Sa&ve As", save_as );
file->insertItem( "Add &Encoding", this, SLOT(addEncoding()) );
#ifndef QT_NO_PRINTER
file->insertSeparator();
file->insertItem( "&Print...", this, SLOT(print()), ALT+Key_P );
#endif
file->insertSeparator();
file->insertItem( "&Close", this, SLOT(close()),ALT+Key_W );
file->insertItem( "&Quit", qApp, SLOT(closeAllWindows()), ALT+Key_Q );
connect( save_as, SIGNAL(activated(int)), this, SLOT(saveAsEncoding(int)) );
connect( open_as, SIGNAL(activated(int)), this, SLOT(openAsEncoding(int)) );
rebuildCodecList();
QPopupMenu * edit = new QPopupMenu();
Q_CHECK_PTR( edit );
m->insertItem( "&Edit", edit );
edit->insertItem( "To &Uppercase", this, SLOT(toUpper()), ALT+Key_U );
edit->insertItem( "To &Lowercase", this, SLOT(toLower()), ALT+Key_L );
#ifndef QT_NO_FONTDIALOG
edit->insertSeparator();
edit->insertItem( "&Select Font" , this, SLOT(font()), ALT+Key_T );
#endif
changed = FALSE;
e = new QMultiLineEdit( this, "editor" );
connect( e, SIGNAL( textChanged() ), this, SLOT( textChanged() ) );
// We use Unifont - if you have it installed you'll see all
// Unicode character glyphs.
//
// Unifont only comes in one pixel size, so we cannot let
// it change pixel size as the display DPI changes.
//
QFont unifont("unifont",16,50); unifont.setPixelSize(16);
e->setFont( unifont );
e->setFocus();
}
示例14: QPopupMenu
QPopupMenu *CInnoDBStatus::createPopupMenu(const QPoint &)
{
QPopupMenu *menu = new QPopupMenu(this);
int copy_id = menu->insertItem(getPixmapIcon("copyIcon"), tr("&Copy"), this, SLOT(copy()));
menu->setItemEnabled(copy_id, hasSelectedText());
menu->insertSeparator();
menu->insertItem(getPixmapIcon("saveIcon"), tr("&Save"), this, SLOT(save()));
menu->insertSeparator();
menu->insertItem(getPixmapIcon("refreshIcon"), tr("&Refresh"), this, SLOT(refresh()));
return menu;
}
示例15: if
void
PatternWidgetClass::mousePressEvent(QMouseEvent* event)
{
// left button //
if (event->button() == LeftButton) {
// are we in the addTransitionMode ? //
if (getView().isAddTransitionMode()) {
getView().endAddTransition(this);
}
// else, save the click position for a possible move //
else {
pickedPos = event->pos();
}
}
// right button -> popup menu //
else if (event->button() == RightButton) {
// popup menu //
QPopupMenu menu;
menuAddBehaviour_ = new QPopupMenu(&menu);
menu.insertItem("Start pattern", this, SLOT(onSetStart()));
menu.insertSeparator();
menu.insertItem("Add behaviour", menuAddBehaviour_);
menu.insertItem("Add transition", this, SLOT(onAddTransition()));
menu.insertSeparator();
menu.insertItem("Rename pattern", this, SLOT(onRenamePattern()));
menu.insertItem("Rename transition", this, SLOT(onRenameTransition()));
menu.insertItem("Delete pattern", this, SLOT(onDelete()));
// submenu: add all behaviour names //
Generator::GroupMap::const_iterator first, last;
PolicyConfigClass::instance()->description().getGroupedClasses("behaviour", first, last);
for (; first != last; ++first) {
if (first->second.isFinal() &&
!getDocument().hasBehaviour(patternName, first->second.name())) {
menuAddBehaviour_->insertItem(first->second.name());
}
}
connect(menuAddBehaviour_, SIGNAL(activated(int)), this, SLOT(onAddBehaviour(int)));
// show popup menu
menu.exec(QCursor::pos());
}