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


C++ QAction::setObjectName方法代码示例

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


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

示例1: createImagesMenu

void MainWindow::createImagesMenu()
{
	QMenu* imagesMenu = menuBar()->addMenu("&Images");

	int interfaceIndex = 0;
	image_interface_iterator iter(m_machine->root_device());
	for (device_image_interface *img = iter.first(); img != NULL; img = iter.next())
	{
		astring menuName;
		menuName.format("%s : %s", img->device().name(), img->exists() ? img->filename() : "[empty slot]");

		QMenu* interfaceMenu = imagesMenu->addMenu(menuName.cstr());
		interfaceMenu->setObjectName(img->device().name());

		QAction* mountAct = new QAction("Mount...", interfaceMenu);
		QAction* unmountAct = new QAction("Unmount", interfaceMenu);
		mountAct->setObjectName("mount");
		mountAct->setData(QVariant(interfaceIndex));
		unmountAct->setObjectName("unmount");
		unmountAct->setData(QVariant(interfaceIndex));
		connect(mountAct, SIGNAL(triggered(bool)), this, SLOT(mountImage(bool)));
		connect(unmountAct, SIGNAL(triggered(bool)), this, SLOT(unmountImage(bool)));

		if (!img->exists())
			unmountAct->setEnabled(false);

		interfaceMenu->addAction(mountAct);
		interfaceMenu->addAction(unmountAct);

		// TODO: Cassette operations

		interfaceIndex++;
	}
}
开发者ID:MisterTea,项目名称:MAMEHub,代码行数:34,代码来源:mainwindow.c

示例2: createImagesMenu

void MainWindow::createImagesMenu()
{
	QMenu* imagesMenu = menuBar()->addMenu("&Images");

	int interfaceIndex = 0;
	for (device_image_interface &img : image_interface_iterator(m_machine->root_device()))
	{
		std::string menuName = string_format("%s : %s", img.device().name(), img.exists() ? img.filename() : "[empty slot]");

		QMenu* interfaceMenu = imagesMenu->addMenu(menuName.c_str());
		interfaceMenu->setObjectName(img.device().name());

		QAction* mountAct = new QAction("Mount...", interfaceMenu);
		QAction* unmountAct = new QAction("Unmount", interfaceMenu);
		mountAct->setObjectName("mount");
		mountAct->setData(QVariant(interfaceIndex));
		unmountAct->setObjectName("unmount");
		unmountAct->setData(QVariant(interfaceIndex));
		connect(mountAct, &QAction::triggered, this, &MainWindow::mountImage);
		connect(unmountAct, &QAction::triggered, this, &MainWindow::unmountImage);

		if (!img.exists())
			unmountAct->setEnabled(false);

		interfaceMenu->addAction(mountAct);
		interfaceMenu->addAction(unmountAct);

		// TODO: Cassette operations

		interfaceIndex++;
	}
}
开发者ID:bradhugh,项目名称:mame,代码行数:32,代码来源:mainwindow.cpp

示例3: QAction

QList<QAction*> UrlFilter::HotSpot::actions()
{
    QAction* openAction = new QAction(_urlObject);
    QAction* copyAction = new QAction(_urlObject);

    const UrlType kind = urlType();
    Q_ASSERT(kind == StandardUrl || kind == Email);

    if (kind == StandardUrl) {
        openAction->setText(i18n("Open Link"));
        copyAction->setText(i18n("Copy Link Address"));
    } else if (kind == Email) {
        openAction->setText(i18n("Send Email To..."));
        copyAction->setText(i18n("Copy Email Address"));
    }

    // object names are set here so that the hotspot performs the
    // correct action when activated() is called with the triggered
    // action passed as a parameter.
    openAction->setObjectName(QLatin1String("open-action"));
    copyAction->setObjectName(QLatin1String("copy-action"));

    QObject::connect(openAction , SIGNAL(triggered()) , _urlObject , SLOT(activated()));
    QObject::connect(copyAction , SIGNAL(triggered()) , _urlObject , SLOT(activated()));

    QList<QAction*> actions;
    actions << openAction;
    actions << copyAction;

    return actions;
}
开发者ID:kitech,项目名称:konsole,代码行数:31,代码来源:Filter.cpp

示例4: createLayout

void DkPaintToolBar::createLayout() {

	QList<QKeySequence> enterSc;
	enterSc.append(QKeySequence(Qt::Key_Enter));
	enterSc.append(QKeySequence(Qt::Key_Return));

	QAction* applyAction = new QAction(icons[apply_icon], tr("Apply (ENTER)"), this);
	applyAction->setShortcuts(enterSc);
	applyAction->setObjectName("applyAction");

	QAction* cancelAction = new QAction(icons[cancel_icon], tr("Cancel (ESC)"), this);
	cancelAction->setShortcut(QKeySequence(Qt::Key_Escape));
	cancelAction->setObjectName("cancelAction");

	panAction = new QAction(icons[pan_icon], tr("Pan"), this);
	panAction->setShortcut(QKeySequence(Qt::Key_P));
	panAction->setObjectName("panAction");
	panAction->setCheckable(true);
	panAction->setChecked(false);

	// pen color
	penCol = QColor(0,0,0);
	penColButton = new QPushButton(this);
	penColButton->setObjectName("penColButton");
	penColButton->setStyleSheet("QPushButton {background-color: " + nmc::DkUtils::colorToString(penCol) + "; border: 1px solid #888;}");
	penColButton->setToolTip(tr("Background Color"));
	penColButton->setStatusTip(penColButton->toolTip());

	// undo Button
	undoAction = new QAction(icons[undo_icon], tr("Undo (CTRL+Z)"), this);
	undoAction->setShortcut(QKeySequence::Undo);
	undoAction->setObjectName("undoAction");

	colorDialog = new QColorDialog(this);
	colorDialog->setObjectName("colorDialog");

	// pen width
	widthBox = new QSpinBox(this);
	widthBox->setObjectName("widthBox");
	widthBox->setSuffix("px");
	widthBox->setMinimum(1);
	widthBox->setMaximum(500);	// huge sizes since images might have high resolutions

	// pen alpha
	alphaBox = new QSpinBox(this);
	alphaBox->setObjectName("alphaBox");
	alphaBox->setSuffix("%");
	alphaBox->setMinimum(0);
	alphaBox->setMaximum(100);

	addAction(applyAction);
	addAction(cancelAction);
	addSeparator();
	addAction(panAction);
	addAction(undoAction);
	addSeparator();
	addWidget(widthBox);
	addWidget(penColButton);
	addWidget(alphaBox);
}
开发者ID:h0rm,项目名称:nomacs-plugins,代码行数:60,代码来源:DkPaintPlugin.cpp

示例5: connect

QMenu* Scene_c3t3_item::contextMenu()
{
  const char* prop_name = "Menu modified by Scene_c3t3_item.";

  QMenu* menu = Scene_item::contextMenu();

  // Use dynamic properties:
  // http://doc.qt.io/qt-5/qobject.html#property
  bool menuChanged = menu->property(prop_name).toBool();

  if (!menuChanged) {
    QAction* actionExportFacetsInComplex =
      menu->addAction(tr("Export facets in complex"));
    actionExportFacetsInComplex->setObjectName("actionExportFacetsInComplex");
    connect(actionExportFacetsInComplex,
      SIGNAL(triggered()), this,
      SLOT(export_facets_in_complex()));

    QAction* actionShowSpheres =
      menu->addAction(tr("Show protecting &spheres"));
    actionShowSpheres->setCheckable(true);
    actionShowSpheres->setObjectName("actionShowSpheres");
    connect(actionShowSpheres, SIGNAL(toggled(bool)),
            this, SLOT(show_spheres(bool)));
    menu->setProperty(prop_name, true);
  }
开发者ID:logtcn,项目名称:cgal,代码行数:26,代码来源:Scene_c3t3_item.cpp

示例6: QAction

DnaAssemblySupport::DnaAssemblySupport()
{
    QAction* convertAssemblyToSamAction = new QAction( tr("Convert UGENE assembly database to SAM..."), this );
    convertAssemblyToSamAction->setObjectName(ToolsMenu::NGS_CONVERT_SAM);
    convertAssemblyToSamAction->setIcon(QIcon(":core/images/align.png"));
    connect( convertAssemblyToSamAction, SIGNAL( triggered() ), SLOT( sl_showConvertToSamDialog() ) );
    ToolsMenu::addAction(ToolsMenu::NGS_MENU, convertAssemblyToSamAction);

    QAction* genomeAssemblyAction = new QAction( tr("Genome de novo assembly..."), this );
    genomeAssemblyAction->setObjectName(ToolsMenu::NGS_DENOVO);
    genomeAssemblyAction->setIcon(QIcon(":core/images/align.png"));
    connect( genomeAssemblyAction, SIGNAL( triggered() ), SLOT( sl_showGenomeAssemblyDialog() ) );
    ToolsMenu::addAction(ToolsMenu::NGS_MENU, genomeAssemblyAction);

    QAction* dnaAssemblyAction = new QAction(tr("Map reads to reference..."), this );
    dnaAssemblyAction->setObjectName(ToolsMenu::NGS_MAP);
    dnaAssemblyAction->setIcon(QIcon(":core/images/align.png"));
    connect( dnaAssemblyAction, SIGNAL( triggered() ), SLOT( sl_showDnaAssemblyDialog() ) );
    ToolsMenu::addAction(ToolsMenu::NGS_MENU, dnaAssemblyAction);

    QAction* buildIndexAction = new QAction( tr("Build index for reads mapping..."), this );
    buildIndexAction->setObjectName(ToolsMenu::NGS_INDEX);
    buildIndexAction->setIcon(QIcon(":core/images/align.png"));
    connect( buildIndexAction, SIGNAL( triggered() ), SLOT( sl_showBuildIndexDialog() ) );
    ToolsMenu::addAction(ToolsMenu::NGS_MENU, buildIndexAction);
}
开发者ID:m-angelov,项目名称:ugene,代码行数:26,代码来源:DnaAssemblyUtils.cpp

示例7: contextMenu

void ModuleDockWidget::contextMenu(QPoint point)
{
    m_point = point;
    QPointer<QMenu> contextMenu = new QMenu(ui->treeView_module);
    contextMenu->setObjectName("contextMenu");

    QAction *actionOpen = new QAction(QIcon::fromTheme("document-open", QIcon(":/icons/16x16/document-open.png")), tr("Open module"), contextMenu);
    actionOpen->setObjectName("actionOpen");
    connect(actionOpen, SIGNAL(triggered()), this, SLOT(open()));

    QAction *actionOpenInNewTab = new QAction(QIcon::fromTheme("tab-new", QIcon(":/icons/16x16/tab-new.png")), tr("Open module in new tab"), contextMenu);
    actionOpenInNewTab->setObjectName("actionPaste");
    connect(actionOpenInNewTab, SIGNAL(triggered()), this, SLOT(openInNewTab()));

    QAction *actionSettings = new QAction(QIcon::fromTheme("configure", QIcon(":/icons/16x16/configure.png")), tr("Configure"), contextMenu);
    actionSettings->setObjectName("actionNew");
    connect(actionSettings, SIGNAL(triggered()), this, SLOT(configure()));



    contextMenu->addAction(actionOpen);
    contextMenu->addAction(actionOpenInNewTab);

    contextMenu->addSeparator();
    contextMenu->addAction(actionSettings);

    contextMenu->exec(QCursor::pos());
    delete contextMenu;
}
开发者ID:benf,项目名称:openBibleViewer,代码行数:29,代码来源:moduledockwidget.cpp

示例8: KexiView

KexiReportView::KexiReportView(QWidget *parent)
        : KexiView(parent)
{
    m_preRenderer = 0;
    setObjectName("KexiReportDesigner_DataView");
    m_scrollArea = new QScrollArea(this);
    m_scrollArea->setBackgroundRole(QPalette::Dark);
    m_scrollArea->viewport()->setAutoFillBackground(true);

    m_pageSelector = new KexiRecordNavigator(this, 0);
    layout()->addWidget(m_scrollArea);
    layout()->addWidget(m_pageSelector);

    m_pageSelector->setRecordCount(0);
    m_pageSelector->setInsertingButtonVisible(false);
    m_pageSelector->setLabelText(i18n("Page"));


    // -- setup local actions
    QList<QAction*> viewActions;
    QAction* a;
    viewActions << (a = new KAction(KIcon("printer"), i18n("Print"), this));
    a->setObjectName("pgzkexirpt_print_report");
    a->setToolTip(i18n("Print Report"));
    a->setWhatsThis(i18n("Prints the current report."));
    connect(a, SIGNAL(triggered()), this, SLOT(slotPrintReport()));

    viewActions << (a = new KAction(KIcon("kword"), i18n("Open in KWord"), this));
    a->setObjectName("pgzkexirpt_open_kword");
    a->setToolTip(i18n("Open the report in KWord"));
    a->setWhatsThis(i18n("Opens the current report in KWord."));
    a->setEnabled(false);
//! @todo connect(a, SIGNAL(triggered()), this, SLOT(slotRenderKWord()));

#ifdef HAVE_KSPREAD
    viewActions << (a = new KAction(KIcon("kspread"), i18n("Open in KSpread"), this));
    a->setObjectName("pgzkexirpt_open_kspread");
    a->setToolTip(i18n("Open the report in KSpread"));
    a->setWhatsThis(i18n("Opens the current report in KSpread."));
    a->setEnabled(true);
    connect(a, SIGNAL(triggered()), this, SLOT(slotRenderKSpread()));
#endif

    viewActions << (a = new KAction(KIcon("text-html"), i18n("Export to HTML"), this));
    a->setObjectName("pgzkexirpt_export_html");
    a->setToolTip(i18n("Export the report to HTML"));
    a->setWhatsThis(i18n("Exports the report to a HTML file."));
    a->setEnabled(true);
    connect(a, SIGNAL(triggered()), this, SLOT(slotExportHTML()));

    setViewActions(viewActions);


    connect(m_pageSelector, SIGNAL(nextButtonClicked()), this, SLOT(nextPage()));
    connect(m_pageSelector, SIGNAL(prevButtonClicked()), this, SLOT(prevPage()));
    connect(m_pageSelector, SIGNAL(firstButtonClicked()), this, SLOT(firstPage()));
    connect(m_pageSelector, SIGNAL(lastButtonClicked()), this, SLOT(lastPage()));

}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:59,代码来源:kexireportview.cpp

示例9: setupViewActions

void TextEdit::setupViewActions()
{
    QMenu* menu = new QMenu(tr("&View"), this);
    menuBar()->addMenu(menu);
    actionStatusBar = new QAction(tr("&StatusBar"), this);
    actionStatusBar->setStatusTip(tr("Show or hide the status bar"));
    actionStatusBar->setCheckable(true);
    actionStatusBar->setChecked(true);
    menu->addAction(actionStatusBar);
    connect(actionStatusBar, SIGNAL(triggered()), this, SLOT(hideStatusBar()));

    QMenu* menuToolBars = menu->addMenu(tr("&Toolbars"));
    actionStandardBar = new QAction(tr("Standard"), this);
    connect(actionStandardBar, SIGNAL(triggered()), this, SLOT(standardBar()));
    actionStandardBar->setCheckable(true);
    actionStandardBar->setChecked(true);
    actionStandardBar->setStatusTip(tr("Shows or hides the toolbar"));
    menuToolBars->addAction(actionStandardBar);

    actionFormattingBar = new QAction(tr("Formatting"), this);
    connect(actionFormattingBar, SIGNAL(triggered()), this, SLOT(formattingBar()));
    actionFormattingBar->setStatusTip(tr("Shows or hides the toolbar"));
    actionFormattingBar->setCheckable(true);
    actionFormattingBar->setChecked(true);
    menuToolBars->addAction(actionFormattingBar);

    menu->addSeparator();

    QActionGroup* styleActions = new QActionGroup(this);

    QAction* actionBlue = menu->addAction(tr("Office 2007 Blue"));
    actionBlue->setCheckable(true);
    actionBlue->setChecked(true);
    actionBlue->setObjectName("OS_OFFICE2007BLUE");

    QAction *actionBlack = menu->addAction(tr("Office 2007 Black"));
    actionBlack->setObjectName("OS_OFFICE2007BLACK");
    actionBlack->setCheckable(true);

    QAction* actionSilver = menu->addAction(tr("Office 2007 Silver"));
    actionSilver->setObjectName("OS_OFFICE2007SILVER");
    actionSilver->setCheckable(true);

    QAction* actionAqua = menu->addAction(tr("Office 2007 Aqua"));
    actionAqua->setObjectName("OS_OFFICE2007AQUA");
    actionAqua->setCheckable(true);

    styleActions->addAction(actionBlue);
    styleActions->addAction(actionBlack);
    styleActions->addAction(actionSilver);
    styleActions->addAction(actionAqua);
    connect( styleActions, SIGNAL(triggered(QAction*)), this, SLOT(options(QAction*)) );

    menu->addSeparator();

    QAction* actionCusomize = menu->addAction( tr("Cusomize..."));
    actionCusomize->setEnabled(false);
}
开发者ID:lixunguang,项目名称:myhelloworld,代码行数:58,代码来源:textedit.cpp

示例10: createMenu

void MenuExplore::createMenu(){




   /* this->setStyleSheet(QString::fromUtf8("QMenu {\n"
                                          "\n"
                                          "background-color: qlineargradient(spread:pad, x1:0.994318, y1:1, x2:1, y2:0, stop:0.0113636 rgba(146, 169, 211, 255), stop:0.982955 rgba(174, 199, 230, 255));\n"
                                          "border-color: rgb(0, 0, 0);\n"
                                          "}\n"
                                          "QMenu::item {\n"
                                          "background-color: rgb(255, 255, 255);\n"
                                          "}\n"
                                          "QMenu::item:selected {\n"
                                          "background-color: qlineargradient(spread:pad, x1:1, y1:1, x2:1, y2:0, stop:0 rgba(129, 166, 226, 255), stop:1 rgba(93, 131, 190, 255));\n"
                                          "}"));*/


    QMenu* asignar = this->addMenu("Añadir a...");

           QAction *action;



           action = new QAction("Player 1",this);
           action->setObjectName("1"); //para identificar en es cast
           connect(action, SIGNAL(triggered()), explore, SLOT (clickAsignar()));
           asignar->addAction(action);

           action = new QAction("Player 2",this);
           action->setObjectName("2");
           connect(action, SIGNAL(triggered()), explore, SLOT (clickAsignar()));
           asignar->addAction(action);

this->addSeparator();
       action = new QAction("Cortar",this);
       //connect(action, SIGNAL(triggered()), explore, SLOT(addPage()));
       this->addAction(action);


       action = new QAction("Copiar",this);
      // connect(action, SIGNAL(triggered()), explore, SLOT(deletePage()));
       this->addAction(action);


       action = new QAction("Pegar",this);
      // connect(action, SIGNAL(triggered()), explore, SLOT(vaciarPage()));
       this->addAction(action);


this->addSeparator();
              action = new QAction("Eliminar",this);
              //connect(action, SIGNAL(triggered()), explore, SLOT(addPage()));
              this->addAction(action);



}
开发者ID:jfperini,项目名称:iradit,代码行数:58,代码来源:MenuExplore.cpp

示例11: showServicePopup

void ServiceTree::showServicePopup(const QPoint &iPosition)
{
    emit changeTimer(false);
    //should be Select
    //lastRightClickedItem->setSelected(true);
    itemAt(iPosition)->setSelected(true);
    selectedServices.clear();
    for (int i = 0; i < selectedItems().size(); ++i)
    {
        QTreeWidgetItem *item=selectedItems().at(i);
        QStringList hostAndService;
        hostAndService << item->text(0) << item->text(1);
        qDebug() << "Selected Items  " << hostAndService;
        selectedServices << hostAndService;
    }

    lastRightClickedItem = 0 ;
      lastRightClickedItem = itemAt(iPosition) ;
      if ( 0 == lastRightClickedItem )
      {
        qDebug() << "No item selected" ;
      }
      else
      {
        qDebug() << "Item clicked" + lastRightClickedItem->text(0);

        QMenu menu(this);
        QMenu* hostMenu = new QMenu(this);
        hostMenu->setTitle("&Host");

        //host_state                                    host_state_type                             host_acknowledge (already)
        if ((lastRightClickedItem->text(10) != "0") && (lastRightClickedItem->text(11) != "0") && (lastRightClickedItem->text(12) == "0"))
        {
        QAction *hostAckRightAction   = new QAction("&Acknowledge", this);
            hostAckRightAction->setIcon(QPixmap(ack_xpm));
            hostAckRightAction->setObjectName("HostAcknowledge");
                connect(hostAckRightAction, SIGNAL(triggered(bool)), this, SLOT(menuRightSlot(bool)));
        hostMenu->addAction(hostAckRightAction);
        }

        QAction *hostDowntimeRightAction   = new QAction("&Downtime", this);
            hostDowntimeRightAction->setIcon(QPixmap(downtime_xpm));
            hostDowntimeRightAction->setObjectName("HostDowntime");
                connect(hostDowntimeRightAction, SIGNAL(triggered(bool)), this, SLOT(menuRightSlot(bool)));
        hostMenu->addAction(hostDowntimeRightAction);

        hostMenu->addSeparator();

        // 19 == host_active_checks_enabled
        if (lastRightClickedItem->text(19) == "0")
        {
        QAction *hostEnableActiveChecks   = new QAction("&Enable Active Checks", this);
            hostEnableActiveChecks->setIcon(QIcon(":/images/checks_enabled.png"));
            hostEnableActiveChecks->setObjectName("HostEnableActiveChecks");
                connect(hostEnableActiveChecks, SIGNAL(triggered(bool)), this, SLOT(menuRightSlot(bool)));
        hostMenu->addAction(hostEnableActiveChecks);
        }
开发者ID:eastcoastkiter,项目名称:whassup,代码行数:57,代码来源:servicetree.cpp

示例12: setup

void MenuManager::setup(MenuItem* menuItems) const
{
    if (!menuItems)
        return; // empty menu bar

    QMenuBar* menuBar = getMainWindow()->menuBar();
    //menuBar->setUpdatesEnabled(false);

    QList<MenuItem*> items = menuItems->getItems();
    QList<QAction*> actions = menuBar->actions();
    for (QList<MenuItem*>::ConstIterator it = items.begin(); it != items.end(); ++it)
    {
        // search for the menu action
        QAction* action = findAction(actions, QString::fromAscii((*it)->command().c_str()));
        if (!action) {
            // There must be not more than one separator in the menu bar, so
            // we can safely remove it if available and append it at the end
            if ((*it)->command() == "Separator") {
                action = menuBar->addSeparator();
                action->setObjectName(QLatin1String("Separator"));
            }
            else {
                // create a new menu
                std::string menuName = (*it)->command();
                QMenu* menu = menuBar->addMenu(
                    QApplication::translate("Workbench", menuName.c_str(),
                                            0, QApplication::UnicodeUTF8));
                action = menu->menuAction();
                menu->setObjectName(QString::fromAscii(menuName.c_str()));
                action->setObjectName(QString::fromAscii(menuName.c_str()));
            }

            // set the menu user data
            action->setData(QString::fromAscii((*it)->command().c_str()));
        }
        else {
            // put the menu at the end
            menuBar->removeAction(action);
            menuBar->addAction(action);
            action->setVisible(true);
            int index = actions.indexOf(action);
            actions.removeAt(index);
        }

        // flll up the menu
        if (!action->isSeparator())
            setup(*it, action->menu());
    }

    // hide all menus which we don't need for the moment
    for (QList<QAction*>::Iterator it = actions.begin(); it != actions.end(); ++it) {
        (*it)->setVisible(false);
    }

    // enable update again
    //menuBar->setUpdatesEnabled(true);
}
开发者ID:lainegates,项目名称:FreeCAD,代码行数:57,代码来源:MenuManager.cpp

示例13: initGui

void QgsRasterTerrainAnalysisPlugin::initGui()
{
  //create Action
  if ( mIface )
  {
    //find raster menu
    QString rasterText = QCoreApplication::translate( "QgisApp", "&Raster" );
    QMainWindow* mainWindow = qobject_cast<QMainWindow*>( mIface->mainWindow() );
    if ( !mainWindow )
    {
      return;
    }

    QMenuBar* menuBar = mainWindow->menuBar();
    if ( !menuBar )
    {
      return;
    }

    QMenu* rasterMenu = 0;
    QList<QAction *> menuBarActions = menuBar->actions();
    QList<QAction *>::iterator menuActionIt =  menuBarActions.begin();
    for ( ; menuActionIt != menuBarActions.end(); ++menuActionIt )
    {
      if (( *menuActionIt )->menu() && ( *menuActionIt )->menu()->title() == rasterText )
      {
        rasterMenu = ( *menuActionIt )->menu();
        rasterMenu->addSeparator();
        break;
      }
    }

    if ( !rasterMenu )
    {
      return;
    }

    mTerrainAnalysisMenu = new QMenu( tr( "Terrain analysis" ), rasterMenu );
    mTerrainAnalysisMenu->setObjectName( "mTerrainAnalysisMenu" );
    mTerrainAnalysisMenu->setIcon( QIcon( ":/raster/dem.png" ) );
    QAction *slopeAction = mTerrainAnalysisMenu->addAction( tr( "Slope" ), this, SLOT( slope() ) );
    slopeAction->setObjectName( "slopeAction" );

    QAction *aspectAction = mTerrainAnalysisMenu->addAction( tr( "Aspect" ), this, SLOT( aspect() ) );
    aspectAction->setObjectName( "aspectAction" );
    QAction *hilshadeAction = mTerrainAnalysisMenu->addAction( tr( "Hillshade" ), this, SLOT( hillshade() ) );
    hilshadeAction->setObjectName( "hilshadeAction" );
    QAction *reliefAction = mTerrainAnalysisMenu->addAction( tr( "Relief" ), this, SLOT( relief() ) );
    reliefAction->setObjectName( "reliefAction" );
    QAction *ruggednesIndex = mTerrainAnalysisMenu->addAction( tr( "Ruggedness index" ), this, SLOT( ruggedness() ) );
    ruggednesIndex->setObjectName( "ruggednesIndex" );

    rasterMenu->addMenu( mTerrainAnalysisMenu );


  }
}
开发者ID:Aladar64,项目名称:QGIS,代码行数:57,代码来源:qgsrasterterrainanalysisplugin.cpp

示例14: KexiView

KexiReportView::KexiReportView(QWidget *parent)
        : KexiView(parent), m_preRenderer(0), m_reportDocument(0), m_kexi(0), m_functions(0)
{   
    setObjectName("KexiReportDesigner_DataView");
    m_scrollArea = new QScrollArea(this);
    m_scrollArea->setBackgroundRole(QPalette::Dark);
    m_scrollArea->viewport()->setAutoFillBackground(true);

    layout()->addWidget(m_scrollArea);
    
#ifndef KEXI_MOBILE
    m_pageSelector = new KexiRecordNavigator(this, 0);
    layout()->addWidget(m_pageSelector);
    m_pageSelector->setRecordCount(0);
    m_pageSelector->setInsertingButtonVisible(false);
    m_pageSelector->setLabelText(i18n("Page"));
#endif
    
    // -- setup local actions
    QList<QAction*> viewActions;
    QAction* a;
    viewActions << (a = new KAction(KIcon("printer"), i18n("Print"), this));
    a->setObjectName("print_report");
    a->setToolTip(i18n("Print Report"));
    a->setWhatsThis(i18n("Prints the current report."));
    connect(a, SIGNAL(triggered()), this, SLOT(slotPrintReport()));

    viewActions << (a = new KAction(KIcon("kword"), i18n("Save to KWord"), this));
    a->setObjectName("save_to_kword");
    a->setToolTip(i18n("Save the report to a KWord document"));
    a->setWhatsThis(i18n("Save the report to a KWord document"));
    a->setEnabled(true);
    connect(a, SIGNAL(triggered()), this, SLOT(slotRenderODT()));

    viewActions << (a = new KAction(KIcon("kspread"), i18n("Save to KSpread"), this));
    a->setObjectName("save_to_kspread");
    a->setToolTip(i18n("Save the report to a KSpread document"));
    a->setWhatsThis(i18n("Saves the current report to a KSpread document."));
    a->setEnabled(true);
    connect(a, SIGNAL(triggered()), this, SLOT(slotRenderKSpread()));

    viewActions << (a = new KAction(KIcon("text-html"), i18n("Export as Web Page"), this));
    a->setObjectName("export_as_web_page");
    a->setToolTip(i18n("Export the report as web page"));
    a->setWhatsThis(i18n("Exports the report to a web page file."));
    a->setEnabled(true);
    connect(a, SIGNAL(triggered()), this, SLOT(slotExportHTML()));

    setViewActions(viewActions);

#ifndef KEXI_MOBILE
    connect(m_pageSelector, SIGNAL(nextButtonClicked()), this, SLOT(nextPage()));
    connect(m_pageSelector, SIGNAL(prevButtonClicked()), this, SLOT(prevPage()));
    connect(m_pageSelector, SIGNAL(firstButtonClicked()), this, SLOT(firstPage()));
    connect(m_pageSelector, SIGNAL(lastButtonClicked()), this, SLOT(lastPage()));
#endif
}
开发者ID:KDE,项目名称:calligra-history,代码行数:57,代码来源:kexireportview.cpp

示例15: getProgram

void
MidiProgramsEditor::slotKeyMapButtonPressed()
{
    QToolButton* button = dynamic_cast<QToolButton*>(const_cast<QObject *>(sender()));
    if (!button) {
        RG_DEBUG << "MidiProgramsEditor::slotKeyMapButtonPressed() : %%% ERROR - signal sender is not a QPushButton\n";
        return ;
    }

//    std::cout << "editor button name" << button->objectName().toStdString() << std::endl;

    QString senderName = button->objectName();

    if (!m_device)
        return ;

    const KeyMappingList &kml = m_device->getKeyMappings();
    if (kml.empty())
        return ;

    // Adjust value back to zero rated
    //
    unsigned int id = senderName.toUInt() - 1;
    MidiProgram *program = getProgram(*getCurrentBank(), id);
    if (!program)
        return ;
    m_currentMenuProgram = id;

    RosegardenPopupMenu *menu = new RosegardenPopupMenu(button);

    const MidiKeyMapping *currentMapping =
        m_device->getKeyMappingForProgram(*program);

    int currentKeyMap = 0;

    QAction *a = menu->addAction(tr("<no key mapping>"));
    a->setObjectName("0");

    for (size_t i = 0; i < kml.size(); ++i) {
        a = menu->addAction(strtoqstr(kml[i].getName()));
        a->setObjectName(QString("%1").arg(i+1));
        if (currentMapping && (kml[i] == *currentMapping)) currentKeyMap = int(i + 1);
    }

    connect(menu, SIGNAL(triggered(QAction *)),
            this, SLOT(slotKeyMapMenuItemSelected(QAction *)));

    int itemHeight = menu->actionGeometry(actions().value(0)).height() + 2;
    QPoint pos = QCursor::pos();

    pos.rx() -= 10;
    pos.ry() -= (itemHeight / 2 + currentKeyMap * itemHeight);

    menu->popup(pos);
}
开发者ID:UIKit0,项目名称:rosegarden,代码行数:55,代码来源:MidiProgramsEditor.cpp


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