summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtClosableLineEdit.h')
-rw-r--r--Swift/QtUI/QtClosableLineEdit.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/Swift/QtUI/QtClosableLineEdit.h b/Swift/QtUI/QtClosableLineEdit.h
new file mode 100644
index 0000000..91b4f0e
--- /dev/null
+++ b/Swift/QtUI/QtClosableLineEdit.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2014 Kevin Smith and Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+/* Contains demo Trolltech code from http://git.forwardbias.in/?p=lineeditclearbutton.git with license: */
+/****************************************************************************
+**
+** Copyright (c) 2007 Trolltech ASA <info@trolltech.com>
+**
+** Use, modification and distribution is allowed without limitation,
+** warranty, liability or support of any kind.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QLineEdit>
+
+class QToolButton;
+
+namespace Swift {
+
+class QtClosableLineEdit : public QLineEdit
+{
+ Q_OBJECT
+ public:
+ QtClosableLineEdit(QWidget *parent = 0);
+
+ protected:
+ void resizeEvent(QResizeEvent *);
+
+ private slots:
+ void updateCloseButton(const QString &text);
+ void handleCloseButtonClicked();
+
+ private:
+ static const int clearButtonPadding;
+ QToolButton *clearButton;
+};
+
+}