Changeset 846 for trunk/src/gui/text/qtextcontrol.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/text/qtextcontrol.cpp
r769 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) … … 92 92 93 93 #ifndef QT_NO_CONTEXTMENU 94 #if defined(Q_WS_WIN) 94 #if defined(Q_WS_WIN) || defined(Q_WS_X11) 95 95 extern bool qt_use_rtl_extensions; 96 96 #endif … … 405 405 setContent(format, text, document); 406 406 407 QWidget *parentWidget = qobject_cast<QWidget*>(parent);408 if (parentWidget) {409 QTextOption opt = doc->defaultTextOption();410 opt.setTextDirection(parentWidget->layoutDirection());411 doc->setDefaultTextOption(opt);412 }413 407 doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable); 414 408 q->setCursorWidth(-1); … … 442 436 443 437 // convenience signal forwards 444 QObject::connect(doc, SIGNAL(contentsChanged()), q, SIGNAL(textChanged()));445 438 QObject::connect(doc, SIGNAL(undoAvailable(bool)), q, SIGNAL(undoAvailable(bool))); 446 439 QObject::connect(doc, SIGNAL(redoAvailable(bool)), q, SIGNAL(redoAvailable(bool))); … … 453 446 doc->setUndoRedoEnabled(false); 454 447 448 //Saving the index save some time. 449 static int contentsChangedIndex = QTextDocument::staticMetaObject.indexOfSignal("contentsChanged()"); 450 static int textChangedIndex = QTextControl::staticMetaObject.indexOfSignal("textChanged()"); 455 451 // avoid multiple textChanged() signals being emitted 456 Q Object::disconnect(doc, SIGNAL(contentsChanged()), q, SIGNAL(textChanged()));452 QMetaObject::disconnect(doc, contentsChangedIndex, q, textChangedIndex); 457 453 458 454 if (!text.isEmpty()) { … … 489 485 cursor.setCharFormat(charFormatForInsertion); 490 486 491 Q Object::connect(doc, SIGNAL(contentsChanged()), q, SIGNAL(textChanged()));487 QMetaObject::connect(doc, contentsChangedIndex, q, textChangedIndex); 492 488 emit q->textChanged(); 493 489 if (!document) … … 746 742 Q_D(QTextControl); 747 743 d->repaintSelection(); 744 const int oldCursorPos = d->cursor.position(); 748 745 d->doc->undo(&d->cursor); 746 if (d->cursor.position() != oldCursorPos) 747 emit cursorPositionChanged(); 748 emit microFocusChanged(); 749 749 ensureCursorVisible(); 750 750 } … … 754 754 Q_D(QTextControl); 755 755 d->repaintSelection(); 756 const int oldCursorPos = d->cursor.position(); 756 757 d->doc->redo(&d->cursor); 758 if (d->cursor.position() != oldCursorPos) 759 emit cursorPositionChanged(); 760 emit microFocusChanged(); 757 761 ensureCursorVisible(); 758 762 } … … 847 851 } 848 852 849 void QTextControl::paste( )850 { 851 const QMimeData *md = QApplication::clipboard()->mimeData( );853 void QTextControl::paste(QClipboard::Mode mode) 854 { 855 const QMimeData *md = QApplication::clipboard()->mimeData(mode); 852 856 if (md) 853 857 insertFromMimeData(md); … … 884 888 { 885 889 Q_D(QTextControl); 886 if (d->interactionFlags & Qt::NoTextInteraction) 887 return; 890 if (d->interactionFlags == Qt::NoTextInteraction) { 891 e->ignore(); 892 return; 893 } 888 894 889 895 d->contextWidget = contextWidget; … … 1090 1096 } 1091 1097 break; 1092 case QEvent::LayoutDirectionChange: {1093 if (contextWidget) {1094 QTextOption opt = document()->defaultTextOption();1095 opt.setTextDirection(contextWidget->layoutDirection());1096 document()->setDefaultTextOption(opt);1097 }1098 }1099 // FALL THROUGH1100 1098 default: 1101 1099 break; … … 1230 1228 } 1231 1229 else if (e == QKeySequence::Paste) { 1232 q->paste(); 1230 QClipboard::Mode mode = QClipboard::Clipboard; 1231 #ifdef Q_WS_X11 1232 if (e->modifiers() == (Qt::CTRL | Qt::SHIFT) && e->key() == Qt::Key_Insert) 1233 mode = QClipboard::Selection; 1234 #endif 1235 q->paste(mode); 1233 1236 } 1234 1237 #endif … … 1765 1768 if (!menu) 1766 1769 return; 1767 menu-> exec(screenPos);1768 delete menu;1770 menu->setAttribute(Qt::WA_DeleteOnClose); 1771 menu->popup(screenPos); 1769 1772 #endif 1770 1773 } … … 2076 2079 #endif 2077 2080 2078 #if defined(Q_WS_WIN) 2081 #if defined(Q_WS_WIN) || defined(Q_WS_X11) 2079 2082 if ((d->interactionFlags & Qt::TextEditable) && qt_use_rtl_extensions) { 2080 2083 #else
Note:
See TracChangeset
for help on using the changeset viewer.