diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-07-02 10:40:38 (GMT) |
---|---|---|
committer | Richard Maudsley <richard.maudsley@isode.com> | 2014-07-08 09:11:59 (GMT) |
commit | 8ab7ca17fdde8f8fb62a0c574478aa2c4c01a9bc (patch) | |
tree | 26a3b88639149370fcd231bd102bc37e039b07d3 /Swift/QtUI/QtClosableLineEdit.h | |
parent | b4fe7ad5c1036b1d24470d9f8e0888faf582530a (diff) | |
download | swift-8ab7ca17fdde8f8fb62a0c574478aa2c4c01a9bc.zip swift-8ab7ca17fdde8f8fb62a0c574478aa2c4c01a9bc.tar.bz2 |
Added close/clear button to roster filter search term box.
Test-Information:
Verify that the clear button resets the roster filter and hides the search box. Verify that the roster filter continues to behave as normal.
Change-Id: Ifa5de1e611334b83634ac31d30bf912fd5c4da87
Diffstat (limited to 'Swift/QtUI/QtClosableLineEdit.h')
-rw-r--r-- | Swift/QtUI/QtClosableLineEdit.h | 43 |
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; +}; + +} |