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] {
58 for (
const auto &
aggregate : std::as_const( mAvailableAggregates ) )
60 QAction *action = mMenu->addAction(
aggregate.name );
61 connect( action, &QAction::triggered,
this, [
this,
aggregate] {
68void QgsAggregateToolButton::updateAvailableAggregates()
72 for (
const auto &
aggregate : aggregates )
74 if (
aggregate.supportedTypes.contains( mType ) )
89 setText( tr(
"Exclude" ) );
103 mAggregate = QString();
105 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.