summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2011-04-27 12:59:51 +0200
committeraxis <qt-info@nokia.com>2011-04-27 12:59:51 +0200
commita4a585d2ee907746682846ae6e8a48e19deef469 (patch)
tree71df078aa4493c66604f4f31eeb858c9eb3bc041
parent1c09b529e4aa12cc31b70d07899eac1882710e80 (diff)
parent896db169ea224deb96c59ce8af800d019de63f12 (diff)
Merge branch 'master' into qtquick2history/qtquick2
-rw-r--r--doc/src/platforms/platform-notes.qdoc32
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp17
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput_p_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextlayout.cpp15
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextlayout_p.h2
-rw-r--r--src/declarative/util/qdeclarativepixmapcache.cpp4
-rw-r--r--src/gui/image/qpixmapcache.cpp4
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp13
-rw-r--r--src/gui/painting/qpainter.cpp22
-rw-r--r--src/gui/text/qtextcontrol.cpp16
-rw-r--r--src/opengl/qwindowsurface_gl.cpp48
-rw-r--r--src/svg/qsvghandler.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp10
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_readonly.qml8
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_readonly.qml8
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp93
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/mouseselection_default.qml7
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/mouseselection_false.qml7
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/mouseselection_false_readonly.qml8
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/mouseselection_false_words.qml7
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/mouseselection_true_readonly.qml8
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/mouseselection_true_words.qml7
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp150
24 files changed, 398 insertions, 96 deletions
diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc
index 113ad86784..310ef06009 100644
--- a/doc/src/platforms/platform-notes.qdoc
+++ b/doc/src/platforms/platform-notes.qdoc
@@ -708,28 +708,8 @@
\section1 Supported Devices
- Qt is designed to work on any device which runs one of the following
- versions of Symbian:
-
- \table
- \header \o Symbian Version
- \row \o S60 3.1
- \row \o S60 3.2
- \row \o S60 5.0 (Symbian ^1)
- \endtable
-
- Qt has received \l{Tier 1 Platforms}{Tier 1} testing on the following phone models:
-
- \table
- \header \o Phone
- \row \o Nokia 5800
- \row \o Nokia E71
- \row \o Nokia E72
- \row \o Nokia N78
- \row \o Nokia N95
- \row \o Nokia N97
- \row \o Samsung i8910
- \endtable
+ See the list of supported devices at
+ http://wiki.forum.nokia.com/index.php/Nokia_Smart_Installer_for_Symbian#Supported_Devices
\section1 Supported Functionality
@@ -742,8 +722,6 @@
\o Planned for future release.
\row \o QtDBus
\o No current plans to support this feature.
- \row \o QtOpenGL ES
- \o Planned for future release.
\row \o Printing support
\o No current plans to support this feature.
\row \o Qt3Support
@@ -837,6 +815,12 @@
plugin. If the Helix plugin fails to load, the MMF plugin, if present on
the device, will be loaded instead.
+ \section1 QtOpenGL Support
+
+ Qt 4.7 introduces the QtOpenGL module to Symbian^3. QtOpenGL is supported on
+ devices which support OpenGL ES 2.0. Symbian platforms prior to Symbian^3
+ are not supported.
+
\section1 UI Performance in devices prior to Symbian^3
Qt uses the QPainter class to perform low-level painting on widgets and
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 778b8b91c1..aed849bd39 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -1525,6 +1525,8 @@ void QDeclarativePathView::itemsRemoved(int modelIndex, int count)
} else {
d->regenerate();
d->updateCurrent();
+ if (!d->flicking && !d->moving && d->haveHighlightRange && d->highlightRangeMode == QDeclarativePathView::StrictlyEnforceRange)
+ d->snapToCurrent();
}
if (changedOffset)
emit offsetChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index ee241d614e..9a917690f1 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -949,6 +949,8 @@ void QDeclarativeTextInput::setCursorDelegate(QDeclarativeComponent* c)
//note that the components are owned by something else
disconnect(d->control, SIGNAL(cursorPositionChanged(int,int)),
this, SLOT(moveCursor()));
+ disconnect(d->control, SIGNAL(updateMicroFocus()),
+ this, SLOT(moveCursor()));
delete d->cursorItem;
}else{
d->startCreatingCursor();
@@ -961,7 +963,9 @@ void QDeclarativeTextInputPrivate::startCreatingCursor()
{
Q_Q(QDeclarativeTextInput);
q->connect(control, SIGNAL(cursorPositionChanged(int,int)),
- q, SLOT(moveCursor()));
+ q, SLOT(moveCursor()), Qt::UniqueConnection);
+ q->connect(control, SIGNAL(updateMicroFocus()),
+ q, SLOT(moveCursor()), Qt::UniqueConnection);
if(cursorComponent->isReady()){
q->createCursor();
}else if(cursorComponent->isLoading()){
@@ -1164,9 +1168,10 @@ void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event)
}
if (d->selectByMouse) {
setKeepMouseGrab(false);
+ d->selectPressed = true;
d->pressPos = event->pos();
}
- bool mark = event->modifiers() & Qt::ShiftModifier;
+ bool mark = (event->modifiers() & Qt::ShiftModifier) && d->selectByMouse;
int cursor = d->xToPos(event->pos().x());
d->control->moveCursor(cursor, mark);
event->setAccepted(true);
@@ -1177,7 +1182,7 @@ void QDeclarativeTextInput::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Q_D(QDeclarativeTextInput);
if (d->sendMouseEventToInputContext(event, QEvent::MouseMove))
return;
- if (d->selectByMouse) {
+ if (d->selectPressed) {
if (qAbs(int(event->pos().x() - d->pressPos.x())) > QApplication::startDragDistance())
setKeepMouseGrab(true);
moveCursorSelection(d->xToPos(event->pos().x()), d->mouseSelectionMode);
@@ -1196,8 +1201,10 @@ void QDeclarativeTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Q_D(QDeclarativeTextInput);
if (d->sendMouseEventToInputContext(event, QEvent::MouseButtonRelease))
return;
- if (d->selectByMouse)
+ if (d->selectPressed) {
+ d->selectPressed = false;
setKeepMouseGrab(false);
+ }
if (!d->showInputPanelOnFocus) { // input panel on click
if (d->focusOnPress && !isReadOnly() && boundingRect().contains(event->pos())) {
if (QGraphicsView * view = qobject_cast<QGraphicsView*>(qApp->focusWidget())) {
@@ -1253,8 +1260,10 @@ bool QDeclarativeTextInputPrivate::sendMouseEventToInputContext(
bool QDeclarativeTextInput::sceneEvent(QEvent *event)
{
+ Q_D(QDeclarativeTextInput);
bool rv = QDeclarativeItem::sceneEvent(event);
if (event->type() == QEvent::UngrabMouse) {
+ d->selectPressed = false;
setKeepMouseGrab(false);
}
return rv;
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
index ed53e8f89e..f6f6bd8ca4 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
@@ -76,7 +76,8 @@ public:
mouseSelectionMode(QDeclarativeTextInput::SelectCharacters), inputMethodHints(Qt::ImhNone),
hscroll(0), oldScroll(0), oldValidity(false), focused(false), focusOnPress(true),
showInputPanelOnFocus(true), clickCausedFocus(false), cursorVisible(false),
- autoScroll(true), selectByMouse(false), canPaste(false), hAlignImplicit(true)
+ autoScroll(true), selectByMouse(false), canPaste(false), hAlignImplicit(true),
+ selectPressed(false)
{
#ifdef Q_OS_SYMBIAN
if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) {
@@ -142,6 +143,7 @@ public:
bool selectByMouse:1;
bool canPaste:1;
bool hAlignImplicit:1;
+ bool selectPressed:1;
static inline QDeclarativeTextInputPrivate *get(QDeclarativeTextInput *t) {
return t->d_func();
diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
index 987aa237c7..1e6db3f1e7 100644
--- a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
@@ -296,7 +296,7 @@ void QDeclarativeTextLayout::clearLayout()
QTextLayout::clearLayout();
}
-void QDeclarativeTextLayout::prepare()
+void QDeclarativeTextLayout::prepare(QPainter *painter)
{
if (!d || !d->cached) {
@@ -305,6 +305,7 @@ void QDeclarativeTextLayout::prepare()
InertTextPainter *itp = inertTextPainter();
itp->device.begin(d);
+ itp->painter.setPen(painter->pen());
QTextLayout::draw(&itp->painter, QPointF(0, 0));
glyph_t *glyphPool = d->glyphs.data();
@@ -323,6 +324,12 @@ void QDeclarativeTextLayout::prepare()
}
}
+// Defined in qpainter.cpp
+extern Q_GUI_EXPORT void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t *glyphArray,
+ const QFixedPoint *positions, int glyphCount,
+ QFontEngine *fontEngine, const QFont &font,
+ const QTextCharFormat &charFormat);
+
void QDeclarativeTextLayout::draw(QPainter *painter, const QPointF &p)
{
QPainterPrivate *priv = QPainterPrivate::get(painter);
@@ -337,7 +344,7 @@ void QDeclarativeTextLayout::draw(QPainter *painter, const QPointF &p)
return;
}
- prepare();
+ prepare(painter);
int itemCount = d->items.count();
@@ -368,6 +375,10 @@ void QDeclarativeTextLayout::draw(QPainter *painter, const QPointF &p)
currentColor = item.color;
}
priv->extended->drawStaticTextItem(&item);
+
+ qt_draw_decoration_for_glyphs(painter, item.glyphs, item.glyphPositions,
+ item.numGlyphs, item.fontEngine(), painter->font(),
+ QTextCharFormat());
}
if (currentColor != oldPen.color())
painter->setPen(oldPen);
diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
index 2c9264ed70..23b22a665a 100644
--- a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
@@ -61,7 +61,7 @@ public:
void beginLayout();
void clearLayout();
- void prepare();
+ void prepare(QPainter *);
void draw(QPainter *, const QPointF & = QPointF());
private:
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp
index 0cddaa6a71..dcce7db813 100644
--- a/src/declarative/util/qdeclarativepixmapcache.cpp
+++ b/src/declarative/util/qdeclarativepixmapcache.cpp
@@ -76,9 +76,7 @@ QT_BEGIN_NAMESPACE
// The cache limit describes the maximum "junk" in the cache.
// These are the same defaults as QPixmapCache
-#if defined(Q_OS_SYMBIAN)
-static int cache_limit = 1024 * 1024; // 1048 KB cache limit for symbian
-#elif defined(Q_WS_QWS) || defined(Q_WS_WINCE)
+#if defined(Q_WS_QWS) || defined(Q_WS_WINCE)
static int cache_limit = 2048 * 1024; // 2048 KB cache limit for embedded
#else
static int cache_limit = 128 * 1024; // 10 MB cache limit for desktop
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 41fc6e94b4..ae772d8bc3 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -91,9 +91,7 @@ QT_BEGIN_NAMESPACE
\sa QCache, QPixmap
*/
-#if defined(Q_OS_SYMBIAN)
-static int cache_limit = 1024; // 1048 KB cache limit for symbian
-#elif defined(Q_WS_QWS) || defined(Q_WS_WINCE)
+#if defined(Q_WS_QWS) || defined(Q_WS_WINCE)
static int cache_limit = 2048; // 2048 KB cache limit for embedded
#else
static int cache_limit = 10240; // 10 MB cache limit for desktop
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 92f83844d7..06dc25c708 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -255,9 +255,13 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
// fall through intended
case QEvent::KeyRelease:
const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event);
+ //If proxy exists, always use hints from proxy.
+ QWidget *proxy = focusWidget()->focusProxy();
+ Qt::InputMethodHints currentHints = proxy ? proxy->inputMethodHints() : focusWidget()->inputMethodHints();
+
switch (keyEvent->key()) {
case Qt::Key_F20:
- Q_ASSERT(m_lastImHints == focusWidget()->inputMethodHints());
+ Q_ASSERT(m_lastImHints == currentHints);
if (m_lastImHints & Qt::ImhHiddenText) {
// Special case in Symbian. On editors with secret text, F20 is for some reason
// considered to be a backspace.
@@ -287,7 +291,7 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
}
if (keyEvent->type() == QEvent::KeyPress
- && focusWidget()->inputMethodHints() & Qt::ImhHiddenText
+ && currentHints & Qt::ImhHiddenText
&& !keyEvent->text().isEmpty()) {
// Send some temporary preedit text in order to make text visible for a moment.
m_preeditString = keyEvent->text();
@@ -588,9 +592,10 @@ void QCoeFepInputContext::updateHints(bool mustUpdateInputCapabilities)
{
QWidget *w = focusWidget();
if (w) {
- Qt::InputMethodHints hints = w->inputMethodHints();
+ QWidget *proxy = w->focusProxy();
+ Qt::InputMethodHints hints = proxy ? proxy->inputMethodHints() : w->inputMethodHints();
- // Since splitview support works like an input method hint, yet it is private flag,
+ // Since splitview support works like an input method hint, yet it is private flag,
// we need to update its state separately.
if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) {
TInt currentFlags = m_fepState->Flags();
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index bef6b7df91..9fafba5f4f 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -98,10 +98,10 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
QTextItem::RenderFlags flags, qreal width,
const QTextCharFormat &charFormat);
// Helper function to calculate left most position, width and flags for decoration drawing
-static void drawDecorationForGlyphs(QPainter *painter, const glyph_t *glyphArray,
- const QFixedPoint *positions, int glyphCount,
- QFontEngine *fontEngine, const QFont &font,
- const QTextCharFormat &charFormat);
+Q_GUI_EXPORT void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t *glyphArray,
+ const QFixedPoint *positions, int glyphCount,
+ QFontEngine *fontEngine, const QFont &font,
+ const QTextCharFormat &charFormat);
static inline QGradient::CoordinateMode coordinateMode(const QBrush &brush)
{
@@ -6060,9 +6060,9 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
}
d->extended->drawStaticTextItem(item);
- drawDecorationForGlyphs(this, item->glyphs, item->glyphPositions,
- item->numGlyphs, item->fontEngine(), staticText_d->font,
- QTextCharFormat());
+ qt_draw_decoration_for_glyphs(this, item->glyphs, item->glyphPositions,
+ item->numGlyphs, item->fontEngine(), staticText_d->font,
+ QTextCharFormat());
}
if (currentColor != oldPen.color())
setPen(oldPen);
@@ -6507,10 +6507,10 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
painter->setBrush(oldBrush);
}
-static void drawDecorationForGlyphs(QPainter *painter, const glyph_t *glyphArray,
- const QFixedPoint *positions, int glyphCount,
- QFontEngine *fontEngine, const QFont &font,
- const QTextCharFormat &charFormat)
+Q_GUI_EXPORT void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t *glyphArray,
+ const QFixedPoint *positions, int glyphCount,
+ QFontEngine *fontEngine, const QFont &font,
+ const QTextCharFormat &charFormat)
{
if (!(font.underline() || font.strikeOut() || font.overline()))
return;
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index faf4e77a1c..43967307bc 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1519,7 +1519,7 @@ void QTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton button, con
const QTextCursor oldSelection = cursor;
const int oldCursorPos = cursor.position();
- mousePressed = true;
+ mousePressed = (interactionFlags & Qt::TextSelectableByMouse);
#ifndef QT_NO_DRAGANDDROP
mightStartDrag = false;
#endif
@@ -1608,13 +1608,11 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons
if (!(buttons & Qt::LeftButton))
return;
- const bool selectable = interactionFlags & Qt::TextSelectableByMouse;
const bool editable = interactionFlags & Qt::TextEditable;
- if (!selectable && !editable)
- return;
-
if (!(mousePressed
+ || editable
+ || mightStartDrag
|| selectedWordOnDoubleClick.hasSelection()
|| selectedBlockOnTrippleClick.hasSelection()))
return;
@@ -1628,7 +1626,7 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons
return;
}
- if (!selectable)
+ if (!mousePressed)
return;
const qreal mouseX = qreal(mousePos.x());
@@ -1696,10 +1694,8 @@ void QTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton button, c
if (mousePressed) {
mousePressed = false;
#ifndef QT_NO_CLIPBOARD
- if (interactionFlags & Qt::TextSelectableByMouse) {
- setClipboardSelection();
- selectionChanged(true);
- }
+ setClipboardSelection();
+ selectionChanged(true);
} else if (button == Qt::MidButton
&& (interactionFlags & Qt::TextEditable)
&& QApplication::clipboard()->supportsSelection()) {
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 70c1fdecd4..56e2c3b517 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -717,7 +717,6 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
} else {
glFlush();
}
-
return;
}
@@ -874,8 +873,22 @@ void QGLWindowSurface::updateGeometry() {
bool hijack(true);
QWidgetPrivate *wd = window()->d_func();
- if (wd->extraData() && wd->extraData()->glContext)
- hijack = false; // we already have gl context for widget
+ if (wd->extraData() && wd->extraData()->glContext) {
+#ifdef Q_OS_SYMBIAN // Symbian needs to recreate the context when native window size changes
+ if (d_ptr->size != geometry().size()) {
+ if (window() != qt_gl_share_widget())
+ --(_qt_gl_share_widget()->widgetRefCount);
+
+ delete wd->extraData()->glContext;
+ wd->extraData()->glContext = 0;
+ d_ptr->ctx = 0;
+ }
+ else
+#endif
+ {
+ hijack = false; // we already have gl context for widget
+ }
+ }
if (hijack)
hijackWindow(window());
@@ -896,35 +909,6 @@ void QGLWindowSurface::updateGeometry() {
d_ptr->size = surfSize;
-#ifdef Q_OS_SYMBIAN
- if (!hijack) { // Symbian needs to recreate EGL surface when native window size changes
- if (ctx->d_func()->eglSurface != EGL_NO_SURFACE) {
- eglDestroySurface(ctx->d_func()->eglContext->display(),
- ctx->d_func()->eglSurface);
- }
-
- ctx->d_func()->eglSurface = QEgl::createSurface(ctx->device(),
- ctx->d_func()->eglContext->config());
-
- eglGetError(); // Clear error state.
- if (!d_ptr->destructive_swap_buffers) {
- eglSurfaceAttrib(ctx->d_func()->eglContext->display(),
- ctx->d_func()->eglSurface,
- EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
-
- if (eglGetError() != EGL_SUCCESS)
- qWarning("QGLWindowSurface: could not enable preserved swap behaviour");
- } else {
- eglSurfaceAttrib(ctx->d_func()->eglContext->display(),
- ctx->d_func()->eglSurface,
- EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED);
-
- if (eglGetError() != EGL_SUCCESS)
- qWarning("QGLWindowSurface: could not enable destroyed swap behaviour");
- }
- }
-#endif
-
if (d_ptr->ctx) {
#ifndef QT_OPENGL_ES_2
if (d_ptr->destructive_swap_buffers)
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 96988607fb..3fbc08cc4b 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -584,7 +584,7 @@ static qreal toDouble(const QChar *&str)
++str;
}
bool exponent = false;
- if (*str == QLatin1Char('e') && pos < maxLen) {
+ if ((*str == QLatin1Char('e') || *str == QLatin1Char('E')) && pos < maxLen) {
exponent = true;
temp[pos++] = 'e';
++str;
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
index 01a6786cab..fa6093f311 100644
--- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
+++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
@@ -458,6 +458,16 @@ void tst_QDeclarativePathView::dataModel()
model.removeItem(model.count()-1);
QCOMPARE(pathview->currentIndex(), model.count()-1);
+ // QTBUG-18825
+ // Confirm that the target offset is adjusted when removing items
+ pathview->setCurrentIndex(model.count()-1);
+ QTRY_COMPARE(pathview->offset(), 1.);
+ pathview->setCurrentIndex(model.count()-5);
+ model.removeItem(model.count()-1);
+ model.removeItem(model.count()-1);
+ model.removeItem(model.count()-1);
+ QTRY_COMPARE(pathview->offset(), 2.);
+
delete canvas;
delete testObject;
}
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_readonly.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_readonly.qml
new file mode 100644
index 0000000000..4aea61160f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_readonly.qml
@@ -0,0 +1,8 @@
+import QtQuick 1.0
+
+TextEdit {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: false
+ readOnly: true
+}
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_readonly.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_readonly.qml
new file mode 100644
index 0000000000..959e683721
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_readonly.qml
@@ -0,0 +1,8 @@
+import QtQuick 1.0
+
+TextEdit {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: true
+ readOnly: true
+}
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 26a6fd8dae..2fad88d339 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -119,6 +119,10 @@ private slots:
void moveCursorSelectionSequence();
void mouseSelection_data();
void mouseSelection();
+ void deferEnableSelectByMouse_data();
+ void deferEnableSelectByMouse();
+ void deferDisableSelectByMouse_data();
+ void deferDisableSelectByMouse();
void mouseSelectionMode_data();
void mouseSelectionMode();
void dragMouseSelection();
@@ -1360,6 +1364,86 @@ void tst_qdeclarativetextedit::mouseSelection()
delete canvas;
}
+void tst_qdeclarativetextedit::deferEnableSelectByMouse_data()
+{
+ QTest::addColumn<QString>("qmlfile");
+
+ QTest::newRow("writable") << SRCDIR "/data/mouseselection_false.qml";
+ QTest::newRow("read only") << SRCDIR "/data/mouseselection_false_readonly.qml";
+}
+
+void tst_qdeclarativetextedit::deferEnableSelectByMouse()
+{
+ // Verify text isn't selected if selectByMouse is enabled after the mouse button has been pressed.
+ QFETCH(QString, qmlfile);
+
+ QDeclarativeView *canvas = createView(qmlfile);
+
+ canvas->show();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+
+ QVERIFY(canvas->rootObject() != 0);
+ QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit *>(canvas->rootObject());
+ QVERIFY(textEditObject != 0);
+
+ // press-and-drag-and-release from x1 to x2
+ int x1 = 10;
+ int x2 = 70;
+ int y = textEditObject->height()/2;
+
+ QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y)));
+ textEditObject->setSelectByMouse(true);
+ //QTest::mouseMove(canvas->viewport(), canvas->mapFromScene(QPoint(x2,y))); // doesn't work
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y)));
+ QVERIFY(textEditObject->selectedText().isEmpty());
+
+ delete canvas;
+}
+
+void tst_qdeclarativetextedit::deferDisableSelectByMouse_data()
+{
+ QTest::addColumn<QString>("qmlfile");
+
+ QTest::newRow("writable") << SRCDIR "/data/mouseselection_true.qml";
+ QTest::newRow("read only") << SRCDIR "/data/mouseselection_true_readonly.qml";
+}
+
+void tst_qdeclarativetextedit::deferDisableSelectByMouse()
+{
+ // Verify text isn't selected if selectByMouse is enabled after the mouse button has been pressed.
+ QFETCH(QString, qmlfile);
+
+ QDeclarativeView *canvas = createView(qmlfile);
+
+ canvas->show();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+
+ QVERIFY(canvas->rootObject() != 0);
+ QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit *>(canvas->rootObject());
+ QVERIFY(textEditObject != 0);
+
+ // press-and-drag-and-release from x1 to x2
+ int x1 = 10;
+ int x2 = 70;
+ int y = textEditObject->height()/2;
+
+ QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y)));
+ textEditObject->setSelectByMouse(false);
+ //QTest::mouseMove(canvas->viewport(), canvas->mapFromScene(QPoint(x2,y))); // doesn't work
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y)));
+ QVERIFY(textEditObject->selectedText().length() > 3);
+
+ delete canvas;
+}
+
void tst_qdeclarativetextedit::dragMouseSelection()
{
QString qmlfile = SRCDIR "/data/mouseselection_true.qml";
@@ -1546,6 +1630,15 @@ void tst_qdeclarativetextedit::cursorDelegate()
QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x()));
QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y()));
}
+ const QString preedit = "preedit";
+ for (int i = 0; i <= preedit.length(); i++) {
+ QInputMethodEvent event(preedit, QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, i, 1, QVariant()));
+ QApplication::sendEvent(view, &event);
+
+ QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x()));
+ QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y()));
+ }
textEditObject->setCursorPosition(0);
QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x()));
QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y()));
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_default.qml b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_default.qml
new file mode 100644
index 0000000000..eea83ed035
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_default.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+
+TextInput {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: false
+}
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_false.qml b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_false.qml
new file mode 100644
index 0000000000..eea83ed035
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_false.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+
+TextInput {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: false
+}
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_false_readonly.qml b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_false_readonly.qml
new file mode 100644
index 0000000000..36a95634e3
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_false_readonly.qml
@@ -0,0 +1,8 @@
+import QtQuick 1.0
+
+TextInput {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: false
+ readOnly: true
+}
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_false_words.qml b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_false_words.qml
new file mode 100644
index 0000000000..eea83ed035
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_false_words.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+
+TextInput {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: false
+}
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_true_readonly.qml b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_true_readonly.qml
new file mode 100644
index 0000000000..678a89aa8b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_true_readonly.qml
@@ -0,0 +1,8 @@
+import QtQuick 1.0
+
+TextInput {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: true
+ readOnly: true
+}
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_true_words.qml b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_true_words.qml
new file mode 100644
index 0000000000..8115ba05e3
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_true_words.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+
+TextInput {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: true
+}
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index 531dee1802..821c4ca0f7 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -95,6 +95,12 @@ private slots:
void moveCursorSelection();
void moveCursorSelectionSequence_data();
void moveCursorSelectionSequence();
+ void mouseSelection_data();
+ void mouseSelection();
+ void deferEnableSelectByMouse_data();
+ void deferEnableSelectByMouse();
+ void deferDisableSelectByMouse_data();
+ void deferDisableSelectByMouse();
void dragMouseSelection();
void mouseSelectionMode_data();
void mouseSelectionMode();
@@ -915,6 +921,141 @@ void tst_qdeclarativetextinput::moveCursorSelectionSequence()
delete textinputObject;
}
+void tst_qdeclarativetextinput::mouseSelection_data()
+{
+ QTest::addColumn<QString>("qmlfile");
+ QTest::addColumn<bool>("expectSelection");
+
+ // import installed
+ QTest::newRow("on") << SRCDIR "/data/mouseselection_true.qml" << true;
+ QTest::newRow("off") << SRCDIR "/data/mouseselection_false.qml" << false;
+ QTest::newRow("default") << SRCDIR "/data/mouseselection_default.qml" << false;
+ QTest::newRow("on word selection") << SRCDIR "/data/mouseselection_true_words.qml" << true;
+ QTest::newRow("off word selection") << SRCDIR "/data/mouseselection_false_words.qml" << false;
+ QTest::newRow("on read only") << SRCDIR "/data/mouseselection_true_readonly.qml" << true;
+ QTest::newRow("off read only") << SRCDIR "/data/mouseselection_false_readonly.qml" << false;
+}
+
+void tst_qdeclarativetextinput::mouseSelection()
+{
+ QFETCH(QString, qmlfile);
+ QFETCH(bool, expectSelection);
+
+ QDeclarativeView *canvas = createView(qmlfile);
+
+ canvas->show();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+
+ QVERIFY(canvas->rootObject() != 0);
+ QDeclarativeTextInput *textInputObject = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject());
+ QVERIFY(textInputObject != 0);
+
+ // press-and-drag-and-release from x1 to x2
+ int x1 = 10;
+ int x2 = 70;
+ int y = textInputObject->height()/2;
+ QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y)));
+ //QTest::mouseMove(canvas->viewport(), canvas->mapFromScene(QPoint(x2,y))); // doesn't work
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y)));
+ QString str = textInputObject->selectedText();
+ if (expectSelection)
+ QVERIFY(str.length() > 3); // don't reallly care *what* was selected (and it's too sensitive to platform)
+ else
+ QVERIFY(str.isEmpty());
+
+ // Clicking and shift to clicking between the same points should select the same text.
+ textInputObject->setCursorPosition(0);
+ QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::NoModifier, canvas->mapFromScene(QPoint(x1,y)));
+ QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::ShiftModifier, canvas->mapFromScene(QPoint(x2,y)));
+ QCOMPARE(textInputObject->selectedText(), str);
+
+ delete canvas;
+}
+
+void tst_qdeclarativetextinput::deferEnableSelectByMouse_data()
+{
+ QTest::addColumn<QString>("qmlfile");
+
+ QTest::newRow("writable") << SRCDIR "/data/mouseselection_false.qml";
+ QTest::newRow("read only") << SRCDIR "/data/mouseselection_false_readonly.qml";
+}
+
+void tst_qdeclarativetextinput::deferEnableSelectByMouse()
+{
+ // Verify text isn't selected if selectByMouse is enabled after the mouse button has been pressed.
+ QFETCH(QString, qmlfile);
+
+ QDeclarativeView *canvas = createView(qmlfile);
+
+ canvas->show();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+
+ QVERIFY(canvas->rootObject() != 0);
+ QDeclarativeTextInput *textInputObject = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject());
+ QVERIFY(textInputObject != 0);
+
+ // press-and-drag-and-release from x1 to x2
+ int x1 = 10;
+ int x2 = 70;
+ int y = textInputObject->height()/2;
+
+ QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y)));
+ textInputObject->setSelectByMouse(true);
+ //QTest::mouseMove(canvas->viewport(), canvas->mapFromScene(QPoint(x2,y))); // doesn't work
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y)));
+ QVERIFY(textInputObject->selectedText().isEmpty());
+
+ delete canvas;
+}
+
+void tst_qdeclarativetextinput::deferDisableSelectByMouse_data()
+{
+ QTest::addColumn<QString>("qmlfile");
+
+ QTest::newRow("writable") << SRCDIR "/data/mouseselection_true.qml";
+ QTest::newRow("read only") << SRCDIR "/data/mouseselection_true_readonly.qml";
+}
+
+void tst_qdeclarativetextinput::deferDisableSelectByMouse()
+{
+ // Verify text isn't selected if selectByMouse is enabled after the mouse button has been pressed.
+ QFETCH(QString, qmlfile);
+
+ QDeclarativeView *canvas = createView(qmlfile);
+
+ canvas->show();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+
+ QVERIFY(canvas->rootObject() != 0);
+ QDeclarativeTextInput *textInputObject = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject());
+ QVERIFY(textInputObject != 0);
+
+ // press-and-drag-and-release from x1 to x2
+ int x1 = 10;
+ int x2 = 70;
+ int y = textInputObject->height()/2;
+
+ QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y)));
+ textInputObject->setSelectByMouse(false);
+ //QTest::mouseMove(canvas->viewport(), canvas->mapFromScene(QPoint(x2,y))); // doesn't work
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y)));
+ QVERIFY(textInputObject->selectedText().length() > 3);
+
+ delete canvas;
+}
+
void tst_qdeclarativetextinput::dragMouseSelection()
{
QString qmlfile = SRCDIR "/data/mouseselection_true.qml";
@@ -1651,6 +1792,15 @@ void tst_qdeclarativetextinput::cursorDelegate()
QCOMPARE(textInputObject->cursorRectangle().x(), qRound(delegateObject->x()));
QCOMPARE(textInputObject->cursorRectangle().y(), qRound(delegateObject->y()));
}
+ const QString preedit = "preedit";
+ for (int i = 0; i <= preedit.length(); i++) {
+ QInputMethodEvent event(preedit, QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, i, 1, QVariant()));
+ QApplication::sendEvent(view, &event);
+
+ QCOMPARE(textInputObject->cursorRectangle().x(), qRound(delegateObject->x()));
+ QCOMPARE(textInputObject->cursorRectangle().y(), qRound(delegateObject->y()));
+ }
textInputObject->setCursorPosition(0);
QCOMPARE(textInputObject->cursorRectangle().x(), qRound(delegateObject->x()));
QCOMPARE(textInputObject->cursorRectangle().y(), qRound(delegateObject->y()));