#ifndef AUTOCOMPLETETAGEDIT_H
#define AUTOCOMPLETETAGEDIT_H

#include "TagEditWidget.h"
#include "IxWidgetFactory.h"

class AutoCompleteTagEditWidget : public TagEditWidget
{
    Q_OBJECT
public:
	static const QString type;

public:
	explicit AutoCompleteTagEditWidget(QWidget *parent = nullptr);

    IXWIDGET_OBJECT_NAME

	QVariant getValue();

	void setValue(const QVariant &value) override;

	void setOptions(QVariantMap options);

    QStringList getTextList();
    QStringList getValueList();
	void setValueList(const QStringList &values);

protected:
	bool eventFilter(QObject * watched, QEvent * event) override;
	void addTag(const QString &text);

private:
    void init();

public slots:
	void onEnter();

private slots:
    void onItemSlected(const QString &text);

private:
	QVariantMap options;
};

#endif // AUTOCOMPLETETAGEDIT_H
