aboutsummaryrefslogtreecommitdiff
path: root/src/documentoutlinemodel.cpp
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-06-12 15:48:35 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-06-12 15:48:35 +0200
commit79e62a80579c5669542c65d1e9e7b31dc3872137 (patch)
tree0375ca6ecbdaa4808e37d4b07dede08f64aabc21 /src/documentoutlinemodel.cpp
parent89263ec94135dfa03fe1e4501c780d982ee78385 (diff)
downloadkristall-79e62a80579c5669542c65d1e9e7b31dc3872137.tar.gz
Fixes a small bug in the outline generator.
Diffstat (limited to 'src/documentoutlinemodel.cpp')
-rw-r--r--src/documentoutlinemodel.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/documentoutlinemodel.cpp b/src/documentoutlinemodel.cpp
index 0f12233..e9bef1b 100644
--- a/src/documentoutlinemodel.cpp
+++ b/src/documentoutlinemodel.cpp
@@ -61,18 +61,32 @@ void DocumentOutlineModel::appendH3(const QString &title, QString const & anchor
void DocumentOutlineModel::endBuild()
{
- for(auto const & h1 : this->root.children)
+ int root_index = 0;
+ for(auto & h1 : this->root.children)
{
assert(h1.depth == 1);
assert(h1.parent == &this->root);
- for(auto const & h2 : h1.children)
+
+ h1.index = root_index;
+ root_index += 1;
+
+ int group_index = 0;
+ for(auto & h2 : h1.children)
{
assert(h2.depth == 2);
assert(h2.parent == &h1);
- for(auto const & h3 : h2.children)
+
+ h2.index = group_index;
+ group_index += 1;
+
+ int bottom_index = 0;
+ for(auto & h3 : h2.children)
{
assert(h3.depth == 3);
assert(h3.parent == &h2);
+
+ h3.index = bottom_index;
+ bottom_index += 1;
}
}
}