summaryrefslogtreecommitdiff
path: root/src/mylineedit.cpp
diff options
context:
space:
mode:
authorAlessio Treglia <alessio@debian.org>2012-02-16 11:08:45 +0100
committerAlessio Treglia <alessio@debian.org>2012-02-16 11:08:45 +0100
commit65a64d260e05c7bf8d3bdf82e796637dc820e574 (patch)
tree600c2becea7f28fdefff51200bb3ed33514e4cc7 /src/mylineedit.cpp
parent1d323e54ee434609cf035598486075c9a918a2d3 (diff)
Imported Upstream version 0.7.0
Diffstat (limited to 'src/mylineedit.cpp')
-rw-r--r--src/mylineedit.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/mylineedit.cpp b/src/mylineedit.cpp
new file mode 100644
index 0000000..ba5a6c4
--- /dev/null
+++ b/src/mylineedit.cpp
@@ -0,0 +1,41 @@
+/* smplayer, GUI front-end for mplayer.
+ Copyright (C) 2006-2012 Ricardo Villalba <rvm@users.sourceforge.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "mylineedit.h"
+#include <QToolButton>
+#include <QStyle>
+#include "images.h"
+
+MyLineEdit::MyLineEdit(QWidget *parent)
+ : LineEditWithIcon(parent)
+{
+ setupButton();
+ button->hide();
+ connect(button, SIGNAL(clicked()), this, SLOT(clear()));
+ connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateCloseButton(const QString&)));
+}
+
+void MyLineEdit::setupButton() {
+ setIcon( Images::icon("clear_left") );
+}
+
+void MyLineEdit::updateCloseButton(const QString& text) {
+ button->setVisible(!text.isEmpty());
+}
+
+#include "moc_mylineedit.cpp"