QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
16 #ifndef QGSSETTINGSENTRYENUMFLAG_H
17 #define QGSSETTINGSENTRYENUMFLAG_H
56 mMetaEnum = QMetaEnum::fromType<T>();
57 Q_ASSERT( mMetaEnum.isValid() );
58 if ( !mMetaEnum.isValid() )
59 QgsDebugMsg( QStringLiteral(
"Invalid metaenum. Enum/Flag probably misses Q_ENUM/Q_FLAG declaration. Settings key: '%1'" ).arg( this->
key() ) );
67 if ( !mMetaEnum.isValid() )
69 QgsDebugMsg( QStringLiteral(
"Invalid metaenum. Enum/Flag probably misses Q_ENUM/Q_FLAG declaration. Settings key: '%1'" ).arg( this->
key() ) );
75 if ( !mMetaEnum.isFlag() )
82 QgsDebugMsg( QStringLiteral(
"Invalid enum/flag key/s '%1' for settings key '%2'" ).arg(
value.toString(), this->key() ) );
97 if ( !mMetaEnum.isValid() )
99 QgsDebugMsg( QStringLiteral(
"Invalid metaenum. Enum/Flag probably misses Q_ENUM/Q_FLAG declaration. Settings key: '%1'" ).arg( this->
key( dynamicKeyPartList ) ) );
103 QVariant variantValue;
108 variantValue =
static_cast<int>(
value );
112 if ( !mMetaEnum.isFlag() )
135 #endif // QGSSETTINGSENTRYENUMFLAG_H
QString description() const
Returns the settings entry description.
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
T qgsFlagKeysToValue(const QString &keys, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given keys of a flag.
QgsSettingsEntryEnumFlag(const QString &key, const QString §ion, T defaultValue, const QString &description=QString(), Qgis::SettingsOptions options=Qgis::SettingsOptions())
Constructor for QgsSettingsEntryEnumFlagBase.
Qgis::SettingsOptions options() const
Returns the settings options.
SettingsType
Types of settings entries.
bool setVariantValuePrivate(const QVariant &value, const QStringList &dynamicKeyPartList=QStringList()) const
Sets the settings value with a variant value.
T convertFromVariant(const QVariant &value) const override
Returns settings default value.
QString qgsFlagValueToKeys(const T &value, bool *returnOk=nullptr)
Returns the value for the given keys of a flag.
QString key(const QString &dynamicKeyPart=QString()) const
Returns settings entry key.
Base abstract class for settings entry which are passed by value.
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
bool setValuePrivate(T value, const QStringList &dynamicKeyPartList) const override
Set settings value.
virtual Qgis::SettingsType settingsType() const override
Returns the settings entry type.
T defaultValue() const
Returns settings default value.
A template class for enum and flag settings entry.
Q_DECL_DEPRECATED QgsSettings::Section section() const
Returns settings section.
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.