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


C++ QMenu::setAttribute方法代码示例

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


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

示例1: itemsTabTreeContextMenu

void QtSE::itemsTabTreeContextMenu( QPoint point )
{
	std::cout << "lol" << std::endl;

	int index = itemsTab->tabBar()->tabAt( itemsTab->tabBar()->mapFromGlobal( QCursor::pos() ) );

	if( index >= 0 )
	{
		QMenu *menu = new QMenu();
		menu->setAttribute( Qt::WA_DeleteOnClose , true );

		/*
		if( itemsTab->tabText( index ) == "Project" )
		{
			//
		}
		else
		*/
		if( itemsTab->tabText( index ) == "Filesystem" )
		{
			menu->addAction( "Refresh" , this , SLOT(fsRefresh()) );
		}
		else
		{
			delete menu;
			return;
		}

		menu->popup( QCursor::pos() , NULL );
	}
}
开发者ID:zekin,项目名称:QtShaderEditor,代码行数:31,代码来源:QtSE.cpp

示例2: contextMenuRequest

void Frequencies::contextMenuRequest(QPoint pos)
{
  QMenu *menu = new QMenu(this);
  menu->setAttribute(Qt::WA_DeleteOnClose);
  menu->addAction("Save PNG", this, SLOT(savePNG()));
  menu->popup(m_customPlot->mapToGlobal(pos));
}
开发者ID:jlane-waikato,项目名称:IQmol,代码行数:7,代码来源:FrequenciesConfigurator.C

示例3: projectTreeContextMenu

void QtSE::projectTreeContextMenu( QPoint point )
{
	CProjectTreeItem *item = (CProjectTreeItem*)projectTree->itemAt( point );

	if( item )
	{
		QMenu *menu = new QMenu();
		menu->setAttribute( Qt::WA_DeleteOnClose , true );

		switch( item->getPartType() )
		{
			case CProjectTreeItem::stage:
				menu->addAction( "Add Stage" , this , SLOT(addStage()) );
				break;
			case CProjectTreeItem::framebuffer:
				menu->addAction( "Add Framebuffer" , this , SLOT(addFramebuffer()) );
				break;
			case CProjectTreeItem::shader:
				menu->addAction( "Add Shader" , this , SLOT(addShader()) );
				break;
			case CProjectTreeItem::texture:
				menu->addAction( "Add Texture" , this , SLOT(addTexture()) );
				break;
			case CProjectTreeItem::model:
				menu->addAction( "Add Model" , this , SLOT(addModel()) );
				break;
			default:
				delete menu;
				return;
		}

		menu->popup( QCursor::pos() , NULL );
	}
}
开发者ID:zekin,项目名称:QtShaderEditor,代码行数:34,代码来源:QtSE.cpp

示例4: contextMenuEvent

void SongInfoTextView::contextMenuEvent(QContextMenuEvent* e) {
  QMenu* menu = createStandardContextMenu(e->pos());
  menu->setAttribute(Qt::WA_DeleteOnClose);

  menu->addAction(tr("Change font size..."), this, SIGNAL(ShowSettingsDialog()));

  menu->popup(e->globalPos());
}
开发者ID:ximion,项目名称:Clementine-LibDanceTag,代码行数:8,代码来源:songinfotextview.cpp

示例5: contextMenuFilters

void FramePlaybackWindow::contextMenuFilters(QPoint pos)
{
    QMenu *menu = new QMenu(this);
    menu->setAttribute(Qt::WA_DeleteOnClose);
    menu->addAction(tr("Save filter definition to file"), this, SLOT(saveFilters()));
    menu->addAction(tr("Load filter definition from file"), this, SLOT(loadFilters()));
    menu->popup(ui->listID->mapToGlobal(pos));
}
开发者ID:collin80,项目名称:SavvyCAN,代码行数:8,代码来源:frameplaybackwindow.cpp

示例6: QMenu

QMenu *EC_MediaPlayer::GetContextMenu()
{
    QMenu *actionMenu = new QMenu(0);
    actionMenu->setAttribute(Qt::WA_DeleteOnClose, true);
    actionMenu->addAction(QIcon(":/images/playpause.png"), "Play/Pause", this, SLOT(PlayPauseToggle()));
    actionMenu->addAction(QIcon(":/images/stop.png"), "Stop", this, SLOT(Stop()));
    actionMenu->addAction("Show Player", this, SLOT(ShowPlayer()));
    return actionMenu;
}
开发者ID:katik,项目名称:naali,代码行数:9,代码来源:EC_MediaPlayer.cpp

示例7: showToolBarStylePopupMenu

void PdfViewer::showToolBarStylePopupMenu(const QPoint &pos)
{
	QMenu *popupMenu = new QMenu(this);
	popupMenu->setAttribute(Qt::WA_DeleteOnClose);
	popupMenu->move(mapToGlobal(QPoint(0,0)) + pos);

	QWidgetAction *iconOnlyAction = new QWidgetAction(popupMenu);
	QRadioButton *iconOnlyRadio = new QRadioButton(tr("&Icons Only"), popupMenu);
	iconOnlyAction->setDefaultWidget(iconOnlyRadio);

	QWidgetAction *textOnlyAction = new QWidgetAction(popupMenu);
	QRadioButton *textOnlyRadio = new QRadioButton(tr("&Text Only"), popupMenu);
	textOnlyAction->setDefaultWidget(textOnlyRadio);

	QWidgetAction *textBesideIconAction = new QWidgetAction(popupMenu);
	QRadioButton *textBesideIconRadio = new QRadioButton(tr("Text &Alongside Icons"), popupMenu);
	textBesideIconAction->setDefaultWidget(textBesideIconRadio);

	QWidgetAction *textUnderIconAction = new QWidgetAction(popupMenu);
	QRadioButton *textUnderIconRadio = new QRadioButton(tr("Text &Under Icons"), popupMenu);
	textUnderIconAction->setDefaultWidget(textUnderIconRadio);

	QButtonGroup *popupButtonGroup = new QButtonGroup(popupMenu);
	popupButtonGroup->addButton(iconOnlyRadio);
	popupButtonGroup->addButton(textOnlyRadio);
	popupButtonGroup->addButton(textBesideIconRadio);
	popupButtonGroup->addButton(textUnderIconRadio);
	popupButtonGroup->setId(iconOnlyRadio, 0);
	popupButtonGroup->setId(textOnlyRadio, 1);
	popupButtonGroup->setId(textBesideIconRadio, 2);
	popupButtonGroup->setId(textUnderIconRadio, 3);
	connect(popupButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotChangeToolBarStyle(int)));

	popupMenu->addAction(iconOnlyAction);
	popupMenu->addAction(textOnlyAction);
	popupMenu->addAction(textBesideIconAction);
	popupMenu->addAction(textUnderIconAction);
	popupMenu->setContentsMargins(5, 0, 5, 0);

	QSettings settings;
	settings.beginGroup("MainWindow");
	const int toolBarStyleNumber = settings.value("ToolBarStyle", 0).toInt();
	switch (toolBarStyleNumber)
	{
		case 0: iconOnlyRadio->setChecked(true); break;
		case 1: textOnlyRadio->setChecked(true); break;
		case 2: textBesideIconRadio->setChecked(true); break;
		case 3: textUnderIconRadio->setChecked(true); break;
	}
	settings.endGroup();

	popupMenu->show();
	// make sure that the popupMenu stays completely inside the screen (must be done after popupMenu->show() in order to have the correct width)
	const int desktopWidth = QApplication::desktop()->availableGeometry(this).width();
	if (popupMenu->x() + popupMenu->width() > desktopWidth)
		popupMenu->move(desktopWidth - popupMenu->width(), popupMenu->y());
}
开发者ID:amkhlv,项目名称:pdfviewer,代码行数:57,代码来源:viewer.cpp

示例8: contextMenuRequestPresupuesto

void Presupuesto_Widget::contextMenuRequestPresupuesto(QPoint pos)
{
    QMenu *menu = new QMenu(this);
    menu->setAttribute(Qt::WA_DeleteOnClose);
    menu->addAction(QIcon(":/imagenes/Imagenes/add.png"),"Añadir registro", this, SLOT(on_addRegPresupuesto_clicked()));
    if(ui->tablePresupuesto->currentIndex().isValid())
        menu->addAction(QIcon(":/imagenes/Imagenes/quit.png"),"Remover registro", this, SLOT(on_removeRegPresupuesto_clicked()));
    menu->popup(ui->tablePresupuesto->mapToGlobal(pos));
}
开发者ID:mdchaparror,项目名称:QFinanzas,代码行数:9,代码来源:presupuesto_widget.cpp

示例9: contextPlot

void qBicWin::contextPlot(QPoint pos)
{
    QMenu *menu = new QMenu(this);
    menu->setAttribute(Qt::WA_DeleteOnClose);

    menu->addAction("Save heatmap", this, SLOT(saveHeat()));

    menu->popup(plot->mapToGlobal(pos));
}
开发者ID:Archi0,项目名称:QtBiVis,代码行数:9,代码来源:qbicwin.cpp

示例10: onCustomMenuValues

void DBCSignalEditor::onCustomMenuValues(QPoint point)
{
    QMenu *menu = new QMenu(this);
    menu->setAttribute(Qt::WA_DeleteOnClose);

    menu->addAction(tr("Delete currently selected value"), this, SLOT(deleteCurrentValue()));

    menu->popup(ui->valuesTable->mapToGlobal(point));
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例11: contextMenuRequestGraph

void FlowViewWindow::contextMenuRequestGraph(QPoint pos)
{
  QMenu *menu = new QMenu(this);
  menu->setAttribute(Qt::WA_DeleteOnClose);

  menu->addAction(tr("Save image to file"), this, SLOT(saveFileGraph()));

  menu->popup(ui->graphView->mapToGlobal(pos));
}
开发者ID:klasrocket,项目名称:SavvyCAN,代码行数:9,代码来源:flowviewwindow.cpp

示例12: contextMenuRequest

void viewGVpropertieslayout::contextMenuRequest(QPoint pos)
{
    // first get a pointer to the current plot!
    QCustomPlot * currPlot = (QCustomPlot *) currentSubWindow->widget();
    QMenu *menu = new QMenu(this);
    menu->setAttribute(Qt::WA_DeleteOnClose);

    if (currPlot->legend->selectTest(pos, false) >= 0) // context menu on legend requested
    {
        /*menu->addAction("Move to top left", this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignLeft));
        menu->addAction("Move to top center", this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignHCenter));
        menu->addAction("Move to top right", this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignRight));
        menu->addAction("Move to bottom right", this, SLOT(moveLegend()))->setData((int)(Qt::AlignBottom|Qt::AlignRight));
        menu->addAction("Move to bottom left", this, SLOT(moveLegend()))->setData((int)(Qt::AlignBottom|Qt::AlignLeft));*/
    } else if (currPlot->xAxis->selectTest(pos, false) >= 0 || \
               currPlot->xAxis2->selectTest(pos, false) >= 0)
    {
        // enable / disable zoom
        if (currPlot->axisRect()->rangeZoom() & Qt::Horizontal)
            menu->addAction("Disable zoom on axis", this, SLOT(toggleHorizontalZoom()));
        else
            menu->addAction("Enable zoom on axis", this, SLOT(toggleHorizontalZoom()));

        // enable / diable drag
        if (currPlot->axisRect()->rangeDrag() & Qt::Horizontal)
            menu->addAction("Disable drag on axis", this, SLOT(toggleHorizontalDrag()));
        else
            menu->addAction("Enable drag on axis", this, SLOT(toggleHorizontalDrag()));

    } else if (currPlot->yAxis->selectTest(pos, false) >= 0 || \
               currPlot->yAxis2->selectTest(pos, false) >= 0)
    {

        // enable / disable zoom
        if (currPlot->axisRect()->rangeZoom() & Qt::Vertical)
            menu->addAction("Disable zoom on axis", this, SLOT(toggleVerticalZoom()));
        else
            menu->addAction("Enable zoom on axis", this, SLOT(toggleVerticalZoom()));

        // enable / diable drag
        if (currPlot->axisRect()->rangeDrag() & Qt::Vertical)
            menu->addAction("Disable drag on axis", this, SLOT(toggleVerticalDrag()));
        else
            menu->addAction("Enable drag on axis", this, SLOT(toggleVerticalDrag()));

    } else
    {
        if (currPlot->graphCount() > 0)
          menu->addAction("Scale axes to fit", this, SLOT(rescaleAxes()));
        if (currPlot->selectedGraphs().size() > 0)
          menu->addAction("Remove selected graph", this, SLOT(removeSelectedGraph()));
        if (currPlot->graphCount() > 0)
          menu->addAction("Remove all graphs", this, SLOT(removeAllGraphs()));
    }

    menu->popup(currPlot->mapToGlobal(pos));
    }
开发者ID:ajc158,项目名称:spinecreator,代码行数:57,代码来源:viewGVpropertieslayout.cpp

示例13: onCustomMenuSignals

void DBCSignalEditor::onCustomMenuSignals(QPoint point)
{
    QMenu *menu = new QMenu(this);
    menu->setAttribute(Qt::WA_DeleteOnClose);

    menu->addAction(tr("Add a new signal"), this, SLOT(addNewSignal()));
    menu->addAction(tr("Delete currently selected signal"), this, SLOT(deleteCurrentSignal()));

    menu->popup(ui->signalsList->mapToGlobal(point));
}
开发者ID:duderdice,项目名称:SavvyCAN,代码行数:10,代码来源:dbcsignaleditor.cpp

示例14: slotCustomContextMenu

void KBookmarkMenu::slotCustomContextMenu(const QPoint &pos)
{
    QAction *action = m_parentMenu->actionAt(pos);
    QMenu *menu = contextMenu(action);
    if (!menu) {
        return;
    }
    menu->setAttribute(Qt::WA_DeleteOnClose);
    menu->popup(m_parentMenu->mapToGlobal(pos));
}
开发者ID:KDE,项目名称:kbookmarks,代码行数:10,代码来源:kbookmarkmenu.cpp

示例15: contextMenuEvent

void LocationBar::contextMenuEvent(QContextMenuEvent* event)
{
    QMenu* menu = createContextMenu();
    menu->setAttribute(Qt::WA_DeleteOnClose);

    // Prevent choosing first option with double rightclick
    QPoint pos = event->globalPos();
    pos.setY(pos.y() + 1);
    menu->popup(pos);
}
开发者ID:kkofler,项目名称:qupzilla,代码行数:10,代码来源:locationbar.cpp


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