summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
12 files changed, 77 insertions, 72 deletions
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;