#pragma once #include #include class QStringListModel; // A QCompleter for a comma-separated tags line edit. It completes only the // token currently being typed (the text after the last comma) and, on // selection, splices the chosen tag back in place of that token — the same // per-token behaviour as the web and Android tag fields. Attach with // QLineEdit::setCompleter; call setSuggestions() to (re)fill the tag list. class TagCompleter : public QCompleter { public: explicit TagCompleter(QObject *parent = nullptr); void setSuggestions(const QStringList &tags); protected: QStringList splitPath(const QString &path) const override; QString pathFromIndex(const QModelIndex &index) const override; private: QStringListModel *m_model; };