mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 06:19:52 +08:00
fix bug in VEditWindow
Bug: when we press the scroll button to the end and click the first/last tab, it won't set current tab correctly. We should not change anything related to current index in handling tabbarClicked(). Signed-off-by: Le Tan <tamlokveer@gmail.com>
This commit is contained in:
parent
3005d9bf5c
commit
7ed92ed7eb
@ -32,6 +32,8 @@ VEditWindow::VEditWindow(VNote *vnote, VEditArea *editArea, QWidget *parent)
|
||||
this, &VEditWindow::handleTabCloseRequest);
|
||||
connect(this, &VEditWindow::tabBarClicked,
|
||||
this, &VEditWindow::handleTabbarClicked);
|
||||
connect(this, &VEditWindow::currentChanged,
|
||||
this, &VEditWindow::handleCurrentIndexChanged);
|
||||
connect(this, &VEditWindow::customContextMenuRequested,
|
||||
this, &VEditWindow::contextMenuRequested);
|
||||
}
|
||||
@ -368,9 +370,18 @@ void VEditWindow::focusWindow()
|
||||
getTab(idx)->focusTab();
|
||||
}
|
||||
|
||||
void VEditWindow::handleTabbarClicked(int /* index */)
|
||||
void VEditWindow::handleTabbarClicked(int p_index)
|
||||
{
|
||||
// Only handle the case when (p_index == currentIndex()) here
|
||||
// because currentIndex() is not changed yet. If we focus window
|
||||
// now, we may change the current index forcely.
|
||||
if (p_index == currentIndex()) {
|
||||
focusWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void VEditWindow::handleCurrentIndexChanged(int /* p_index */)
|
||||
{
|
||||
// The child will emit getFocused here
|
||||
focusWindow();
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,8 @@ private slots:
|
||||
bool handleTabCloseRequest(int index);
|
||||
void splitWindow();
|
||||
void removeSplit();
|
||||
void handleTabbarClicked(int index);
|
||||
void handleTabbarClicked(int p_index);
|
||||
void handleCurrentIndexChanged(int p_index);
|
||||
void contextMenuRequested(QPoint pos);
|
||||
void tabListJump(QAction *action);
|
||||
void handleOutlineChanged(const VToc &p_toc);
|
||||
|
Loading…
x
Reference in New Issue
Block a user