コード例 #1
0
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 );
}
コード例 #2
0
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);
}
コード例 #3
0
ファイル: textedit.cpp プロジェクト: aroraujjwal/qt3
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 );
}
コード例 #4
0
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 );
  }
}
コード例 #5
0
ファイル: coverageview.cpp プロジェクト: serghei/kde-kdesdk
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);
}
コード例 #6
0
ファイル: main.cpp プロジェクト: kthxbyte/QT2-Linaro
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();
}
コード例 #7
0
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;
}
コード例 #8
0
ファイル: ktagcombobox.cpp プロジェクト: KDE/kde-runtime
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);
}
コード例 #9
0
ファイル: vcframe.cpp プロジェクト: speakman/qlc
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;
}
コード例 #10
0
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 );
}
コード例 #11
0
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 );
}
コード例 #12
0
ファイル: vcdockslider.cpp プロジェクト: speakman/qlc
//
// 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);
    }

}
コード例 #13
0
ファイル: vcxypadproperties.cpp プロジェクト: speakman/qlc
/**
 * 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;
    }
}
コード例 #14
0
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 c**t;
  int item = 0;
  for (c**t = classList.begin(); c**t != classList.end(); ++c**t) {

    qDebug("Class %s\n", (const char *) *c**t);
    QPopupMenu *popup = new QPopupMenu();
    popup_->insertItem(*c**t, popup);
    connect(popup, SIGNAL(activated(int)), this, SLOT(newObjectSlot(int)));
    ModuleDict *moduleDict = classDict[*c**t];
    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 = *c**t;
      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_);
}
コード例 #15
0
ファイル: mainwindow.cpp プロジェクト: opieproject/opie
void MainWindow::showPopup()
{
    popupTimer->stop();
    if (!_currentItem)
        return;
    QPopupMenu *pop = _currentItem->popupMenu();
    if (pop) pop->popup( QCursor::pos() );
}
コード例 #16
0
ファイル: editor.cpp プロジェクト: JustDevZero/pdfedit5
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;
}
コード例 #17
0
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;
}
コード例 #18
0
ファイル: packagelistview.cpp プロジェクト: opieproject/opie
void PackageListView::showPopup()
{
  qDebug("PackageListView::showPopup");
  QPopupMenu *popup = activeItem->getPopupMenu();
  if (popup == 0) return;
  popup->popup( QCursor::pos() );
  qDebug("PackageListView::showPopup");
}
コード例 #19
0
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;
}
コード例 #20
0
void KxkbLabelController::initLayoutList(const QValueList< LayoutUnit > &layouts, const XkbRules &rules)
{
    //	KPopupMenu* menu = contextMenu();
    QPopupMenu *menu = contextMenu;
    //	int index = menu->indexOf(0);

    m_descriptionMap.clear();
    //    menu->clear();
    //    menu->insertTitle( kapp->miniIcon(), kapp->caption() );

    for(int ii = 0; ii < m_prevLayoutCount; ++ii)
    {
        menu->removeItem(START_MENU_ID + ii);
        kdDebug() << "remove item: " << START_MENU_ID + ii << endl;
    }
    /*	menu->removeItem(CONFIG_MENU_ID);
        menu->removeItem(HELP_MENU_ID);*/

    KIconEffect iconeffect;

    int cnt = 0;
    QValueList< LayoutUnit >::ConstIterator it;
    for(it = layouts.begin(); it != layouts.end(); ++it)
    {
        const QString layoutName = (*it).layout;
        const QString variantName = (*it).variant;

        const QPixmap &layoutPixmap = LayoutIcon::getInstance().findPixmap(layoutName, m_showFlag, (*it).displayName);
        const QPixmap pix = iconeffect.apply(layoutPixmap, KIcon::Small, KIcon::DefaultState);

        QString fullName = i18n((rules.layouts()[layoutName]));
        if(variantName.isEmpty() == false)
            fullName += " (" + variantName + ")";
        contextMenu->insertItem(pix, fullName, START_MENU_ID + cnt, m_menuStartIndex + cnt);
        m_descriptionMap.insert((*it).toPair(), fullName);

        cnt++;
    }

    m_prevLayoutCount = cnt;

    // if show config, if show help
    if(menu->indexOf(CONFIG_MENU_ID) == -1)
    {
        contextMenu->insertSeparator();
        contextMenu->insertItem(SmallIcon("configure"), i18n("Configure..."), CONFIG_MENU_ID);
        if(menu->indexOf(HELP_MENU_ID) == -1)
            contextMenu->insertItem(SmallIcon("help"), i18n("Help"), HELP_MENU_ID);
    }

    /*    if( index != -1 ) { //not first start
            menu->insertSeparator();
            KAction* quitAction = KStdAction::quit(this, SIGNAL(quitSelected()), actionCollection());
            if (quitAction)
                quitAction->plug(menu);
        }*/
}
コード例 #21
0
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()));
}
コード例 #22
0
ファイル: globjwin.cpp プロジェクト: serghei/kde3-qt
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
    : QWidget( parent, name )
{

    // Create nice frames to put around the OpenGL widgets
    QFrame* f1 = new QFrame( this, "frame1" );
    f1->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f1->setLineWidth( 2 );

    // Create an OpenGL widget
    GLTexobj* c = new GLTexobj( f1, "glbox1");

    // Create a menu
    QPopupMenu *file = new QPopupMenu( this );
    file->insertItem( "Toggle Animation", c, SLOT(toggleAnimation()),
                      CTRL+Key_A );
    file->insertSeparator();
    file->insertItem( "Exit",  qApp, SLOT(quit()), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );

    // Create the three sliders; one for each rotation axis
    QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
    x->setTickmarks( QSlider::Left );
    connect( x, SIGNAL(valueChanged(int)), c, SLOT(setXRotation(int)) );

    QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
    y->setTickmarks( QSlider::Left );
    connect( y, SIGNAL(valueChanged(int)), c, SLOT(setYRotation(int)) );

    QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
    z->setTickmarks( QSlider::Left );
    connect( z, SIGNAL(valueChanged(int)), c, SLOT(setZRotation(int)) );


    // Now that we have all the widgets, put them into a nice layout

    // Put the sliders on top of each other
    QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
    vlayout->addWidget( x );
    vlayout->addWidget( y );
    vlayout->addWidget( z );

    // Put the GL widget inside the frame
    QHBoxLayout* flayout1 = new QHBoxLayout( f1, 2, 2, "flayout1");
    flayout1->addWidget( c, 1 );

    // Top level layout, puts the sliders to the left of the frame/GL widget
    QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");
    hlayout->setMenuBar( m );
    hlayout->addLayout( vlayout );
    hlayout->addWidget( f1, 1 );

}
コード例 #23
0
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;
}
コード例 #24
0
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);
}
コード例 #25
0
void FloatyPlugin::showPopup()
{
    ProcessMenuParam mp;
    mp.id    = MenuContact;
    mp.param = (void*)(popupId);
    mp.key	 = 0;
    Event eMenu(EventProcessMenu, &mp);
    QPopupMenu *menu = (QPopupMenu*)eMenu.process();
    menu->popup(popupPos);
}
コード例 #26
0
ファイル: protocolview.cpp プロジェクト: serghei/kde-kdesdk
QPopupMenu* ProtocolView::createPopupMenu(const QPoint &pos)
{
    QPopupMenu* menu = QTextEdit::createPopupMenu(pos);

    int id = menu->insertItem(i18n("Clear"), this, SLOT( clear() ), 0, -1, 0);

    if( length() == 0 )
        menu->setItemEnabled(id, false);

    return menu;
}
コード例 #27
0
void StatusFrame::mousePressEvent(QMouseEvent *me)
{
    if (me->button() == RightButton){
        Command cmd;
        cmd->id = MenuConnections;
        Event e(EventGetMenu, &cmd);
        QPopupMenu *popup = (QPopupMenu*)(e.process());
        if (popup)
            popup->popup(me->globalPos());
    }
}
コード例 #28
0
void GofunWidget::popupDirectoryAdd()
{
	QPopupMenu* popup = new QPopupMenu(this);

	connect(popup,SIGNAL(activated(int)),this,SLOT(popupCAActivated(int)));
	popup->insertItem(tr("Add Directory"),PID_Add_Directory);
	int x = pos().x()+cats_bg->pos().x()+cats_bg->find(0)->pos().x()+cats_bg->find(0)->width();
	int y = QCursor::pos().y();
	QPoint pos(x,y);
	popup->popup(pos);
}
コード例 #29
0
ファイル: imexportplugin.cpp プロジェクト: alexckp/qgis
/*
 * Initialize the GUI interface for the plugin 
 */
void IMExportPlugin::initGui()
{
  QPopupMenu *pluginMenu = mQGisIface->getPluginMenu("&Image Map Exporter");
  mMenuId = pluginMenu->insertItem(QIconSet(icon),"&Image Map Exporter", this, SLOT(run()));

  // Create the action for the tool
  QAction *myQActionPointer = new QAction("Image Map Exporter", QIconSet(icon),
					  "&Wmi",0, this, "run");
  connect(myQActionPointer, SIGNAL(activated()), this, SLOT(run()));
  mQGisIface->addToolBarIcon(myQActionPointer);
}
コード例 #30
0
void RKConsolePart::showPopupMenu (const QPoint &pos) {
	RK_TRACE (APP);

	QPopupMenu *menu = static_cast<QPopupMenu *> (factory ()->container ("rkconsole_context_menu", this));

	if (!menu) {
		RK_ASSERT (false);
		return;
	}
	menu->exec (pos);
}