From ff464cee022c75258405ab01ebeedf7bc1c79aa0 Mon Sep 17 00:00:00 2001 From: Kevin Smith <git@kismith.co.uk> Date: Mon, 24 May 2010 18:14:38 +0100 Subject: Escape to close status edit. Resolves: #363 diff --git a/Swift/QtUI/QtStatusWidget.cpp b/Swift/QtUI/QtStatusWidget.cpp index e7e2e5b..a5eda8b 100644 --- a/Swift/QtUI/QtStatusWidget.cpp +++ b/Swift/QtUI/QtStatusWidget.cpp @@ -8,7 +8,6 @@ #include <QBoxLayout> #include <QComboBox> -#include <QLineEdit> #include <QLabel> #include <QFrame> #include <QPoint> @@ -20,6 +19,7 @@ #include <QListWidgetItem> #include "Swift/QtUI/QtElidingLabel.h" +#include "Swift/QtUI/QtLineEdit.h" namespace Swift { @@ -64,9 +64,10 @@ QtStatusWidget::QtStatusWidget(QWidget *parent) : QWidget(parent), editCursor_(Q page2Layout->setContentsMargins(0,0,0,0); stack_->addWidget(page2); - statusEdit_ = new QLineEdit(this); + statusEdit_ = new QtLineEdit(this); page2Layout->addWidget(statusEdit_); connect(statusEdit_, SIGNAL(returnPressed()), this, SLOT(handleEditComplete())); + connect(statusEdit_, SIGNAL(escapePressed()), this, SLOT(handleEditCancelled())); connect(statusEdit_, SIGNAL(textChanged(const QString&)), this, SLOT(generateList())); setStatusText(""); diff --git a/Swift/QtUI/QtStatusWidget.h b/Swift/QtUI/QtStatusWidget.h index 4e6aa20..7317ea5 100644 --- a/Swift/QtUI/QtStatusWidget.h +++ b/Swift/QtUI/QtStatusWidget.h @@ -16,11 +16,11 @@ class QComboBox; class QLabel; class QStackedWidget; -class QLineEdit; class QListWidget; class QListWidgetItem; namespace Swift { + class QtLineEdit; class QtStatusWidget : public QWidget { Q_OBJECT public: @@ -47,7 +47,7 @@ namespace Swift { QStackedWidget* stack_; QLabel* statusIcon_; QLabel* statusTextLabel_; - QLineEdit* statusEdit_; + QtLineEdit* statusEdit_; QString statusText_; QMap<StatusShow::Type, QIcon> icons_; StatusShow::Type selectedStatusType_; diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index d948729..d4acc50 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -78,6 +78,7 @@ sources = [ "MessageSnippet.cpp", "SystemMessageSnippet.cpp", "QtElidingLabel.cpp", + "QtLineEdit.cpp", "Roster/RosterModel.cpp", "Roster/QtTreeWidget.cpp", # "Roster/QtTreeWidgetItem.cpp", -- cgit v0.10.2-6-g49f6