diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2010-07-17 23:31:36 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2010-07-17 23:31:36 (GMT) |
commit | 8d545a21b6aa89675b404a9d7bf08b7499d26e5e (patch) | |
tree | 761c900e05538a337517435d5337392f7fc8931d /src/gui/text | |
parent | 571b85896ee3663479b4a10d2418e2e19b3639f3 (diff) | |
parent | d61c74faef2ed787aacc53c03b8361fa57bccc8e (diff) | |
download | Qt-8d545a21b6aa89675b404a9d7bf08b7499d26e5e.zip Qt-8d545a21b6aa89675b404a9d7bf08b7499d26e5e.tar.gz Qt-8d545a21b6aa89675b404a9d7bf08b7499d26e5e.tar.bz2 |
Merge remote branch 'origin/4.7' into 4.7-from-4.6
Conflicts:
tests/auto/qtexttable/tst_qtexttable.cpp
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qtextcursor.cpp | 6 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qtextoption.cpp | 7 | ||||
-rw-r--r-- | src/gui/text/qtexttable.cpp | 28 |
4 files changed, 34 insertions, 9 deletions
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index daa40a1..769ab2f 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -1283,7 +1283,7 @@ void QTextCursor::setVisualNavigation(bool b) /*! \since 4.7 - Sets the visual x position for vertical cursor movements. + Sets the visual x position for vertical cursor movements to \a x. The vertical movement x position is cleared automatically when the cursor moves horizontally, and kept unchanged when the cursor moves vertically. The mechanism allows the cursor to move up and down on a @@ -1335,8 +1335,8 @@ bool QTextCursor::keepPositionOnInsert() const Defines whether the cursor should keep its current position when text gets inserted at the current position of the cursor. - If \b is true, the cursor keeps its current position when text gets inserted at the positing of the cursor. - If \b is false, the cursor moves along with the inserted text. + If \a b is true, the cursor keeps its current position when text gets inserted at the positing of the cursor. + If \a b is false, the cursor moves along with the inserted text. The default is false. diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index d6535ea..674064e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1935,7 +1935,7 @@ void QTextLine::layout_helper(int maxGlyphs) // We ignore the right bearing if the minimum negative bearing is too little to // expand the text beyond the edge. if (sb_or_ws|breakany) { - if (lbh.calculateNewWidth(line) + lbh.minimumRightBearing > line.width) + if (lbh.calculateNewWidth(line) - lbh.minimumRightBearing > line.width) lbh.adjustRightBearing(); if (lbh.checkFullOtherwiseExtend(line)) { if (!breakany) { diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp index 8f31e46..9eeec0b 100644 --- a/src/gui/text/qtextoption.cpp +++ b/src/gui/text/qtextoption.cpp @@ -392,7 +392,12 @@ QList<QTextOption::Tab> QTextOption::tabs() const /*! \fn Tab::Tab(qreal pos, TabType tabType, QChar delim = QChar()) - Creates a tab with the given position, tab type, and (for DelimiterTab) delimiter + + Creates a tab with the given position, tab type, and delimiter + (\a pos, \a tabType, \a delim). + + \note \a delim is only used when \a tabType is DelimiterTab. + \since 4.7 */ diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index ada18c8..c291f25 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -754,19 +754,39 @@ 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 - fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num); - p->setCharFormat(it.position(), 1, fmt); + 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; + } } 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()); |