diff options
Diffstat (limited to 'Swift/QtUI/QtStatusWidget.cpp')
-rw-r--r-- | Swift/QtUI/QtStatusWidget.cpp | 15 |
1 files changed, 14 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(); } |