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


C++ setPopupMode函数代码示例

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


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

示例1: QToolButton

QgsColorButtonV2::QgsColorButtonV2( QWidget *parent, QString cdt, QColorDialog::ColorDialogOptions cdo, QgsColorSchemeRegistry* registry )
    : QToolButton( parent )
    , mBehaviour( QgsColorButtonV2::ShowDialog )
    , mColorDialogTitle( cdt.isEmpty() ? tr( "Select Color" ) : cdt )
    , mColor( QColor() )
    , mDefaultColor( QColor() ) //default to invalid color
    , mColorDialogOptions( cdo )
    , mAcceptLiveUpdates( true )
    , mColorSet( false )
    , mShowNoColorOption( false )
    , mNoColorString( tr( "No color" ) )
    , mPickingColor( false )
    , mMenu( 0 )

{
  //if a color scheme registry was specified, use it, otherwise use the global instance
  mColorSchemeRegistry = registry ? registry : QgsColorSchemeRegistry::instance();

  setAcceptDrops( true );
  setMinimumSize( QSize( 24, 16 ) );
  connect( this, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) );

  //setup dropdown menu
  mMenu = new QMenu( this );
  connect( mMenu, SIGNAL( aboutToShow() ), this, SLOT( prepareMenu() ) );
  setMenu( mMenu );
  setPopupMode( QToolButton::MenuButtonPopup );
}
开发者ID:wyom,项目名称:QGIS,代码行数:28,代码来源:qgscolorbuttonv2.cpp

示例2: QToolButton

QgsColorButton::QgsColorButton( QWidget *parent, const QString &cdt, QgsColorSchemeRegistry *registry )
  : QToolButton( parent )
  , mColorDialogTitle( cdt.isEmpty() ? tr( "Select Color" ) : cdt )
  , mNoColorString( tr( "No color" ) )
{
  //if a color scheme registry was specified, use it, otherwise use the global instance
  mColorSchemeRegistry = registry ? registry : QgsApplication::colorSchemeRegistry();

  setAcceptDrops( true );
  setMinimumSize( QSize( 24, 16 ) );
  connect( this, &QAbstractButton::clicked, this, &QgsColorButton::buttonClicked );

  //setup drop-down menu
  mMenu = new QMenu( this );
  connect( mMenu, &QMenu::aboutToShow, this, &QgsColorButton::prepareMenu );
  setMenu( mMenu );
  setPopupMode( QToolButton::MenuButtonPopup );

#ifdef Q_OS_WIN
  mMinimumSize = QSize( 120, 22 );
#else
  mMinimumSize = QSize( 120, 28 );
#endif

  mMinimumSize.setHeight( std::max( static_cast<int>( fontMetrics().height() * 1.1 ), mMinimumSize.height() ) );
}
开发者ID:cz172638,项目名称:QGIS,代码行数:26,代码来源:qgscolorbutton.cpp

示例3: QToolButton

OutPatternButton::OutPatternButton(QWidget * parent):
    QToolButton(parent)
{
    setPopupMode(QToolButton::InstantPopup);
    setMenu(new QMenu(this));
    mSeparator = menu()->addSeparator();
}
开发者ID:Zefling,项目名称:flacon,代码行数:7,代码来源:controls.cpp

示例4: QToolButton

// +-----------------------------------------------------------
fsdk::VolumeButton::VolumeButton(QWidget *pParent) : QToolButton(pParent)
{
	setPopupMode(QToolButton::InstantPopup);

	QWidget *pPopup = new QWidget(this);

	m_pSlider = new CustomSlider(this);
	m_pSlider->setStyleSheet(SLIDER_STYLE_SHEET);
	connect(m_pSlider, &QAbstractSlider::valueChanged, this, &VolumeButton::sliderValueChanged);

	m_pLabel = new QLabel(this);
	m_pLabel->setAlignment(Qt::AlignCenter);
	m_pLabel->setText("100%");
	m_pLabel->setMinimumWidth(m_pLabel->sizeHint().width());

	QBoxLayout *pPopupLayout = new QHBoxLayout(pPopup);
	pPopupLayout->setMargin(2);
	pPopupLayout->addWidget(m_pSlider);
	pPopupLayout->addWidget(m_pLabel);

	m_pVolumeAction = new QWidgetAction(this);
	m_pVolumeAction->setDefaultWidget(pPopup);

	m_pMenu = new QMenu(this);
	m_pMenu->addAction(m_pVolumeAction);
	setMenu(m_pMenu);

	setVolume(100);
}
开发者ID:luigivieira,项目名称:fun-sdk,代码行数:30,代码来源:volumebutton.cpp

示例5: setMenu

void QgsColorRampButton::setShowMenu( const bool showMenu )
{
  setMenu( showMenu ? mMenu : nullptr );
  setPopupMode( showMenu ? QToolButton::MenuButtonPopup : QToolButton::DelayedPopup );
  //force recalculation of icon size
  mIconSize = QSize();
  setButtonBackground( mColorRamp );
}
开发者ID:cz172638,项目名称:QGIS,代码行数:8,代码来源:qgscolorrampbutton.cpp

示例6: QToolButton

PHIAComboButton::PHIAComboButton( QWidget *parent )
    : QToolButton( parent ), _popup( 0 )
{
    qDebug( "PHIAComboButton::PHIAComboButton()" );
    setPopupMode( QToolButton::InstantPopup );
    setEnabled( false );
    setVisible( false );
}
开发者ID:Phisketeer,项目名称:phisketeer,代码行数:8,代码来源:phiacomboboxhack.cpp

示例7: QToolButton

QgsPropertyOverrideButton::QgsPropertyOverrideButton( QWidget *parent,
    const QgsVectorLayer *layer )
  : QToolButton( parent )
  , mVectorLayer( layer )

{
  setFocusPolicy( Qt::StrongFocus );

  int iconSize = QgsGuiUtils::scaleIconSize( 24 );

  // button width is 1.25 * icon size, height 1.1 * icon size. But we round to ensure even pixel sizes for equal margins
  setFixedSize( 2 * static_cast< int >( 1.25 * iconSize / 2.0 ), 2 * static_cast< int >( iconSize * 1.1 / 2.0 ) );

  setIconSize( QSize( iconSize, iconSize ) );
  setPopupMode( QToolButton::InstantPopup );

  connect( this, &QgsPropertyOverrideButton::activated, this, &QgsPropertyOverrideButton::updateSiblingWidgets );

  mDefineMenu = new QMenu( this );
  connect( mDefineMenu, &QMenu::aboutToShow, this, &QgsPropertyOverrideButton::aboutToShowMenu );
  connect( mDefineMenu, &QMenu::triggered, this, &QgsPropertyOverrideButton::menuActionTriggered );
  setMenu( mDefineMenu );

  mFieldsMenu = new QMenu( this );
  mActionDataTypes = new QAction( this );
  // list fields and types in submenu, since there may be many
  mActionDataTypes->setMenu( mFieldsMenu );

  mActionVariables = new QAction( tr( "Variable" ), this );
  mVariablesMenu = new QMenu( this );
  mActionVariables->setMenu( mVariablesMenu );

  mActionColors = new QAction( tr( "Color" ), this );
  mColorsMenu = new QMenu( this );
  mActionColors->setMenu( mColorsMenu );

  mActionActive = new QAction( this );
  QFont f = mActionActive->font();
  f.setBold( true );
  mActionActive->setFont( f );

  mActionDescription = new QAction( tr( "Description…" ), this );

  mActionCreateAuxiliaryField = new QAction( tr( "Store Data in the Project" ), this );
  mActionCreateAuxiliaryField->setCheckable( true );

  mActionExpDialog = new QAction( tr( "Edit…" ), this );
  mActionExpression = nullptr;
  mActionPasteExpr = new QAction( tr( "Paste" ), this );
  mActionCopyExpr = new QAction( tr( "Copy" ), this );
  mActionClearExpr = new QAction( tr( "Clear" ), this );
  mActionAssistant = new QAction( tr( "Assistant…" ), this );
  QFont assistantFont = mActionAssistant->font();
  assistantFont.setBold( true );
  mActionAssistant->setFont( assistantFont );
  mDefineMenu->addAction( mActionAssistant );
}
开发者ID:jonnyforestGIS,项目名称:QGIS,代码行数:57,代码来源:qgspropertyoverridebutton.cpp

示例8: QToolButton

MenuButton::MenuButton(QWidget *parent) :
    QToolButton(parent)
{
    setAutoRaise(true);
    setPopupMode(QToolButton::InstantPopup);
    setFocusPolicy(Qt::NoFocus);
    setStyleSheet("QToolButton::menu-indicator { image: none; }");
    setIcon(APP_ICON("menu"));
}
开发者ID:39dotyt,项目名称:litetran,代码行数:9,代码来源:menubutton.cpp

示例9: QToolButton

QgsDataDefinedButton::QgsDataDefinedButton( QWidget* parent,
    const QgsVectorLayer* vl,
    const QgsDataDefined* datadefined,
    DataTypes datatypes,
    QString description )
    : QToolButton( parent )
{
  // set up static icons
  if ( mIconDataDefine.isNull() )
  {
    mIconDataDefine = QgsApplication::getThemeIcon( "/mIconDataDefine.svg" );
    mIconDataDefineOn = QgsApplication::getThemeIcon( "/mIconDataDefineOn.svg" );
    mIconDataDefineError = QgsApplication::getThemeIcon( "/mIconDataDefineError.svg" );
    mIconDataDefineExpression = QgsApplication::getThemeIcon( "/mIconDataDefineExpression.svg" );
    mIconDataDefineExpressionOn = QgsApplication::getThemeIcon( "/mIconDataDefineExpressionOn.svg" );
    mIconDataDefineExpressionError = QgsApplication::getThemeIcon( "/mIconDataDefineExpressionError.svg" );
  }

  setFocusPolicy( Qt::StrongFocus );

  // set default tool button icon properties
  setFixedSize( 30, 26 );
  setStyleSheet( QString( "QToolButton{ background: none; border: 1px solid rgba(0, 0, 0, 0%);} QToolButton:focus { border: 1px solid palette(highlight); }" ) );
  setIconSize( QSize( 24, 24 ) );
  setPopupMode( QToolButton::InstantPopup );

  mDefineMenu = new QMenu( this );
  connect( mDefineMenu, SIGNAL( aboutToShow() ), this, SLOT( aboutToShowMenu() ) );
  connect( mDefineMenu, SIGNAL( triggered( QAction* ) ), this, SLOT( menuActionTriggered( QAction* ) ) );
  setMenu( mDefineMenu );

  mFieldsMenu = new QMenu( this );

  mActionDataTypes = new QAction( this );
  // list fields and types in submenu, since there may be many
  mActionDataTypes->setMenu( mFieldsMenu );

  mActionActive = new QAction( this );
  QFont f = mActionActive->font();
  f.setBold( true );
  mActionActive->setFont( f );

  mActionDescription = new QAction( tr( "Description..." ), this );

  mActionExpDialog = new QAction( tr( "Edit..." ), this );
  mActionExpression = 0;
  mActionPasteExpr = new QAction( tr( "Paste" ), this );
  mActionCopyExpr = new QAction( tr( "Copy" ), this );
  mActionClearExpr = new QAction( tr( "Clear" ), this );
  mActionAssistant = new QAction( tr( "Assistant..." ), this );

  // set up sibling widget connections
  connect( this, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( disableEnabledWidgets( bool ) ) );
  connect( this, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( checkCheckedWidgets( bool ) ) );

  init( vl, datadefined, datatypes, description );
}
开发者ID:Br1ndavoine,项目名称:QGIS,代码行数:57,代码来源:qgsdatadefinedbutton.cpp

示例10: QToolButton

ListStyleButton::ListStyleButton( QWidget *parent)
    : QToolButton(parent)
    , m_letterSynchronization(false)
    , m_lastAction(0)
{
    m_menu = new QMenu();
    setPopupMode(MenuButtonPopup);
    setMenu(m_menu);
    connect(this, SIGNAL(triggered(QAction *)), this, SLOT(itemSelected(QAction *)));
}
开发者ID:KDE,项目名称:calligra-history,代码行数:10,代码来源:ListStyleButton.cpp

示例11: QToolButton

ToolButton_Impl::ToolButton_Impl()
	: QToolButton(), WidgetInterface(), fFlat(false)
{
	setPopupMode(InstantPopup);
	setAutoRaise(true);
	
	connect(this, SIGNAL(clicked()), this, SLOT(handleClicked()), Qt::QueuedConnection);
	connect(this, SIGNAL(toggled(bool)), this, SLOT(handleToggled(bool)));
	connect(SL_QAPP(), SIGNAL(endDrag(QObject *)), this, SLOT(handleEndDrag(QObject *)));
}
开发者ID:amottola,项目名称:slew,代码行数:10,代码来源:toolbutton.cpp

示例12: QToolButton

ComboToolButton::ComboToolButton(QWidget *parent) : QToolButton(parent) {
    setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    setPopupMode(QToolButton::MenuButtonPopup);
    setAutoRaise(true);

    connect(this,SIGNAL(triggered(QAction *)),this,SLOT(onMenuSelected(QAction *)));

    isFirstTime = true;
    curr_action = NULL;
}
开发者ID:AlexLevkovich,项目名称:QPacman,代码行数:10,代码来源:combotoolbutton.cpp

示例13: QToolButton

QgsPropertyOverrideButton::QgsPropertyOverrideButton( QWidget *parent,
    const QgsVectorLayer *layer )
  : QToolButton( parent )
  , mVectorLayer( layer )

{
  setFocusPolicy( Qt::StrongFocus );

  // icon size is a bit bigger than text, but minimum size of 24 so that we get pixel-aligned rendering on low-dpi screens
  int iconSize = std::floor( std::max( Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 1.1, 24.0 ) );

  // button width is 1.25 * icon size, height 1.1 * icon size. But we round to ensure even pixel sizes for equal margins
  setFixedSize( 2 * static_cast< int >( 1.25 * iconSize / 2.0 ), 2 * static_cast< int >( iconSize * 1.1 / 2.0 ) );
  setStyleSheet( QStringLiteral( "QToolButton{ background: none; border: 1px solid rgba(0, 0, 0, 0%);} QToolButton:focus { border: 1px solid palette(highlight); }" ) );

  setIconSize( QSize( iconSize, iconSize ) );
  setPopupMode( QToolButton::InstantPopup );

  connect( this, &QgsPropertyOverrideButton::activated, this, &QgsPropertyOverrideButton::updateSiblingWidgets );

  mDefineMenu = new QMenu( this );
  connect( mDefineMenu, &QMenu::aboutToShow, this, &QgsPropertyOverrideButton::aboutToShowMenu );
  connect( mDefineMenu, &QMenu::triggered, this, &QgsPropertyOverrideButton::menuActionTriggered );
  setMenu( mDefineMenu );

  mFieldsMenu = new QMenu( this );
  mActionDataTypes = new QAction( this );
  // list fields and types in submenu, since there may be many
  mActionDataTypes->setMenu( mFieldsMenu );

  mActionVariables = new QAction( tr( "Variable" ), this );
  mVariablesMenu = new QMenu( this );
  mActionVariables->setMenu( mVariablesMenu );

  mActionActive = new QAction( this );
  QFont f = mActionActive->font();
  f.setBold( true );
  mActionActive->setFont( f );

  mActionDescription = new QAction( tr( "Description..." ), this );

  mActionCreateAuxiliaryField = new QAction( tr( "Store data in the project" ), this );
  mActionCreateAuxiliaryField->setCheckable( true );

  mActionExpDialog = new QAction( tr( "Edit..." ), this );
  mActionExpression = nullptr;
  mActionPasteExpr = new QAction( tr( "Paste" ), this );
  mActionCopyExpr = new QAction( tr( "Copy" ), this );
  mActionClearExpr = new QAction( tr( "Clear" ), this );
  mActionAssistant = new QAction( tr( "Assistant..." ), this );
  QFont assistantFont = mActionAssistant->font();
  assistantFont.setBold( true );
  mActionAssistant->setFont( assistantFont );
  mDefineMenu->addAction( mActionAssistant );
}
开发者ID:cz172638,项目名称:QGIS,代码行数:55,代码来源:qgspropertyoverridebutton.cpp

示例14: setFocusPolicy

QgsAggregateToolButton::QgsAggregateToolButton()
{
  setFocusPolicy( Qt::StrongFocus );
  setPopupMode( QToolButton::InstantPopup );

  mMenu = new QMenu( this );
  connect( mMenu, &QMenu::aboutToShow, this, &QgsAggregateToolButton::aboutToShowMenu );
  setMenu( mMenu );

  setText( tr( "Exclude" ) );
}
开发者ID:cz172638,项目名称:QGIS,代码行数:11,代码来源:qgsaggregatetoolbutton.cpp

示例15: ToolButton

ButtonWithMenu::ButtonWithMenu(QWidget* parent)
    : ToolButton(parent)
    , m_menu(new QMenu(this))
{
    setPopupMode(QToolButton::InstantPopup);
    setCursor(Qt::ArrowCursor);
    setFocusPolicy(Qt::ClickFocus);
    setMenu(m_menu);

    connect(m_menu, SIGNAL(aboutToShow()), this, SLOT(generateMenu()));
}
开发者ID:Haommin,项目名称:qupzilla,代码行数:11,代码来源:buttonwithmenu.cpp


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