diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
commit | 6630937e63ae5797487b86743a7733c8ae5cc42c (patch) | |
tree | 3d53dacf6430f9099e1fb20835881205de674961 /src/gui/text/qtexttable.cpp | |
parent | 37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff) | |
parent | c7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff) |
Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
Diffstat (limited to 'src/gui/text/qtexttable.cpp')
-rw-r--r-- | src/gui/text/qtexttable.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index 9639c18d2b..39f26d5d42 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -696,18 +696,22 @@ void QTextTable::insertRows(int pos, int num) int extended = 0; int insert_before = 0; if (pos > 0 && pos < d->nRows) { + int lastCell = -1; for (int i = 0; i < d->nCols; ++i) { int cell = d->grid[pos*d->nCols + i]; if (cell == d->grid[(pos-1)*d->nCols+i]) { // cell spans the insertion place, extend it - QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell); - QTextCharFormat fmt = c->charFormat(it->format); - fmt.setTableCellRowSpan(fmt.tableCellRowSpan() + num); - p->setCharFormat(it.position(), 1, fmt); + if (cell != lastCell) { + QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell); + QTextCharFormat fmt = c->charFormat(it->format); + fmt.setTableCellRowSpan(fmt.tableCellRowSpan() + num); + p->setCharFormat(it.position(), 1, fmt); + } extended++; } else if (!insert_before) { insert_before = cell; } + lastCell = cell; } } else { insert_before = (pos == 0 ? d->grid[0] : d->fragment_end); |