Changeset 846 for trunk/src/gui/widgets/qplaintextedit.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/widgets/qplaintextedit.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 912 912 913 913 if (moveCursor) { 914 cursor.setVisualNavigation(true); 914 915 // move using movePosition to keep the cursor's x 915 916 lastY += verticalOffset(); … … 944 945 if (!centerOnScroll && q->isVisible()) { 945 946 QTextBlock block = doc->lastBlock(); 946 const int visible = static_cast<int>(viewport->rect().height() - margin - 1);947 inty = 0;947 const qreal visible = viewport->rect().height() - margin - 1; 948 qreal y = 0; 948 949 int visibleFromBottom = 0; 949 950 … … 953 954 continue; 954 955 } 955 y += int(documentLayout->blockBoundingRect(block).height());956 y += documentLayout->blockBoundingRect(block).height(); 956 957 957 958 QTextLayout *layout = block.layout(); … … 962 963 QTextLine line = layout->lineAt(lineNumber); 963 964 const QRectF lr = line.naturalTextRect(); 964 if ( int(lr.top()) >= y - visible)965 if (lr.top() >= y - visible) 965 966 break; 966 967 ++lineNumber; … … 1320 1321 } 1321 1322 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 */ 1329 QString 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 } 1322 1343 1323 1344 /*! … … 1456 1477 } 1457 1478 #endif 1479 #ifndef QT_NO_GESTURES 1458 1480 else if (e->type() == QEvent::Gesture) { 1459 1481 QGestureEvent *ge = static_cast<QGestureEvent *>(e); … … 1479 1501 return true; 1480 1502 } 1503 #endif // QT_NO_GESTURES 1481 1504 return QAbstractScrollArea::event(e); 1482 1505 } … … 2394 2417 2395 2418 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. 2397 2420 */ 2398 2421
Note:
See TracChangeset
for help on using the changeset viewer.