From 3da9c2045670b4c896f540f65c7dfdfdb2db8f1b Mon Sep 17 00:00:00 2001 From: Pavel Sanda Date: Sat, 2 May 2009 12:43:42 +0000 Subject: [PATCH] Use Qt native close button on tabbar. 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 | 14 ++++++++++++++ src/frontends/qt4/GuiWorkArea.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index b0eb1e353f..37c9db7e0d 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -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)); } diff --git a/src/frontends/qt4/GuiWorkArea.h b/src/frontends/qt4/GuiWorkArea.h index 3eb757ab06..3dc7e6c907 100644 --- a/src/frontends/qt4/GuiWorkArea.h +++ b/src/frontends/qt4/GuiWorkArea.h @@ -368,6 +368,10 @@ private: Q_SIGNALS: /// void tabMoveRequested(int fromIndex, int toIndex); + +private Q_SLOTS: + /// + void on_tabCloseRequested(int index); }; } // namespace frontend -- 2.39.2