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
This commit is contained in:
Vincent van Ravesteijn 2009-10-31 18:10:18 +00:00
parent d5f23c9fa1
commit e8ec788924
2 changed files with 18 additions and 12 deletions

View 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
{

View 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