summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/QtUI/QtStatusWidget.cpp15
-rw-r--r--Swift/QtUI/QtStatusWidget.h1
2 files changed, 15 insertions, 1 deletions
diff --git a/Swift/QtUI/QtStatusWidget.cpp b/Swift/QtUI/QtStatusWidget.cpp
index 28df59c..6aeec4a 100644
--- a/Swift/QtUI/QtStatusWidget.cpp
+++ b/Swift/QtUI/QtStatusWidget.cpp
@@ -74,9 +74,13 @@ QtStatusWidget::QtStatusWidget(QWidget *parent) : QWidget(parent), editCursor_(Q
menu_ = new QListWidget();
menu_->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint );
- menu_->setAlternatingRowColors(true);
+ menu_->setAlternatingRowColors(true);
+ menu_->setFocusProxy(statusEdit_);
connect(menu_, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(handleItemClicked(QListWidgetItem*)));
+
+ connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(handleApplicationFocusChanged(QWidget*, QWidget*)));
+
viewMode();
}
@@ -84,6 +88,15 @@ QtStatusWidget::~QtStatusWidget() {
delete menu_;
}
+void QtStatusWidget::handleApplicationFocusChanged(QWidget* /*old*/, QWidget* now) {
+ if (stack_->currentIndex() == 0) {
+ return;
+ }
+ if (now != menu_ && now != statusEdit_) {
+ handleEditCancelled();
+ }
+}
+
void QtStatusWidget::mousePressEvent(QMouseEvent*) {
handleClicked();
}
diff --git a/Swift/QtUI/QtStatusWidget.h b/Swift/QtUI/QtStatusWidget.h
index 84994d8..4e6aa20 100644
--- a/Swift/QtUI/QtStatusWidget.h
+++ b/Swift/QtUI/QtStatusWidget.h
@@ -37,6 +37,7 @@ namespace Swift {
void handleClicked();
void handleEditComplete();
void handleEditCancelled();
+ void handleApplicationFocusChanged(QWidget* old, QWidget* now);
protected slots:
virtual void mousePressEvent(QMouseEvent* event);
void handleItemClicked(QListWidgetItem* item);