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


C++ QWidgetAction类代码示例

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


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

示例1: QMenu

NBCategoryMenu::NBCategoryMenu( QString catName, QPixmap icon, QString wNode, QModelIndexList nodeList, QWidget *parent ) : QMenu( parent ) {

	mCategory = catName;
	mWorkNode = wNode;
	sNodes << nodeList;

	QWidgetAction *title = new QWidgetAction( this );
	QWidget *actBase = new QWidget( this );

	QLabel *pix = new QLabel();
	pix->setFixedSize( 20, 20 );
	pix->setPixmap( icon.scaled( 16, 16, Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
	pix->setAlignment( Qt::AlignCenter );

	QLabel *name = new QLabel( "<b>" + catName + "</b>" );
	name->setFixedHeight( 20 );
	name->setAlignment( Qt::AlignVCenter );

	QHBoxLayout *lyt = new QHBoxLayout();
	lyt->setContentsMargins( QMargins( 4, 4, 4, 0 ) );
	lyt->addWidget( pix );
	lyt->addWidget( name );

	actBase->setLayout( lyt );
	title->setDefaultWidget( actBase );
	addAction( title );

	addSeparator();

	populateMenu();
};
开发者ID:marcusbritanicus,项目名称:NewBreeze,代码行数:31,代码来源:NBCategoryMenu.cpp

示例2: KPushButton

KisMouseInputEditor::KisMouseInputEditor(QWidget *parent)
    : KPushButton(parent), d(new Private)
{
    QWidget *popup = new QWidget();

    d->ui = new Ui::KisMouseInputEditor;
    d->ui->setupUi(popup);
    d->ui->mouseButton->setType(KisInputButton::MouseType);

    d->ui->clearModifiersButton->setIcon(KisIconUtils::loadIcon("edit-clear"));
    d->ui->clearMouseButton->setIcon(KisIconUtils::loadIcon("edit-clear"));

    QWidgetAction *action = new QWidgetAction(this);
    action->setDefaultWidget(popup);

    QMenu *menu = new QMenu(this);
    menu->addAction(action);
    setMenu(menu);

    QTimer::singleShot(0, this, SLOT(showMenu()));

    connect(d->ui->mouseButton, SIGNAL(dataChanged()), SLOT(updateLabel()));
    connect(d->ui->modifiersButton, SIGNAL(dataChanged()), SLOT(updateLabel()));
    connect(d->ui->clearMouseButton, SIGNAL(clicked(bool)), d->ui->mouseButton, SLOT(clear()));
    connect(d->ui->clearModifiersButton, SIGNAL(clicked(bool)), d->ui->modifiersButton, SLOT(clear()));
}
开发者ID:woylaski,项目名称:kexi,代码行数:26,代码来源:kis_mouse_input_editor.cpp

示例3: QAction

void CMainWindow::initBrushMenu()
{
   // allocate menu members
   brushMenuAction = new QAction(drawDefActions);
   brushMenu = new QMenu(this);
   QWidgetAction *brushSelectorWidgetAction = new QWidgetAction(this);
   CBrushSelector *brushSelector = new CBrushSelector(brushMenu);

   // misc
   brushSelectorWidgetAction->setDefaultWidget(brushSelector);
   brushMenu->addAction(brushSelectorWidgetAction);
   brushMenuAction->setToolTip(tr("Brush"));
   brushMenuAction->setIcon(QIcon(":/images/brush.png"));
   brushMenuAction->setMenu(brushMenu);
   drawDefBar->addAction(brushMenuAction);

   // make connections to main window
   connect(brushMenuAction, SIGNAL(triggered(bool)),
      this, SLOT(brushActionTriggeredSlot(bool)));

   connect(brushSelector, SIGNAL(closeSignal()),
      this, SLOT(closeBrushMenu()));

   //connect(brushSelector, SIGNAL(sendBrushSettings(const CBrushSettings *)),
   //   this, SLOT(receiveBrushSettings(const CBrushSettings *)));
}
开发者ID:Broentech,项目名称:sdraw,代码行数:26,代码来源:mainWindow.cpp

示例4: connect

QMenu* Scene_polylines_item::contextMenu() 
{
    const char* prop_name = "Menu modified by Scene_polylines_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) {
        menu->addSeparator();
        // TODO: add actions to display corners
        QAction* action = menu->addAction(tr("Display corners with radius..."));
        connect(action, SIGNAL(triggered()),
                this, SLOT(change_corner_radii()));

        QAction* actionSmoothPolylines =
                menu->addAction(tr("Smooth polylines"));
        actionSmoothPolylines->setObjectName("actionSmoothPolylines");
        connect(actionSmoothPolylines, SIGNAL(triggered()),this, SLOT(smooth()));

        QMenu *container = new QMenu(tr("Line Width"));
        QWidgetAction *sliderAction = new QWidgetAction(0);
        connect(d->line_Slider, &QSlider::valueChanged, this, &Scene_polylines_item::itemChanged);

        sliderAction->setDefaultWidget(d->line_Slider);

        container->addAction(sliderAction);
        menu->addMenu(container);

        menu->setProperty(prop_name, true);
    }
    return menu;
}
开发者ID:FEniCS,项目名称:mshr,代码行数:35,代码来源:Scene_polylines_item.cpp

示例5: Q_ASSERT

bool MenuItemMgr::updateRibbonMenu( Qtitan::RibbonBar* ribonBar)
{
	QObjectList::iterator it , git ;
	Q_ASSERT( myMainWindow!= NULL ) ;
	Q_ASSERT( myMenuItems!= NULL ) ;

	QObjectList pages = myMenuItems->children() ;

	for( it = pages.begin() ; it != pages.end() ; it++ )
	{
		QWidgetAction *wa = (QWidgetAction*)*it ; 
		if( wa != NULL )
		{
			Qtitan::RibbonPage* page = ribonBar->addPage( wa->text() );
			if( page != NULL )
			{
				insertMenu( page , wa ) ;
			}
		}// if
	}// for
	

	
	connect( myMainWindow->getActionGroup() , SIGNAL( triggered( QAction* ) ), myMainWindow, SLOT( onMenuAction( QAction*) ) );

	return true ;
}
开发者ID:ijab,项目名称:SpeechNav,代码行数:27,代码来源:MenuItemMgr.cpp

示例6: QWidgetAction

void ComponentWidget::addOption(QWidget *widget)
{
    QWidgetAction *action = new QWidgetAction(widget);
    action->setDefaultWidget(widget);

    m_componentUi.optionsButton->menu()->addAction(action);
}
开发者ID:B-Rich,项目名称:plasmoid-adjustable-clock,代码行数:7,代码来源:ComponentWidget.cpp

示例7: QgsMapTool

CDTMapToolSelectTrainingSamples::CDTMapToolSelectTrainingSamples(QgsMapCanvas *canvas) :
    QgsMapTool(canvas),
    mapCanvas(canvas),
    toolBar(new CDTCategoryToolBar(tr("Select training samples"),MainWindow::getMainWindow())),
    model(new QSqlQueryModel(this))
{    
    toolBar->setFloatable(true);
    toolBar->setMovable(true);
    toolBar->show();
    toolBar->raise();

    QSettings setting("WHU","CDTStudio");
    setting.beginGroup("CDTCategoryToolBar");
    QByteArray geometry = setting.value("Geometry").toByteArray();
    setting.endGroup();
    if (geometry.isEmpty())
    {
        QPoint ptGlobal = MainWindow::getCurrentMapCanvas()->mapToGlobal(MainWindow::getCurrentMapCanvas()->rect().center());
        toolBar->move(MainWindow::getMainWindow()->mapFromGlobal(ptGlobal));
    }
    else
        toolBar->restoreGeometry(geometry);

    comboBoxCategory = new QComboBox(toolBar);
    comboBoxCategory->setModel(model);

    QWidgetAction *actionLabel = new QWidgetAction(this);
    QWidgetAction *actionCombo = new QWidgetAction(this);
    actionLabel->setDefaultWidget(new QLabel(tr("Category"),toolBar));
    actionCombo->setDefaultWidget(comboBoxCategory);

    toolBar->addAction(actionLabel);
    toolBar->addAction(actionCombo);
    MainWindow::getMainWindow()->addToolBar(toolBar);
}
开发者ID:chenguanzhou,项目名称:CDTStudio,代码行数:35,代码来源:cdtmaptoolselecttrainingsamples.cpp

示例8: QLabel

void ComicMainWindow::setupContextMenu()
{
    QMenu *cmenu = view->contextMenu();
    pageinfo = new QLabel(cmenu);
    pageinfo->setMargin(3);
    pageinfo->setAlignment(Qt::AlignHCenter);
    pageinfo->setFrameStyle(QFrame::Box | QFrame::Raised);
    QWidgetAction *actionPageInfo = new QWidgetAction(this);
    actionPageInfo->setDefaultWidget(pageinfo);
    
    cmenu->addAction(actionNextPage);
    cmenu->addAction(actionPreviousPage);
    cmenu->addSeparator();
    cmenu->addAction(actionFitWidth);
    cmenu->addAction(actionFitHeight);
    cmenu->addAction(actionWholePage);
    cmenu->addAction(actionOriginalSize);
    cmenu->addAction(actionBestFit);
    cmenu->addSeparator();
    cmenu->addAction(actionRotateRight);
    cmenu->addAction(actionRotateLeft);
    cmenu->addAction(actionNoRotation);
    cmenu->addSeparator();
    cmenu->addAction(actionTwoPages);
    cmenu->addAction(actionMangaMode);
    cmenu->addSeparator();
    cmenu->addAction(actionFullscreen);
    cmenu->addAction(actionPageInfo);
}
开发者ID:machekku,项目名称:QComicBook,代码行数:29,代码来源:ComicMainWindow.cpp

示例9: QMenu

EmoticonMenu::EmoticonMenu(QWidget *parent) :
    QMenu(parent)
{
    layout = new QGridLayout(this);
    layout->setContentsMargins(1,1,1,1);
    layout->setSpacing(0);

    QWidgetAction *action = new QWidgetAction(this);
    action->setDefaultWidget(new QWidget(this));
    action->defaultWidget()->setLayout(layout);
    this->addAction(action);

    // some Skype smileys
    addEmoticon(":/icons/emoticons/emotion_smile.png",    {":)", ":-)", ":o)"});
    addEmoticon(":/icons/emoticons/emotion_sad.png",      {":(", ":-("});
    addEmoticon(":/icons/emoticons/emotion_grin.png",     {":D", ":-D"});
    addEmoticon(":/icons/emoticons/emotion_cool.png",     {"8)", "8-)"});
    addEmoticon(":/icons/emoticons/emotion_suprised.png", {":O", ":-O"});
    addEmoticon(":/icons/emoticons/emotion_wink.png",     {";)", ";-)"});
    addEmoticon(":/icons/emoticons/emotion_cry.png",      {";(", ";-("});
    addEmoticon(":/icons/emoticons/emotion_sweat.png",    {"(:|"});
    // ...
    addEmoticon(":/icons/emoticons/emotion_kiss.png",     {":*", ":-*"});
    addEmoticon(":/icons/emoticons/emotion_tongue.png",   {":P", ":-P"});
    // ...
    addEmoticon(":/icons/emoticons/emotion_doubt.png",    {":^)", ":^-)"});
    // ...
    addEmoticon(":/icons/emoticons/emotion_love.png",     {"(inlove)"});
    addEmoticon(":/icons/emoticons/emotion_evilgrin.png", {"]:)", "]:-)"});
    // ...
    addEmoticon(":/icons/emoticons/emotion_angel.png",    {"O:)", "O:-)", "o:)", "o:-)", "(angel)"});
    // ...
}
开发者ID:lance0,项目名称:ProjectTox-Qt-GUI,代码行数:33,代码来源:emoticonmenu.cpp

示例10: QString

void KviStatusBar::contextPopupAboutToShow()
{
	if(!m_pContextPopup)
		return;

	m_pContextPopup->clear();

	if(appletExists(m_pClickedApplet))
	{
		QString szApp = m_pClickedApplet->descriptor()->visibleName();

		QString szTmp = QString("<center><b>%1</b></center>").arg(szApp);

		QLabel * pLabel = new QLabel(szTmp,m_pContextPopup);
		QPalette p;
		pLabel->setStyleSheet("background-color: " + p.color(QPalette::Normal, QPalette::Mid).name());

		QWidgetAction * pWaction = new QWidgetAction(m_pContextPopup);
		pWaction->setDefaultWidget(pLabel);
		m_pContextPopup->addAction(pWaction);

		m_pClickedApplet->fillContextPopup(m_pContextPopup);

		szTmp = QString(__tr2qs("Remove %1")).arg(szApp);
        m_pContextPopup->addSeparator();
		m_pContextPopup->addAction(szTmp,this,SLOT(removeClickedApplet()));
	}

	if(!m_pAppletsPopup)
	{
        m_pAppletsPopup = new QMenu(this);
		connect(m_pAppletsPopup,SIGNAL(aboutToShow()),this,SLOT(appletsPopupAboutToShow()));
        connect(m_pAppletsPopup,SIGNAL(triggered(QAction *)),this,SLOT(appletsPopupActivated(QAction *)));
	}
开发者ID:Heufneutje,项目名称:KVIrc,代码行数:34,代码来源:KviStatusBar.cpp

示例11: QToolButton

VolumeButton::VolumeButton(QWidget *parent) :
    QToolButton(parent), menu(0), label(0), slider(0)
{
    setIcon(style()->standardIcon(QStyle::SP_MediaVolume));
    setPopupMode(QToolButton::InstantPopup);

    QWidget *popup = new QWidget(this);

    slider = new QSlider(Qt::Horizontal, popup);
    slider->setRange(0, 100);
    connect(slider, SIGNAL(valueChanged(int)), this, SIGNAL(volumeChanged(int)));

    label = new QLabel(popup);
    label->setAlignment(Qt::AlignCenter);
    label->setNum(100);
    label->setMinimumWidth(label->sizeHint().width());
    connect(slider, SIGNAL(valueChanged(int)), label, SLOT(setNum(int)));

    QBoxLayout *popupLayout = new QHBoxLayout(popup);
    popupLayout->setMargin(2);
    popupLayout->addWidget(slider);
    popupLayout->addWidget(label);

    QWidgetAction *action = new QWidgetAction(this);
    action->setDefaultWidget(popup);

    menu = new QMenu(this);
    menu->addAction(action);
    setMenu(menu);

    stylize();
}
开发者ID:JamesLinus,项目名称:MusicEditor,代码行数:32,代码来源:volumebutton.cpp

示例12: QWidget

VideoControl::VideoControl(QWidget *parent)
    : QWidget(parent)
{
    setStyleSheet("background:black;");

    m_timeSlider = new QSlider(Qt::Horizontal, this);
    m_menuButton = new QToolButton(this);
    m_playButton = new QPushButton(this);

    m_volumnButton = new QToolButton(this);
    m_volumnSlider = new QSlider(Qt::Vertical, this);
    m_volumnSlider->setRange(0, 100);
    m_volumnSlider->setValue(100);

    m_playButton->setIcon(QIcon(":/video/play"));
    m_volumnButton->setIcon(QIcon(":/video/volumn"));
    m_menuButton->setIcon(QIcon(":/video/menu"));

    m_playButton->setCursor(QCursor(Qt::PointingHandCursor));
    m_volumnButton->setCursor(QCursor(Qt::PointingHandCursor));
    m_menuButton->setCursor(QCursor(Qt::PointingHandCursor));
    m_timeSlider->setCursor(QCursor(Qt::PointingHandCursor));
    m_volumnSlider->setCursor(QCursor(Qt::PointingHandCursor));

    m_popupVolumn.setStyleSheet(BarrageCore::MMenuStyle01);
    m_timeSlider->setStyleSheet(BarrageCore::MSliderStyle02);
    m_volumnSlider->setStyleSheet(BarrageCore::MSliderStyle01);
    m_playButton->setStyleSheet(BarrageCore::MPushButtonStyle02);
    m_volumnButton->setStyleSheet(BarrageCore::MToolButtonStyle02);
    m_menuButton->setStyleSheet(BarrageCore::MToolButtonStyle02);

    QVBoxLayout *controlVLayout = new QVBoxLayout(this);
    controlVLayout->setSpacing(0);
    controlVLayout->setContentsMargins(0, 0, 0, 0);
    QWidget *controlBWidget = new QWidget(this);
    QHBoxLayout *controlBLayout = new QHBoxLayout(controlBWidget);
    controlBLayout->setContentsMargins(9, 0, 9, 0);
    controlBLayout->addWidget(m_menuButton);
    controlBLayout->addWidget(m_playButton);
    controlBLayout->addWidget(m_volumnButton);
    controlBLayout->addStretch(1);
    controlBLayout->addWidget(createBarrageWidget(), 15);
    controlBLayout->addStretch(1);
    controlBWidget->setLayout(controlBLayout);
    controlVLayout->addWidget(m_timeSlider);
    controlVLayout->addWidget(controlBWidget);
    setLayout(controlVLayout);

    QWidgetAction *widgetAction = new QWidgetAction(this);
    widgetAction->setDefaultWidget(m_volumnSlider);
    m_popupVolumn.addAction(widgetAction);
    m_volumnButton->setMenu(&m_popupVolumn);
    m_volumnButton->setPopupMode(QToolButton::InstantPopup);

    connect(m_menuButton, SIGNAL(clicked()), SLOT(openFileDialog()));
    connect(m_timeSlider, SIGNAL(sliderReleased()), SLOT(sliderReleased()));
    connect(m_volumnSlider, SIGNAL(valueChanged(int)), parent, SLOT(volumnChanged(int)));
    connect(m_playButton, SIGNAL(clicked()), parent, SLOT(play()));
}
开发者ID:YeClimEric,项目名称:Qt,代码行数:59,代码来源:videocontrol.cpp

示例13: insertWidget

/*!
    Adds the given \a widget to the toolbar as the toolbar's last
    item.

    The toolbar takes ownership of \a widget.

    If you add a QToolButton with this method, the tools bar's
    Qt::ToolButtonStyle will not be respected.

    \note You should use QAction::setVisible() to change the
    visibility of the widget. Using QWidget::setVisible(),
    QWidget::show() and QWidget::hide() does not work.

    \sa insertWidget()
*/
QAction *QToolBar::addWidget(QWidget *widget)
{
    QWidgetAction *action = new QWidgetAction(this);
    action->setDefaultWidget(widget);
    action->d_func()->autoCreated = true;
    addAction(action);
    return action;
}
开发者ID:dirlinch,项目名称:chromecast-mirrored-source.vendor,代码行数:23,代码来源:qtoolbar.cpp

示例14: addWidget

/*!
    Inserts the given \a widget in front of the toolbar item
    associated with the \a before action.

    Note: You should use QAction::setVisible() to change the
    visibility of the widget. Using QWidget::setVisible(),
    QWidget::show() and QWidget::hide() does not work.

    \sa addWidget()
*/
QAction *QToolBar::insertWidget(QAction *before, QWidget *widget)
{
    QWidgetAction *action = new QWidgetAction(this);
    action->setDefaultWidget(widget);
    action->d_func()->autoCreated = true;
    insertAction(before, action);
    return action;
}
开发者ID:dirlinch,项目名称:chromecast-mirrored-source.vendor,代码行数:18,代码来源:qtoolbar.cpp

示例15: QMenu

void SAQwtPlotCurveItemSetWidget::createSymbolSetWidget()
{
    m_symbolSetMenu = new QMenu(this);
    QWidgetAction* act = new QWidgetAction(m_symbolSetMenu);
    m_symbolSetWidget = new SAQwtSymbolSetWidget();
    act->setDefaultWidget(m_symbolSetWidget);
    m_symbolSetMenu->addAction(act);
    connect(m_symbolSetMenu,&QMenu::aboutToHide
            ,this,&SAQwtPlotCurveItemSetWidget::onSymbolSetMenuHide);
}
开发者ID:czyt1988,项目名称:sa,代码行数:10,代码来源:SAQwtPlotCurveItemSetWidget.cpp


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