21 const int MAX_LOG_LENGTH = 5;
23 QgsProcessingRecentAlgorithmLog::QgsProcessingRecentAlgorithmLog( QObject *parent )
27 mRecentAlgorithmIds = settings.
value( QStringLiteral(
"processing/recentAlgorithms" ), QVariant(),
QgsSettings::Gui ).toStringList();
30 QStringList QgsProcessingRecentAlgorithmLog::recentAlgorithmIds()
const 32 return mRecentAlgorithmIds;
35 void QgsProcessingRecentAlgorithmLog::push(
const QString &
id )
37 const QStringList previous = mRecentAlgorithmIds;
38 mRecentAlgorithmIds.removeAll(
id );
39 mRecentAlgorithmIds.insert( 0,
id );
40 if ( mRecentAlgorithmIds.length() > MAX_LOG_LENGTH )
41 mRecentAlgorithmIds = mRecentAlgorithmIds.mid( 0, MAX_LOG_LENGTH );
46 if ( previous != mRecentAlgorithmIds )
This class is a composition of two QSettings instances:
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.