17#include "moc_qgsaggregatetoolbutton.cpp"
25 setFocusPolicy( Qt::StrongFocus );
26 setPopupMode( QToolButton::InstantPopup );
28 mMenu =
new QMenu(
this );
29 connect( mMenu, &QMenu::aboutToShow,
this, &QgsAggregateToolButton::aboutToShowMenu );
32 setText( tr(
"Exclude" ) );
41 updateAvailableAggregates();
49void QgsAggregateToolButton::aboutToShowMenu()
53 QAction *action = mMenu->addAction( tr(
"Exclude" ) );
54 connect( action, &QAction::triggered,
this, [
this ]
59 for (
const auto &
aggregate : std::as_const( mAvailableAggregates ) )
61 QAction *action = mMenu->addAction(
aggregate.name );
62 connect( action, &QAction::triggered,
this, [
this,
aggregate ]
70void QgsAggregateToolButton::updateAvailableAggregates()
74 for (
const auto &
aggregate : aggregates )
76 if (
aggregate.supportedTypes.contains( mType ) )
91 setText( tr(
"Exclude" ) );
105 mAggregate = QString();
107 for (
const auto &agg : std::as_const( mAvailableAggregates ) )
static QList< QgsAggregateCalculator::AggregateInfo > aggregates()
Structured information for available aggregates.
static QMetaType::Type variantTypeToMetaType(QVariant::Type variantType)
Converts a QVariant::Type to a QMetaType::Type.