Changeset 561 for trunk/src/gui/widgets/qtextedit.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/widgets/qtextedit.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 75 75 76 76 #ifndef QT_NO_TEXTEDIT 77 78 79 80 77 81 78 82 class QTextEditControl : public QTextControl … … 106 110 autoFormatting(QTextEdit::AutoNone), tabChangesFocus(false), 107 111 lineWrap(QTextEdit::WidgetWidth), lineWrapColumnOrWidth(0), 108 wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), textFormat(Qt::AutoText) 112 wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), clickCausedFocus(0), 113 textFormat(Qt::AutoText) 109 114 { 110 115 ignoreAutomaticScrollbarAdjustment = false; … … 153 158 QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged())); 154 159 QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged())); 160 161 155 162 156 163 QTextDocument *doc = control->document(); … … 178 185 #ifndef QT_NO_CURSOR 179 186 viewport->setCursor(Qt::IBeamCursor); 187 188 189 180 190 #endif 181 191 } … … 329 339 both plain and rich text. 330 340 331 \ingroup text332 \mainclass 341 \ingroup 342 333 343 334 344 \tableofcontents … … 523 533 524 534 If the text edit has another content type, it will not be replaced 525 by plain text if you call toPlainText(). 535 by plain text if you call toPlainText(). The only exception to this 536 is the non-break space, \e{nbsp;}, that will be converted into 537 standard space. 526 538 527 539 By default, for an editor with no contents, this property contains … … 1203 1215 if (e->text()[0].isPrint()) { 1204 1216 setEditFocus(true); 1217 1205 1218 clear(); 1219 1206 1220 } else { 1207 1221 e->ignore(); … … 1213 1227 } 1214 1228 #endif 1215 1216 if (!(d->control->textInteractionFlags() & Qt::TextEditable)) { 1229 #ifndef QT_NO_SHORTCUT 1230 1231 Qt::TextInteractionFlags tif = d->control->textInteractionFlags(); 1232 1233 if (tif & Qt::TextSelectableByKeyboard){ 1234 if (e == QKeySequence::SelectPreviousPage) { 1235 e->accept(); 1236 d->pageUpDown(QTextCursor::Up, QTextCursor::KeepAnchor); 1237 return; 1238 } else if (e ==QKeySequence::SelectNextPage) { 1239 e->accept(); 1240 d->pageUpDown(QTextCursor::Down, QTextCursor::KeepAnchor); 1241 return; 1242 } 1243 } 1244 if (tif & (Qt::TextSelectableByKeyboard | Qt::TextEditable)) { 1245 if (e == QKeySequence::MoveToPreviousPage) { 1246 e->accept(); 1247 d->pageUpDown(QTextCursor::Up, QTextCursor::MoveAnchor); 1248 return; 1249 } else if (e == QKeySequence::MoveToNextPage) { 1250 e->accept(); 1251 d->pageUpDown(QTextCursor::Down, QTextCursor::MoveAnchor); 1252 return; 1253 } 1254 } 1255 1256 if (!(tif & Qt::TextEditable)) { 1217 1257 switch (e->key()) { 1218 1258 case Qt::Key_Space: … … 1239 1279 } 1240 1280 return; 1241 }1242 1243 #ifndef QT_NO_SHORTCUT1244 if (e == QKeySequence::MoveToPreviousPage) {1245 e->accept();1246 d->pageUpDown(QTextCursor::Up, QTextCursor::MoveAnchor);1247 return;1248 } else if (e == QKeySequence::MoveToNextPage) {1249 e->accept();1250 d->pageUpDown(QTextCursor::Down, QTextCursor::MoveAnchor);1251 return;1252 } else if (e == QKeySequence::SelectPreviousPage) {1253 e->accept();1254 d->pageUpDown(QTextCursor::Up, QTextCursor::KeepAnchor);1255 return;1256 } else if (e ==QKeySequence::SelectNextPage) {1257 e->accept();1258 d->pageUpDown(QTextCursor::Down, QTextCursor::KeepAnchor);1259 return;1260 1281 } 1261 1282 #endif // QT_NO_SHORTCUT … … 1560 1581 ensureCursorVisible(); 1561 1582 } 1583 1584 1585 1562 1586 } 1563 1587 … … 1656 1680 && !hasEditFocus()) { 1657 1681 setEditFocus(true); 1682 1658 1683 selectAll(); // so text is replaced rather than appended to 1684 1659 1685 } 1660 1686 #endif 1661 1687 d->sendControlEvent(e); 1688 1662 1689 } 1663 1690 … … 1695 1722 { 1696 1723 Q_D(QTextEdit); 1724 1725 1726 1697 1727 QAbstractScrollArea::focusInEvent(e); 1698 1728 d->sendControlEvent(e); … … 1879 1909 \since 4.1 1880 1910 1881 By default, this property contains a value of 80 .1911 By default, this property contains a value of 80. 1882 1912 */ 1883 1913 … … 2059 2089 flags = Qt::TextEditorInteraction; 2060 2090 } 2061 setAttribute(Qt::WA_InputMethodEnabled, !ro);2062 2091 d->control->setTextInteractionFlags(flags); 2092 2063 2093 } 2064 2094 … … 2610 2640 } 2611 2641 2612 2613 2642 /*! 2614 2643 \enum QTextEdit::KeyboardAction
Note:
See TracChangeset
for help on using the changeset viewer.