/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QPainter>
#include <QtGui/QInputPanel>
-#include <private/qtextcontrol_p.h>
+#include <private/qwidgettextcontrol_p.h>
QT_BEGIN_NAMESPACE
#ifndef QT_NO_TEXTHTMLPARSER
if (d->richText)
- return d->document->toHtml();
+ return d->control->toHtml();
else
#endif
- return d->document->toPlainText();
+ return d->control->toPlainText();
}
/*!
if (hAlignImplicit && q->isComponentComplete()) {
bool alignToRight;
if (text.isEmpty()) {
- const QString preeditText = control->textCursor().block().layout()->preeditAreaText();
+ QTextCursor cursor = control->textCursor();
+ const QString preeditText = cursor.block().isValid()
+ ? control->textCursor().block().layout()->preeditAreaText()
+ : QString();
alignToRight = preeditText.isEmpty()
- ? QApplication::keyboardInputDirection() == Qt::RightToLeft
+ ? qApp->inputPanel()->inputDirection() == Qt::RightToLeft
: preeditText.isRightToLeft();
} else {
alignToRight = rightToLeftText;
q->setFlag(QGraphicsItem::ItemHasNoContents, false);
q->setFlag(QGraphicsItem::ItemAcceptsInputMethod);
- control = new QTextControl(q);
+ control = new QWidgetTextControl(q);
control->setIgnoreUnusedNavigationEvents(true);
control->setTextInteractionFlags(Qt::TextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard | Qt::TextEditable));
control->setDragEnabled(false);
- // QTextControl follows the default text color
+ // QWidgetTextControl follows the default text color
// defined by the platform, declarative text
// should be black by default
QPalette pal = control->palette();
d->cursor->setY(cursorRect.y());
}
-void QDeclarative1TextEditPrivate::updateSelection()
-{
- Q_Q(QDeclarative1TextEdit);
- QTextCursor cursor = control->textCursor();
- bool startChange = (lastSelectionStart != cursor.selectionStart());
- bool endChange = (lastSelectionEnd != cursor.selectionEnd());
- cursor.beginEditBlock();
- cursor.setPosition(lastSelectionStart, QTextCursor::MoveAnchor);
- cursor.setPosition(lastSelectionEnd, QTextCursor::KeepAnchor);
- cursor.endEditBlock();
- control->setTextCursor(cursor);
- if(startChange)
- q->selectionStartChanged();
- if(endChange)
- q->selectionEndChanged();
-}
-
void QDeclarative1TextEdit::updateSelectionMarkers()
{
Q_D(QDeclarative1TextEdit);
customizing when you want the input keyboard to be shown and hidden in
your application.
- By default the opening of input panels follows the platform style. On Symbian^1 and
- Symbian^3 -based devices the panels are opened by clicking TextEdit. On other platforms
- the panels are automatically opened when TextEdit element gains active focus. Input panels are
+ By default the opening of input panels follows the platform style.
+ The panels are automatically opened when TextEdit element gains active focus. Input panels are
always closed if no editor has active focus.
You can disable the automatic behavior by setting the property \c activeFocusOnPress to false
for customizing when you want the input keyboard to be shown and hidden in
your application.
- By default the opening of input panels follows the platform style. On Symbian^1 and
- Symbian^3 -based devices the panels are opened by clicking TextEdit. On other platforms
- the panels are automatically opened when TextEdit element gains active focus. Input panels are
+ By default the opening of input panels follows the platform style.
+ The panels are automatically opened when TextEdit element gains active focus. Input panels are
always closed if no editor has active focus.
You can disable the automatic behavior by setting the property \c activeFocusOnPress to false