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
This commit is contained in:
Pavel Sanda 2009-05-02 12:43:42 +00:00
parent e032cd934d
commit 3da9c20456
2 changed files with 18 additions and 0 deletions

View 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));
}

View File

@ -368,6 +368,10 @@ private:
Q_SIGNALS:
///
void tabMoveRequested(int fromIndex, int toIndex);
private Q_SLOTS:
///
void on_tabCloseRequested(int index);
};
} // namespace frontend