Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r2 r561  
    22**
    33** 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])
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7575
    7676#ifndef QT_NO_TEXTEDIT
     77
     78
     79
     80
    7781
    7882class QTextEditControl : public QTextControl
     
    106110      autoFormatting(QTextEdit::AutoNone), tabChangesFocus(false),
    107111      lineWrap(QTextEdit::WidgetWidth), lineWrapColumnOrWidth(0),
    108       wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), textFormat(Qt::AutoText)
     112      wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), clickCausedFocus(0),
     113      textFormat(Qt::AutoText)
    109114{
    110115    ignoreAutomaticScrollbarAdjustment = false;
     
    153158    QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged()));
    154159    QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged()));
     160
     161
    155162
    156163    QTextDocument *doc = control->document();
     
    178185#ifndef QT_NO_CURSOR
    179186    viewport->setCursor(Qt::IBeamCursor);
     187
     188
     189
    180190#endif
    181191}
     
    329339    both plain and rich text.
    330340
    331     \ingroup text
    332     \mainclass
     341    \ingroup
     342
    333343
    334344    \tableofcontents
     
    523533
    524534    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.
    526538
    527539    By default, for an editor with no contents, this property contains
     
    12031215                    if (e->text()[0].isPrint()) {
    12041216                        setEditFocus(true);
     1217
    12051218                        clear();
     1219
    12061220                    } else {
    12071221                        e->ignore();
     
    12131227    }
    12141228#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)) {
    12171257        switch (e->key()) {
    12181258            case Qt::Key_Space:
     
    12391279        }
    12401280        return;
    1241     }
    1242 
    1243 #ifndef QT_NO_SHORTCUT
    1244     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;
    12601281    }
    12611282#endif // QT_NO_SHORTCUT
     
    15601581        ensureCursorVisible();
    15611582    }
     1583
     1584
     1585
    15621586}
    15631587
     
    16561680        && !hasEditFocus()) {
    16571681        setEditFocus(true);
     1682
    16581683        selectAll();    // so text is replaced rather than appended to
     1684
    16591685    }
    16601686#endif
    16611687    d->sendControlEvent(e);
     1688
    16621689}
    16631690
     
    16951722{
    16961723    Q_D(QTextEdit);
     1724
     1725
     1726
    16971727    QAbstractScrollArea::focusInEvent(e);
    16981728    d->sendControlEvent(e);
     
    18791909    \since 4.1
    18801910
    1881     By default, this property contains a value of 80.
     1911    By default, this property contains a value of 80.
    18821912*/
    18831913
     
    20592089        flags = Qt::TextEditorInteraction;
    20602090    }
    2061     setAttribute(Qt::WA_InputMethodEnabled, !ro);
    20622091    d->control->setTextInteractionFlags(flags);
     2092
    20632093}
    20642094
     
    26102640}
    26112641
    2612 
    26132642/*!
    26142643    \enum QTextEdit::KeyboardAction
Note: See TracChangeset for help on using the changeset viewer.