_tags << normalTags << systemTagStringList;
Q_EMIT totalTagsChanged();
+ updateOverflowTagsString();
endResetModel();
}
}
Q_EMIT maxTagsChanged();
+ updateOverflowTagsString();
+}
+
+QString FileTagModel::overflowTagsString() const
+{
+ return _overflowTagsString;
+}
+
+void FileTagModel::updateOverflowTagsString()
+{
+ if (totalTags() <= _maxTags) {
+ _overflowTagsString = "";
+ } else {
+ const auto overflowingTags = _tags.mid(_maxTags + 1);
+ _overflowTagsString = overflowingTags.join(", ");
+ }
+
+ qDebug() << _overflowTagsString;
+ Q_EMIT overflowTagsStringChanged();
}
int FileTagModel::totalTags() const
Q_PROPERTY(AccountPtr account READ account WRITE setAccount NOTIFY accountChanged)
Q_PROPERTY(int maxTags READ maxTags WRITE setMaxTags NOTIFY maxTagsChanged)
Q_PROPERTY(int totalTags READ totalTags NOTIFY totalTagsChanged)
+ Q_PROPERTY(QString overflowTagsString READ overflowTagsString NOTIFY overflowTagsStringChanged)
public:
explicit FileTagModel(const QString &serverRelativePath, const AccountPtr &account, QObject * const parent = nullptr);
[[nodiscard]] int maxTags() const;
[[nodiscard]] int totalTags() const;
+ [[nodiscard]] QString overflowTagsString() const;
+
signals:
void serverRelativePathChanged();
void accountChanged();
void maxTagsChanged();
void totalTagsChanged();
+ void overflowTagsStringChanged();
public slots:
void setServerRelativePath(const QString &serverRelativePath);
void setAccount(const OCC::AccountPtr &account);
void setMaxTags(const int maxTags);
+ void updateOverflowTagsString();
void resetForNewFile();
QStringList _tags;
int _maxTags = 0;
+ QString _overflowTagsString;
};
}