33
44#include " SplitTabWidget.h"
55#include < QApplication>
6+ #include < QDebug>
67#include < QDrag>
78#include < QDragEnterEvent>
89#include < QEvent>
1718#include < QTabBar>
1819#include < QTabWidget>
1920#include < QTimer>
20- #include < QDebug>
2121
2222DropIndicatorWidget::DropIndicatorWidget (QWidget *parent) : QWidget(parent) {
2323 setAttribute (Qt::WA_TransparentForMouseEvents);
@@ -149,7 +149,7 @@ void DraggableTabBar::dragMoveEvent(QDragMoveEvent *event) {
149149
150150 auto dropPos = event->position ().toPoint ();
151151 auto newIndex = tabAt (dropPos);
152-
152+
153153 if (newIndex >= 0 ) {
154154 QRect rect = tabRect (newIndex);
155155 bool after = dropPos.x () > rect.center ().x ();
@@ -158,7 +158,7 @@ void DraggableTabBar::dragMoveEvent(QDragMoveEvent *event) {
158158 QRect rect = tabRect (count () - 1 );
159159 dropIndicator->showAt (rect, true );
160160 }
161-
161+
162162 event->acceptProposedAction ();
163163}
164164
@@ -178,9 +178,10 @@ void DraggableTabBar::dropEvent(QDropEvent *event) {
178178 }
179179
180180 // Forward the drop event to the tab widget
181- QDropEvent newEvent (event->position (), event->dropAction (), event->mimeData (), event->buttons (), event->modifiers ());
181+ QDropEvent newEvent (event->position (), event->dropAction (), event->mimeData (), event->buttons (),
182+ event->modifiers ());
182183 tabWidget->dropEvent (&newEvent);
183-
184+
184185 dropIndicator->hide ();
185186}
186187
@@ -226,7 +227,7 @@ void DraggableTabWidget::dropEvent(QDropEvent *event) {
226227 auto oldIndex = indexOf (widget);
227228 auto dropPos = event->position ().toPoint ();
228229 auto newIndex = tabBar ()->tabAt (dropPos);
229-
230+
230231 if (newIndex >= 0 ) {
231232 auto tabRect = tabBar ()->tabRect (newIndex);
232233 if (dropPos.x () > tabRect.center ().x ()) {
@@ -290,9 +291,7 @@ SplitTabWidget::SplitTabWidget(QWidget *parent)
290291 if (tab) {
291292 auto count = splitter->count ();
292293 onNewSplitCreated (tab, count);
293- QTimer::singleShot (0 , this , [this ]() {
294- onSplitCountMaybeChanged ();
295- });
294+ QTimer::singleShot (0 , this , [this ]() { onSplitCountMaybeChanged (); });
296295 }
297296 });
298297
@@ -394,9 +393,7 @@ void SplitTabWidget::closeSplitWithTabWidget(QTabWidget *tab) {
394393 equalizeWidths ();
395394
396395 // Defer the split count check to after the event loop processes the deletion
397- QTimer::singleShot (0 , this , [this ]() {
398- onSplitCountMaybeChanged ();
399- });
396+ QTimer::singleShot (0 , this , [this ]() { onSplitCountMaybeChanged (); });
400397}
401398
402399void SplitTabWidget::addTabToCurrentSplit (QWidget *widget, const QString &label,
@@ -593,7 +590,7 @@ void SplitTabWidget::onTabFocusChanged(QWidget *widget, bool focused) {
593590 tab->currentWidget ()->setFocus ();
594591 onTabFocusChanged (tab->currentWidget (), true );
595592 }
596- }
593+ }
597594 if (widget && focused) {
598595 widget->setFocus ();
599596 }
@@ -608,10 +605,9 @@ void SplitTabWidget::onNewSplitCreated(QTabWidget *tabWidget, int count) {
608605 }
609606
610607 if (auto tabBar = qobject_cast<DraggableTabBar *>(tabWidget->tabBar ())) {
611- connect (tabBar, &DraggableTabBar::emptyAreaDoubleClicked, this ,
612- [this , tabWidget](const QPoint &pos) {
613- emit emptyAreaDoubleClicked (tabWidget, pos);
614- });
608+ connect (
609+ tabBar, &DraggableTabBar::emptyAreaDoubleClicked, this ,
610+ [this , tabWidget](const QPoint &pos) { emit emptyAreaDoubleClicked (tabWidget, pos); });
615611 }
616612}
617613
0 commit comments