Skip to content

Commit

Permalink
Add signal by widget for attach/reattach.
Browse files Browse the repository at this point in the history
  • Loading branch information
epasveer committed Sep 2, 2024
1 parent eaafa6b commit 1c8f368
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/QDetachTabWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void QDetachTabWidget::detachTab (int tabIndex, Qt::WindowState windowState) {

// Notify listeners the tab was detached.
emit tabDetached(tabIndex);
emit tabDetached(w);
}

void QDetachTabWidget::reattachTab (int tabIndex, Qt::WindowState windowState) {
Expand Down Expand Up @@ -109,11 +110,15 @@ void QDetachTabWidget::reattachTab (int tabIndex, Qt::WindowState windowState) {
// Insert the real tab in the same position.
insertTab(tabIndex, it->_widget, it->_title);

// Save the real tab's widget before we delete the entry.
w = it->_widget;

// Delete the entry from the tab cache.
_tabInfo.erase(it);

// Notify listeners the tab was reattached.
emit tabReattached(tabIndex);
emit tabReattached(w);
}

void QDetachTabWidget::closeEvent (QCloseEvent* e) {
Expand Down
2 changes: 2 additions & 0 deletions src/QDetachTabWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class QDetachTabWidget : public QTabWidget {

signals:
void tabDetached (int tabIndex);
void tabDetached (QWidget* widget);
void tabReattached (int tabIndex);
void tabReattached (QWidget* widget);

protected:
void closeEvent (QCloseEvent* e);
Expand Down

0 comments on commit 1c8f368

Please sign in to comment.