]> git.lyx.org Git - features.git/commitdiff
Use Qt native close button on tabbar.
authorPavel Sanda <sanda@lyx.org>
Sat, 2 May 2009 12:43:42 +0000 (12:43 +0000)
committerPavel Sanda <sanda@lyx.org>
Sat, 2 May 2009 12:43:42 +0000 (12:43 +0000)
Fixes http://www.lyx.org/trac/ticket/3724

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29491 a592a061-630c-0410-9148-cb99ea01b6c8

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

index b0eb1e353f1963b5e90d203a0e00e6c2310471d3..37c9db7e0d4517d6a5a48efe761dd804a4d0f333 100644 (file)
@@ -1334,6 +1334,10 @@ TabWorkArea::TabWorkArea(QWidget * parent)
        tb->setContextMenuPolicy(Qt::CustomContextMenu);
        connect(tb, SIGNAL(customContextMenuRequested(const QPoint &)),
                this, SLOT(showContextMenu(const QPoint &)));
+#if QT_VERSION >= 0x040500
+       connect(tb, SIGNAL(tabCloseRequested(int)),
+               tb, SLOT(on_tabCloseRequested(int)));
+#endif
 
        setUsesScrollButtons(true);
 }
@@ -1741,6 +1745,16 @@ DragTabBar::DragTabBar(QWidget* parent)
        : QTabBar(parent)
 {
        setAcceptDrops(true);
+#if QT_VERSION >= 0x040500
+       setTabsClosable(true);
+#endif
+}
+
+
+void DragTabBar::on_tabCloseRequested(int index)
+{
+       setCurrentIndex(index);
+       lyx::dispatch(FuncRequest(LFUN_BUFFER_CLOSE));
 }
 
 
index 3eb757ab0662aab21f2e7e0a3d133d5617631b76..3dc7e6c9072c1293594ffae068070d172ab2fb6e 100644 (file)
@@ -368,6 +368,10 @@ private:
 Q_SIGNALS:
        ///
        void tabMoveRequested(int fromIndex, int toIndex);
+
+private Q_SLOTS:
+       ///
+       void on_tabCloseRequested(int index);
 };
 
 } // namespace frontend