From a651fb04412f7f970088674e95dfe8d130945d82 Mon Sep 17 00:00:00 2001 From: Doronin Stanislav Date: Sun, 24 Oct 2021 11:44:38 +0300 Subject: [PATCH] removed extra trimming to fix tree model completer example --- examples/widgets/tools/treemodelcompleter/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/widgets/tools/treemodelcompleter/mainwindow.cpp b/examples/widgets/tools/treemodelcompleter/mainwindow.cpp index 44c5b13..a8e776e 100644 --- a/examples/widgets/tools/treemodelcompleter/mainwindow.cpp +++ b/examples/widgets/tools/treemodelcompleter/mainwindow.cpp @@ -206,7 +206,7 @@ QAbstractItemModel *MainWindow::modelFromFile(const QString &fileName) QRegularExpression re("^\\s+"); while (!file.atEnd()) { - const QString line = QString::fromUtf8(file.readLine()).trimmed(); + const QString line = QString::fromUtf8(file.readLine()); const QString trimmedLine = line.trimmed(); if (trimmedLine.isEmpty()) continue; @@ -218,7 +218,7 @@ QAbstractItemModel *MainWindow::modelFromFile(const QString &fileName) level = 0; } else { const int capLen = match.capturedLength(); - level = line.startsWith(QLatin1Char('\t')) ? capLen / 4 : capLen; + level = line.startsWith(QLatin1Char('\t')) ? capLen : capLen / 4; } if (level + 1 >= parents.size()) -- 2.29.2.windows.2