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();
48void QgsAggregateToolButton::aboutToShowMenu()
52 QAction *action = mMenu->addAction( tr(
"Exclude" ) );
53 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 ]
69void QgsAggregateToolButton::updateAvailableAggregates()
73 for (
const auto &
aggregate : aggregates )
75 if (
aggregate.supportedTypes.contains( mType ) )
90 setText( tr(
"Exclude" ) );
104 mAggregate = QString();
106 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.