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


C++ QgsSymbolSelectorWidget::setContext方法代码示例

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


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

示例1: changeRangeSymbol

void QgsGraduatedSymbolRendererWidget::changeRangeSymbol( int rangeIdx )
{
  const QgsRendererRange &range = mRenderer->ranges()[rangeIdx];
  std::unique_ptr< QgsSymbol > newSymbol( range.symbol()->clone() );
  QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( this );
  if ( panel && panel->dockMode() )
  {
    // bit tricky here - the widget doesn't take ownership of the symbol. So we need it to last for the duration of the
    // panel's existence. Accordingly, just kinda give it ownership here, and clean up in cleanUpSymbolSelector
    QgsSymbolSelectorWidget *dlg = new QgsSymbolSelectorWidget( newSymbol.release(), mStyle, mLayer, panel );
    dlg->setContext( mContext );
    dlg->setPanelTitle( range.label() );
    connect( dlg, &QgsPanelWidget::widgetChanged, this, &QgsGraduatedSymbolRendererWidget::updateSymbolsFromWidget );
    connect( dlg, &QgsPanelWidget::panelAccepted, this, &QgsGraduatedSymbolRendererWidget::cleanUpSymbolSelector );
    openPanel( dlg );
  }
  else
  {
    QgsSymbolSelectorDialog dlg( newSymbol.get(), mStyle, mLayer, panel );
    dlg.setContext( mContext );
    if ( !dlg.exec() || !newSymbol )
    {
      return;
    }

    mGraduatedSymbol = std::move( newSymbol );
    applyChangeToSymbol();
  }
}
开发者ID:dmarteau,项目名称:QGIS,代码行数:29,代码来源:qgsgraduatedsymbolrendererwidget.cpp

示例2: changeGraduatedSymbol

void QgsGraduatedSymbolRendererWidget::changeGraduatedSymbol()
{
  QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( this );
  std::unique_ptr< QgsSymbol > newSymbol( mGraduatedSymbol->clone() );
  if ( panel && panel->dockMode() )
  {
    QgsSymbolSelectorWidget *dlg = new QgsSymbolSelectorWidget( newSymbol.release(), mStyle, mLayer, panel );
    dlg->setContext( mContext );

    connect( dlg, &QgsPanelWidget::widgetChanged, this, &QgsGraduatedSymbolRendererWidget::updateSymbolsFromWidget );
    connect( dlg, &QgsPanelWidget::panelAccepted, this, &QgsGraduatedSymbolRendererWidget::cleanUpSymbolSelector );
    connect( dlg, &QgsPanelWidget::panelAccepted, this, &QgsGraduatedSymbolRendererWidget::updateGraduatedSymbolIcon );
    panel->openPanel( dlg );
  }
  else
  {
    QgsSymbolSelectorDialog dlg( newSymbol.get(), mStyle, mLayer, panel );
    if ( !dlg.exec() || !newSymbol )
    {
      return;
    }

    mGraduatedSymbol = std::move( newSymbol );
    updateGraduatedSymbolIcon();
    applyChangeToSymbol();
  }
}
开发者ID:dmarteau,项目名称:QGIS,代码行数:27,代码来源:qgsgraduatedsymbolrendererwidget.cpp

示例3: mLineStyleButton_clicked

void QgsComposerArrowWidget::mLineStyleButton_clicked()
{
  if ( !mArrow )
  {
    return;
  }

  // use the atlas coverage layer, if any
  QgsVectorLayer *coverageLayer = atlasCoverageLayer();

  QgsLineSymbol *newSymbol = mArrow->lineSymbol()->clone();
  QgsExpressionContext context = mArrow->createExpressionContext();

  QgsSymbolSelectorWidget *d = new QgsSymbolSelectorWidget( newSymbol, QgsStyle::defaultStyle(), coverageLayer, nullptr );
  QgsSymbolWidgetContext symbolContext;
  symbolContext.setExpressionContext( &context );
  d->setContext( symbolContext );

  connect( d, &QgsPanelWidget::widgetChanged, this, &QgsComposerArrowWidget::updateLineStyleFromWidget );
  connect( d, &QgsPanelWidget::panelAccepted, this, &QgsComposerArrowWidget::cleanUpLineStyleSelector );
  openPanel( d );
  mArrow->beginCommand( tr( "Arrow line style changed" ) );
}
开发者ID:cz172638,项目名称:QGIS,代码行数:23,代码来源:qgscomposerarrowwidget.cpp

示例4: on_mPolygonStyleButton_clicked

void QgsComposerPolygonWidget::on_mPolygonStyleButton_clicked()
{
  if ( !mComposerPolygon )
  {
    return;
  }

  // use the atlas coverage layer, if any
  QgsVectorLayer* coverageLayer = atlasCoverageLayer();

  QgsFillSymbol* newSymbol = mComposerPolygon->polygonStyleSymbol()->clone();
  QgsExpressionContext context = mComposerPolygon->createExpressionContext();

  QgsSymbolSelectorWidget* d = new QgsSymbolSelectorWidget( newSymbol, QgsStyle::defaultStyle(), coverageLayer, nullptr );
  QgsSymbolWidgetContext symbolContext;
  symbolContext.setExpressionContext( &context );
  d->setContext( symbolContext );

  connect( d, SIGNAL( widgetChanged() ), this, SLOT( updateStyleFromWidget() ) );
  connect( d, SIGNAL( panelAccepted( QgsPanelWidget* ) ), this, SLOT( cleanUpStyleSelector( QgsPanelWidget* ) ) );
  openPanel( d );
  mComposerPolygon->beginCommand( tr( "Polygon style changed" ) );
}
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:23,代码来源:qgscomposerpolygonwidget.cpp

示例5: on_mGridMarkerStyleButton_clicked

void QgsComposerMapGridWidget::on_mGridMarkerStyleButton_clicked()
{
  if ( !mComposerMapGrid || !mComposerMap )
  {
    return;
  }

  // use the atlas coverage layer, if any
  QgsVectorLayer* coverageLayer = atlasCoverageLayer();

  QgsMarkerSymbol* newSymbol = static_cast<QgsMarkerSymbol*>( mComposerMapGrid->markerSymbol()->clone() );
  QgsExpressionContext context = mComposerMap->createExpressionContext();

  QgsSymbolSelectorWidget* d = new QgsSymbolSelectorWidget( newSymbol, QgsStyle::defaultStyle(), coverageLayer, nullptr );
  QgsSymbolWidgetContext symbolContext;
  symbolContext.setExpressionContext( &context );
  d->setContext( symbolContext );

  connect( d, SIGNAL( widgetChanged() ), this, SLOT( updateGridMarkerStyleFromWidget() ) );
  connect( d, SIGNAL( panelAccepted( QgsPanelWidget* ) ), this, SLOT( cleanUpGridMarkerStyleSelector( QgsPanelWidget* ) ) );
  openPanel( d );
  mComposerMap->beginCommand( tr( "Grid markers style changed" ) );
}
开发者ID:mterente,项目名称:QGIS,代码行数:23,代码来源:qgscomposermapgridwidget.cpp


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