当前位置: 首页>>代码示例>>C++>>正文


C++ QPopupMenu::exec方法代码示例

本文整理汇总了C++中QPopupMenu::exec方法的典型用法代码示例。如果您正苦于以下问题:C++ QPopupMenu::exec方法的具体用法?C++ QPopupMenu::exec怎么用?C++ QPopupMenu::exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPopupMenu的用法示例。


在下文中一共展示了QPopupMenu::exec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
}
开发者ID:yunlong,项目名称:wdget,代码行数:29,代码来源:dnd.cpp

示例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);
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:28,代码来源:coverageview.cpp

示例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;
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例4: mousePressEvent

void VMemo::mousePressEvent( QMouseEvent *me ) {
    if(!recording) {
        QPopupMenu * menu = new QPopupMenu( this );
        menu->insertItem( tr( "Start recording" ), 0 );
        menu->insertSeparator();
        menu->insertItem( tr( "Settings..." ), 1 );
        QPoint p = mapToGlobal( QPoint( 0, 0 ) );
        QSize s = menu->sizeHint();
        int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ),
                                    p.y() - s.height() ), 0 );

        if ( opt == 0 ) {
            if(!startRecording() ){
                QMessageBox::critical(0, tr("vmemo"), tr("Recording aborted"));
            }
        }
        else if ( opt == 1 ) {
            // Show vmemo settings
            QCopEnvelope e("QPE/Application/sound", "raise()" );
        }

        delete menu;
    }
    else {
        stopRecording();
    }
}
开发者ID:opieproject,项目名称:opie,代码行数:27,代码来源:vmemo.cpp

示例5: 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);
  }
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:34,代码来源:sourceview.cpp

示例6: displayMenu

void CTableFieldChooserListView::displayMenu( QListViewItem *, const QPoint &pos, int )
{
  QPopupMenu *menu = new QPopupMenu();
  menu->insertItem(getPixmapIcon("checkedIcon"), tr("Check All"), 1);
  menu->insertItem(getPixmapIcon("uncheckedIcon"), tr("Clear All"), 2);
  menu->insertSeparator();
  menu->insertItem(getPixmapIcon("refreshTablesIcon"), "Refresh", MENU_REFRESH);
  int res = menu->exec(pos);
  delete menu;
  bool b = false;
  switch (res)
  {
  case 1: b = true;
    break;
  case 2: b = false;
    break;
  case MENU_REFRESH:
    refresh();
    break;
  }

  if (res != MENU_REFRESH)
  {
    QListViewItemIterator it(this);
    for ( ; it.current(); ++it)
      ((CTableFieldChooserListItem *)it.current())->setOn(b);
  }  
}
开发者ID:soundgnome,项目名称:mysqlcc,代码行数:28,代码来源:CTableFieldChooser.cpp

示例7: invokeMenu

void VCFrame::invokeMenu(QPoint point)
{
	QPopupMenu* menu = VCWidget::createMenu();

	// Add menu
	QPopupMenu* addMenu = new QPopupMenu(menu);
	addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/button.png")),
			    "&Button", KVCMenuAddButton);
	addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/slider.png")),
			    "&Slider", KVCMenuAddSlider);
	addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/frame.png")),
			    "&Frame", KVCMenuAddFrame);
	addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/xypad.png")),
			    "&XY-Pad", KVCMenuAddXYPad);
	addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/label.png")),
			    "L&abel", KVCMenuAddLabel);

	menu->insertSeparator();

	menu->insertItem("Add", addMenu);

	connect(addMenu, SIGNAL(activated(int)),
		this, SLOT(slotMenuCallback(int)));

	menu->exec(point);

	delete menu;
}
开发者ID:speakman,项目名称:qlc,代码行数:28,代码来源:vcframe.cpp

示例8: if

void K3bIsoImageWritingDialog::slotContextMenu( KListView*, QListViewItem*, const QPoint& pos )
{
  if( !d->haveMd5Sum )
    return;

  QPopupMenu popup;
  int copyItem = popup.insertItem( i18n("Copy checksum to clipboard") );
  int compareItem = popup.insertItem( i18n("Compare checksum...") );

  int r = popup.exec( pos );

  if( r == compareItem ) {
    bool ok;
    QString md5sumToCompare = KInputDialog::getText( i18n("MD5 Sum Check"),
						     i18n("Please insert the MD5 Sum to compare:"),
						     QString::null,
						     &ok,
						     this );
    if( ok ) {
      if( md5sumToCompare.lower().utf8() == m_md5Job->hexDigest().lower() )
	KMessageBox::information( this, i18n("The MD5 Sum of %1 equals the specified.").arg(imagePath()),
				  i18n("MD5 Sums Equal") );
      else
	KMessageBox::sorry( this, i18n("The MD5 Sum of %1 differs from the specified.").arg(imagePath()),
			    i18n("MD5 Sums Differ") );
    }
  }
  else if( r == copyItem ) {
    QApplication::clipboard()->setText( m_md5Job->hexDigest().lower(), QClipboard::Clipboard );
  }
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例9: slotContextMenuRequested

/**
 * Set a value to a min/max/reverse column using a context menu
 */
void VCXYPadProperties::slotContextMenuRequested(QListViewItem* item,
        const QPoint &point,
        int column)
{
    int result;
    QString s;

    if (column == KColumnLo)
    {
        result = invokeDMXValueMenu(point);

        if (result <= KChannelValueMax &&
                result >= KChannelValueMin)
        {
            s.sprintf("%.3d", result);
            item->setText(KColumnLo, s);

            slotSelectionXChanged(m_listX->currentItem());
            slotSelectionYChanged(m_listY->currentItem());
        }
    }
    else if (column == KColumnHi)
    {
        result = invokeDMXValueMenu(point);

        if (result <= KChannelValueMax &&
                result >= KChannelValueMin)
        {
            s.sprintf("%.3d", result);
            item->setText(KColumnHi, s);

            slotSelectionXChanged(m_listX->currentItem());
            slotSelectionYChanged(m_listY->currentItem());
        }
    }
    else if (column == KColumnReverse)
    {
        QPopupMenu* menu = new QPopupMenu();
        menu->insertItem("Reverse", KNoID);
        menu->insertSeparator();
        menu->insertItem(Settings::trueValue(), KComboItemReverse);
        menu->insertItem(Settings::falseValue(), KComboItemNormal);

        result = menu->exec(point);
        if (result == KComboItemNormal)
        {
            item->setText(KColumnReverse, Settings::falseValue());
        }
        else if (result == KComboItemReverse)
        {
            item->setText(KColumnReverse, Settings::trueValue());
        }

        slotSelectionXChanged(m_listX->currentItem());
        slotSelectionYChanged(m_listY->currentItem());

        delete menu;
    }
}
开发者ID:speakman,项目名称:qlc,代码行数:62,代码来源:vcxypadproperties.cpp

示例10: invokeMenu

//
// Invoke a menu at given point
//
void VCDockSlider::invokeMenu(QPoint point)
{
  if (m_static)
    {
      QString dir;
      _app->settings()->get(KEY_SYSTEM_DIR, dir);
      dir += QString("/") + PIXMAPPATH;

      QPopupMenu menu;
      menu.insertItem(QPixmap(dir + "/settings.xpm"),
		     QString("&Properties..."), KVCMenuEditProperties);

      if (menu.exec(point) == KVCMenuEditProperties)
	{
	  bool ok = false;
	  QString current;
	  current.sprintf("%d-%d", m_busLowLimit, m_busHighLimit);

	  QString text = 
	    QInputDialog::getText(KApplicationNameShort,
				  "Slider value range (e.g. 0-10) in seconds:",
				  QLineEdit::Normal, current, &ok, this);
	  
	  if (ok && !text.isEmpty())
	    {
	      int dash = text.find('-');
	      QString min = text.left(dash);
	      QString max = text.mid(dash + 1);
	      
	      if (min.toInt() >= max.toInt())
		{
		  QMessageBox::warning(this, KApplicationNameShort,
       "Minimum value cannot be bigger than or equal to the maximum value");
		}
	      else
		{
		  setBusRange(min.toInt(), max.toInt());
		  setMode(Speed);

		  if (m_busID == KBusIDDefaultFade)
		    {
		      _app->settings()->set(KEY_DEFAULT_FADE_MIN, min.toInt());
		      _app->settings()->set(KEY_DEFAULT_FADE_MAX, max.toInt());
		    }
		  else
		    {
		      _app->settings()->set(KEY_DEFAULT_HOLD_MIN, min.toInt());
		      _app->settings()->set(KEY_DEFAULT_HOLD_MAX, max.toInt());
		    }
		}
	    }
	}
    }
  else
    {
      _app->virtualConsole()->editMenu()->exec(point);
    }

}
开发者ID:speakman,项目名称:qlc,代码行数:62,代码来源:vcdockslider.cpp

示例11: contextMenuSectionItem

void QTodoLists::contextMenuSectionItem(QListViewItem*, const QPoint& pos, int)
{
	QPopupMenu* menu = new QPopupMenu(this);
	menu->insertItem(tr("GoTo"),MNID_GOTO_SECTION);
	connect(menu,SIGNAL(activated(int)),this,SLOT(sectionMenuActivated(int)));
	menu->exec(pos);
	delete menu;
}
开发者ID:BackupTheBerlios,项目名称:qtodo-svn,代码行数:8,代码来源:qtodo_lists.cpp

示例12: 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;
}
开发者ID:,项目名称:,代码行数:58,代码来源:

示例13: 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);
}
开发者ID:,项目名称:,代码行数:57,代码来源:

示例14: contextMenuListItem

void QTodoLists::contextMenuListItem(QListViewItem*, const QPoint & pos, int)
{
	return; //FIXME

	QPopupMenu* menu = new QPopupMenu(this);
	menu->insertItem(tr("Add section"),MNID_ADD_SECTION);
	connect(menu,SIGNAL(activated(int)),this,SLOT(listMenuActivated(int)));
	menu->exec(pos);
	delete menu;
}
开发者ID:BackupTheBerlios,项目名称:qtodo-svn,代码行数:10,代码来源:qtodo_lists.cpp

示例15: slotMenu

void KateFileList::slotMenu ( QListViewItem *item, const QPoint &p, int /*col*/ )
{
  if (!item)
    return;

  QPopupMenu *menu = (QPopupMenu*) ((viewManager->mainWindow())->factory()->container("filelist_popup", viewManager->mainWindow()));

  if (menu)
    menu->exec(p);
}
开发者ID:,项目名称:,代码行数:10,代码来源:


注:本文中的QPopupMenu::exec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。