mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 22:09:52 +08:00
bug-fix: re-connect signals about Vim status after moving split
This commit is contained in:
parent
026e9f7ed5
commit
59cf0a9e33
@ -131,7 +131,9 @@ void VEditWindow::setupCornerWidget()
|
|||||||
tr("Split"), this);
|
tr("Split"), this);
|
||||||
splitAct->setToolTip(tr("Split current window vertically"));
|
splitAct->setToolTip(tr("Split current window vertically"));
|
||||||
connect(splitAct, &QAction::triggered,
|
connect(splitAct, &QAction::triggered,
|
||||||
this, &VEditWindow::splitWindow);
|
this, [this](){
|
||||||
|
splitWindow(true);
|
||||||
|
});
|
||||||
|
|
||||||
removeSplitAct = new QAction(QIcon(":/resources/icons/remove_split.svg"),
|
removeSplitAct = new QAction(QIcon(":/resources/icons/remove_split.svg"),
|
||||||
tr("Remove split"), this);
|
tr("Remove split"), this);
|
||||||
@ -309,18 +311,8 @@ int VEditWindow::openFileInTab(VFile *p_file, OpenFileMode p_mode)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(editor, &VEditTab::getFocused,
|
// Connect the signals.
|
||||||
this, &VEditWindow::getFocused);
|
connectEditTab(editor);
|
||||||
connect(editor, &VEditTab::outlineChanged,
|
|
||||||
this, &VEditWindow::handleOutlineChanged);
|
|
||||||
connect(editor, &VEditTab::curHeaderChanged,
|
|
||||||
this, &VEditWindow::handleCurHeaderChanged);
|
|
||||||
connect(editor, &VEditTab::statusUpdated,
|
|
||||||
this, &VEditWindow::handleTabStatusUpdated);
|
|
||||||
connect(editor, &VEditTab::statusMessage,
|
|
||||||
this, &VEditWindow::handleTabStatusMessage);
|
|
||||||
connect(editor, &VEditTab::vimStatusUpdated,
|
|
||||||
this, &VEditWindow::handleTabVimStatusUpdated);
|
|
||||||
|
|
||||||
int idx = appendEditTab(p_file, editor);
|
int idx = appendEditTab(p_file, editor);
|
||||||
return idx;
|
return idx;
|
||||||
@ -775,25 +767,37 @@ bool VEditWindow::addEditTab(QWidget *p_widget)
|
|||||||
if (!p_widget) {
|
if (!p_widget) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
VEditTab *editor = dynamic_cast<VEditTab *>(p_widget);
|
VEditTab *editor = dynamic_cast<VEditTab *>(p_widget);
|
||||||
if (!editor) {
|
if (!editor) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect the signals.
|
// Connect the signals.
|
||||||
connect(editor, &VEditTab::getFocused,
|
connectEditTab(editor);
|
||||||
this, &VEditWindow::getFocused);
|
|
||||||
connect(editor, &VEditTab::outlineChanged,
|
|
||||||
this, &VEditWindow::handleOutlineChanged);
|
|
||||||
connect(editor, &VEditTab::curHeaderChanged,
|
|
||||||
this, &VEditWindow::handleCurHeaderChanged);
|
|
||||||
connect(editor, &VEditTab::statusUpdated,
|
|
||||||
this, &VEditWindow::handleTabStatusUpdated);
|
|
||||||
int idx = appendEditTab(editor->getFile(), editor);
|
int idx = appendEditTab(editor->getFile(), editor);
|
||||||
setCurrentIndex(idx);
|
setCurrentIndex(idx);
|
||||||
updateTabStatus(idx);
|
updateTabStatus(idx);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VEditWindow::connectEditTab(const VEditTab *p_tab)
|
||||||
|
{
|
||||||
|
connect(p_tab, &VEditTab::getFocused,
|
||||||
|
this, &VEditWindow::getFocused);
|
||||||
|
connect(p_tab, &VEditTab::outlineChanged,
|
||||||
|
this, &VEditWindow::handleOutlineChanged);
|
||||||
|
connect(p_tab, &VEditTab::curHeaderChanged,
|
||||||
|
this, &VEditWindow::handleCurHeaderChanged);
|
||||||
|
connect(p_tab, &VEditTab::statusUpdated,
|
||||||
|
this, &VEditWindow::handleTabStatusUpdated);
|
||||||
|
connect(p_tab, &VEditTab::statusMessage,
|
||||||
|
this, &VEditWindow::handleTabStatusMessage);
|
||||||
|
connect(p_tab, &VEditTab::vimStatusUpdated,
|
||||||
|
this, &VEditWindow::handleTabVimStatusUpdated);
|
||||||
|
}
|
||||||
|
|
||||||
void VEditWindow::setCurrentWindow(bool p_current)
|
void VEditWindow::setCurrentWindow(bool p_current)
|
||||||
{
|
{
|
||||||
if (p_current) {
|
if (p_current) {
|
||||||
|
@ -130,9 +130,13 @@ private:
|
|||||||
void moveTabOneSplit(int p_tabIdx, bool p_right);
|
void moveTabOneSplit(int p_tabIdx, bool p_right);
|
||||||
|
|
||||||
void updateTabInfo(int p_idx);
|
void updateTabInfo(int p_idx);
|
||||||
|
|
||||||
// Update the sequence number of all the tabs.
|
// Update the sequence number of all the tabs.
|
||||||
void updateAllTabsSequence();
|
void updateAllTabsSequence();
|
||||||
|
|
||||||
|
// Connect the signals of VEditTab to this VEditWindow.
|
||||||
|
void connectEditTab(const VEditTab *p_tab);
|
||||||
|
|
||||||
VNote *vnote;
|
VNote *vnote;
|
||||||
VEditArea *m_editArea;
|
VEditArea *m_editArea;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user