summaryrefslogtreecommitdiffstats
path: root/qt-ui/groupedlineedit.h
diff options
context:
space:
mode:
authorGravatar Maximilian Güntner <maximilian.guentner@gmail.com>2013-11-02 02:20:02 +0100
committerGravatar Maximilian Güntner <maximilian.guentner@gmail.com>2013-11-02 03:37:31 +0100
commit04cdfce782f2a104ab5d0ee92de67c7b6271835b (patch)
treef937c8c8a005ef00f880bbcd3d7c56fd043ddfeb /qt-ui/groupedlineedit.h
parent6fe8cb652191728586f3731dcf6688b5a5b3efbb (diff)
downloadsubsurface-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/groupedlineedit.h')
-rw-r--r--qt-ui/groupedlineedit.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/qt-ui/groupedlineedit.h b/qt-ui/groupedlineedit.h
new file mode 100644
index 000000000..327932c9d
--- /dev/null
+++ b/qt-ui/groupedlineedit.h
@@ -0,0 +1,66 @@
+/* Original License:
+ *
+ * This file is part of the Nepomuk widgets collection
+ * Copyright (c) 2013 Denis Steckelmacher <steckdenis@yahoo.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2.1 as published by the Free Software Foundation,
+ * or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ *
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GROUPEDLINEEDIT_H__
+#define __GROUPEDLINEEDIT_H__
+
+#include <QtGui/QPlainTextEdit>
+#include <QStringList>
+
+class GroupedLineEdit : public QPlainTextEdit
+{
+ Q_OBJECT
+
+public:
+ explicit GroupedLineEdit(QWidget *parent = 0);
+ virtual ~GroupedLineEdit();
+
+ QString text() const;
+
+ int cursorPosition() const;
+ void setCursorPosition(int position);
+ void setText(const QString &text);
+ void clear();
+ void selectAll();
+
+ void removeAllBlocks();
+ void addBlock(int start, int end);
+ QStringList getBlockStringList();
+
+ void addColor(QColor color);
+ void removeAllColors();
+
+ virtual QSize sizeHint() const;
+ virtual QSize minimumSizeHint() const;
+
+signals:
+ void editingFinished();
+
+protected:
+ virtual void paintEvent(QPaintEvent *e);
+ virtual void keyPressEvent(QKeyEvent *e);
+
+private:
+ struct Private;
+ Private *d;
+};
+#endif