From 800a5cffbbd312abbe61241f0c01e22cefb39b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pinkava?= Date: Thu, 3 Oct 2024 19:32:42 +0200 Subject: [PATCH] Gui: remove unused MDITabbar and MainWindowTabBar classes --- src/Gui/MainWindow.cpp | 80 ------------------------------------------ 1 file changed, 80 deletions(-) diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 6862089d02..c9ac2a6413 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -300,86 +300,6 @@ struct MainWindowP void restoreWindowState(const QByteArray &); }; -class MDITabbar : public QTabBar -{ -public: - explicit MDITabbar( QWidget * parent = nullptr ) : QTabBar(parent) - { - menu = new QMenu(this); - setDrawBase(false); - setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); - } - - ~MDITabbar() override - { - delete menu; - } - -protected: - void contextMenuEvent ( QContextMenuEvent * e ) override - { - menu->clear(); - CommandManager& cMgr = Application::Instance->commandManager(); - if (tabRect(currentIndex()).contains(e->pos())) - cMgr.getCommandByName("Std_CloseActiveWindow")->addTo(menu); - cMgr.getCommandByName("Std_CloseAllWindows")->addTo(menu); - menu->addSeparator(); - cMgr.getCommandByName("Std_CascadeWindows")->addTo(menu); - cMgr.getCommandByName("Std_TileWindows")->addTo(menu); - menu->addSeparator(); - cMgr.getCommandByName("Std_Windows")->addTo(menu); - menu->popup(e->globalPos()); - } - -private: - QMenu* menu; -}; - -#if defined(Q_OS_WIN32) -class MainWindowTabBar : public QTabBar -{ -public: - MainWindowTabBar(QWidget *parent) : QTabBar(parent) - { - setExpanding(false); - } -protected: - bool event(QEvent *e) - { - // show the tooltip if tab is too small to fit label - if (e->type() != QEvent::ToolTip) - return QTabBar::event(e); - QSize size = this->size(); - QSize hint = sizeHint(); - if (shape() == QTabBar::RoundedWest || shape() == QTabBar::RoundedEast) { - size.transpose(); - hint.transpose(); - } - if (size.width() < hint.width()) - return QTabBar::event(e); - e->accept(); - return true; - } - void tabInserted (int index) - { - // get all dock windows - QList dw = getMainWindow()->findChildren(); - for (QList::iterator it = dw.begin(); it != dw.end(); ++it) { - // compare tab text and window title to get the right dock window - if (this->tabText(index) == (*it)->windowTitle()) { - QWidget* dock = (*it)->widget(); - if (dock) { - QIcon icon = dock->windowIcon(); - if (!icon.isNull()) - setTabIcon(index, icon); - } - break; - } - } - } -}; -#endif - } // namespace Gui /* TRANSLATOR Gui::MainWindow */