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


C++ QPopupMenu类代码示例

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


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

示例1: QToolBar

void TextEdit::setupEditActions()
{
    QToolBar *tb = new QToolBar( this );
    QPopupMenu *menu = new QPopupMenu( this );
    menuBar()->insertItem( tr( "&Edit" ), menu );

    QAction *a;
    a = new QAction( tr( "Undo" ), QPixmap( "textdrawing/undo.png" ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
    connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Redo" ), QPixmap( "textdrawing/redo.png" ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
    connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
    a->addTo( tb );
    a->addTo( menu );
    menu->insertSeparator();
    a = new QAction( tr( "Cut" ), QPixmap( "textdrawing/editcut.png" ), tr( "&Cut" ), CTRL + Key_X, this, "editCut" );
    connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Copy" ), QPixmap( "textdrawing/editcopy.png" ), tr( "C&opy" ), CTRL + Key_C, this, "editCopy" );
    connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Paste" ), QPixmap( "textdrawing/editpaste.png" ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
    connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
    a->addTo( tb );
    a->addTo( menu );
}
开发者ID:OS2World,项目名称:LIB-QT3_Toolkit_Vbox,代码行数:29,代码来源:textedit.cpp

示例2: selectTab

void UserTabBar::mousePressEvent(QMouseEvent *e)
{
    if (e->button() == RightButton){
        QTab *t = selectTab(e->pos());
        if (t == NULL) return;
        UserTab *tab = static_cast<UserTab*>(t);

        EventMenuProcess eMenu(MenuContact, (void*)tab->wnd()->id());
        eMenu.process();
        QPopupMenu *menu = eMenu.menu();
        if (menu)
            menu->popup(e->globalPos());
        return;
    }
    if (e->button() == MidButton){
        //Close tab on middle button pressed
        QTab *t = selectTab(e->pos());
        if (t == NULL) return;
        UserTab *tab = static_cast<UserTab*>(t);
        Command cmd;
        cmd->id = CmdClose;
        cmd->param = (void*)tab->wnd()->id();
        EventCommandExec(cmd).process();
    }
    QTabBar::mousePressEvent(e);
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:26,代码来源:container.cpp

示例3: QToolBar

void TextEdit::setupEditActions()
{
    QToolBar *tb = new QToolBar( this );
    tb->setLabel( "Edit Actions" );
    QPopupMenu *menu = new QPopupMenu( this );
    menuBar()->insertItem( tr( "&Edit" ), menu );

    QAction *a;
    a = new QAction( QPixmap::fromMimeSource( "editundo.xpm" ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
    connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( QPixmap::fromMimeSource( "editredo.xpm" ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
    connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
    a->addTo( tb );
    a->addTo( menu );
    menu->insertSeparator();
    a = new QAction( QPixmap::fromMimeSource( "editcopy.xpm" ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
    connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( QPixmap::fromMimeSource( "editcut.xpm" ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
    connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( QPixmap::fromMimeSource( "editpaste.xpm" ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
    connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
    a->addTo( tb );
    a->addTo( menu );
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:30,代码来源:textedit.cpp

示例4: 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,代码来源:

示例5: 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

示例6: main

int main( int argc, char **argv )
{
    QApplication app( argc, argv );

    QMainWindow mw;
    app.setMainWidget( &mw );

    QPopupMenu menu2;
    menu2.insertItem( "Test 2" );
    TrayIcon tray2( QPixmap( (const char**)minimize_xpm ), "Minimize MainWindow", &menu2 );
    QObject::connect(&tray2,SIGNAL(clicked(const QPoint&)),&mw,SLOT(showMinimized()));

    QPopupMenu menu;
    menu.insertItem( "Test 1" );
    menu.insertSeparator();
    menu.insertItem( "&Quit", &app, SLOT(quit()) );
    TrayIcon tray( QPixmap( (const char**)normalize_xpm ), "Show MainWindow", &menu );
    QObject::connect(&tray,SIGNAL(clicked(const QPoint&)),&mw,SLOT(showNormal()));

    TrayIcon tray3( QPixmap( (const char**)maximize_xpm ), "Maximize MainWindow" );
    QObject::connect(&tray3,SIGNAL(clicked(const QPoint&)),&mw,SLOT(showMaximized()));

    mw.show();
    tray.show();
    tray2.show();
    tray3.show();

    return app.exec();
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:29,代码来源:main.cpp

示例7: tree

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,代码来源:

示例8: checkInsertIndex

void KTagComboBox::insertItem(const QString &text, const QString &tag, const QString &submenu, int index )
{
  QPopupMenu *pi = checkInsertIndex(popup, tags, submenu);
  checkInsertPos(pi, text, index);
  pi->insertItem(text, count(), index);
  tags.append(tag);
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:7,代码来源:ktagcombobox.cpp

示例9: QPopupMenu

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

示例10: QPopupMenu

void ClassMainWindow::slotRightClick( QListViewItem *, const QPoint &pos, int )
{
	QPopupMenu *menu = new QPopupMenu( this );
	menu->insertItem( i18n( "&Add" ), this, SLOT(slotAdd()) );
	menu->insertItem( i18n( "&Remove" ), this, SLOT(slotRemove()) );
	menu->popup( pos );
}
开发者ID:BackupTheBerlios,项目名称:kandau-svn,代码行数:7,代码来源:classmainwindow.cpp

示例11: QString

//
// 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

示例12: invokeDMXValueMenu

/**
 * 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

示例13: qDebug

void GadWorkspace::genMenu()
{
  qDebug("GadWorkspace::genMenu\n");
  if (!menubar_) {
    QtGui *mainmenu = (QtGui *) (*(_qtguiappl->classDict()))["mainmenu"];
    if (mainmenu) {
      QWidget *w = mainmenu->widget();
      if (w && w->inherits("QMenuBar"))
        menubar_ = (QMenuBar *) w;
    }
  }

  const ClassDict & classDict = *classDict_;
  int size = 0;
  QStringList classList;
  QDictIterator < ModuleDict > cit(classDict);
  for (; cit.current(); ++cit) {
    size += cit.current()->count();
    classList += cit.currentKey();
  }

  if (classNameMenu_)
    delete classNameMenu_;
  classNameMenu_ = new ClassNameMenu[size];
  if (popup_)
    delete popup_;
  popup_ = new QPopupMenu(0);
  classList.sort();
  QStringList::Iterator clit;
  int item = 0;
  for (clit = classList.begin(); clit != classList.end(); ++clit) {

    qDebug("Class %s\n", (const char *) *clit);
    QPopupMenu *popup = new QPopupMenu();
    popup_->insertItem(*clit, popup);
    connect(popup, SIGNAL(activated(int)), this, SLOT(newObjectSlot(int)));
    ModuleDict *moduleDict = classDict[*clit];
    QDictIterator < GadModule > mit(*moduleDict);
    QStringList moduleList;
    qDebug("test\n");
    for (; mit.current(); ++mit)
      moduleList += mit.currentKey();
    moduleList.sort();
    QStringList::Iterator mlit;
    qDebug("test\n");
    for (mlit = moduleList.begin(); mlit != moduleList.end(); ++mlit) {
      qDebug("item=%d\n", item);
      classNameMenu_[item].className = *clit;
      classNameMenu_[item].name = *mlit;
      popup->insertItem(*mlit, item++);
      //      popup->insertItem(*mlit,this,SLOT(genNewObject(int)),0,item);
      qDebug("test\n");
    }
  }
  if (menubar_)
    popupId_ = menubar_->insertItem("&Glyphs", popup_);
  qDebug("     connecting with mainMenu\n");
  //  _qtguiappl->insertClass("classmenu",popup_);
}
开发者ID:BackupTheBerlios,项目名称:geoaida-svn,代码行数:59,代码来源:GadWorkspace.cpp

示例14: showPopup

void MainWindow::showPopup()
{
    popupTimer->stop();
    if (!_currentItem)
        return;
    QPopupMenu *pop = _currentItem->popupMenu();
    if (pop) pop->popup( QCursor::pos() );
}
开发者ID:opieproject,项目名称:opie,代码行数:8,代码来源:mainwindow.cpp

示例15: tr

QPopupMenu *Editor::createPopupMenu( const QPoint &p )
{
    QPopupMenu *menu = QTextEdit::createPopupMenu( p );
    menu->insertSeparator();
    menu->insertItem( tr( "C&omment Code\tAlt+C" ), this, SLOT( commentSelection() ) );
    menu->insertItem( tr( "Unco&mment Code\tAlt+U" ), this, SLOT( uncommentSelection() ) );
    return menu;
}
开发者ID:JustDevZero,项目名称:pdfedit5,代码行数:8,代码来源:editor.cpp


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