mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 06:19:52 +08:00
NotebookNodeExplorer: fix reload issue not loading children of node item
This commit is contained in:
parent
21edc0f20d
commit
6b10a5f63d
@ -1,5 +1,5 @@
|
|||||||
<p>
|
<p>
|
||||||
VNoteX is designed to be a pleasant note-taking platform, refactored from VNote, which is an open source note-taking application for Markdown since 2016. VNote shares most of the code base with VNoteX since version 3.0 and continue to be open source.
|
VNoteX is designed to be a pleasant note-taking platform, refactored from VNote, which is an open source note-taking application for Markdown since 2016. VNote shares most of the code base with VNoteX since version 3 and continue to be open source.
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
Source code of VNote could be found at <a href="https://github.com/vnotex/vnote">GitHub</a>.
|
Source code of VNote could be found at <a href="https://github.com/vnotex/vnote">GitHub</a>.
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<p>
|
<p>
|
||||||
VNoteX 致力于成为一个舒适的笔记平台。VNoteX 重构自 VNote,后者是一个始于2016年的专注于 Markdown 的开源笔记软件。VNote 3.0 会和 VNoteX 共享大部分源代码,并继续开源。
|
VNoteX 致力于成为一个舒适的笔记平台。VNoteX 重构自 VNote,后者是一个始于2016年的专注于 Markdown 的开源笔记软件。VNote 在版本3之后会和 VNoteX 共享大部分源代码,并继续开源。
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
VNote 源代码可以在 <a href="https://github.com/vnotex/vnote">GitHub</a> 获取。
|
VNote 源代码可以在 <a href="https://github.com/vnotex/vnote">GitHub</a> 获取。
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
@ -238,16 +238,7 @@ void NotebookNodeExplorer::setupMasterExplorer(QWidget *p_parent)
|
|||||||
NavigationModeMgr::getInst().registerNavigationTarget(m_navigationWrapper.data());
|
NavigationModeMgr::getInst().registerNavigationTarget(m_navigationWrapper.data());
|
||||||
|
|
||||||
connect(m_masterExplorer, &QTreeWidget::itemExpanded,
|
connect(m_masterExplorer, &QTreeWidget::itemExpanded,
|
||||||
this, [this](QTreeWidgetItem *p_item) {
|
this, &NotebookNodeExplorer::loadItemChildren);
|
||||||
auto cnt = p_item->childCount();
|
|
||||||
for (int i = 0; i < cnt; ++i) {
|
|
||||||
auto child = p_item->child(i);
|
|
||||||
auto data = getItemNodeData(child);
|
|
||||||
if (data.isNode() && !data.isLoaded()) {
|
|
||||||
loadNode(child, data.getNode(), 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(m_masterExplorer, &QTreeWidget::customContextMenuRequested,
|
connect(m_masterExplorer, &QTreeWidget::customContextMenuRequested,
|
||||||
this, [this](const QPoint &p_pos) {
|
this, [this](const QPoint &p_pos) {
|
||||||
@ -421,8 +412,13 @@ void NotebookNodeExplorer::loadNode(QTreeWidgetItem *p_item, Node *p_node, int p
|
|||||||
|
|
||||||
loadChildren(p_item, p_node, p_level - 1);
|
loadChildren(p_item, p_node, p_level - 1);
|
||||||
|
|
||||||
if (stateCache()->contains(p_item)) {
|
if (stateCache()->contains(p_item) && p_item->childCount() > 0) {
|
||||||
p_item->setExpanded(true);
|
if (p_item->isExpanded()) {
|
||||||
|
loadItemChildren(p_item);
|
||||||
|
} else {
|
||||||
|
// itemExpanded() will trigger loadItemChildren().
|
||||||
|
p_item->setExpanded(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2050,3 +2046,15 @@ void NotebookNodeExplorer::openSelectedNodesWithExternalProgram(const QString &p
|
|||||||
ProcessUtils::startDetached(command);
|
ProcessUtils::startDetached(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NotebookNodeExplorer::loadItemChildren(QTreeWidgetItem *p_item) const
|
||||||
|
{
|
||||||
|
auto cnt = p_item->childCount();
|
||||||
|
for (int i = 0; i < cnt; ++i) {
|
||||||
|
auto child = p_item->child(i);
|
||||||
|
auto data = getItemNodeData(child);
|
||||||
|
if (data.isNode() && !data.isLoaded()) {
|
||||||
|
loadNode(child, data.getNode(), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -169,6 +169,8 @@ namespace vnotex
|
|||||||
|
|
||||||
void loadChildren(QTreeWidgetItem *p_item, Node *p_node, int p_level) const;
|
void loadChildren(QTreeWidgetItem *p_item, Node *p_node, int p_level) const;
|
||||||
|
|
||||||
|
void loadItemChildren(QTreeWidgetItem *p_item) const;
|
||||||
|
|
||||||
void loadNode(QTreeWidgetItem *p_item, const QSharedPointer<ExternalNode> &p_node) const;
|
void loadNode(QTreeWidgetItem *p_item, const QSharedPointer<ExternalNode> &p_node) const;
|
||||||
|
|
||||||
void loadRecycleBinNode(Node *p_node) const;
|
void loadRecycleBinNode(Node *p_node) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user