]> git.lyx.org Git - features.git/commitdiff
Close the correct tab when clicking one while the active tab is in another tabworkare...
authorVincent van Ravesteijn <vfr@lyx.org>
Sat, 31 Oct 2009 18:10:18 +0000 (18:10 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Sat, 31 Oct 2009 18:10:18 +0000 (18:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31814 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiWorkArea.cpp
src/frontends/qt4/GuiWorkArea.h

index fb93ae29037aeca78e091a75e7beaadc4d6842fc..7c49cb794e3991a3f360398fc6843c0f055fa48a 100644 (file)
@@ -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<GuiWorkArea *>(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
 {
index 5f5eec9bc13792ed485b3eb55076b4b880d99f3c..1f44c5cef5995d21c11418520a578276ccf1b24d 100644 (file)
@@ -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