23 setFocusPolicy( Qt::StrongFocus );
24 setPopupMode( QToolButton::InstantPopup );
26 mMenu =
new QMenu(
this );
27 connect( mMenu, &QMenu::aboutToShow,
this, &QgsAggregateToolButton::aboutToShowMenu );
30 setText( tr(
"Exclude" ) );
39 updateAvailableAggregates();
42 void QgsAggregateToolButton::aboutToShowMenu()
46 QAction *action = mMenu->addAction( tr(
"Exclude" ) );
47 connect( action, &QAction::triggered,
this, [
this ]
52 for (
const auto &
aggregate : qgis::as_const( mAvailableAggregates ) )
54 QAction *action = mMenu->addAction(
aggregate.name );
55 connect( action, &QAction::triggered,
this, [
this,
aggregate ]
63 void QgsAggregateToolButton::updateAvailableAggregates()
67 for (
const auto &
aggregate : aggregates )
69 if (
aggregate.supportedTypes.contains( mType ) )
78 if ( active == mActive )
84 setText( tr(
"Exclude" ) );
95 if ( aggregate == mAggregate )
98 mAggregate = QString();
100 for (
const auto &agg : qgis::as_const( mAvailableAggregates ) )
102 if ( agg.function == aggregate )
static QList< QgsAggregateCalculator::AggregateInfo > aggregates()
Structured information for available aggregates.