From: Vincent van Ravesteijn Date: Sat, 31 Oct 2009 18:10:18 +0000 (+0000) Subject: Close the correct tab when clicking one while the active tab is in another tabworkare... X-Git-Tag: 2.0.0~5251 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e8ec7889241e7105dffe3a856df3571be55e6e80;p=features.git Close the correct tab when clicking one while the active tab is in another tabworkarea. This was fixed in r31072 for the cornerbutton; now it is fixed for the buttons on the tabs themselves. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31814 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index fb93ae2903..7c49cb794e 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -1360,7 +1360,7 @@ TabWorkArea::TabWorkArea(QWidget * parent) this, SLOT(showContextMenu(const QPoint &))); #if QT_VERSION >= 0x040500 connect(tb, SIGNAL(tabCloseRequested(int)), - tb, SLOT(on_tabCloseRequested(int))); + this, SLOT(closeTab(int))); #endif setUsesScrollButtons(true); @@ -1540,6 +1540,21 @@ void TabWorkArea::closeCurrentTab() wa->view().hideWorkArea(wa); } + +void TabWorkArea::closeTab(int index) +{ + on_currentTabChanged(index); + GuiWorkArea * wa; + if (index == -1) + wa = currentWorkArea(); + else { + wa = dynamic_cast(widget(index)); + LASSERT(wa, /**/); + } + wa->view().hideWorkArea(wa); +} + + /// class DisplayPath { public: @@ -1780,13 +1795,6 @@ DragTabBar::DragTabBar(QWidget* parent) } -void DragTabBar::on_tabCloseRequested(int index) -{ - setCurrentIndex(index); - lyx::dispatch(FuncRequest(LFUN_BUFFER_CLOSE)); -} - - #if QT_VERSION < 0x040300 int DragTabBar::tabAt(QPoint const & position) const { diff --git a/src/frontends/qt4/GuiWorkArea.h b/src/frontends/qt4/GuiWorkArea.h index 5f5eec9bc1..1f44c5cef5 100644 --- a/src/frontends/qt4/GuiWorkArea.h +++ b/src/frontends/qt4/GuiWorkArea.h @@ -322,6 +322,8 @@ public Q_SLOTS: void closeCurrentBuffer(); /// close current tab, or the one given by \c clicked_tab_ void closeCurrentTab(); + /// close the tab given by \c index + void closeTab(int index); /// void updateTabTexts(); @@ -372,10 +374,6 @@ private: Q_SIGNALS: /// void tabMoveRequested(int fromIndex, int toIndex); - -private Q_SLOTS: - /// - void on_tabCloseRequested(int index); }; } // namespace frontend