diff --git a/cockatrice/src/client/tabs/tab_supervisor.cpp b/cockatrice/src/client/tabs/tab_supervisor.cpp index 03611c1cf..0f9d6739a 100644 --- a/cockatrice/src/client/tabs/tab_supervisor.cpp +++ b/cockatrice/src/client/tabs/tab_supervisor.cpp @@ -339,19 +339,12 @@ void TabSupervisor::updatePingTime(int value, int max) setTabIcon(indexOf(tabServer), QIcon(PingPixmapGenerator::generatePixmap(15, value, max))); } -void TabSupervisor::closeButtonPressed() -{ - Tab *tab = static_cast(static_cast(sender())->property("tab").value()); - tab->closeRequest(); -} - void TabSupervisor::addCloseButtonToTab(Tab *tab, int tabIndex) { - QTabBar::ButtonPosition closeSide = - (QTabBar::ButtonPosition)tabBar()->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, tabBar()); - CloseButton *closeButton = new CloseButton; - connect(closeButton, &CloseButton::clicked, this, &TabSupervisor::closeButtonPressed); - closeButton->setProperty("tab", QVariant::fromValue((QObject *)tab)); + auto closeSide = static_cast( + tabBar()->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, tabBar())); + auto *closeButton = new CloseButton(tab); + connect(closeButton, &CloseButton::clicked, tab, &Tab::closeRequest); tabBar()->setTabButton(tabIndex, closeSide, closeButton); } diff --git a/cockatrice/src/client/tabs/tab_supervisor.h b/cockatrice/src/client/tabs/tab_supervisor.h index b05547dd9..8b5b79c47 100644 --- a/cockatrice/src/client/tabs/tab_supervisor.h +++ b/cockatrice/src/client/tabs/tab_supervisor.h @@ -135,7 +135,6 @@ public slots: void openReplay(GameReplay *replay); void maximizeMainWindow(); private slots: - void closeButtonPressed(); void updateCurrent(int index); void updatePingTime(int value, int max); void gameJoined(const Event_GameJoined &event);