diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-09-30 13:39:26 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-09-30 13:39:26 (GMT) |
commit | 6385ba952548b098348f3ab1002437d516b29e5c (patch) | |
tree | 639f14702ab1fdb51eff84f86e79b6f6ec0ef9cb /Swift | |
parent | d6ca3cac8a2e00a3b68ae34d53412bbd0e9920d2 (diff) | |
download | swift-contrib-6385ba952548b098348f3ab1002437d516b29e5c.zip swift-contrib-6385ba952548b098348f3ab1002437d516b29e5c.tar.bz2 |
Slightly neaten code
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index 90be786..d3a5676 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -110,18 +110,16 @@ void QtChatTabs::handleWantsToActivate() { void QtChatTabs::handleTabClosing() { QWidget* widget = qobject_cast<QWidget*>(sender()); - if (!widget) { - return; - } - int index = tabs_->indexOf(widget); - if (index < 0) { - return; - } - tabs_->removeTab(index); - if (tabs_->count() == 0) { - hide(); + int index; + if (widget && ((index = tabs_->indexOf(widget)) >= 0)) { + tabs_->removeTab(index); + if (tabs_->count() == 0) { + hide(); + } + else { + handleTabTitleUpdated(tabs_->currentWidget()); + } } - handleTabTitleUpdated(tabs_->currentWidget()); } void QtChatTabs::handleRequestedPreviousTab() { |