24 setFocusPolicy( Qt::StrongFocus );
25 setPopupMode( QToolButton::InstantPopup );
27 mMenu =
new QMenu(
this );
28 connect( mMenu, &QMenu::aboutToShow,
this, &QgsAggregateToolButton::aboutToShowMenu );
31 setText( tr(
"Exclude" ) );
40 updateAvailableAggregates();
43 void QgsAggregateToolButton::aboutToShowMenu()
47 QAction *action = mMenu->addAction( tr(
"Exclude" ) );
48 connect( action, &QAction::triggered,
this, [
this ]
53 for (
const auto &
aggregate : std::as_const( mAvailableAggregates ) )
55 QAction *action = mMenu->addAction(
aggregate.name );
56 connect( action, &QAction::triggered,
this, [
this,
aggregate ]
64 void QgsAggregateToolButton::updateAvailableAggregates()
68 for (
const auto &
aggregate : aggregates )
70 if (
aggregate.supportedTypes.contains( mType ) )
85 setText( tr(
"Exclude" ) );
99 mAggregate = QString();
101 for (
const auto &agg : std::as_const( mAvailableAggregates ) )
static QList< QgsAggregateCalculator::AggregateInfo > aggregates()
Structured information for available aggregates.