2017-04-27 18:26:05 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2014-02-11 18:14:46 +00:00
|
|
|
#ifndef TAGWIDGET_H
|
|
|
|
#define TAGWIDGET_H
|
2013-11-02 01:20:02 +00:00
|
|
|
|
|
|
|
#include "groupedlineedit.h"
|
|
|
|
#include <QPair>
|
|
|
|
|
2014-06-26 17:01:31 +00:00
|
|
|
class QCompleter;
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
class TagWidget : public GroupedLineEdit {
|
|
|
|
Q_OBJECT
|
2013-11-02 01:20:02 +00:00
|
|
|
public:
|
2014-02-28 04:09:57 +00:00
|
|
|
explicit TagWidget(QWidget *parent = 0);
|
2013-11-02 01:20:02 +00:00
|
|
|
void setCompleter(QCompleter *completer);
|
|
|
|
QPair<int, int> getCursorTagPosition();
|
|
|
|
void highlight();
|
2014-05-22 18:40:22 +00:00
|
|
|
void setText(const QString &text);
|
2013-11-02 01:20:02 +00:00
|
|
|
void clear();
|
|
|
|
void setCursorPosition(int position);
|
2014-01-19 15:33:24 +00:00
|
|
|
void wheelEvent(QWheelEvent *event);
|
2014-11-17 01:28:48 +00:00
|
|
|
void fixPopupPosition(int delta);
|
2014-02-28 04:09:57 +00:00
|
|
|
public
|
|
|
|
slots:
|
2014-02-09 17:35:23 +00:00
|
|
|
void reparse();
|
2014-05-22 18:40:22 +00:00
|
|
|
void completionSelected(const QString &text);
|
|
|
|
void completionHighlighted(const QString &text);
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2013-11-02 16:04:18 +00:00
|
|
|
protected:
|
|
|
|
void keyPressEvent(QKeyEvent *e);
|
2013-11-02 01:20:02 +00:00
|
|
|
private:
|
2019-02-07 18:59:34 +00:00
|
|
|
void focusOutEvent(QFocusEvent *ev) override;
|
2014-02-09 17:35:23 +00:00
|
|
|
QCompleter *m_completer;
|
2014-05-16 06:12:46 +00:00
|
|
|
bool lastFinishedTag;
|
2013-11-02 01:20:02 +00:00
|
|
|
};
|
|
|
|
|
2014-02-11 18:14:46 +00:00
|
|
|
#endif // TAGWIDGET_H
|