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


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

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


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

示例1: QgsDockWidget

QgsBrowserDockWidget::QgsBrowserDockWidget( const QString& name, QWidget * parent )
    : QgsDockWidget( parent )
    , mModel( nullptr )
    , mProxyModel( nullptr )
    , mPropertiesWidgetEnabled( false )
    , mPropertiesWidgetHeight( 0 )
{
  setupUi( this );

  setWindowTitle( name );

  mBrowserView = new QgsDockBrowserTreeView( this );
  mLayoutBrowser->addWidget( mBrowserView );

  mWidgetFilter->hide();
  mLeFilter->setPlaceholderText( tr( "Type here to filter visible items..." ) );
  // icons from http://www.fatcow.com/free-icons License: CC Attribution 3.0

  QMenu* menu = new QMenu( this );
  menu->setSeparatorsCollapsible( false );
  mBtnFilterOptions->setMenu( menu );
  QAction* action = new QAction( tr( "Case Sensitive" ), menu );
  action->setData( "case" );
  action->setCheckable( true );
  action->setChecked( false );
  connect( action, SIGNAL( toggled( bool ) ), this, SLOT( setCaseSensitive( bool ) ) );
  menu->addAction( action );
  QActionGroup* group = new QActionGroup( menu );
  action = new QAction( tr( "Filter Pattern Syntax" ), group );
  action->setSeparator( true );
  menu->addAction( action );
  action = new QAction( tr( "Normal" ), group );
  action->setData( "normal" );
  action->setCheckable( true );
  action->setChecked( true );
  menu->addAction( action );
  action = new QAction( tr( "Wildcard(s)" ), group );
  action->setData( "wildcard" );
  action->setCheckable( true );
  menu->addAction( action );
  action = new QAction( tr( "Regular Expression" ), group );
  action->setData( "regexp" );
  action->setCheckable( true );
  menu->addAction( action );

  connect( mActionRefresh, SIGNAL( triggered( bool ) ), this, SLOT( refresh() ) );
  connect( mActionAddLayers, SIGNAL( triggered( bool ) ), this, SLOT( addSelectedLayers() ) );
  connect( mActionCollapse, SIGNAL( triggered( bool ) ), mBrowserView, SLOT( collapseAll() ) );
  connect( mActionShowFilter, SIGNAL( triggered( bool ) ), this, SLOT( showFilterWidget( bool ) ) );
  connect( mActionPropertiesWidget, SIGNAL( triggered( bool ) ), this, SLOT( enablePropertiesWidget( bool ) ) );
  connect( mLeFilter, SIGNAL( returnPressed() ), this, SLOT( setFilter() ) );
  connect( mLeFilter, SIGNAL( cleared() ), this, SLOT( setFilter() ) );
  connect( mLeFilter, SIGNAL( textChanged( const QString & ) ), this, SLOT( setFilter() ) );
  connect( group, SIGNAL( triggered( QAction * ) ), this, SLOT( setFilterSyntax( QAction * ) ) );
  connect( mBrowserView, SIGNAL( customContextMenuRequested( const QPoint & ) ), this, SLOT( showContextMenu( const QPoint & ) ) );
  connect( mBrowserView, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( addLayerAtIndex( const QModelIndex& ) ) );
  connect( mSplitter, SIGNAL( splitterMoved( int, int ) ), this, SLOT( splitterMoved() ) );
}
开发者ID:Wen2012,项目名称:QGIS,代码行数:58,代码来源:qgsbrowserdockwidget.cpp

示例2: QObject

	CNotificationManager::CNotificationManager(QWidget * mainWindow, QObject * parent) : QObject(parent), m_MainWindow(mainWindow) {
		m_MainIcon = new QSystemTrayIcon(QIcon(UI_ICON_QNUT_SMALL), this);

		QMenu * trayMenu = new QMenu("QNUT");
		trayMenu->setSeparatorsCollapsible(true);
		trayMenu->addAction(tr("Open Connection &Manager"), m_MainWindow, SLOT(show()));
		trayMenu->addSeparator();
		m_InsertMarker = trayMenu->addSeparator();
		trayMenu->addAction(tr("&Quit"), qApp, SLOT(quit()));

		m_MainIcon->setContextMenu(trayMenu);
		m_MainIcon->show();

		connect(m_MainIcon, &QSystemTrayIcon::activated,
			this, &CNotificationManager::handleMainIconActivated);

		if (m_MainWindow)
			qApp->setQuitOnLastWindowClosed(false);
	}
开发者ID:dosnut,项目名称:nut,代码行数:19,代码来源:cnotificationmanager.cpp

示例3: mousePressEvent

void RightClickLabel::mousePressEvent(QMouseEvent* event)
{
	if(event->button() == Qt::RightButton)
	{
		QMenu menu;
		QAction* action;
		QLineEdit* lineEdit = new QLineEdit(&menu);
		QWidgetAction* wa = new QWidgetAction(&menu);
		int speed = (m_nSpeed) ? (m_nSpeed/1024) : 200;

		lineEdit->setText(QString::number(m_nSpeed/1024));
		//lineEdit->setInputMask("00000");
		wa->setDefaultWidget(lineEdit);
		connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(customSpeedEntered()));
		connect(lineEdit, SIGNAL(returnPressed()), &menu, SLOT(close()));
		
		menu.setSeparatorsCollapsible(false);
		action = menu.addSeparator();
		action->setText(m_bUpload ? tr("Upload") : tr("Download"));
		menu.addAction(wa);
		menu.addSeparator();
		
		action = menu.addAction(QString::fromUtf8("∞ kB/s"));
		action->setData(0);
		connect(action, SIGNAL(triggered()), this, SLOT(setLimit()));
		menu.addSeparator();
		
		int step = speed/4;
		speed *= 2;
		
		for(int i=0;i<8 && speed;i++)
		{
			action = menu.addAction(formatSize(speed*1024, true));
			action->setData(speed);
			connect(action, SIGNAL(triggered()), this, SLOT(setLimit()));
			
			speed -= step;
		}
		
		menu.exec(QCursor::pos());
	}
}
开发者ID:ActionLuzifer,项目名称:fatrat,代码行数:42,代码来源:SpeedLimitWidget.cpp

示例4: QWidget

QgsRasterHistogramWidget::QgsRasterHistogramWidget( QgsRasterLayer* lyr, QWidget *parent )
    : QWidget( parent ),
    mRasterLayer( lyr ), mRendererWidget( 0 )
{
  setupUi( this );

  mSaveAsImageButton->setIcon( QgsApplication::getThemeIcon( "/mActionFileSave.png" ) );

  mRendererWidget = 0;
  mRendererName = "singlebandgray";

  mHistoMin = 0;
  mHistoMax = 0;

  mHistoPicker = NULL;
  mHistoZoomer = NULL;
  mHistoMarkerMin = NULL;
  mHistoMarkerMax = NULL;

  QSettings settings;
  mHistoShowMarkers = settings.value( "/Raster/histogram/showMarkers", false ).toBool();
  // mHistoLoadApplyAll = settings.value( "/Raster/histogram/loadApplyAll", false ).toBool();
  mHistoZoomToMinMax = settings.value( "/Raster/histogram/zoomToMinMax", false ).toBool();
  mHistoUpdateStyleToMinMax = settings.value( "/Raster/histogram/updateStyleToMinMax", true ).toBool();
  // mHistoShowBands = (HistoShowBands) settings.value( "/Raster/histogram/showBands", (int) ShowAll ).toInt();
  mHistoShowBands = ShowAll;

  if ( true )
  {
    //band selector
    int myBandCountInt = mRasterLayer->bandCount();
    for ( int myIteratorInt = 1;
          myIteratorInt <= myBandCountInt;
          ++myIteratorInt )
    {
      cboHistoBand->addItem( mRasterLayer->bandName( myIteratorInt ) );
    }

    // histo min/max selectors
    leHistoMin->setValidator( new QDoubleValidator( this ) );
    leHistoMax->setValidator( new QDoubleValidator( this ) );
    // this might generate many refresh events! test..
    // connect( leHistoMin, SIGNAL( textChanged( const QString & ) ), this, SLOT( updateHistoMarkers() ) );
    // connect( leHistoMax, SIGNAL( textChanged( const QString & ) ), this, SLOT( updateHistoMarkers() ) );
    // connect( leHistoMin, SIGNAL( textChanged( const QString & ) ), this, SLOT( applyHistoMin() ) );
    // connect( leHistoMax, SIGNAL( textChanged( const QString & ) ), this, SLOT( applyHistoMax() ) );
    connect( leHistoMin, SIGNAL( editingFinished() ), this, SLOT( applyHistoMin() ) );
    connect( leHistoMax, SIGNAL( editingFinished() ), this, SLOT( applyHistoMax() ) );

    // histo actions
    QMenu* menu = new QMenu( this );
    menu->setSeparatorsCollapsible( false );
    btnHistoActions->setMenu( menu );
    QActionGroup* group;
    QAction* action;

    // min/max options
    group = new QActionGroup( this );
    group->setExclusive( false );
    connect( group, SIGNAL( triggered( QAction* ) ), this, SLOT( histoActionTriggered( QAction* ) ) );
    action = new QAction( tr( "Min/Max options" ), group );
    action->setSeparator( true );
    menu->addAction( action );
    action = new QAction( tr( "Always show min/max markers" ), group );
    action->setData( QVariant( "Show markers" ) );
    action->setCheckable( true );
    action->setChecked( mHistoShowMarkers );
    menu->addAction( action );
    action = new QAction( tr( "Zoom to min/max" ), group );
    action->setData( QVariant( "Zoom min_max" ) );
    action->setCheckable( true );
    action->setChecked( mHistoZoomToMinMax );
    menu->addAction( action );
    action = new QAction( tr( "Update style to min/max" ), group );
    action->setData( QVariant( "Update min_max" ) );
    action->setCheckable( true );
    action->setChecked( mHistoUpdateStyleToMinMax );
    menu->addAction( action );

    // visibility options
    group = new QActionGroup( this );
    group->setExclusive( false );
    connect( group, SIGNAL( triggered( QAction* ) ), this, SLOT( histoActionTriggered( QAction* ) ) );
    action = new QAction( tr( "Visibility" ), group );
    action->setSeparator( true );
    menu->addAction( action );
    group = new QActionGroup( this );
    group->setExclusive( true ); // these options are exclusive
    connect( group, SIGNAL( triggered( QAction* ) ), this, SLOT( histoActionTriggered( QAction* ) ) );
    action = new QAction( tr( "Show all bands" ), group );
    action->setData( QVariant( "Show all" ) );
    action->setCheckable( true );
    action->setChecked( mHistoShowBands == ShowAll );
    menu->addAction( action );
    action = new QAction( tr( "Show RGB/Gray band(s)" ), group );
    action->setData( QVariant( "Show RGB" ) );
    action->setCheckable( true );
    action->setChecked( mHistoShowBands == ShowRGB );
    menu->addAction( action );
    action = new QAction( tr( "Show selected band" ), group );
//.........这里部分代码省略.........
开发者ID:JoeyPinilla,项目名称:Quantum-GIS,代码行数:101,代码来源:qgsrasterhistogramwidget.cpp

示例5: setSeparatorsCollapsible

void QMenuProto::setSeparatorsCollapsible(bool collapse)
{
  QMenu *item = qscriptvalue_cast<QMenu*>(thisObject());
  if (item)
    item->setSeparatorsCollapsible(collapse);
}
开发者ID:,项目名称:,代码行数:6,代码来源:

示例6: file

// Neue Widget-Klasse vom eigentlichen Widget ableiten
MyWindow::MyWindow( QMainWindow *parent,
                    Qt::WindowFlags flags) :
                    QMainWindow(parent, flags)  {
    editor = new QTextEdit;
    editor->setWhatsThis(
                "Dieser Text kann mit (Shift)+(F1) angezeigt werden."
                "Auch eine <b>HTML-Formatierung</b> ist möglich. ");


    // Das komplette Menü zum Hauptprogramm
    QMenu *fileMenu = new QMenu(tr("&Datei"), this);
    menuBar()->addMenu(fileMenu);
    act1 = fileMenu->addAction(
                QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/page_white.png")), tr("&Neu"),
       this, SLOT(newFile()),
       QKeySequence(tr("Ctrl+N", "Datei|Neu")) );
    act1->setStatusTip(
       tr("Löscht den aktuellen Inhalt der Datei"));
    act2 = fileMenu->addAction(
                QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/folder_page_white.png")),
       tr("&Öffnen..."), this, SLOT(openFile() ),
       QKeySequence(tr("Ctrl+O", "Datei|Öffnen")));
    act2->setStatusTip(
       tr("Öffnet eine Datei in den Texteditor"));
    fileMenu->addSeparator();
    act3 = fileMenu->addAction(
                QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/cancel.png"))   ,
                tr("Be&enden"),
       qApp, SLOT(quit()),
       QKeySequence(tr("Ctrl+E", "Datei|Beenden")) );
    act3->setStatusTip(tr("Programm beenden"));
    QMenu *workMenu = new QMenu(
       tr("&Bearbeiten"), this);
    menuBar()->addMenu(workMenu);
    act4 = workMenu->addAction(
       tr("&Suchen"), this, SLOT(search()),
       QKeySequence(tr("Ctrl+S", "Bearbeiten|Suchen")));
    act4->setStatusTip(
       tr("Nach einer Stringfolge suchen") );
    // Menü mit Linie von der Leiste Abnehmbar
    fileMenu->setSeparatorsCollapsible(true);

    // Mehrere Aktionen erzeugen
    QAction* underLineAct = new QAction(
       tr("&Unterstreichen"), this );
    underLineAct->setCheckable(true);
    underLineAct->setShortcut(tr("Ctrl+U"));
    underLineAct->setStatusTip(
       tr("Text unterstreichen") );
    underLineAct->setIcon(
                QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/text_underline.png")));
    connect( underLineAct, SIGNAL(triggered(bool)),
             editor, SLOT(setFontUnderline(bool)) );

    QAction *leftAlignAct = new QAction(
       tr("&Links ausgerichtet"), this);
    leftAlignAct->setCheckable(true);
    leftAlignAct->setShortcut(tr("Ctrl+L"));
    leftAlignAct->setStatusTip(
       tr("Text links ausrichten"));
    leftAlignAct->setIcon(
                 QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/text_align_left.png")));
    connect( leftAlignAct, SIGNAL(triggered()),
             this, SLOT(leftAlignment() ) );

    QAction *rightAlignAct = new QAction(
       tr("&Rechts ausgerichtet"), this);
    rightAlignAct->setCheckable(true);
    rightAlignAct->setShortcut(tr("Ctrl+R"));
    rightAlignAct->setStatusTip(
       tr("Text rechts ausrichten") );
    rightAlignAct->setIcon(
                 QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/text_align_right.png")));
    connect( rightAlignAct, SIGNAL(triggered()),
             this, SLOT(rightAlignment() ) );

    QAction *justifyAct = new QAction(
       tr("&Bündig ausrichten"), this);
    justifyAct->setCheckable(true);
    justifyAct->setShortcut(tr("Ctrl+J"));
    justifyAct->setStatusTip(
       tr("Text bündig ausrichten"));
    justifyAct->setIcon(
                QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/text_align_justify.png")));
    connect( justifyAct, SIGNAL(triggered()),
             this, SLOT(justifyAlignment() ) );

    QAction *centerAct = new QAction(
       tr("&Zentriert ausrichten"), this);
    centerAct->setCheckable(true);
    centerAct->setShortcut(tr("Ctrl+E"));
    centerAct->setStatusTip(
       tr("Text zentriert ausrichten") );
    centerAct->setIcon(
                  QIcon(QString("%1%2").arg(QCoreApplication::applicationDirPath()).arg("/images/text_align_center.png")));
    connect( centerAct, SIGNAL(triggered()),
             this, SLOT(centerAlignment() ) );

    // Einige Aktionen zu einer Gruppe zusammenfassen
//.........这里部分代码省略.........
开发者ID:rehberry,项目名称:C-C-Programmierung-1,代码行数:101,代码来源:MyWindow.cpp

示例7: QgsMapLayerConfigWidget

QgsRasterHistogramWidget::QgsRasterHistogramWidget( QgsRasterLayer* lyr, QWidget *parent )
    : QgsMapLayerConfigWidget( lyr, nullptr, parent )
    , mRasterLayer( lyr )
    , mRendererWidget( nullptr )
{
  setupUi( this );

  mSaveAsImageButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionFileSave.svg" ) ) );

  mRendererWidget = nullptr;
  mRendererName = QStringLiteral( "singlebandgray" );

  mHistoMin = 0;
  mHistoMax = 0;

  mHistoPicker = nullptr;
  mHistoZoomer = nullptr;
  mHistoMarkerMin = nullptr;
  mHistoMarkerMax = nullptr;

  QSettings settings;
  mHistoShowMarkers = settings.value( QStringLiteral( "/Raster/histogram/showMarkers" ), false ).toBool();
  // mHistoLoadApplyAll = settings.value( "/Raster/histogram/loadApplyAll", false ).toBool();
  mHistoZoomToMinMax = settings.value( QStringLiteral( "/Raster/histogram/zoomToMinMax" ), false ).toBool();
  mHistoUpdateStyleToMinMax = settings.value( QStringLiteral( "/Raster/histogram/updateStyleToMinMax" ), true ).toBool();
  mHistoDrawLines = settings.value( QStringLiteral( "/Raster/histogram/drawLines" ), true ).toBool();
  // mHistoShowBands = (HistoShowBands) settings.value( "/Raster/histogram/showBands", (int) ShowAll ).toInt();
  mHistoShowBands = ShowAll;

  bool isInt = true;
  if ( true )
  {
    //band selector
    int myBandCountInt = mRasterLayer->bandCount();
    for ( int myIteratorInt = 1;
          myIteratorInt <= myBandCountInt;
          ++myIteratorInt )
    {
      cboHistoBand->addItem( mRasterLayer->bandName( myIteratorInt ) );
      Qgis::DataType mySrcDataType = mRasterLayer->dataProvider()->sourceDataType( myIteratorInt );
      if ( !( mySrcDataType == Qgis::Byte ||
              mySrcDataType == Qgis::Int16 || mySrcDataType == Qgis::Int32 ||
              mySrcDataType == Qgis::UInt16 || mySrcDataType == Qgis::UInt32 ) )
        isInt = false;
    }

    // histo min/max selectors
    leHistoMin->setValidator( new QDoubleValidator( this ) );
    leHistoMax->setValidator( new QDoubleValidator( this ) );
    // this might generate many refresh events! test..
    // connect( leHistoMin, SIGNAL( textChanged( const QString & ) ), this, SLOT( updateHistoMarkers() ) );
    // connect( leHistoMax, SIGNAL( textChanged( const QString & ) ), this, SLOT( updateHistoMarkers() ) );
    // connect( leHistoMin, SIGNAL( textChanged( const QString & ) ), this, SLOT( applyHistoMin() ) );
    // connect( leHistoMax, SIGNAL( textChanged( const QString & ) ), this, SLOT( applyHistoMax() ) );
    connect( leHistoMin, SIGNAL( editingFinished() ), this, SLOT( applyHistoMin() ) );
    connect( leHistoMax, SIGNAL( editingFinished() ), this, SLOT( applyHistoMax() ) );

    // histo actions
    // TODO move/add options to qgis options dialog
    QMenu* menu = new QMenu( this );
    menu->setSeparatorsCollapsible( false );
    btnHistoActions->setMenu( menu );
    QActionGroup* group;
    QAction* action;

    // min/max options
    group = new QActionGroup( this );
    group->setExclusive( false );
    connect( group, SIGNAL( triggered( QAction* ) ), this, SLOT( histoActionTriggered( QAction* ) ) );
    action = new QAction( tr( "Min/Max options" ), group );
    action->setSeparator( true );
    menu->addAction( action );
    action = new QAction( tr( "Always show min/max markers" ), group );
    action->setData( QVariant( "Show markers" ) );
    action->setCheckable( true );
    action->setChecked( mHistoShowMarkers );
    menu->addAction( action );
    action = new QAction( tr( "Zoom to min/max" ), group );
    action->setData( QVariant( "Zoom min_max" ) );
    action->setCheckable( true );
    action->setChecked( mHistoZoomToMinMax );
    menu->addAction( action );
    action = new QAction( tr( "Update style to min/max" ), group );
    action->setData( QVariant( "Update min_max" ) );
    action->setCheckable( true );
    action->setChecked( mHistoUpdateStyleToMinMax );
    menu->addAction( action );

    // visibility options
    group = new QActionGroup( this );
    group->setExclusive( false );
    connect( group, SIGNAL( triggered( QAction* ) ), this, SLOT( histoActionTriggered( QAction* ) ) );
    action = new QAction( tr( "Visibility" ), group );
    action->setSeparator( true );
    menu->addAction( action );
    group = new QActionGroup( this );
    group->setExclusive( true ); // these options are exclusive
    connect( group, SIGNAL( triggered( QAction* ) ), this, SLOT( histoActionTriggered( QAction* ) ) );
    action = new QAction( tr( "Show all bands" ), group );
    action->setData( QVariant( "Show all" ) );
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例8: palette

XmlConsole::XmlConsole(Client* client, QWidget *parent) :
	QWidget(parent),
	m_ui(new Ui::XmlConsole),
	m_client(client),	m_filter(0x1f)
{
	m_ui->setupUi(this);

    m_client->addXmlStreamHandler(this);

	QPalette pal = palette();
	pal.setColor(QPalette::Base, Qt::black);
	pal.setColor(QPalette::Text, Qt::white);
	m_ui->xmlBrowser->viewport()->setPalette(pal);
	QTextDocument *doc = m_ui->xmlBrowser->document();
	doc->setDocumentLayout(new QPlainTextDocumentLayout(doc));
	doc->clear();

	QTextFrameFormat format = doc->rootFrame()->frameFormat();
	format.setBackground(QColor(Qt::black));
	format.setMargin(0);
	doc->rootFrame()->setFrameFormat(format);
	QMenu *menu = new QMenu(m_ui->filterButton);
	menu->setSeparatorsCollapsible(false);
	menu->addSeparator()->setText(tr("Filter"));
	QActionGroup *group = new QActionGroup(menu);
	QAction *disabled = group->addAction(menu->addAction(tr("Disabled")));
	disabled->setCheckable(true);
	disabled->setData(Disabled);
	QAction *jid = group->addAction(menu->addAction(tr("By JID")));
	jid->setCheckable(true);
	jid->setData(ByJid);
	QAction *xmlns = group->addAction(menu->addAction(tr("By namespace uri")));
	xmlns->setCheckable(true);
	xmlns->setData(ByXmlns);
	QAction *attrb = group->addAction(menu->addAction(tr("By all attributes")));
	attrb->setCheckable(true);
	attrb->setData(ByAllAttributes);
	disabled->setChecked(true);
	connect(group, SIGNAL(triggered(QAction*)), this, SLOT(onActionGroupTriggered(QAction*)));
	menu->addSeparator()->setText(tr("Visible stanzas"));
	group = new QActionGroup(menu);
	group->setExclusive(false);
	QAction *iq = group->addAction(menu->addAction(tr("Information query")));
	iq->setCheckable(true);
	iq->setData(XmlNode::Iq);
	iq->setChecked(true);
	QAction *message = group->addAction(menu->addAction(tr("Message")));
	message->setCheckable(true);
	message->setData(XmlNode::Message);
	message->setChecked(true);
	QAction *presence = group->addAction(menu->addAction(tr("Presence")));
	presence->setCheckable(true);
	presence->setData(XmlNode::Presence);
	presence->setChecked(true);
	QAction *custom = group->addAction(menu->addAction(tr("Custom")));
	custom->setCheckable(true);
	custom->setData(XmlNode::Custom);
	custom->setChecked(true);
	connect(group, SIGNAL(triggered(QAction*)), this, SLOT(onActionGroupTriggered(QAction*)));
	m_ui->filterButton->setMenu(menu);
	m_stackBracketsColor = QColor(0x666666);
	m_stackIncoming.bodyColor = QColor(0xbb66bb);
	m_stackIncoming.tagColor = QColor(0x006666);
	m_stackIncoming.attributeColor = QColor(0x009933);
	m_stackIncoming.paramColor = QColor(0xcc0000);
	m_stackOutgoing.bodyColor = QColor(0x999999);
	m_stackOutgoing.tagColor = QColor(0x22aa22);
	m_stackOutgoing.attributeColor = QColor(0xffff33);
	m_stackOutgoing.paramColor = QColor(0xdd8811);

	QAction *action = new QAction(tr("Close"),this);
	action->setSoftKeyRole(QAction::NegativeSoftKey);
	connect(action, SIGNAL(triggered()), SLOT(close()));
	addAction(action);
}
开发者ID:andrix,项目名称:tomahawk,代码行数:75,代码来源:xmlconsole.cpp

示例9: QgsDockWidget

QgsBrowserDockWidget::QgsBrowserDockWidget( const QString &name, QWidget *parent )
  : QgsDockWidget( parent )
  , mModel( nullptr )
  , mProxyModel( nullptr )
  , mPropertiesWidgetEnabled( false )
  , mPropertiesWidgetHeight( 0 )
{
  setupUi( this );

  mContents->layout()->setContentsMargins( 0, 0, 0, 0 );
  mContents->layout()->setMargin( 0 );
  static_cast< QVBoxLayout * >( mContents->layout() )->setSpacing( 0 );

  setWindowTitle( name );

  mBrowserView = new QgsDockBrowserTreeView( this );
  mLayoutBrowser->addWidget( mBrowserView );

  mWidgetFilter->hide();
  mLeFilter->setPlaceholderText( tr( "Type here to filter visible items..." ) );
  // icons from http://www.fatcow.com/free-icons License: CC Attribution 3.0

  QMenu *menu = new QMenu( this );
  menu->setSeparatorsCollapsible( false );
  mBtnFilterOptions->setMenu( menu );
  QAction *action = new QAction( tr( "Case Sensitive" ), menu );
  action->setData( "case" );
  action->setCheckable( true );
  action->setChecked( false );
  connect( action, &QAction::toggled, this, &QgsBrowserDockWidget::setCaseSensitive );
  menu->addAction( action );
  QActionGroup *group = new QActionGroup( menu );
  action = new QAction( tr( "Filter Pattern Syntax" ), group );
  action->setSeparator( true );
  menu->addAction( action );
  action = new QAction( tr( "Normal" ), group );
  action->setData( "normal" );
  action->setCheckable( true );
  action->setChecked( true );
  menu->addAction( action );
  action = new QAction( tr( "Wildcard(s)" ), group );
  action->setData( "wildcard" );
  action->setCheckable( true );
  menu->addAction( action );
  action = new QAction( tr( "Regular Expression" ), group );
  action->setData( "regexp" );
  action->setCheckable( true );
  menu->addAction( action );

  connect( mActionRefresh, &QAction::triggered, this, &QgsBrowserDockWidget::refresh );
  connect( mActionAddLayers, &QAction::triggered, this, &QgsBrowserDockWidget::addSelectedLayers );
  connect( mActionCollapse, &QAction::triggered, mBrowserView, &QgsDockBrowserTreeView::collapseAll );
  connect( mActionShowFilter, &QAction::triggered, this, &QgsBrowserDockWidget::showFilterWidget );
  connect( mActionPropertiesWidget, &QAction::triggered, this, &QgsBrowserDockWidget::enablePropertiesWidget );
  connect( mLeFilter, &QgsFilterLineEdit::returnPressed, this, &QgsBrowserDockWidget::setFilter );
  connect( mLeFilter, &QgsFilterLineEdit::cleared, this, &QgsBrowserDockWidget::setFilter );
  connect( mLeFilter, &QgsFilterLineEdit::textChanged, this, &QgsBrowserDockWidget::setFilter );
  connect( group, &QActionGroup::triggered, this, &QgsBrowserDockWidget::setFilterSyntax );
  connect( mBrowserView, &QgsDockBrowserTreeView::customContextMenuRequested, this, &QgsBrowserDockWidget::showContextMenu );
  connect( mBrowserView, &QgsDockBrowserTreeView::doubleClicked, this, &QgsBrowserDockWidget::addLayerAtIndex );
  connect( mSplitter, &QSplitter::splitterMoved, this, &QgsBrowserDockWidget::splitterMoved );
}
开发者ID:cayetanobv,项目名称:QGIS,代码行数:62,代码来源:qgsbrowserdockwidget.cpp


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