From eb84a2f12778572ca97bb7ff8749fd80e84b16d4 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Wed, 29 Mar 2017 18:02:10 +0200 Subject: Remove superfluous duplicated variable in QtDNDTabBar code Coverity raised this issue. Test-Information: Swift and unit tests still build on macOS 10.12.4. Drag and drop of tabs still work. Change-Id: I64bdb973da73a4f2b5ed514583c4f8740adc77b4 diff --git a/Swift/QtUI/Trellis/QtDNDTabBar.cpp b/Swift/QtUI/Trellis/QtDNDTabBar.cpp index 9a6c436..3ae2124 100644 --- a/Swift/QtUI/Trellis/QtDNDTabBar.cpp +++ b/Swift/QtUI/Trellis/QtDNDTabBar.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 Isode Limited. + * Copyright (c) 2014-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -70,21 +70,19 @@ void QtDNDTabBar::dragEnterEvent(QDragEnterEvent* dragEnterEvent) { } void QtDNDTabBar::dropEvent(QDropEvent* dropEvent) { - QtDNDTabBar* sourceTabBar = dynamic_cast(dropEvent->source()); + auto sourceTabBar = dynamic_cast(dropEvent->source()); if (sourceTabBar && dropEvent->mimeData() && dropEvent->mimeData()->data("action") == QByteArray("application/tab-detach")) { - QtDNDTabBar* source = dynamic_cast(dropEvent->source()); - int targetTabIndex = tabAt(dropEvent->pos()); QRect rect = tabRect(targetTabIndex); if (targetTabIndex >= 0 && (dropEvent->pos().x() - rect.left() - rect.width()/2 > 0)) { targetTabIndex++; } - QWidget* tab = source->getDragWidget(); + QWidget* tab = sourceTabBar->getDragWidget(); assert(tab); QTabWidget* targetTabWidget = dynamic_cast(parentWidget()); - QString tabText = source->getDragText(); + QString tabText = sourceTabBar->getDragText(); /* * When you add a widget to an empty QTabWidget, it's automatically made the current widget. -- cgit v0.10.2-6-g49f6