summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-07-14 03:52:48 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-07-14 03:52:48 (GMT)
commitb2002d0814e18f7a50bdbf8d17c4bc1662fa70ee (patch)
treec1489ec6b23f7d6e01b3e44676d3018e334056a4 /src
parent05971cf88bf03f2cbf563cb194ebee62bb907394 (diff)
downloadQt-b2002d0814e18f7a50bdbf8d17c4bc1662fa70ee.zip
Qt-b2002d0814e18f7a50bdbf8d17c4bc1662fa70ee.tar.gz
Qt-b2002d0814e18f7a50bdbf8d17c4bc1662fa70ee.tar.bz2
Revert "Fix an Assert in QTextTable"
This reverts commit b2a4c7f0142a48f60e7ec4fc5866917e3da8b7c3. Unit test tst_qtexttable::QTBUG11282_insertBeforeMergedEnding fails on mac and Linux, reverting for now.
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtexttable.cpp28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index e3985ce..5100176 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -754,39 +754,19 @@ void QTextTable::insertColumns(int pos, int num)
QTextFormatCollection *c = p->formatCollection();
p->beginEditBlock();
- QList<int> extendedSpans;
for (int i = 0; i < d->nRows; ++i) {
int cell;
if (i == d->nRows - 1 && pos == d->nCols)
cell = d->fragment_end;
else
cell = d->grid[i*d->nCols + pos];
+ QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
+ QTextCharFormat fmt = c->charFormat(it->format);
if (pos > 0 && pos < d->nCols && cell == d->grid[i*d->nCols + pos - 1]) {
// cell spans the insertion place, extend it
- if (!extendedSpans.contains(cell)) {
- QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
- QTextCharFormat fmt = c->charFormat(it->format);
- fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num);
- p->setCharFormat(it.position(), 1, fmt);
- d->dirty = true;
- extendedSpans << cell;
- }
+ fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num);
+ p->setCharFormat(it.position(), 1, fmt);
} else {
- /* If the next cell is spanned from the row above, we need to find the right position
- to insert to */
- if (i > 0 && pos < d->nCols && cell == d->grid[(i-1) * d->nCols + pos]) {
- int gridIndex = i*d->nCols + pos;
- const int gridEnd = d->nRows * d->nCols - 1;
- while (gridIndex < gridEnd && cell == d->grid[gridIndex]) {
- ++gridIndex;
- }
- if (gridIndex == gridEnd)
- cell = d->fragment_end;
- else
- cell = d->grid[gridIndex];
- }
- QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
- QTextCharFormat fmt = c->charFormat(it->format);
fmt.setTableCellRowSpan(1);
fmt.setTableCellColumnSpan(1);
Q_ASSERT(fmt.objectIndex() == objectIndex());