diff options
author | Maximilian Güntner <maximilian.guentner@gmail.com> | 2013-11-02 02:20:02 +0100 |
---|---|---|
committer | Maximilian Güntner <maximilian.guentner@gmail.com> | 2013-11-02 03:37:31 +0100 |
commit | 04cdfce782f2a104ab5d0ee92de67c7b6271835b (patch) | |
tree | f937c8c8a005ef00f880bbcd3d7c56fd043ddfeb /qt-ui/tagwidget.h | |
parent | 6fe8cb652191728586f3731dcf6688b5a5b3efbb (diff) | |
download | subsurface-04cdfce782f2a104ab5d0ee92de67c7b6271835b.tar.gz |
Added a custom widget for tagging dives
A custom tag widget has been added to MainTab.
Tags are seperated by a comma ",". The implementation
supports escaping a comma by using "\,".
While typing, the widget supports the user by suggesting
tags using a QCompleter.
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Diffstat (limited to 'qt-ui/tagwidget.h')
-rw-r--r-- | qt-ui/tagwidget.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/qt-ui/tagwidget.h b/qt-ui/tagwidget.h new file mode 100644 index 000000000..ff19d7283 --- /dev/null +++ b/qt-ui/tagwidget.h @@ -0,0 +1,26 @@ +#ifndef __TAGWIDGET_H +#define __TAGWIDGET_H + +#include "groupedlineedit.h" +#include <QCompleter> +#include <QPair> + +class TagWidget : public GroupedLineEdit +{ + Q_OBJECT +public: + explicit TagWidget(QWidget *parent = 0); + void setCompleter(QCompleter *completer); + QPair<int, int> getCursorTagPosition(); + void highlight(); + void setText(QString text); + void clear(); + void setCursorPosition(int position); +public slots: + void reparse(); + void completionSelected(QString); +private: + QCompleter *m_completer; +}; + +#endif /* __TAGWIDGET_H */ |