Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qplaintextedit.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    912912
    913913        if (moveCursor) {
     914            cursor.setVisualNavigation(true);
    914915            // move using movePosition to keep the cursor's x
    915916            lastY += verticalOffset();
     
    944945    if (!centerOnScroll && q->isVisible()) {
    945946        QTextBlock block = doc->lastBlock();
    946         const int visible = static_cast<int>(viewport->rect().height() - margin - 1);
    947         int y = 0;
     947        const qreal visible = viewport->rect().height() - margin - 1;
     948        qreal y = 0;
    948949        int visibleFromBottom = 0;
    949950
     
    953954                continue;
    954955            }
    955             y += int(documentLayout->blockBoundingRect(block).height());
     956            y += documentLayout->blockBoundingRect(block).height();
    956957
    957958            QTextLayout *layout = block.layout();
     
    962963                    QTextLine line = layout->lineAt(lineNumber);
    963964                    const QRectF lr = line.naturalTextRect();
    964                     if (int(lr.top()) >= y - visible)
     965                    if (lr.top() >= y - visible)
    965966                        break;
    966967                    ++lineNumber;
     
    13201321}
    13211322
     1323/*!
     1324    Returns the reference of the anchor at position \a pos, or an
     1325    empty string if no anchor exists at that point.
     1326
     1327    \since 4.7
     1328 */
     1329QString QPlainTextEdit::anchorAt(const QPoint &pos) const
     1330{
     1331    Q_D(const QPlainTextEdit);
     1332    int cursorPos = d->control->hitTest(pos + QPoint(d->horizontalOffset(),
     1333                                                     d->verticalOffset()),
     1334                                        Qt::ExactHit);
     1335    if (cursorPos < 0)
     1336        return QString();
     1337
     1338    QTextDocumentPrivate *pieceTable = document()->docHandle();
     1339    QTextDocumentPrivate::FragmentIterator it = pieceTable->find(cursorPos);
     1340    QTextCharFormat fmt = pieceTable->formatCollection()->charFormat(it->format);
     1341    return fmt.anchorHref();
     1342}
    13221343
    13231344/*!
     
    14561477    }
    14571478#endif
     1479#ifndef QT_NO_GESTURES
    14581480    else if (e->type() == QEvent::Gesture) {
    14591481        QGestureEvent *ge = static_cast<QGestureEvent *>(e);
     
    14791501        return true;
    14801502    }
     1503#endif // QT_NO_GESTURES
    14811504    return QAbstractScrollArea::event(e);
    14821505}
     
    23942417
    23952418    The default value depends on whether the QPlainTextEdit is read-only
    2396     or editable, and whether it is a QTextBrowser or not.
     2419    or editable.
    23972420*/
    23982421
Note: See TracChangeset for help on using the changeset viewer.