summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-12-02 19:27:48 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-12-02 19:27:48 (GMT)
commit204fc5ed9642a3754dfefe7d4b1a5374615726a4 (patch)
tree65465f39338fb4d00c1c86be65edc372ab990795 /src/gui
parent2eb96bf5b68cbdcc1ebd2616b0b9e5f0f77eb257 (diff)
parentf29f1bb287c6b39bd1270802d1579f1c1d53f905 (diff)
downloadQt-204fc5ed9642a3754dfefe7d4b1a5374615726a4.zip
Qt-204fc5ed9642a3754dfefe7d4b1a5374615726a4.tar.gz
Qt-204fc5ed9642a3754dfefe7d4b1a5374615726a4.tar.bz2
Merge branch '4.6'
Conflicts: src/corelib/global/qglobal.h src/gui/dialogs/qfiledialog_win.cpp src/plugins/qpluginbase.pri src/qbase.pri tests/auto/selftests/expected_cmptest.txt tests/auto/selftests/expected_crashes_3.txt tests/auto/selftests/expected_longstring.txt tests/auto/selftests/expected_maxwarnings.txt tests/auto/selftests/expected_skip.txt tools/assistant/tools/assistant/doc/assistant.qdocconf tools/qdoc3/test/assistant.qdocconf tools/qdoc3/test/designer.qdocconf tools/qdoc3/test/linguist.qdocconf tools/qdoc3/test/qmake.qdocconf tools/qdoc3/test/qt-build-docs.qdocconf tools/qdoc3/test/qt.qdocconf
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qfiledialog_win.cpp4
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm5
-rw-r--r--src/gui/egl/qegl.cpp12
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout.cpp23
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp207
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h34
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp9
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h6
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp5
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks.cpp28
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks_p.h3
-rw-r--r--src/gui/image/qpixmap.cpp4
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp8
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp6
-rw-r--r--src/gui/kernel/qapplication_s60.cpp98
-rw-r--r--src/gui/kernel/qkeysequence.cpp6
-rw-r--r--src/gui/kernel/qwidget.cpp40
-rw-r--r--src/gui/kernel/qwidget_mac.mm2
-rw-r--r--src/gui/kernel/qwidget_p.h42
-rw-r--r--src/gui/kernel/qwidget_s60.cpp3
-rw-r--r--src/gui/painting/qbackingstore.cpp2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp3
-rw-r--r--src/gui/painting/qpaintengineex.cpp16
-rw-r--r--src/gui/painting/qpainter.cpp92
-rw-r--r--src/gui/painting/qvectorpath_p.h13
-rw-r--r--src/gui/styles/qcommonstyle.cpp2
-rw-r--r--src/gui/styles/qmacstyle_mac.mm8
-rw-r--r--src/gui/styles/qs60style.cpp25
-rw-r--r--src/gui/styles/qs60style_p.h11
-rw-r--r--src/gui/styles/qs60style_s60.cpp2
-rw-r--r--src/gui/styles/qwindowsstyle.cpp10
-rw-r--r--src/gui/text/qfontengine.cpp2
-rw-r--r--src/gui/text/qfontengine_win.cpp2
-rw-r--r--src/gui/text/qfontengine_win_p.h2
-rw-r--r--src/gui/text/qtextodfwriter.cpp13
-rw-r--r--src/gui/widgets/qdockarealayout.cpp7
-rw-r--r--src/gui/widgets/qfontcombobox.cpp5
-rw-r--r--src/gui/widgets/qlinecontrol.cpp8
-rw-r--r--src/gui/widgets/qlineedit.cpp4
-rw-r--r--src/gui/widgets/qmainwindow.cpp1
-rw-r--r--src/gui/widgets/qmenu.cpp12
-rw-r--r--src/gui/widgets/qplaintextedit.cpp3
-rw-r--r--src/gui/widgets/qspinbox.cpp100
-rw-r--r--src/gui/widgets/qtoolbararealayout.cpp7
44 files changed, 403 insertions, 492 deletions
diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp
index 73ca94c..c74f622 100644
--- a/src/gui/dialogs/qfiledialog_win.cpp
+++ b/src/gui/dialogs/qfiledialog_win.cpp
@@ -526,7 +526,7 @@ static QStringList qt_win_CID_get_open_file_names(const QFileDialogArgs &args,
modal_widget.setParent(args.parent, Qt::Window);
QApplicationPrivate::enterModal(&modal_widget);
// Multiple selection is allowed only in IFileOpenDialog.
- IFileOpenDialog *pfd;
+ IFileOpenDialog *pfd = 0;
HRESULT hr = CoCreateInstance(QT_CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, QT_IID_IFileOpenDialog,
reinterpret_cast<void**>(&pfd));
@@ -597,6 +597,8 @@ static QStringList qt_win_CID_get_open_file_names(const QFileDialogArgs &args,
}
}
}
+ if (pfd)
+ pfd->Release();
return result;
}
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index 5b0983b..0c467cd 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -625,10 +625,11 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font)
}
NSFontManager *mgr = [NSFontManager sharedFontManager];
- nsFont = [mgr fontWithFamily:qt_mac_QStringToNSString(font.family())
+ QFontInfo fontInfo(font);
+ nsFont = [mgr fontWithFamily:qt_mac_QStringToNSString(fontInfo.family())
traits:mask
weight:weight
- size:QFontInfo(font).pointSize()];
+ size:fontInfo.pointSize()];
}
[mgr setSelectedFont:nsFont isMultiple:NO];
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index c0e4890..cf28dc4 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -236,6 +236,18 @@ bool QEglContext::makeCurrent(EGLSurface surface)
currentSurface = surface;
setCurrentContext(apiType, this);
+ // Force the right API to be bound before making the context current.
+ // The EGL implementation should be able to figure this out from ctx,
+ // but some systems require the API to be explicitly set anyway.
+#ifdef EGL_OPENGL_ES_API
+ if (apiType == QEgl::OpenGL)
+ eglBindAPI(EGL_OPENGL_ES_API);
+#endif
+#ifdef EGL_OPENVG_API
+ if (apiType == QEgl::OpenVG)
+ eglBindAPI(EGL_OPENVG_API);
+#endif
+
bool ok = eglMakeCurrent(dpy, surface, surface, ctx);
if (!ok)
qWarning() << "QEglContext::makeCurrent():" << errorString(eglGetError());
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
index 7e5929e..686096c 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
@@ -370,12 +370,6 @@ void QGraphicsAnchorLayout::setHorizontalSpacing(qreal spacing)
{
Q_D(QGraphicsAnchorLayout);
- // ### We don't support negative spacing yet
- if (spacing < 0) {
- spacing = 0;
- qWarning() << "QGraphicsAnchorLayout does not support negative spacing.";
- }
-
d->spacings[0] = spacing;
invalidate();
}
@@ -389,12 +383,6 @@ void QGraphicsAnchorLayout::setVerticalSpacing(qreal spacing)
{
Q_D(QGraphicsAnchorLayout);
- // ### We don't support negative spacing yet
- if (spacing < 0) {
- spacing = 0;
- qWarning() << "QGraphicsAnchorLayout does not support negative spacing.";
- }
-
d->spacings[1] = spacing;
invalidate();
}
@@ -405,7 +393,8 @@ void QGraphicsAnchorLayout::setVerticalSpacing(qreal spacing)
If an item is anchored with no spacing associated with the anchor, it will use the default
spacing.
- Currently QGraphicsAnchorLayout does not support negative default spacings.
+ QGraphicsAnchorLayout does not support negative spacings. Setting a negative value will unset the
+ previous spacing and make the layout use the spacing provided by the current widget style.
\sa setHorizontalSpacing(), setVerticalSpacing()
*/
@@ -413,14 +402,6 @@ void QGraphicsAnchorLayout::setSpacing(qreal spacing)
{
Q_D(QGraphicsAnchorLayout);
- // ### Currently we do not support negative anchors inside the graph.
- // To avoid those being created by a negative spacing, we must
- // make this test.
- if (spacing < 0) {
- spacing = 0;
- qWarning() << "QGraphicsAnchorLayout does not support negative spacing.";
- }
-
d->spacings[0] = d->spacings[1] = spacing;
invalidate();
}
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 94a37a0..bb45e7e 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -755,7 +755,6 @@ void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag ch
case QGraphicsItem::ItemClipsChildrenToShape:
flag = AncestorClipsChildren;
enabled = flags & QGraphicsItem::ItemClipsChildrenToShape;
- invalidateCachedClipPathRecursively(/*childrenOnly=*/true);
break;
case QGraphicsItem::ItemIgnoresTransformations:
flag = AncestorIgnoresTransformations;
@@ -1104,9 +1103,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
parent->itemChange(QGraphicsItem::ItemChildAddedChange, thisPointerVariant);
if (scene) {
if (!implicitUpdate)
- scene->d_func()->markDirty(q_ptr, QRect(),
- /*invalidateChildren=*/false,
- /*maybeDirtyClipPath=*/true);
+ scene->d_func()->markDirty(q_ptr);
// Re-enable scene pos notifications for new ancestors
if (scenePosDescendants || (flags & QGraphicsItem::ItemSendsScenePositionChanges))
@@ -1147,11 +1144,8 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
setEnabledHelper(true, /* explicit = */ false);
// If the item is being deleted, the whole scene will be updated.
- if (scene) {
- scene->d_func()->markDirty(q_ptr, QRect(),
- /*invalidateChildren=*/false,
- /*maybeDirtyClipPath=*/true);
- }
+ if (scene)
+ scene->d_func()->markDirty(q_ptr);
}
}
@@ -1732,9 +1726,6 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags)
d_ptr->updateAncestorFlag(ItemClipsChildrenToShape);
}
- if ((flags & ItemClipsToShape) != (oldFlags & ItemClipsToShape))
- d_ptr->invalidateCachedClipPath();
-
if ((flags & ItemIgnoresTransformations) != (oldFlags & ItemIgnoresTransformations)) {
// Item children clipping changes. Propagate the ancestor flag to
// all children.
@@ -1777,9 +1768,7 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags)
else
d_ptr->scene->d_func()->unregisterScenePosItem(this);
}
- d_ptr->scene->d_func()->markDirty(this, QRectF(),
- /*invalidateChildren=*/true,
- /*maybeDirtyClipPath*/true);
+ d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true);
}
// Notify change.
@@ -2127,12 +2116,8 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
QGraphicsItemCache *c = (QGraphicsItemCache *)qVariantValue<void *>(extra(ExtraCacheData));
if (c)
c->purge();
- if (scene) {
- scene->d_func()->markDirty(q_ptr, QRectF(),
- /*invalidateChildren=*/false,
- /*maybeDirtyClipPath=*/false,
- /*force=*/true);
- }
+ if (scene)
+ scene->d_func()->markDirty(q_ptr, QRectF(), /*invalidateChildren=*/false, /*force=*/true);
}
// Certain properties are dropped as an item becomes invisible.
@@ -2542,7 +2527,6 @@ void QGraphicsItem::setOpacity(qreal opacity)
#endif //QT_NO_GRAPHICSEFFECT
d_ptr->scene->d_func()->markDirty(this, QRectF(),
/*invalidateChildren=*/true,
- /*maybeDirtyClipPath=*/false,
/*force=*/false,
/*ignoreOpacity=*/true);
}
@@ -2590,8 +2574,11 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect)
d_ptr->graphicsEffect = 0;
if (oldEffectPrivate) {
oldEffectPrivate->setGraphicsEffectSource(0); // deletes the current source.
- if (d_ptr->scene) // Update the views directly.
- d_ptr->scene->d_func()->markDirty(this, QRectF(), false, false, false, false, true);
+ if (d_ptr->scene) { // Update the views directly.
+ d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/false,
+ /*force=*/false, /*ignoreOpacity=*/false,
+ /*removeItemFromScene=*/true);
+ }
}
} else {
// Set new effect.
@@ -3399,7 +3386,6 @@ void QGraphicsItemPrivate::setPosHelper(const QPointF &pos)
{
Q_Q(QGraphicsItem);
inSetPosHelper = 1;
- updateCachedClipPathFromSetPosHelper(pos);
if (scene)
q->prepareGeometryChange();
QPointF oldPos = this->pos;
@@ -4535,22 +4521,12 @@ bool QGraphicsItem::isClipped() const
QPainterPath QGraphicsItem::clipPath() const
{
Q_D(const QGraphicsItem);
- if (!d->dirtyClipPath)
- return d->emptyClipPath ? QPainterPath() : d->cachedClipPath;
-
- if (!isClipped()) {
- d_ptr->setCachedClipPath(QPainterPath());
- return d->cachedClipPath;
- }
+ if (!isClipped())
+ return QPainterPath();
const QRectF thisBoundingRect(boundingRect());
- if (thisBoundingRect.isEmpty()) {
- if (d_ptr->flags & ItemClipsChildrenToShape)
- d_ptr->setEmptyCachedClipPathRecursively();
- else
- d_ptr->setEmptyCachedClipPath();
+ if (thisBoundingRect.isEmpty())
return QPainterPath();
- }
QPainterPath clip;
// Start with the item's bounding rect.
@@ -4561,40 +4537,18 @@ QPainterPath QGraphicsItem::clipPath() const
const QGraphicsItem *lastParent = this;
// Intersect any in-between clips starting at the top and moving downwards.
- bool foundValidClipPath = false;
while ((parent = parent->d_ptr->parent)) {
if (parent->d_ptr->flags & ItemClipsChildrenToShape) {
// Map clip to the current parent and intersect with its shape/clipPath
clip = lastParent->itemTransform(parent).map(clip);
- if ((foundValidClipPath = !parent->d_ptr->dirtyClipPath && parent->isClipped())) {
- if (parent->d_ptr->emptyClipPath) {
- if (d_ptr->flags & ItemClipsChildrenToShape)
- d_ptr->setEmptyCachedClipPathRecursively();
- else
- d_ptr->setEmptyCachedClipPath();
- return QPainterPath();
- }
- clip = clip.intersected(parent->d_ptr->cachedClipPath);
- if (!(parent->d_ptr->flags & ItemClipsToShape))
- clip = clip.intersected(parent->shape());
- } else {
- clip = clip.intersected(parent->shape());
- }
-
- if (clip.isEmpty()) {
- if (d_ptr->flags & ItemClipsChildrenToShape)
- d_ptr->setEmptyCachedClipPathRecursively();
- else
- d_ptr->setEmptyCachedClipPath();
+ clip = clip.intersected(parent->shape());
+ if (clip.isEmpty())
return clip;
- }
lastParent = parent;
}
- if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)
- || foundValidClipPath) {
+ if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren))
break;
- }
}
if (lastParent != this) {
@@ -4607,7 +4561,6 @@ QPainterPath QGraphicsItem::clipPath() const
if (d->flags & ItemClipsToShape)
clip = clip.intersected(shape());
- d_ptr->setCachedClipPath(clip);
return clip;
}
@@ -5026,15 +4979,14 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity)
\internal
Returns true if we can discard an update request; otherwise false.
*/
-bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, bool ignoreVisibleBit,
- bool ignoreDirtyBit, bool ignoreOpacity) const
+bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreVisibleBit, bool ignoreDirtyBit,
+ bool ignoreOpacity) const
{
// No scene, or if the scene is updating everything, means we have nothing
// to do. The only exception is if the scene tracks the growing scene rect.
return !scene
|| (!visible && !ignoreVisibleBit && !this->ignoreVisible)
|| (!ignoreDirtyBit && fullUpdatePending)
- || (!ignoreClipping && (childrenClippedToShape() && isClippedAway()))
|| (!ignoreOpacity && !this->ignoreOpacity && childrenCombineOpacity() && isFullyTransparent());
}
@@ -5169,109 +5121,6 @@ void QGraphicsItemPrivate::removeExtraItemCache()
unsetExtra(ExtraCacheData);
}
-void QGraphicsItemPrivate::setEmptyCachedClipPathRecursively(const QRectF &emptyIfOutsideThisRect)
-{
- setEmptyCachedClipPath();
-
- const bool checkRect = !emptyIfOutsideThisRect.isNull()
- && !(flags & QGraphicsItem::ItemClipsChildrenToShape);
- for (int i = 0; i < children.size(); ++i) {
- if (!checkRect) {
- children.at(i)->d_ptr->setEmptyCachedClipPathRecursively();
- continue;
- }
-
- QGraphicsItem *child = children.at(i);
- const QRectF rect = child->mapRectFromParent(emptyIfOutsideThisRect);
- if (rect.intersects(child->boundingRect()))
- child->d_ptr->invalidateCachedClipPathRecursively(false, rect);
- else
- child->d_ptr->setEmptyCachedClipPathRecursively(rect);
- }
-}
-
-void QGraphicsItemPrivate::invalidateCachedClipPathRecursively(bool childrenOnly, const QRectF &emptyIfOutsideThisRect)
-{
- if (!childrenOnly)
- invalidateCachedClipPath();
-
- const bool checkRect = !emptyIfOutsideThisRect.isNull();
- for (int i = 0; i < children.size(); ++i) {
- if (!checkRect) {
- children.at(i)->d_ptr->invalidateCachedClipPathRecursively(false);
- continue;
- }
-
- QGraphicsItem *child = children.at(i);
- const QRectF rect = child->mapRectFromParent(emptyIfOutsideThisRect);
- if (rect.intersects(child->boundingRect()))
- child->d_ptr->invalidateCachedClipPathRecursively(false, rect);
- else
- child->d_ptr->setEmptyCachedClipPathRecursively(rect);
- }
-}
-
-void QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper(const QPointF &newPos)
-{
- Q_ASSERT(inSetPosHelper);
-
- if (inDestructor || !(ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren))
- return; // Not clipped by any ancestor.
-
- // Find closest clip ancestor and transform.
- Q_Q(QGraphicsItem);
- // COMBINE
- QTransform thisToParentTransform = QTransform::fromTranslate(newPos.x(), newPos.y());
- if (transformData)
- thisToParentTransform = transformData->computedFullTransform(&thisToParentTransform);
- QGraphicsItem *clipParent = parent;
- while (clipParent && !clipParent->d_ptr->inDestructor && !(clipParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)) {
- thisToParentTransform *= clipParent->d_ptr->transformToParent();
- clipParent = clipParent->d_ptr->parent;
- }
-
- // Ensure no parents are currently being deleted. This can only
- // happen if the item is moved by a dying ancestor.
- QGraphicsItem *p = clipParent;
- while (p) {
- if (p->d_ptr->inDestructor)
- return;
- p = p->d_ptr->parent;
- }
-
- // From here everything is calculated in clip parent's coordinates.
- const QRectF parentBoundingRect(clipParent->boundingRect());
- const QRectF thisBoundingRect(thisToParentTransform.mapRect(q->boundingRect()));
-
- if (!parentBoundingRect.intersects(thisBoundingRect)) {
- // Item is moved outside the clip parent's bounding rect,
- // i.e. it is fully clipped and the clip path is empty.
- if (flags & QGraphicsItem::ItemClipsChildrenToShape)
- setEmptyCachedClipPathRecursively();
- else
- setEmptyCachedClipPathRecursively(thisToParentTransform.inverted().mapRect(parentBoundingRect));
- return;
- }
-
- const QPainterPath parentClip(clipParent->isClipped() ? clipParent->clipPath() : clipParent->shape());
- if (parentClip.contains(thisBoundingRect))
- return; // Item is inside the clip parent's shape. No update required.
-
- const QRectF parentClipRect(parentClip.controlPointRect());
- if (!parentClipRect.intersects(thisBoundingRect)) {
- // Item is moved outside the clip parent's shape,
- // i.e. it is fully clipped and the clip path is empty.
- if (flags & QGraphicsItem::ItemClipsChildrenToShape)
- setEmptyCachedClipPathRecursively();
- else
- setEmptyCachedClipPathRecursively(thisToParentTransform.inverted().mapRect(parentClipRect));
- } else {
- // Item is partially inside the clip parent's shape,
- // i.e. the cached clip path must be invalidated.
- invalidateCachedClipPathRecursively(false, thisToParentTransform.inverted().mapRect(parentClipRect));
- }
-}
-
// Traverses all the ancestors up to the top-level and updates the pointer to
// always point to the top-most item that has a dirty scene transform.
// It then backtracks to the top-most dirty item and start calculating the
@@ -7288,9 +7137,7 @@ void QGraphicsItem::prepareGeometryChange()
QGraphicsScenePrivate *scenePrivate = d_ptr->scene->d_func();
scenePrivate->index->prepareBoundingRectChange(this);
- scenePrivate->markDirty(this, QRectF(),
- /*invalidateChildren=*/true,
- /*maybeDirtyClipPath=*/!d_ptr->inSetPosHelper);
+ scenePrivate->markDirty(this, QRectF(), /*invalidateChildren=*/true);
// For compatibility reasons, we have to update the item's old geometry
// if someone is connected to the changed signal or the scene has no views.
@@ -7313,16 +7160,6 @@ void QGraphicsItem::prepareGeometryChange()
// ### Only do this if the parent's effect applies to the entire subtree.
parent->d_ptr->notifyBoundingRectChanged = 1;
}
-
- if (d_ptr->inSetPosHelper)
- return;
-
- if (d_ptr->flags & ItemClipsChildrenToShape
- || d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) {
- d_ptr->invalidateCachedClipPathRecursively();
- } else {
- d_ptr->invalidateCachedClipPath();
- }
}
/*!
@@ -9604,9 +9441,11 @@ void QGraphicsTextItem::setDefaultTextColor(const QColor &col)
{
QTextControl *c = dd->textControl();
QPalette pal = c->palette();
+ QColor old = pal.color(QPalette::Text);
pal.setColor(QPalette::Text, col);
c->setPalette(pal);
- update();
+ if (old != col)
+ update();
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 75c8246..d6ffb1a 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -152,8 +152,6 @@ public:
dirty(0),
dirtyChildren(0),
localCollisionHack(0),
- dirtyClipPath(1),
- emptyClipPath(0),
inSetPosHelper(0),
needSortChildren(1), // ### can be 0 by default?
allChildrenDirty(0),
@@ -221,7 +219,7 @@ public:
void appendGraphicsTransform(QGraphicsTransform *t);
void setVisibleHelper(bool newVisible, bool explicitly, bool update = true);
void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true);
- bool discardUpdateRequest(bool ignoreClipping = false, bool ignoreVisibleBit = false,
+ bool discardUpdateRequest(bool ignoreVisibleBit = false,
bool ignoreDirtyBit = false, bool ignoreOpacity = false) const;
int depth() const;
#ifndef QT_NO_GRAPHICSEFFECT
@@ -307,26 +305,6 @@ public:
QGraphicsItemCache *extraItemCache() const;
void removeExtraItemCache();
- inline void setCachedClipPath(const QPainterPath &path)
- {
- cachedClipPath = path;
- dirtyClipPath = 0;
- emptyClipPath = 0;
- }
-
- inline void setEmptyCachedClipPath()
- {
- emptyClipPath = 1;
- dirtyClipPath = 0;
- }
-
- void setEmptyCachedClipPathRecursively(const QRectF &emptyIfOutsideThisRect = QRectF());
-
- inline void invalidateCachedClipPath()
- { /*static int count = 0 ;qWarning("%i", ++count);*/ dirtyClipPath = 1; emptyClipPath = 0; }
-
- void invalidateCachedClipPathRecursively(bool childrenOnly = false, const QRectF &emptyIfOutsideThisRect = QRectF());
- void updateCachedClipPathFromSetPosHelper(const QPointF &newPos);
void ensureSceneTransformRecursive(QGraphicsItem **topMostDirtyItem);
inline void ensureSceneTransform()
{
@@ -409,17 +387,12 @@ public:
return true;
}
- inline bool isClippedAway() const
- { return !dirtyClipPath && q_func()->isClipped() && (emptyClipPath || cachedClipPath.isEmpty()); }
-
inline bool childrenClippedToShape() const
{ return (flags & QGraphicsItem::ItemClipsChildrenToShape) || children.isEmpty(); }
inline bool isInvisible() const
{
- return !visible
- || (childrenClippedToShape() && isClippedAway())
- || (childrenCombineOpacity() && isFullyTransparent());
+ return !visible || (childrenCombineOpacity() && isFullyTransparent());
}
void setFocusHelper(Qt::FocusReason focusReason, bool climb);
@@ -435,7 +408,6 @@ public:
inline void sendScenePosChange();
virtual void siblingOrderChange();
- QPainterPath cachedClipPath;
QRectF childrenBoundingRect;
QRectF needsRepaint;
QMap<QWidget *, QRect> paintedViewBoundingRects;
@@ -480,8 +452,6 @@ public:
quint32 dirty : 1;
quint32 dirtyChildren : 1;
quint32 localCollisionHack : 1;
- quint32 dirtyClipPath : 1;
- quint32 emptyClipPath : 1;
quint32 inSetPosHelper : 1;
quint32 needSortChildren : 1;
quint32 allChildrenDirty : 1;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 10d251d..8777cdc 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -555,7 +555,8 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
// Clear focus on the item to remove any reference in the focusWidget chain.
item->clearFocus();
- markDirty(item, QRectF(), false, false, false, false, /*removingItemFromScene=*/true);
+ markDirty(item, QRectF(), /*invalidateChildren=*/false, /*force=*/false,
+ /*ignoreOpacity=*/false, /*removingItemFromScene=*/true);
if (item->d_ptr->inDestructor) {
// The item is actually in its destructor, we call the special method in the index.
@@ -4759,15 +4760,13 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q
}
void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, bool invalidateChildren,
- bool maybeDirtyClipPath, bool force, bool ignoreOpacity,
- bool removingItemFromScene)
+ bool force, bool ignoreOpacity, bool removingItemFromScene)
{
Q_ASSERT(item);
if (updateAll)
return;
- if (item->d_ptr->discardUpdateRequest(/*ignoreClipping=*/maybeDirtyClipPath,
- /*ignoreVisibleBit=*/force,
+ if (item->d_ptr->discardUpdateRequest(/*ignoreVisibleBit=*/force,
/*ignoreDirtyBit=*/removingItemFromScene || invalidateChildren,
/*ignoreOpacity=*/ignoreOpacity)) {
if (item->d_ptr->dirty) {
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index fdec466..69e4d5b 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -78,7 +78,7 @@ class QGraphicsSceneIndex;
class QGraphicsView;
class QGraphicsWidget;
-class QGraphicsScenePrivate : public QObjectPrivate
+class Q_AUTOTEST_EXPORT QGraphicsScenePrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QGraphicsScene)
public:
@@ -222,8 +222,7 @@ public:
QRegion *, QWidget *, qreal, const QTransform *const, bool, bool);
void markDirty(QGraphicsItem *item, const QRectF &rect = QRectF(), bool invalidateChildren = false,
- bool maybeDirtyClipPath = false, bool force = false, bool ignoreOpacity = false,
- bool removingItemFromScene = false);
+ bool force = false, bool ignoreOpacity = false, bool removingItemFromScene = false);
void processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren = false,
qreal parentOpacity = qreal(1.0));
@@ -266,6 +265,7 @@ public:
{
if (needSortTopLevelItems) {
qSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf);
+ topLevelSequentialOrdering = false;
needSortTopLevelItems = false;
}
}
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index d9c65bb..fe569f4 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -385,8 +385,6 @@ void QGraphicsWidget::setGeometry(const QRectF &rect)
QSizeF oldSize = size();
QGraphicsLayoutItem::setGeometry(newGeom);
- wd->invalidateCachedClipPathRecursively();
-
// Send resize event
bool resized = newGeom.size() != oldSize;
if (resized) {
@@ -1303,7 +1301,8 @@ bool QGraphicsWidget::event(QEvent *event)
case QEvent::Polish:
polishEvent();
d->polished = true;
- d->updateFont(d->font);
+ if (!d->font.isCopyOf(QApplication::font()))
+ d->updateFont(d->font);
break;
case QEvent::WindowActivate:
case QEvent::WindowDeactivate:
diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp
index 35322e9..650075b 100644
--- a/src/gui/image/qimagepixmapcleanuphooks.cpp
+++ b/src/gui/image/qimagepixmapcleanuphooks.cpp
@@ -55,20 +55,11 @@ Q_GUI_EXPORT _qt_pixmap_cleanup_hook_64 qt_pixmap_cleanup_hook_64 = 0;
Q_GUI_EXPORT _qt_image_cleanup_hook qt_image_cleanup_hook = 0;
Q_GUI_EXPORT _qt_image_cleanup_hook_64 qt_image_cleanup_hook_64 = 0;
-
-QImagePixmapCleanupHooks* qt_image_and_pixmap_cleanup_hooks = 0;
-
-
-QImagePixmapCleanupHooks::QImagePixmapCleanupHooks()
-{
- qt_image_and_pixmap_cleanup_hooks = this;
-}
+Q_GLOBAL_STATIC(QImagePixmapCleanupHooks, qt_image_and_pixmap_cleanup_hooks)
QImagePixmapCleanupHooks *QImagePixmapCleanupHooks::instance()
{
- if (!qt_image_and_pixmap_cleanup_hooks)
- qt_image_and_pixmap_cleanup_hooks = new QImagePixmapCleanupHooks;
- return qt_image_and_pixmap_cleanup_hooks;
+ return qt_image_and_pixmap_cleanup_hooks();
}
void QImagePixmapCleanupHooks::addPixmapModificationHook(_qt_pixmap_cleanup_hook_pm hook)
@@ -105,9 +96,8 @@ void QImagePixmapCleanupHooks::removeImageHook(_qt_image_cleanup_hook_64 hook)
void QImagePixmapCleanupHooks::executePixmapModificationHooks(QPixmap* pm)
{
- Q_ASSERT(qt_image_and_pixmap_cleanup_hooks);
- for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks->pixmapModificationHooks.count(); ++i)
- qt_image_and_pixmap_cleanup_hooks->pixmapModificationHooks[i](pm);
+ for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->pixmapModificationHooks.count(); ++i)
+ qt_image_and_pixmap_cleanup_hooks()->pixmapModificationHooks[i](pm);
if (qt_pixmap_cleanup_hook_64)
qt_pixmap_cleanup_hook_64(pm->cacheKey());
@@ -115,9 +105,8 @@ void QImagePixmapCleanupHooks::executePixmapModificationHooks(QPixmap* pm)
void QImagePixmapCleanupHooks::executePixmapDestructionHooks(QPixmap* pm)
{
- Q_ASSERT(qt_image_and_pixmap_cleanup_hooks);
- for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks->pixmapDestructionHooks.count(); ++i)
- qt_image_and_pixmap_cleanup_hooks->pixmapDestructionHooks[i](pm);
+ for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->pixmapDestructionHooks.count(); ++i)
+ qt_image_and_pixmap_cleanup_hooks()->pixmapDestructionHooks[i](pm);
if (qt_pixmap_cleanup_hook_64)
qt_pixmap_cleanup_hook_64(pm->cacheKey());
@@ -125,9 +114,8 @@ void QImagePixmapCleanupHooks::executePixmapDestructionHooks(QPixmap* pm)
void QImagePixmapCleanupHooks::executeImageHooks(qint64 key)
{
- Q_ASSERT(qt_image_and_pixmap_cleanup_hooks);
- for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks->imageHooks.count(); ++i)
- qt_image_and_pixmap_cleanup_hooks->imageHooks[i](key);
+ for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->imageHooks.count(); ++i)
+ qt_image_and_pixmap_cleanup_hooks()->imageHooks[i](key);
if (qt_image_cleanup_hook_64)
qt_image_cleanup_hook_64(key);
diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h
index 9e490d7..dfc5f28 100644
--- a/src/gui/image/qimagepixmapcleanuphooks_p.h
+++ b/src/gui/image/qimagepixmapcleanuphooks_p.h
@@ -61,13 +61,10 @@ typedef void (*_qt_image_cleanup_hook_64)(qint64);
typedef void (*_qt_pixmap_cleanup_hook_pm)(QPixmap*);
class QImagePixmapCleanupHooks;
-extern QImagePixmapCleanupHooks* qt_image_and_pixmap_cleanup_hooks;
class Q_GUI_EXPORT QImagePixmapCleanupHooks
{
public:
- QImagePixmapCleanupHooks();
-
static QImagePixmapCleanupHooks *instance();
static void enableCleanupHooks(const QImage &image);
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index b085c09..406dc0b 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1168,7 +1168,7 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect)
Qt::HANDLE QPixmap::handle() const
{
#if defined(Q_WS_X11)
- if (data->classId() == QPixmapData::X11Class)
+ if (data && data->classId() == QPixmapData::X11Class)
return static_cast<const QX11PixmapData*>(data.constData())->handle();
#endif
return 0;
@@ -1219,7 +1219,7 @@ QPixmap::QPixmap(const QImage& image)
if (!qt_pixmap_thread_test())
return;
- if (data->pixelType() == QPixmapData::BitmapType)
+ if (data && data->pixelType() == QPixmapData::BitmapType)
*this = QBitmap::fromImage(image);
else
*this = fromImage(image);
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index ad15655..acfeff8 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -2552,7 +2552,9 @@ void QAbstractItemView::verticalScrollbarValueChanged(int value)
Q_D(QAbstractItemView);
if (verticalScrollBar()->maximum() == value && d->model->canFetchMore(d->root))
d->model->fetchMore(d->root);
- d->checkMouseMove(viewport()->mapFromGlobal(QCursor::pos()));
+ QPoint posInVp = viewport()->mapFromGlobal(QCursor::pos());
+ if (viewport()->rect().contains(posInVp))
+ d->checkMouseMove(posInVp);
}
/*!
@@ -2563,7 +2565,9 @@ void QAbstractItemView::horizontalScrollbarValueChanged(int value)
Q_D(QAbstractItemView);
if (horizontalScrollBar()->maximum() == value && d->model->canFetchMore(d->root))
d->model->fetchMore(d->root);
- d->checkMouseMove(viewport()->mapFromGlobal(QCursor::pos()));
+ QPoint posInVp = viewport()->mapFromGlobal(QCursor::pos());
+ if (viewport()->rect().contains(posInVp))
+ d->checkMouseMove(posInVp);
}
/*!
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index f1ae3d2..fc82f30 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -1153,6 +1153,8 @@ void QSortFilterProxyModelPrivate::_q_sourceAboutToBeReset()
{
Q_Q(QSortFilterProxyModel);
q->beginResetModel();
+ invalidatePersistentIndexes();
+ clear_mapping();
}
void QSortFilterProxyModelPrivate::_q_sourceReset()
@@ -1470,6 +1472,8 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
{
Q_D(QSortFilterProxyModel);
+ beginResetModel();
+
disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex)));
@@ -1551,7 +1555,7 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
connect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset()));
d->clear_mapping();
- reset();
+ endResetModel();
if (d->update_source_sort_column() && d->dynamic_sortfilter)
d->sort();
}
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index fb2bc72..ab57c32 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -133,36 +133,46 @@ private:
TTimeIntervalMicroSeconds iDuration;
};
+static QS60Beep* qt_S60Beep = 0;
+
QS60Beep::~QS60Beep()
{
+ if (iToneUtil) {
+ switch (iState) {
+ case EBeepPlaying:
+ iToneUtil->CancelPlay();
+ break;
+ case EBeepNotPrepared:
+ iToneUtil->CancelPrepare();
+ break;
+ }
+ }
delete iToneUtil;
}
QS60Beep* QS60Beep::NewL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration)
{
- QS60Beep* self=new (ELeave) QS60Beep();
+ QS60Beep* self = new (ELeave) QS60Beep();
CleanupStack::PushL(self);
self->ConstructL(aFrequency, aDuration);
CleanupStack::Pop();
return self;
-};
+}
void QS60Beep::ConstructL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration)
{
- iToneUtil=CMdaAudioToneUtility::NewL(*this);
- iState=EBeepNotPrepared;
- iFrequency=aFrequency;
- iDuration=aDuration;
- iToneUtil->PrepareToPlayTone(iFrequency,iDuration);
+ iToneUtil = CMdaAudioToneUtility::NewL(*this);
+ iState = EBeepNotPrepared;
+ iFrequency = aFrequency;
+ iDuration = aDuration;
+ iToneUtil->PrepareToPlayTone(iFrequency, iDuration);
}
void QS60Beep::Play()
{
- if (iState != EBeepNotPrepared) {
- if (iState == EBeepPlaying) {
- iToneUtil->CancelPlay();
- iState = EBeepPrepared;
- }
+ if (iState == EBeepPlaying) {
+ iToneUtil->CancelPlay();
+ iState = EBeepPrepared;
}
iToneUtil->Play();
@@ -173,13 +183,14 @@ void QS60Beep::MatoPrepareComplete(TInt aError)
{
if (aError == KErrNone) {
iState = EBeepPrepared;
+ Play();
}
}
void QS60Beep::MatoPlayComplete(TInt aError)
{
Q_UNUSED(aError);
- iState=EBeepPrepared;
+ iState = EBeepPrepared;
}
@@ -812,6 +823,12 @@ void QSymbianControl::Draw(const TRect& controlRect) const
if (!engine)
return;
+ const bool sendNativePaintEvents = qwidget->d_func()->extraData()->receiveNativePaintEvents;
+ if (sendNativePaintEvents) {
+ const QRect r = qt_TRect2QRect(controlRect);
+ QMetaObject::invokeMethod(qwidget, "beginNativePaintEvent", Qt::DirectConnection, Q_ARG(QRect, r));
+ }
+
// Map source rectangle into coordinates of the backing store.
const QPoint controlBase(controlRect.iTl.iX, controlRect.iTl.iY);
const QPoint backingStoreBase = qwidget->mapTo(qwidget->window(), controlBase);
@@ -822,14 +839,48 @@ void QSymbianControl::Draw(const TRect& controlRect) const
CFbsBitmap *bitmap = s60Surface->symbianBitmap();
CWindowGc &gc = SystemGc();
- if(!qwidget->d_func()->extraData()->disableBlit) {
+ switch(qwidget->d_func()->extraData()->nativePaintMode) {
+ case QWExtra::Disable:
+ // Do nothing
+ break;
+
+ case QWExtra::Blit:
if (qwidget->d_func()->isOpaque)
gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect);
+ break;
+
+ case QWExtra::ZeroFill:
+ if (Window().DisplayMode() == EColor16MA) {
+ gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
+ gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
+ gc.SetBrushColor(TRgb::Color16MA(0));
+ gc.Clear(controlRect);
+ } else {
+ gc.SetBrushColor(TRgb(0x000000));
+ gc.Clear(controlRect);
+ };
+ break;
+
+ default:
+ Q_ASSERT(false);
}
} else {
surface->flush(qwidget, QRegion(qt_TRect2QRect(backingStoreRect)), QPoint());
}
+
+ if (sendNativePaintEvents) {
+ const QRect r = qt_TRect2QRect(controlRect);
+ // The draw ops aren't actually sent to WSERV until the graphics
+ // context is deactivated, which happens in the function calling
+ // this one. We therefore delay the delivery of endNativePaintEvent,
+ // to ensure that drawing has completed by the time the widget
+ // receives the event. Note that, if the widget needs to ensure
+ // that the draw ops have actually been executed into the output
+ // framebuffer, a call to RWsSession::Flush is required in the
+ // endNativePaintEvent implementation.
+ QMetaObject::invokeMethod(qwidget, "endNativePaintEvent", Qt::QueuedConnection, Q_ARG(QRect, r));
+ }
}
void QSymbianControl::SizeChanged()
@@ -1226,6 +1277,10 @@ void qt_init(QApplicationPrivate * /* priv */, int)
*****************************************************************************/
void qt_cleanup()
{
+ if(qt_S60Beep) {
+ delete qt_S60Beep;
+ qt_S60Beep = 0;
+ }
QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles
// S60 structure and window server session are freed in eventdispatcher destructor as they are needed there
@@ -1467,14 +1522,13 @@ void QApplication::setCursorFlashTime(int msecs)
void QApplication::beep()
{
- TInt frequency=440;
- TTimeIntervalMicroSeconds duration(500000);
- QS60Beep* beep=NULL;
- TRAPD(err, beep=QS60Beep::NewL(frequency, duration));
- if (!err)
- beep->Play();
- delete beep;
- beep=NULL;
+ if (!qt_S60Beep) {
+ TInt frequency = 880;
+ TTimeIntervalMicroSeconds duration(500000);
+ TRAP_IGNORE(qt_S60Beep=QS60Beep::NewL(frequency, duration));
+ }
+ if (qt_S60Beep)
+ qt_S60Beep->Play();
}
/*!
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 2a53a16..265f52f 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -282,8 +282,8 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
\row \i SelectPreviousPage \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp
\row \i SelectStartOfLine \i Shift+Home \i Ctrl+Shift+Left \i Shift+Home \i Shift+Home \i Shift+Home
\row \i SelectEndOfLine \i Shift+End \i Ctrl+Shift+Right \i Shift+End \i Shift+End \i Shift+End
- \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up \i (none) \i (none) \i (none)
- \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down \i (none) \i (none) \i (none)
+ \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up, Meta+Shift+A \i (none) \i (none) \i (none)
+ \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down, Meta+Shift+E \i (none) \i (none) \i (none)
\row \i SelectStartOfDocument\i Ctrl+Shift+Home \i Ctrl+Shift+Up, Shift+Home \i Ctrl+Shift+Home\i Ctrl+Shift+Home \i Ctrl+Shift+Home
\row \i SelectEndOfDocument \i Ctrl+Shift+End \i Ctrl+Shift+Down, Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End
\row \i DeleteStartOfWord \i Ctrl+Backspace \i Alt+Backspace \i Ctrl+Backspace \i Ctrl+Backspace \i (none)
@@ -732,6 +732,8 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, QApplicationPrivate::KB_Mac},
{QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, QApplicationPrivate::KB_Mac},
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, QApplicationPrivate::KB_Mac},
+ {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, QApplicationPrivate::KB_Mac},
+ {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, QApplicationPrivate::KB_Mac},
{QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac},
{QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac}
};
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index f31dcc4..49292ac 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -366,7 +366,8 @@ bool QWidget::hasEditFocus() const
normally; otherwise, Qt::Key_Up and Qt::Key_Down are used to
change focus.
- This feature is only available in Qt for Embedded Linux.
+ This feature is only available in Qt for Embedded Linux and Qt
+ for Symbian.
\sa hasEditFocus(), QApplication::keypadNavigationEnabled()
*/
@@ -4605,7 +4606,7 @@ void QWidgetPrivate::updateFont(const QFont &font)
if (!q->parentWidget() && extra && extra->proxyWidget) {
QGraphicsProxyWidget *p = extra->proxyWidget;
inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve();
- } else
+ } else
#endif //QT_NO_GRAPHICSVIEW
if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
inheritedFontResolveMask = 0;
@@ -6053,6 +6054,11 @@ bool QWidget::hasFocus() const
(Nothing happens if the focus in and focus out widgets are the
same.)
+ \note On embedded platforms, setFocus() will not cause an input panel
+ to be opened by the input method. If you want this to happen, you
+ have to send a QEvent::RequestSoftwareInputPanel event to the
+ widget yourself.
+
setFocus() gives focus to a widget regardless of its focus policy,
but does not clear any keyboard grab (see grabKeyboard()).
@@ -6065,7 +6071,7 @@ bool QWidget::hasFocus() const
\sa hasFocus(), clearFocus(), focusInEvent(), focusOutEvent(),
setFocusPolicy(), focusWidget(), QApplication::focusWidget(), grabKeyboard(),
- grabMouse(), {Keyboard Focus}
+ grabMouse(), {Keyboard Focus}, QEvent::RequestSoftwareInputPanel
*/
void QWidget::setFocus(Qt::FocusReason reason)
@@ -9905,13 +9911,13 @@ void QWidget::scroll(int dx, int dy)
Q_D(QWidget);
#ifndef QT_NO_GRAPHICSVIEW
if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
- // Graphics View maintains its own dirty region as a list of rects;
- // until we can connect item updates directly to the view, we must
- // separately add a translated dirty region.
- if (!d->dirty.isEmpty()) {
- foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects())
- proxy->update(rect);
- }
+ // Graphics View maintains its own dirty region as a list of rects;
+ // until we can connect item updates directly to the view, we must
+ // separately add a translated dirty region.
+ if (!d->dirty.isEmpty()) {
+ foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects())
+ proxy->update(rect);
+ }
proxy->scroll(dx, dy, proxy->subWidgetRect(this));
return;
}
@@ -9940,13 +9946,13 @@ void QWidget::scroll(int dx, int dy, const QRect &r)
Q_D(QWidget);
#ifndef QT_NO_GRAPHICSVIEW
if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
- // Graphics View maintains its own dirty region as a list of rects;
- // until we can connect item updates directly to the view, we must
- // separately add a translated dirty region.
- if (!d->dirty.isEmpty()) {
- foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects())
- proxy->update(rect);
- }
+ // Graphics View maintains its own dirty region as a list of rects;
+ // until we can connect item updates directly to the view, we must
+ // separately add a translated dirty region.
+ if (!d->dirty.isEmpty()) {
+ foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects())
+ proxy->update(rect);
+ }
proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint()));
return;
}
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 0d9f9ee..1907cca 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -2617,8 +2617,6 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
releaseMouse();
if(mac_keyboard_grabber == this)
releaseKeyboard();
- if(acceptDrops())
- setAcceptDrops(false);
if(testAttribute(Qt::WA_ShowModal)) // just be sure we leave modal
QApplicationPrivate::leaveModal(this);
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index ba375d8..64e3290 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -230,12 +230,42 @@ struct QWExtra {
#elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian
uint activated : 1; // RWindowBase::Activated has been called
- // If set, QSymbianControl::Draw does not blit this widget
- // This is to allow, for use cases such as video, widgets which, from the Qt point
- // of view, are just placeholders in the scene. For these widgets, any necessary
- // drawing to the UI framebuffer is done by the relevant Symbian subsystem. For
- // video rendering, this would be an MMF controller, or MDF post-processor.
- uint disableBlit : 1;
+ /**
+ * Defines the behaviour of QSymbianControl::Draw.
+ */
+ enum NativePaintMode {
+ /**
+ * Normal drawing mode: blits the required region of the backing store
+ * via WSERV.
+ */
+ Blit,
+
+ /**
+ * Disable drawing for this widget.
+ */
+ Disable,
+
+ /**
+ * Paint zeros into the WSERV framebuffer, using BitGDI APIs. For windows
+ * with an EColor16MU display mode, zero is written only into the R, G and B
+ * channels of the pixel.
+ */
+ ZeroFill,
+
+ Default = Blit
+ };
+
+ NativePaintMode nativePaintMode : 2;
+
+ /**
+ * If this bit is set, each native widget receives the signals from the
+ * Symbian control immediately before and immediately after draw ops are
+ * sent to the window server for this control:
+ * void beginNativePaintEvent(const QRect &paintRect);
+ * void endNativePaintEvent(const QRect &paintRect);
+ */
+ uint receiveNativePaintEvents : 1;
+
#endif
};
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 359df2a..37614c7 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -881,7 +881,8 @@ void QWidgetPrivate::deleteTLSysExtra()
void QWidgetPrivate::createSysExtra()
{
extra->activated = 0;
- extra->disableBlit = 0;
+ extra->nativePaintMode = QWExtra::Default;
+ extra->receiveNativePaintEvents = 0;
}
void QWidgetPrivate::deleteSysExtra()
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 8226797..1b8f413 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -949,6 +949,8 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy)
return;
QWidgetBackingStore *wbs = x->backingStore;
+ if (!wbs)
+ return;
static int accelEnv = -1;
if (accelEnv == -1) {
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 3f33319..4a72434 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3240,7 +3240,8 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
drawCached = false;
// don't try to cache huge fonts
- if (ti.fontEngine->fontDef.pixelSize * qSqrt(s->matrix.determinant()) >= 64)
+ const qreal pixelSize = ti.fontEngine->fontDef.pixelSize;
+ if (pixelSize * pixelSize * qAbs(s->matrix.determinant()) >= 64 * 64)
drawCached = false;
// ### Remove the TestFontEngine and Box engine crap, in these
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 7d1c109..9a0e319 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -56,6 +56,20 @@ QT_BEGIN_NAMESPACE
* class QVectorPath
*
*/
+QVectorPath::~QVectorPath()
+{
+ if (m_hints & ShouldUseCacheHint) {
+ CacheEntry *e = m_cache;
+ while (e) {
+ if (e->data)
+ e->cleanup(e->engine, e->data);
+ CacheEntry *n = e->next;
+ delete e;
+ e = n;
+ }
+ }
+}
+
QRectF QVectorPath::controlPointRect() const
{
@@ -94,7 +108,7 @@ QRectF QVectorPath::controlPointRect() const
QVectorPath::CacheEntry *QVectorPath::addCacheData(QPaintEngineEx *engine, void *data,
- qvectorpath_cache_cleanup cleanup) {
+ qvectorpath_cache_cleanup cleanup) const{
Q_ASSERT(!lookupCacheData(engine));
if ((m_hints & IsCachedHint) == 0) {
m_cache = 0;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 48629d1..443c9c5 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5886,7 +5886,12 @@ void QPainter::drawText(const QRectF &r, const QString &text, const QTextOption
Draws the text item \a ti at position \a p.
*/
-/*! \internal
+/*!
+ \fn void QPainter::drawTextItem(const QPointF &p, const QTextItem &ti)
+
+ \internal
+ \since 4.1
+
Draws the text item \a ti at position \a p.
This method ignores the painters background mode and
@@ -5899,34 +5904,57 @@ void QPainter::drawText(const QRectF &r, const QString &text, const QTextOption
ignored aswell. You'll need to pass in the correct flags to get
underlining and strikeout.
*/
-static QPainterPath generateWavyPath(qreal minWidth, qreal maxRadius, QPaintDevice *device)
+
+static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen)
{
- extern int qt_defaultDpi();
+ const qreal radiusBase = qMax(qreal(1), maxRadius);
+
+ QString key = QLatin1String("WaveUnderline-");
+ key += pen.color().name();
+ key += QLatin1Char('-');
+ key += QString::number(radiusBase);
+
+ QPixmap pixmap;
+ if (QPixmapCache::find(key, pixmap))
+ return pixmap;
+
+ const qreal halfPeriod = qMax(qreal(2), qreal(radiusBase * 1.61803399)); // the golden ratio
+ const int width = qCeil(100 / (2 * halfPeriod)) * (2 * halfPeriod);
+ const int radius = qFloor(radiusBase);
+
QPainterPath path;
- bool up = true;
- const qreal radius = qMax(qreal(.5), qMin(qreal(1.25 * device->logicalDpiY() / qt_defaultDpi()), maxRadius));
- qreal xs, ys;
- int i = 0;
- path.moveTo(0, radius);
- do {
- xs = i*(2*radius);
- ys = 0;
+ qreal xs = 0;
+ qreal ys = radius;
- qreal remaining = minWidth - xs;
- qreal angle = 180;
+ while (xs < width) {
+ xs += halfPeriod;
+ ys = -ys;
+ path.quadTo(xs - halfPeriod / 2, ys, xs, 0);
+ }
- // cut-off at the last arc segment
- if (remaining < 2 * radius)
- angle = 180 * remaining / (2 * radius);
+ pixmap = QPixmap(width, radius * 2);
+ pixmap.fill(Qt::transparent);
+ {
+ QPen wavePen = pen;
+ wavePen.setCapStyle(Qt::SquareCap);
+
+ // This is to protect against making the line too fat, as happens on Mac OS X
+ // due to it having a rather thick width for the regular underline.
+ const qreal maxPenWidth = .8 * radius;
+ if (wavePen.widthF() > maxPenWidth)
+ wavePen.setWidth(maxPenWidth);
- path.arcTo(xs, ys, 2*radius, 2*radius, 180, up ? angle : -angle);
+ QPainter imgPainter(&pixmap);
+ imgPainter.setPen(wavePen);
+ imgPainter.setRenderHint(QPainter::Antialiasing);
+ imgPainter.translate(0, radius);
+ imgPainter.drawPath(path);
+ }
- up = !up;
- ++i;
- } while (xs + 2*radius < minWidth);
+ QPixmapCache::insert(key, pixmap);
- return path;
+ return pixmap;
}
static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QTextItemInt &ti)
@@ -5947,9 +5975,11 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
pen.setCapStyle(Qt::FlatCap);
QLineF line(pos.x(), pos.y(), pos.x() + ti.width.toReal(), pos.y());
+
+ const qreal underlineOffset = fe->underlinePosition().toReal();
// deliberately ceil the offset to avoid the underline coming too close to
// the text above it.
- const qreal underlinePos = pos.y() + qCeil(fe->underlinePosition().toReal());
+ const qreal underlinePos = pos.y() + qCeil(underlineOffset);
if (underlineStyle == QTextCharFormat::SpellCheckUnderline) {
underlineStyle = QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle));
@@ -5957,16 +5987,18 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
if (underlineStyle == QTextCharFormat::WaveUnderline) {
painter->save();
- painter->setRenderHint(QPainter::Antialiasing);
- painter->translate(pos.x(), underlinePos);
+ painter->translate(0, pos.y() + 1);
QColor uc = ti.charFormat.underlineColor();
if (uc.isValid())
- painter->setPen(uc);
+ pen.setColor(uc);
- painter->drawPath(generateWavyPath(ti.width.toReal(),
- fe->underlinePosition().toReal(),
- painter->device()));
+ // Adapt wave to underlineOffset or pen width, whatever is larger, to make it work on all platforms
+ const QPixmap wave = generateWavyPixmap(qMax(underlineOffset, pen.widthF()), pen);
+ const int descent = (int) ti.descent.toReal();
+
+ painter->setBrushOrigin(painter->brushOrigin().x(), 0);
+ painter->fillRect(pos.x(), 0, qCeil(ti.width.toReal()), qMin(wave.height(), descent), wave);
painter->restore();
} else if (underlineStyle != QTextCharFormat::NoUnderline) {
QLineF underLine(line.x1(), underlinePos, line.x2(), underlinePos);
@@ -6001,10 +6033,6 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
painter->setBrush(oldBrush);
}
-/*!
- \internal
- \since 4.1
-*/
void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti)
{
#ifdef QT_DEBUG_DRAW
diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h
index ec27970..5eaddf4 100644
--- a/src/gui/painting/qvectorpath_p.h
+++ b/src/gui/painting/qvectorpath_p.h
@@ -68,7 +68,7 @@ QT_MODULE(Gui)
class QPaintEngineEx;
-typedef void (*qvectorpath_cache_cleanup)(void *data);
+typedef void (*qvectorpath_cache_cleanup)(QPaintEngineEx *engine, void *data);
struct QRealRect {
qreal x1, y1, x2, y2;
@@ -118,6 +118,8 @@ public:
{
}
+ ~QVectorPath();
+
QRectF controlPointRect() const;
inline Hint shape() const { return (Hint) (m_hints & ShapeMask); }
@@ -128,6 +130,7 @@ public:
inline bool hasImplicitClose() const { return m_hints & ImplicitClose; }
inline bool hasWindingFill() const { return m_hints & WindingFill; }
+ inline void makeCacheable() const { m_hints |= ShouldUseCacheHint; m_cache = 0; }
inline uint hints() const { return m_hints; }
inline const QPainterPath::ElementType *elements() const { return m_elements; }
@@ -146,9 +149,9 @@ public:
CacheEntry *next;
};
- CacheEntry *addCacheData(QPaintEngineEx *engine, void *data, qvectorpath_cache_cleanup cleanup);
+ CacheEntry *addCacheData(QPaintEngineEx *engine, void *data, qvectorpath_cache_cleanup cleanup) const;
inline CacheEntry *lookupCacheData(QPaintEngineEx *engine) const {
- Q_ASSERT(m_hints & IsCachedHint);
+ Q_ASSERT(m_hints & ShouldUseCacheHint);
CacheEntry *e = m_cache;
while (e) {
if (e->engine == engine)
@@ -162,14 +165,14 @@ public:
private:
Q_DISABLE_COPY(QVectorPath)
- CacheEntry *m_cache;
-
const QPainterPath::ElementType *m_elements;
const qreal *m_points;
const int m_count;
mutable uint m_hints;
mutable QRealRect m_cp_rect;
+
+ mutable CacheEntry *m_cache;
};
Q_GUI_EXPORT const QVectorPath &qtVectorPathForPath(const QPainterPath &path);
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index fab3998..91974c2 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -770,8 +770,6 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Highlight));
else if (vopt->features & QStyleOptionViewItemV2::Alternate)
p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase));
- else if (!(vopt->state & QStyle::State_Enabled))
- p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Base));
}
break;
case PE_PanelItemViewItem:
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 51c2a96..4075cf7 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -4843,9 +4843,11 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
uint sc = SC_TitleBarMinButton;
ThemeTitleBarWidget tbw = kThemeWidgetCollapseBox;
bool active = titlebar->state & State_Active;
- int border = 2;
- titleBarRect.origin.x += border;
- titleBarRect.origin.y -= border;
+ if (qMacVersion() < QSysInfo::MV_10_6) {
+ int border = 2;
+ titleBarRect.origin.x += border;
+ titleBarRect.origin.y -= border;
+ }
while (sc <= SC_TitleBarCloseButton) {
if (sc & titlebar->subControls) {
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index b5c0d4f..dca78ca 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -144,7 +144,7 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme
{SE_ToolBarButtonPressed, QS60StyleEnums::SP_QsnFrSctrlButtonCenterPressed},
{SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter},
{SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive},
- {SE_Editor, QS60StyleEnums::SP_QsnFrNotepadCenter},
+ {SE_Editor, QS60StyleEnums::SP_QsnFrInputCenter},
};
static const int frameElementsCount =
@@ -459,11 +459,6 @@ void QS60StylePrivate::setThemePalette(QApplication *app) const
storeThemePalette(&widgetPalette);
}
-void QS60StylePrivate::setThemePalette(QStyleOption *option) const
-{
- setThemePalette(&option->palette);
-}
-
QPalette* QS60StylePrivate::themePalette()
{
return m_themePalette;
@@ -475,6 +470,8 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const
QPalette applicationPalette = QApplication::palette();
applicationPalette.setBrush(QPalette::Window, backgroundTexture());
setThemePalette(&applicationPalette);
+ QApplication::setPalette(applicationPalette);
+ setThemePaletteHash(&applicationPalette);
}
void QS60StylePrivate::deleteBackground()
@@ -638,16 +635,16 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const
{
if(!widget)
return;
- QPalette widgetPalette = QApplication::palette(widget);
//header view and its viewport need to be set 100% transparent button color, since drawing code will
//draw transparent theme graphics to table column and row headers.
if (qobject_cast<QHeaderView *>(widget)){
+ QPalette widgetPalette = QApplication::palette(widget);
widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
QHeaderView* header = qobject_cast<QHeaderView *>(widget);
widgetPalette.setColor(QPalette::Button, Qt::transparent );
- if ( header->viewport() )
+ if (header->viewport())
header->viewport()->setPalette(widgetPalette);
QApplication::setPalette(widgetPalette, "QHeaderView");
}
@@ -810,7 +807,7 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag
case QS60StyleEnums::SP_QgnGrafTabActiveL:
//Returned QSize for tabs must not be square, but narrow rectangle with width:height
//ratio of 1:2 for horizontal tab bars (and 2:1 for vertical ones).
- result.setWidth(10);
+ result.setWidth(result.height()>>1);
break;
case QS60StyleEnums::SP_QgnIndiSliderEdit:
result.scale(pixelMetric(QStyle::PM_SliderLength),
@@ -868,7 +865,7 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag
return result;
}
-bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush)
+bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush)
{
//If brush is not changed from style's default values, draw theme graphics.
return (backgroundBrush.color() == Qt::transparent ||
@@ -1786,7 +1783,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
if (qobject_cast<const QAbstractButton *>(widget)) {
//Make cornerButton slightly smaller so that it is not on top of table border graphic.
QStyleOptionHeader subopt = *header;
- const int borderTweak =
+ const int borderTweak =
QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth)>>1;
if (subopt.direction == Qt::LeftToRight)
subopt.rect.adjust(borderTweak, borderTweak, 0, -borderTweak);
@@ -1879,7 +1876,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
adjustableFlags = (adjustableFlags | QS60StylePrivate::SF_PointWest);
} else {
const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
- if (option->direction == Qt::LeftToRight)
+ if (option->direction == Qt::LeftToRight)
headerRect.adjust(-2*frameWidth, 0, 0, 0);
else
headerRect.adjust(0, 0, 2*frameWidth, 0);
@@ -2025,7 +2022,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
buttonRect.setHeight((int)(buttonRect.height() * scaler));
// move the rect up for half of the new height-gain
const int newY = (buttonRect.bottomRight().y() - option->rect.bottomRight().y()) >> 1 ;
- buttonRect.adjust(0,-newY,0,-newY);
+ buttonRect.adjust(0, -newY, -1, -newY);
painter->save();
QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnTextColors, 6, option);
@@ -2594,7 +2591,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
const int indicatorRect = pixelMetric(PM_MenuButtonIndicator) + 2*pixelMetric(PM_ButtonMargin);
const int border = pixelMetric(PM_ButtonMargin) + pixelMetric(PM_DefaultFrameWidth);
ret = toolButton->rect;
- const bool popup = (toolButton->features &
+ const bool popup = (toolButton->features &
(QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay))
== QStyleOptionToolButton::MenuButtonPopup;
switch (scontrol) {
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index ea86bb2..5ab2308 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -271,15 +271,6 @@ public:
SP_QsnFrButtonSideLInactive,
SP_QsnFrButtonSideRInactive,
SP_QsnFrButtonCenterInactive,
- SP_QsnFrNotepadCornerTl,
- SP_QsnFrNotepadCornerTr,
- SP_QsnFrNotepadCornerBl,
- SP_QsnFrNotepadCornerBr,
- SP_QsnFrNotepadSideT,
- SP_QsnFrNotepadSideB,
- SP_QsnFrNotepadSideL,
- SP_QsnFrNotepadSideR,
- SP_QsnFrNotepadCenter
};
enum ColorLists {
@@ -418,8 +409,6 @@ public:
//set theme palette for application
void setThemePalette(QApplication *application) const;
- //set theme palette for style option
- void setThemePalette(QStyleOption *option) const;
//access to theme palette
static QPalette* themePalette();
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index a8dbf8d..48b8fad 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -1324,9 +1324,9 @@ QS60Style::QS60Style()
void QS60StylePrivate::handleDynamicLayoutVariantSwitch()
{
clearCaches(QS60StylePrivate::CC_LayoutChange);
+ setBackgroundTexture(qApp);
setActiveLayout();
refreshUI();
- setBackgroundTexture(qApp);
foreach (QWidget *widget, QApplication::allWidgets())
widget->ensurePolished();
}
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index 30f2f35..0a59d6d 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -213,10 +213,12 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e)
case QEvent::StyleChange:
case QEvent::Show:
if (QProgressBar *bar = qobject_cast<QProgressBar *>(o)) {
- d->bars << bar;
- if (d->bars.size() == 1) {
- Q_ASSERT(d->animationFps> 0);
- d->animateTimer = startTimer(1000 / d->animationFps);
+ if (!d->bars.contains(bar)) {
+ d->bars << bar;
+ if (d->bars.size() == 1) {
+ Q_ASSERT(d->animationFps> 0);
+ d->animateTimer = startTimer(1000 / d->animationFps);
+ }
}
}
break;
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 21b9cca..27fc3c1 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1370,8 +1370,8 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
for (int i = 0; i < len; ++i) {
bool surrogate = (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00 && i < len-1
&& str[i+1].unicode() >= 0xdc00 && str[i+1].unicode() < 0xe000);
- if (glyphs->glyphs[glyph_pos] == 0) {
+ if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) {
QGlyphLayoutInstance tmp = glyphs->instance(glyph_pos);
for (int x = 1; x < engines.size(); ++x) {
QFontEngine *engine = engines.at(x);
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index 18851b7..7ec8e31 100644
--- a/src/gui/text/qfontengine_win.cpp
+++ b/src/gui/text/qfontengine_win.cpp
@@ -485,6 +485,7 @@ glyph_metrics_t QFontEngineWin::boundingBox(const QGlyphLayout &glyphs)
return glyph_metrics_t(0, -tm.tmAscent, w, tm.tmHeight, w, 0);
}
+#ifndef Q_WS_WINCE
bool QFontEngineWin::getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const
{
Q_ASSERT(metrics != 0);
@@ -536,6 +537,7 @@ bool QFontEngineWin::getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph
return false;
}
}
+#endif
glyph_metrics_t QFontEngineWin::boundingBox(glyph_t glyph, const QTransform &t)
{
diff --git a/src/gui/text/qfontengine_win_p.h b/src/gui/text/qfontengine_win_p.h
index 43e1f12..bab71c9 100644
--- a/src/gui/text/qfontengine_win_p.h
+++ b/src/gui/text/qfontengine_win_p.h
@@ -109,7 +109,9 @@ public:
int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, bool mirrored) const;
void getCMap();
+#ifndef Q_WS_WINCE
bool getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const;
+#endif
QString _name;
HFONT hfont;
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index 9b7e8de..1bd4dd6 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -447,18 +447,19 @@ void QTextOdfWriter::writeBlockFormat(QXmlStreamWriter &writer, QTextBlockFormat
writer.writeStartElement(styleNS, QString::fromLatin1("paragraph-properties"));
if (format.hasProperty(QTextFormat::BlockAlignment)) {
+ const Qt::Alignment alignment = format.alignment() & Qt::AlignHorizontal_Mask;
QString value;
- if (format.alignment() == Qt::AlignLeading)
+ if (alignment == Qt::AlignLeading)
value = QString::fromLatin1("start");
- else if (format.alignment() == Qt::AlignTrailing)
+ else if (alignment == Qt::AlignTrailing)
value = QString::fromLatin1("end");
- else if (format.alignment() == (Qt::AlignLeft | Qt::AlignAbsolute))
+ else if (alignment == (Qt::AlignLeft | Qt::AlignAbsolute))
value = QString::fromLatin1("left");
- else if (format.alignment() == (Qt::AlignRight | Qt::AlignAbsolute))
+ else if (alignment == (Qt::AlignRight | Qt::AlignAbsolute))
value = QString::fromLatin1("right");
- else if (format.alignment() == Qt::AlignHCenter)
+ else if (alignment == Qt::AlignHCenter)
value = QString::fromLatin1("center");
- else if (format.alignment() == Qt::AlignJustify)
+ else if (alignment == Qt::AlignJustify)
value = QString::fromLatin1("justify");
else
qWarning() << "QTextOdfWriter: unsupported paragraph alignment; " << format.alignment();
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index 07914b2..0a26a77 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -1167,7 +1167,8 @@ bool QDockAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *dockWid
QDockAreaLayoutInfo *subinfo = item.subinfo;
QLayoutItem *widgetItem = item.widgetItem;
- QRect r = subinfo == 0 ? dockedGeometry(widgetItem->widget()) : subinfo->rect;
+ QPlaceHolderItem *placeHolderItem = item.placeHolderItem;
+ QRect r = subinfo == 0 ? widgetItem ? dockedGeometry(widgetItem->widget()) : placeHolderItem->topLevelRect : subinfo->rect;
Qt::Orientation opposite = o == Qt::Horizontal ? Qt::Vertical : Qt::Horizontal;
#ifdef QT_NO_TABBAR
@@ -1176,13 +1177,15 @@ bool QDockAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *dockWid
QDockAreaLayoutInfo *new_info
= new QDockAreaLayoutInfo(sep, dockPos, opposite, tabBarShape, mainWindow);
+ //item become a new top-level
item.subinfo = new_info;
item.widgetItem = 0;
+ item.placeHolderItem = 0;
QDockAreaLayoutItem new_item
= widgetItem == 0
? QDockAreaLayoutItem(subinfo)
- : QDockAreaLayoutItem(widgetItem);
+ : widgetItem ? QDockAreaLayoutItem(widgetItem) : QDockAreaLayoutItem(placeHolderItem);
new_item.size = pick(opposite, r.size());
new_item.pos = pick(opposite, r.topLeft());
new_info->item_list.append(new_item);
diff --git a/src/gui/widgets/qfontcombobox.cpp b/src/gui/widgets/qfontcombobox.cpp
index d601f81..b976b94 100644
--- a/src/gui/widgets/qfontcombobox.cpp
+++ b/src/gui/widgets/qfontcombobox.cpp
@@ -269,9 +269,8 @@ void QFontComboBoxPrivate::_q_updateModel()
void QFontComboBoxPrivate::_q_currentChanged(const QString &text)
{
Q_Q(QFontComboBox);
- QFont newFont(text);
- if (currentFont.family() != newFont.family()) {
- currentFont = newFont;
+ if (currentFont.family() != text) {
+ currentFont.setFamily(text);
emit q->currentFontChanged(currentFont);
}
}
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index 87975c3..117c550 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -1586,16 +1586,16 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
}
}
#endif //QT_NO_CLIPBOARD
- else if (event == QKeySequence::MoveToStartOfLine) {
+ else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) {
home(0);
}
- else if (event == QKeySequence::MoveToEndOfLine) {
+ else if (event == QKeySequence::MoveToEndOfLine || event == QKeySequence::MoveToEndOfBlock) {
end(0);
}
- else if (event == QKeySequence::SelectStartOfLine) {
+ else if (event == QKeySequence::SelectStartOfLine || event == QKeySequence::SelectStartOfBlock) {
home(1);
}
- else if (event == QKeySequence::SelectEndOfLine) {
+ else if (event == QKeySequence::SelectEndOfLine || event == QKeySequence::SelectEndOfBlock) {
end(1);
}
else if (event == QKeySequence::MoveToNextChar) {
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 3800224..785b2bd 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1411,6 +1411,8 @@ bool QLineEdit::event(QEvent * e)
QTimer::singleShot(0, this, SLOT(_q_handleWindowActivate()));
}else if(e->type() == QEvent::ShortcutOverride){
d->control->processEvent(e);
+ } else if (e->type() == QEvent::KeyRelease) {
+ d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime());
}
#ifdef QT_KEYPAD_NAVIGATION
@@ -1615,6 +1617,8 @@ void QLineEdit::keyPressEvent(QKeyEvent *event)
}
#endif
d->control->processKeyEvent(event);
+ if (event->isAccepted())
+ d->control->setCursorBlinkPeriod(0);
}
/*!
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index 501e62f..557acfb 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -120,6 +120,7 @@ void QMainWindowPrivate::init()
#ifdef QT_SOFTKEYS_ENABLED
menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, q);
menuBarAction->setObjectName(QLatin1String("_q_menuSoftKeyAction"));
+ menuBarAction->setVisible(false);
#endif
}
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 761a060..2e27226 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -229,7 +229,7 @@ void QMenuPrivate::updateActionRects() const
Q_Q(const QMenu);
if (!itemsDirty)
return;
-
+
q->ensurePolished();
//let's reinitialize the buffer
@@ -292,7 +292,7 @@ void QMenuPrivate::updateActionRects() const
if (!action->isVisible() ||
(collapsibleSeparators && previousWasSeparator && action->isSeparator()))
continue; // we continue, this action will get an empty QRect
-
+
previousWasSeparator = action->isSeparator();
//let the style modify the above size..
@@ -1139,7 +1139,7 @@ void QMenuPrivate::_q_actionTriggered()
//we check the parent hierarchy
QList< QPointer<QWidget> > list;
for(QWidget *widget = q->parentWidget(); widget; ) {
- if (qobject_cast<QMenu*>(widget)
+ if (qobject_cast<QMenu*>(widget)
#ifndef QT_NO_MENUBAR
|| qobject_cast<QMenuBar*>(widget)
#endif
@@ -1306,7 +1306,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
the addAction(), addActions() and insertAction() functions. An action
is represented vertically and rendered by QStyle. In addition, actions
can have a text label, an optional icon drawn on the very left side,
- and shortcut key sequence such as "Ctrl+X".
+ and shortcut key sequence such as "Ctrl+X".
The existing actions held by a menu can be found with actions().
@@ -1906,9 +1906,9 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
pos.setX(qMax(p.x()-size.width(), screen.right()-desktopFrame-size.width()+1));
} else {
if (pos.x()+size.width()-1 > screen.right()-desktopFrame)
- pos.setX(qMin(p.x()+size.width(), screen.right()-desktopFrame-size.width()+1));
+ pos.setX(screen.right()-desktopFrame-size.width()+1);
if (pos.x() < screen.left()+desktopFrame)
- pos.setX(qMax(p.x(), screen.left() + desktopFrame));
+ pos.setX(screen.left() + desktopFrame);
}
if (pos.y() + size.height() - 1 > screen.bottom() - desktopFrame) {
if(snapToMouse)
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index c7759e8..eae8b7d 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -1802,6 +1802,9 @@ void QPlainTextEdit::paintEvent(QPaintEvent *e)
QTextBlock block = firstVisibleBlock();
qreal maximumWidth = document()->documentLayout()->documentSize().width();
+ // Set a brush origin so that the WaveUnderline knows where the wave started
+ painter.setBrushOrigin(offset);
+
// keep right margin clean from full-width selection
int maxX = offset.x() + qMax((qreal)viewportRect.width(), maximumWidth)
- document()->documentMargin();
diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp
index 9eb07ac..50b225c 100644
--- a/src/gui/widgets/qspinbox.cpp
+++ b/src/gui/widgets/qspinbox.cpp
@@ -65,14 +65,13 @@ class QSpinBoxPrivate : public QAbstractSpinBoxPrivate
{
Q_DECLARE_PUBLIC(QSpinBox)
public:
- QSpinBoxPrivate(QWidget *parent = 0);
+ QSpinBoxPrivate();
void emitSignals(EmitPolicy ep, const QVariant &);
virtual QVariant valueFromText(const QString &n) const;
virtual QString textFromValue(const QVariant &n) const;
QVariant validateAndInterpret(QString &input, int &pos,
QValidator::State &state) const;
- QChar thousand;
inline void init() {
Q_Q(QSpinBox);
@@ -85,7 +84,7 @@ class QDoubleSpinBoxPrivate : public QAbstractSpinBoxPrivate
{
Q_DECLARE_PUBLIC(QDoubleSpinBox)
public:
- QDoubleSpinBoxPrivate(QWidget *parent = 0);
+ QDoubleSpinBoxPrivate();
void emitSignals(EmitPolicy ep, const QVariant &);
virtual QVariant valueFromText(const QString &n) const;
@@ -95,7 +94,6 @@ public:
double round(double input) const;
// variables
int decimals;
- QChar delimiter, thousand;
inline void init() {
Q_Q(QDoubleSpinBox);
@@ -201,7 +199,7 @@ public:
*/
QSpinBox::QSpinBox(QWidget *parent)
- : QAbstractSpinBox(*new QSpinBoxPrivate(parent), parent)
+ : QAbstractSpinBox(*new QSpinBoxPrivate, parent)
{
Q_D(QSpinBox);
d->init();
@@ -213,7 +211,7 @@ QSpinBox::QSpinBox(QWidget *parent)
argument and then use setObjectName() instead.
*/
QSpinBox::QSpinBox(QWidget *parent, const char *name)
- : QAbstractSpinBox(*new QSpinBoxPrivate(parent), parent)
+ : QAbstractSpinBox(*new QSpinBoxPrivate, parent)
{
Q_D(QSpinBox);
setObjectName(QString::fromAscii(name));
@@ -225,7 +223,7 @@ QSpinBox::QSpinBox(QWidget *parent, const char *name)
argument and then use setObjectName() instead.
*/
QSpinBox::QSpinBox(int minimum, int maximum, int step, QWidget *parent, const char *name)
- : QAbstractSpinBox(*new QSpinBoxPrivate(parent), parent)
+ : QAbstractSpinBox(*new QSpinBoxPrivate, parent)
{
Q_D(QSpinBox);
d->minimum = QVariant(qMin<int>(minimum, maximum));
@@ -464,10 +462,9 @@ void QSpinBox::setRange(int minimum, int maximum)
QString QSpinBox::textFromValue(int value) const
{
- Q_D(const QSpinBox);
QString str = locale().toString(value);
if (qAbs(value) >= 1000 || value == INT_MIN) {
- str.remove(d->thousand);
+ str.remove(locale().groupSeparator());
}
return str;
@@ -516,9 +513,7 @@ QValidator::State QSpinBox::validate(QString &text, int &pos) const
*/
void QSpinBox::fixup(QString &input) const
{
- Q_D(const QSpinBox);
-
- input.remove(d->thousand);
+ input.remove(locale().groupSeparator());
}
@@ -600,7 +595,7 @@ void QSpinBox::fixup(QString &input) const
\sa setMinimum(), setMaximum(), setSingleStep()
*/
QDoubleSpinBox::QDoubleSpinBox(QWidget *parent)
- : QAbstractSpinBox(*new QDoubleSpinBoxPrivate(parent), parent)
+ : QAbstractSpinBox(*new QDoubleSpinBoxPrivate, parent)
{
Q_D(QDoubleSpinBox);
d->init();
@@ -875,7 +870,7 @@ QString QDoubleSpinBox::textFromValue(double value) const
Q_D(const QDoubleSpinBox);
QString str = locale().toString(value, 'f', d->decimals);
if (qAbs(value) >= 1000.0) {
- str.remove(d->thousand);
+ str.remove(locale().groupSeparator());
}
return str;
}
@@ -920,9 +915,7 @@ QValidator::State QDoubleSpinBox::validate(QString &text, int &pos) const
*/
void QDoubleSpinBox::fixup(QString &input) const
{
- Q_D(const QDoubleSpinBox);
-
- input.remove(d->thousand);
+ input.remove(locale().groupSeparator());
}
// --- QSpinBoxPrivate ---
@@ -932,18 +925,13 @@ void QDoubleSpinBox::fixup(QString &input) const
Constructs a QSpinBoxPrivate object
*/
-QSpinBoxPrivate::QSpinBoxPrivate(QWidget *parent)
+QSpinBoxPrivate::QSpinBoxPrivate()
{
minimum = QVariant((int)0);
maximum = QVariant((int)99);
value = minimum;
singleStep = QVariant((int)1);
type = QVariant::Int;
- const QString str = (parent ? parent->locale() : QLocale()).toString(4567);
- if (str.size() == 5) {
- thousand = QChar(str.at(1));
- }
-
}
/*!
@@ -1019,20 +1007,17 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
state = QValidator::Invalid; // special-case -0 will be interpreted as 0 and thus not be invalid with a range from 0-100
} else {
bool ok = false;
- bool removedThousand = false;
num = locale.toInt(copy, &ok, 10);
- if (!ok && copy.contains(thousand) && (max >= 1000 || min <= -1000)) {
- const int s = copy.size();
- copy.remove(thousand);
- pos = qMax(0, pos - (s - copy.size()));
- removedThousand = true;
- num = locale.toInt(copy, &ok, 10);
+ if (!ok && copy.contains(locale.groupSeparator()) && (max >= 1000 || min <= -1000)) {
+ QString copy2 = copy;
+ copy2.remove(locale.groupSeparator());
+ num = locale.toInt(copy2, &ok, 10);
}
QSBDEBUG() << __FILE__ << __LINE__<< "num is set to" << num;
if (!ok) {
state = QValidator::Invalid;
} else if (num >= min && num <= max) {
- state = removedThousand ? QValidator::Intermediate : QValidator::Acceptable;
+ state = QValidator::Acceptable;
} else if (max == min) {
state = QValidator::Invalid;
} else {
@@ -1064,7 +1049,7 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
Constructs a QSpinBoxPrivate object
*/
-QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate(QWidget *parent)
+QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate()
{
minimum = QVariant(0.0);
maximum = QVariant(99.99);
@@ -1072,15 +1057,6 @@ QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate(QWidget *parent)
singleStep = QVariant(1.0);
decimals = 2;
type = QVariant::Double;
- const QString str = (parent ? parent->locale() : QLocale()).toString(4567.1);
- if (str.size() == 6) {
- delimiter = str.at(4);
- thousand = QChar((ushort)0);
- } else if (str.size() == 7) {
- thousand = str.at(1);
- delimiter = str.at(5);
- }
- Q_ASSERT(!delimiter.isNull());
}
/*!
@@ -1155,7 +1131,7 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
state = max != min ? QValidator::Intermediate : QValidator::Invalid;
goto end;
case 1:
- if (copy.at(0) == delimiter
+ if (copy.at(0) == locale.decimalPoint()
|| (plus && copy.at(0) == QLatin1Char('+'))
|| (minus && copy.at(0) == QLatin1Char('-'))) {
state = QValidator::Intermediate;
@@ -1163,7 +1139,7 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
}
break;
case 2:
- if (copy.at(1) == delimiter
+ if (copy.at(1) == locale.decimalPoint()
&& ((plus && copy.at(0) == QLatin1Char('+')) || (minus && copy.at(0) == QLatin1Char('-')))) {
state = QValidator::Intermediate;
goto end;
@@ -1172,14 +1148,14 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
default: break;
}
- if (copy.at(0) == thousand) {
+ if (copy.at(0) == locale.groupSeparator()) {
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
state = QValidator::Invalid;
goto end;
} else if (len > 1) {
- const int dec = copy.indexOf(delimiter);
+ const int dec = copy.indexOf(locale.decimalPoint());
if (dec != -1) {
- if (dec + 1 < copy.size() && copy.at(dec + 1) == delimiter && pos == dec + 1) {
+ if (dec + 1 < copy.size() && copy.at(dec + 1) == locale.decimalPoint() && pos == dec + 1) {
copy.remove(dec + 1, 1); // typing a delimiter when you are on the delimiter
} // should be treated as typing right arrow
@@ -1189,7 +1165,7 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
goto end;
}
for (int i=dec + 1; i<copy.size(); ++i) {
- if (copy.at(i).isSpace() || copy.at(i) == thousand) {
+ if (copy.at(i).isSpace() || copy.at(i) == locale.groupSeparator()) {
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
state = QValidator::Invalid;
goto end;
@@ -1198,12 +1174,12 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
} else {
const QChar &last = copy.at(len - 1);
const QChar &secondLast = copy.at(len - 2);
- if ((last == thousand || last.isSpace())
- && (secondLast == thousand || secondLast.isSpace())) {
+ if ((last == locale.groupSeparator() || last.isSpace())
+ && (secondLast == locale.groupSeparator() || secondLast.isSpace())) {
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end;
- } else if (last.isSpace() && (!thousand.isSpace() || secondLast.isSpace())) {
+ } else if (last.isSpace() && (!locale.groupSeparator().isSpace() || secondLast.isSpace())) {
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end;
@@ -1215,11 +1191,10 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
bool ok = false;
num = locale.toDouble(copy, &ok);
QSBDEBUG() << __FILE__ << __LINE__ << locale << copy << num << ok;
- bool notAcceptable = false;
if (!ok) {
- if (thousand.isPrint()) {
- if (max < 1000 && min > -1000 && copy.contains(thousand)) {
+ if (locale.groupSeparator().isPrint()) {
+ if (max < 1000 && min > -1000 && copy.contains(locale.groupSeparator())) {
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end;
@@ -1227,27 +1202,23 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
const int len = copy.size();
for (int i=0; i<len- 1; ++i) {
- if (copy.at(i) == thousand && copy.at(i + 1) == thousand) {
+ if (copy.at(i) == locale.groupSeparator() && copy.at(i + 1) == locale.groupSeparator()) {
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
state = QValidator::Invalid;
goto end;
}
}
- const int s = copy.size();
- copy.remove(thousand);
- pos = qMax(0, pos - (s - copy.size()));
-
-
- num = locale.toDouble(copy, &ok);
- QSBDEBUG() << thousand << num << copy << ok;
+ QString copy2 = copy;
+ copy2.remove(locale.groupSeparator());
+ num = locale.toDouble(copy2, &ok);
+ QSBDEBUG() << locale.groupSeparator() << num << copy2 << ok;
if (!ok) {
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end;
}
- notAcceptable = true;
}
}
@@ -1255,9 +1226,8 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
} else if (num >= min && num <= max) {
- state = notAcceptable ? QValidator::Intermediate : QValidator::Acceptable;
- QSBDEBUG() << __FILE__ << __LINE__<< "state is set to "
- << (state == QValidator::Intermediate ? "Intermediate" : "Acceptable");
+ state = QValidator::Acceptable;
+ QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Acceptable";
} else if (max == min) { // when max and min is the same the only non-Invalid input is max (or min)
state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp
index b7e985c..c329305 100644
--- a/src/gui/widgets/qtoolbararealayout.cpp
+++ b/src/gui/widgets/qtoolbararealayout.cpp
@@ -1296,6 +1296,8 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*
QList<QToolBar*> toolBars = _toolBars;
int lines;
stream >> lines;
+ if (!testing)
+ testing = mainWindow->unifiedTitleAndToolBarOnMac();
for (int j = 0; j < lines; ++j) {
int pos;
@@ -1306,6 +1308,7 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*
stream >> cnt;
QToolBarAreaLayoutInfo &dock = docks[pos];
+ const bool applyingLayout = !testing && !(pos == QInternal::TopDock && mainWindow->unifiedTitleAndToolBarOnMac());
QToolBarAreaLayoutLine line(dock.o);
for (int k = 0; k < cnt; ++k) {
@@ -1346,7 +1349,7 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*
continue;
}
- if (!testing) {
+ if (applyingLayout) {
item.widgetItem = new QWidgetItemV2(toolBar);
toolBar->setOrientation(floating ? ((shown & 2) ? Qt::Vertical : Qt::Horizontal) : dock.o);
toolBar->setVisible(shown & 1);
@@ -1357,7 +1360,7 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*
}
}
- if (!testing) {
+ if (applyingLayout) {
dock.lines.append(line);
}
}