diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-02-08 12:34:12 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-02-08 20:18:16 +0100 |
commit | ad01b159e02067ba46d6433412cb1e690553e946 (patch) | |
tree | 9ef900a2ab42719124f2933403b8e41785c958e2 /sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp | |
parent | eca89cd04469a61b3c9ee7993122ca1ec3fe976f (diff) |
shiboken6/Documentation: Fix table width determination
Initialize the width/height lists to 0.
As a drive-by, use the number of lines from splitting
instead of counting.
Pick-to: 6.0
Change-Id: Ib17ed819684298599d3c01cf00cfc8b5c192d232
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp')
-rw-r--r-- | sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp index 19501d06c..40c0e1988 100644 --- a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp +++ b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp @@ -1304,15 +1304,15 @@ void QtXmlToSphinx::Table::format(TextStream& s) const // calc width and height of each column and row const int headerColumnCount = m_rows.constFirst().count(); - QList<int> colWidths(headerColumnCount); - QList<int> rowHeights(m_rows.count()); + QList<int> colWidths(headerColumnCount, 0); + QList<int> rowHeights(m_rows.count(), 0); for (int i = 0, maxI = m_rows.count(); i < maxI; ++i) { const QtXmlToSphinx::TableRow& row = m_rows.at(i); for (int j = 0, maxJ = std::min(row.count(), colWidths.size()); j < maxJ; ++j) { const auto rowLines = QStringView{row[j].data}.split(QLatin1Char('\n')); // cache this would be a good idea for (const auto &str : rowLines) colWidths[j] = std::max(colWidths[j], int(str.size())); - rowHeights[i] = std::max(rowHeights[i], int(row[j].data.count(QLatin1Char('\n')) + 1)); + rowHeights[i] = std::max(rowHeights[i], int(rowLines.size())); } } |