From f973bb1730e1138f9c745d142c1f2f5d9c53b456 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Tue, 31 Jan 2012 13:58:44 +1000 Subject: Fix compile failures. Remove uses of QLineControl, QTextControl and QBool and forward declared QGraphicsWidget. Change-Id: Ic5184a1d5aebfb1100ad0e24444b6773f4e617e8 Reviewed-by: Matthew Vogt --- .../graphicsitems/qdeclarativetextedit.cpp | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/declarative/graphicsitems/qdeclarativetextedit.cpp') diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index c23718b6..6ca1b738 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -56,8 +56,9 @@ #include #include #include +#include -#include +#include QT_BEGIN_NAMESPACE @@ -126,10 +127,10 @@ QString QDeclarativeTextEdit::text() const #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(); } /*! @@ -548,9 +549,12 @@ bool QDeclarativeTextEditPrivate::determineHorizontalAlignment() 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; @@ -1537,12 +1541,12 @@ void QDeclarativeTextEditPrivate::init() q->setFlag(QGraphicsItem::ItemHasNoContents, false); q->setFlag(QGraphicsItem::ItemAcceptsInputMethod); - control = new QTextControl(q); + control = new QWidgetTextControl(q); control->setIgnoreUnusedNavigationEvents(true); - control->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard | Qt::TextEditable); + 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(); @@ -1777,9 +1781,8 @@ void QDeclarativeTextEditPrivate::updateDefaultTextOption() 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 @@ -1811,11 +1814,10 @@ void QDeclarativeTextEditPrivate::updateDefaultTextOption() */ void QDeclarativeTextEdit::openSoftwareInputPanel() { - QEvent event(QEvent::RequestSoftwareInputPanel); if (qApp) { if (QGraphicsView * view = qobject_cast(qApp->focusWidget())) { if (view->scene() && view->scene() == scene()) { - QApplication::sendEvent(view, &event); + qApp->inputPanel()->show(); } } } @@ -1828,9 +1830,8 @@ void QDeclarativeTextEdit::openSoftwareInputPanel() 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 @@ -1862,11 +1863,10 @@ void QDeclarativeTextEdit::openSoftwareInputPanel() */ void QDeclarativeTextEdit::closeSoftwareInputPanel() { - QEvent event(QEvent::CloseSoftwareInputPanel); if (qApp) { if (QGraphicsView * view = qobject_cast(qApp->focusWidget())) { if (view->scene() && view->scene() == scene()) { - QApplication::sendEvent(view, &event); + qApp->inputPanel()->hide(); } } } -- cgit v1.2.3