本文整理汇总了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();
}
}
示例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();
}
}
示例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" ) );
}
示例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" ) );
}
示例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" ) );
}