summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible_win.cpp130
-rw-r--r--src/gui/egl/qegl.cpp2
-rw-r--r--src/gui/egl/qegl_p.h4
-rw-r--r--src/gui/egl/qeglcontext_p.h3
-rw-r--r--src/gui/egl/qeglproperties.cpp4
-rw-r--r--src/gui/embedded/qsoundqss_qws.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp53
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h17
-rw-r--r--src/gui/graphicsview/qgraphicslayoutitem.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp11
-rw-r--r--src/gui/image/qiconloader.cpp4
-rw-r--r--src/gui/image/qjpeghandler.cpp19
-rw-r--r--src/gui/image/qpixmap.cpp10
-rw-r--r--src/gui/image/qpixmapfilter.cpp15
-rw-r--r--src/gui/itemviews/qabstractproxymodel.cpp16
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp8
-rw-r--r--src/gui/kernel/qaction.cpp3
-rw-r--r--src/gui/kernel/qapplication.cpp39
-rw-r--r--src/gui/kernel/qapplication_p.h2
-rw-r--r--src/gui/kernel/qapplication_x11.cpp28
-rw-r--r--src/gui/kernel/qgesture.cpp2
-rw-r--r--src/gui/kernel/qgesture.h4
-rw-r--r--src/gui/kernel/qgesture_p.h18
-rw-r--r--src/gui/kernel/qgesturemanager.cpp2
-rw-r--r--src/gui/kernel/qkeysequence.cpp2
-rw-r--r--src/gui/kernel/qstandardgestures.cpp16
-rw-r--r--src/gui/kernel/qwidget.cpp12
-rw-r--r--src/gui/kernel/qwidget_mac.mm12
-rw-r--r--src/gui/kernel/qwidget_s60.cpp2
-rw-r--r--src/gui/painting/qbrush.cpp15
-rw-r--r--src/gui/painting/qdrawhelper.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp15
-rw-r--r--src/gui/painting/qdrawhelper_ssse3.cpp75
-rw-r--r--src/gui/painting/qgraphicssystem_runtime.cpp6
-rw-r--r--src/gui/painting/qgraphicssystem_runtime_p.h1
-rw-r--r--src/gui/painting/qpaintengineex.cpp2
-rw-r--r--src/gui/painting/qpainter.cpp2
-rw-r--r--src/gui/painting/qprintengine_win.cpp2
-rw-r--r--src/gui/painting/qregion.cpp4
-rw-r--r--src/gui/painting/qstroker.cpp2
-rw-r--r--src/gui/styles/qs60style.cpp78
-rw-r--r--src/gui/styles/qs60style_p.h2
-rw-r--r--src/gui/text/qfontengine.cpp6
-rw-r--r--src/gui/text/qfontengine_win.cpp3
-rw-r--r--src/gui/text/qstatictext.cpp8
-rw-r--r--src/gui/text/qtextdocument.cpp13
-rw-r--r--src/gui/text/qtextobject.cpp5
-rw-r--r--src/gui/widgets/qdockarealayout.cpp10
-rw-r--r--src/gui/widgets/qdockwidget.cpp37
-rw-r--r--src/gui/widgets/qlinecontrol.cpp4
-rw-r--r--src/gui/widgets/qmainwindow.cpp71
-rw-r--r--src/gui/widgets/qmainwindowlayout.cpp11
-rw-r--r--src/gui/widgets/qmainwindowlayout_p.h2
-rw-r--r--src/gui/widgets/qmenu_symbian.cpp8
-rw-r--r--src/gui/widgets/qtoolbar.cpp20
-rw-r--r--src/gui/widgets/qtoolbararealayout.cpp5
-rw-r--r--src/gui/widgets/qtoolbarlayout.cpp7
57 files changed, 516 insertions, 342 deletions
diff --git a/src/gui/accessible/qaccessible_win.cpp b/src/gui/accessible/qaccessible_win.cpp
index 132d01fa97..31e7245c61 100644
--- a/src/gui/accessible/qaccessible_win.cpp
+++ b/src/gui/accessible/qaccessible_win.cpp
@@ -76,71 +76,71 @@ QT_END_INCLUDE_NAMESPACE
static const char *roleString(QAccessible::Role role)
{
static const char *roles[] = {
- "NoRole" /*= 0x00000000*/,
- "TitleBar" /*= 0x00000001*/,
- "MenuBar" /*= 0x00000002*/,
- "ScrollBar" /*= 0x00000003*/,
- "Grip" /*= 0x00000004*/,
- "Sound" /*= 0x00000005*/,
- "Cursor" /*= 0x00000006*/,
- "Caret" /*= 0x00000007*/,
- "AlertMessage" /*= 0x00000008*/,
- "Window" /*= 0x00000009*/,
- "Client" /*= 0x0000000A*/,
- "PopupMenu" /*= 0x0000000B*/,
- "MenuItem" /*= 0x0000000C*/,
- "ToolTip" /*= 0x0000000D*/,
- "Application" /*= 0x0000000E*/,
- "Document" /*= 0x0000000F*/,
- "Pane" /*= 0x00000010*/,
- "Chart" /*= 0x00000011*/,
- "Dialog" /*= 0x00000012*/,
- "Border" /*= 0x00000013*/,
- "Grouping" /*= 0x00000014*/,
- "Separator" /*= 0x00000015*/,
- "ToolBar" /*= 0x00000016*/,
- "StatusBar" /*= 0x00000017*/,
- "Table" /*= 0x00000018*/,
- "ColumnHeader" /*= 0x00000019*/,
- "RowHeader" /*= 0x0000001A*/,
- "Column" /*= 0x0000001B*/,
- "Row" /*= 0x0000001C*/,
- "Cell" /*= 0x0000001D*/,
- "Link" /*= 0x0000001E*/,
- "HelpBalloon" /*= 0x0000001F*/,
- "Assistant" /*= 0x00000020*/,
- "List" /*= 0x00000021*/,
- "ListItem" /*= 0x00000022*/,
- "Tree" /*= 0x00000023*/,
- "TreeItem" /*= 0x00000024*/,
- "PageTab" /*= 0x00000025*/,
- "PropertyPage" /*= 0x00000026*/,
- "Indicator" /*= 0x00000027*/,
- "Graphic" /*= 0x00000028*/,
- "StaticText" /*= 0x00000029*/,
- "EditableText" /*= 0x0000002A*/, // Editable, selectable, etc.
- "PushButton" /*= 0x0000002B*/,
- "CheckBox" /*= 0x0000002C*/,
- "RadioButton" /*= 0x0000002D*/,
- "ComboBox" /*= 0x0000002E*/,
- "DropList" /*= 0x0000002F*/, // commented out
- "ProgressBar" /*= 0x00000030*/,
- "Dial" /*= 0x00000031*/,
- "HotkeyField" /*= 0x00000032*/,
- "Slider" /*= 0x00000033*/,
- "SpinBox" /*= 0x00000034*/,
- "Canvas" /*= 0x00000035*/,
- "Animation" /*= 0x00000036*/,
- "Equation" /*= 0x00000037*/,
- "ButtonDropDown" /*= 0x00000038*/,
- "ButtonMenu" /*= 0x00000039*/,
- "ButtonDropGrid" /*= 0x0000003A*/,
- "Whitespace" /*= 0x0000003B*/,
- "PageTabList" /*= 0x0000003C*/,
- "Clock" /*= 0x0000003D*/,
- "Splitter" /*= 0x0000003E*/,
- "LayeredPane" /*= 0x0000003F*/,
- "UserRole" /*= 0x0000ffff*/
+ "NoRole" /* = 0x00000000 */,
+ "TitleBar" /* = 0x00000001 */,
+ "MenuBar" /* = 0x00000002 */,
+ "ScrollBar" /* = 0x00000003 */,
+ "Grip" /* = 0x00000004 */,
+ "Sound" /* = 0x00000005 */,
+ "Cursor" /* = 0x00000006 */,
+ "Caret" /* = 0x00000007 */,
+ "AlertMessage" /* = 0x00000008 */,
+ "Window" /* = 0x00000009 */,
+ "Client" /* = 0x0000000A */,
+ "PopupMenu" /* = 0x0000000B */,
+ "MenuItem" /* = 0x0000000C */,
+ "ToolTip" /* = 0x0000000D */,
+ "Application" /* = 0x0000000E */,
+ "Document" /* = 0x0000000F */,
+ "Pane" /* = 0x00000010 */,
+ "Chart" /* = 0x00000011 */,
+ "Dialog" /* = 0x00000012 */,
+ "Border" /* = 0x00000013 */,
+ "Grouping" /* = 0x00000014 */,
+ "Separator" /* = 0x00000015 */,
+ "ToolBar" /* = 0x00000016 */,
+ "StatusBar" /* = 0x00000017 */,
+ "Table" /* = 0x00000018 */,
+ "ColumnHeader" /* = 0x00000019 */,
+ "RowHeader" /* = 0x0000001A */,
+ "Column" /* = 0x0000001B */,
+ "Row" /* = 0x0000001C */,
+ "Cell" /* = 0x0000001D */,
+ "Link" /* = 0x0000001E */,
+ "HelpBalloon" /* = 0x0000001F */,
+ "Assistant" /* = 0x00000020 */,
+ "List" /* = 0x00000021 */,
+ "ListItem" /* = 0x00000022 */,
+ "Tree" /* = 0x00000023 */,
+ "TreeItem" /* = 0x00000024 */,
+ "PageTab" /* = 0x00000025 */,
+ "PropertyPage" /* = 0x00000026 */,
+ "Indicator" /* = 0x00000027 */,
+ "Graphic" /* = 0x00000028 */,
+ "StaticText" /* = 0x00000029 */,
+ "EditableText" /* = 0x0000002A */, // Editable, selectable, etc.
+ "PushButton" /* = 0x0000002B */,
+ "CheckBox" /* = 0x0000002C */,
+ "RadioButton" /* = 0x0000002D */,
+ "ComboBox" /* = 0x0000002E */,
+ "DropList" /* = 0x0000002F */, // commented out
+ "ProgressBar" /* = 0x00000030 */,
+ "Dial" /* = 0x00000031 */,
+ "HotkeyField" /* = 0x00000032 */,
+ "Slider" /* = 0x00000033 */,
+ "SpinBox" /* = 0x00000034 */,
+ "Canvas" /* = 0x00000035 */,
+ "Animation" /* = 0x00000036 */,
+ "Equation" /* = 0x00000037 */,
+ "ButtonDropDown" /* = 0x00000038 */,
+ "ButtonMenu" /* = 0x00000039 */,
+ "ButtonDropGrid" /* = 0x0000003A */,
+ "Whitespace" /* = 0x0000003B */,
+ "PageTabList" /* = 0x0000003C */,
+ "Clock" /* = 0x0000003D */,
+ "Splitter" /* = 0x0000003E */,
+ "LayeredPane" /* = 0x0000003F */,
+ "UserRole" /* = 0x0000ffff*/
};
if (role >=0x40)
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 605b1e6b5b..af3b79a87c 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -259,7 +259,7 @@ EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options)
// Add paint engine requirements
if (api == OpenVG) {
-#ifndef QVG_SCISSOR_CLIP
+#if !defined(QVG_SCISSOR_CLIP) && defined(EGL_ALPHA_MASK_SIZE)
configAttribs.setValue(EGL_ALPHA_MASK_SIZE, 1);
#endif
} else {
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index c214e8872a..aa08934028 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -65,6 +65,10 @@ QT_BEGIN_INCLUDE_NAMESPACE
#else
# include <EGL/egl.h>
#endif
+#if !defined(EGL_VERSION_1_2)
+typedef unsigned int EGLenum;
+typedef void *EGLClientBuffer;
+#endif
#else
//types from egltypes.h for compiling stub without EGL headers
diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h
index cae8164fcf..5bc8f09d70 100644
--- a/src/gui/egl/qeglcontext_p.h
+++ b/src/gui/egl/qeglcontext_p.h
@@ -107,6 +107,9 @@ private:
static QEglContext *currentContext(QEgl::API api);
static void setCurrentContext(QEgl::API api, QEglContext *context);
+
+ friend class QMeeGoGraphicsSystem;
+ friend class QMeeGoPixmapData;
};
QT_END_NAMESPACE
diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp
index 3638de5b37..4b8ca9a5f7 100644
--- a/src/gui/egl/qeglproperties.cpp
+++ b/src/gui/egl/qeglproperties.cpp
@@ -241,8 +241,10 @@ void QEglProperties::setRenderableType(QEgl::API api)
// reductions in complexity are possible.
bool QEglProperties::reduceConfiguration()
{
+#ifdef EGL_SWAP_BEHAVIOR
if (value(EGL_SWAP_BEHAVIOR) != EGL_DONT_CARE)
removeValue(EGL_SWAP_BEHAVIOR);
+#endif
#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
// For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't
@@ -258,7 +260,7 @@ bool QEglProperties::reduceConfiguration()
// those with smaller (but faster) lower color depths. One
// way around this is to set EGL_BUFFER_SIZE to 16, which
// trumps the others. Of course, there may not be a 16-bit
- // config avaliable, so it's the first restraint we remove.
+ // config available, so it's the first restraint we remove.
if (value(EGL_BUFFER_SIZE) == 16) {
removeValue(EGL_BUFFER_SIZE);
return true;
diff --git a/src/gui/embedded/qsoundqss_qws.cpp b/src/gui/embedded/qsoundqss_qws.cpp
index 3958cf01ae..c77c35c59c 100644
--- a/src/gui/embedded/qsoundqss_qws.cpp
+++ b/src/gui/embedded/qsoundqss_qws.cpp
@@ -286,7 +286,7 @@ public:
rightVolume = maxVolume>>1;
isPriority = false;
samples_due = 0;
- max1 = max2 = out = 0;//= sound_buffer_size;
+ max1 = max2 = out = 0;// = sound_buffer_size;
data = data1;
max = &max1;
sampleRunin = 0;
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 58395f5f20..096be63c7d 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1272,37 +1272,40 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
Returns the bounding rect of this item's children (excluding itself).
*/
-void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rect, bool doClip)
+void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rect, QGraphicsItem *topMostEffectItem)
{
Q_Q(QGraphicsItem);
QRectF childrenRect;
QRectF *result = rect;
rect = &childrenRect;
+ const bool setTopMostEffectItem = !topMostEffectItem;
for (int i = 0; i < children.size(); ++i) {
QGraphicsItem *child = children.at(i);
QGraphicsItemPrivate *childd = child->d_ptr.data();
+ if (setTopMostEffectItem)
+ topMostEffectItem = child;
bool hasPos = !childd->pos.isNull();
if (hasPos || childd->transformData) {
// COMBINE
QTransform matrix = childd->transformToParent();
if (x)
matrix *= *x;
- *rect |= matrix.mapRect(child->d_ptr->effectiveBoundingRect());
+ *rect |= matrix.mapRect(child->d_ptr->effectiveBoundingRect(topMostEffectItem));
if (!childd->children.isEmpty())
- childd->childrenBoundingRectHelper(&matrix, rect);
+ childd->childrenBoundingRectHelper(&matrix, rect, topMostEffectItem);
} else {
if (x)
- *rect |= x->mapRect(child->d_ptr->effectiveBoundingRect());
+ *rect |= x->mapRect(child->d_ptr->effectiveBoundingRect(topMostEffectItem));
else
- *rect |= child->d_ptr->effectiveBoundingRect();
+ *rect |= child->d_ptr->effectiveBoundingRect(topMostEffectItem);
if (!childd->children.isEmpty())
- childd->childrenBoundingRectHelper(x, rect);
+ childd->childrenBoundingRectHelper(x, rect, topMostEffectItem);
}
}
- if (doClip && (flags & QGraphicsItem::ItemClipsChildrenToShape)){
+ if (flags & QGraphicsItem::ItemClipsChildrenToShape){
if (x)
*rect &= x->mapRect(q->boundingRect());
else
@@ -1870,6 +1873,10 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags)
// Item children clipping changes. Propagate the ancestor flag to
// all children.
d_ptr->updateAncestorFlag(ItemClipsChildrenToShape);
+ // The childrenBoundingRect is clipped to the boundingRect in case of ItemClipsChildrenToShape,
+ // which means we have to invalidate the cached childrenBoundingRect whenever this flag changes.
+ d_ptr->dirtyChildrenBoundingRect = 1;
+ d_ptr->markParentDirty(true);
}
if ((flags & ItemIgnoresTransformations) != (oldFlags & ItemIgnoresTransformations)) {
@@ -2800,6 +2807,8 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const
Q_Q(const QGraphicsItem);
QGraphicsEffect *effect = graphicsEffect;
if (scene && effect && effect->isEnabled()) {
+ if (scene->d_func()->views.isEmpty())
+ return effect->boundingRectFor(rect);
QRectF sceneRect = q->mapRectToScene(rect);
QRectF sceneEffectRect;
foreach (QGraphicsView *view, scene->views()) {
@@ -2823,12 +2832,12 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const
\sa boundingRect()
*/
-QRectF QGraphicsItemPrivate::effectiveBoundingRect() const
+QRectF QGraphicsItemPrivate::effectiveBoundingRect(QGraphicsItem *topMostEffectItem) const
{
#ifndef QT_NO_GRAPHICSEFFECT
Q_Q(const QGraphicsItem);
QRectF brect = effectiveBoundingRect(q_ptr->boundingRect());
- if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)
+ if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren || topMostEffectItem == q)
return brect;
const QGraphicsItem *effectParent = parent;
@@ -2839,8 +2848,10 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect() const
const QRectF effectRectInParentSpace = effectParent->d_ptr->effectiveBoundingRect(brectInParentSpace);
brect = effectParent->mapRectToItem(q, effectRectInParentSpace);
}
- if (effectParent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)
+ if (effectParent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren
+ || topMostEffectItem == effectParent) {
return brect;
+ }
effectParent = effectParent->d_ptr->parent;
}
@@ -4715,7 +4726,7 @@ QRectF QGraphicsItem::childrenBoundingRect() const
return d_ptr->childrenBoundingRect;
d_ptr->childrenBoundingRect = QRectF();
- d_ptr->childrenBoundingRectHelper(0, &d_ptr->childrenBoundingRect);
+ d_ptr->childrenBoundingRectHelper(0, &d_ptr->childrenBoundingRect, 0);
d_ptr->dirtyChildrenBoundingRect = 0;
return d_ptr->childrenBoundingRect;
}
@@ -7676,6 +7687,14 @@ QGraphicsObject *QGraphicsItemPrivate::children_at(QDeclarativeListProperty<QGra
return 0;
}
+void QGraphicsItemPrivate::children_clear(QDeclarativeListProperty<QGraphicsObject> *list)
+{
+ QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object));
+ int childCount = d->children.count();
+ for (int index = 0; index < childCount; index++)
+ QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, /*newParentVariant=*/0, /*thisPointerVariant=*/0);
+}
+
/*!
Returns a list of this item's children.
@@ -7689,7 +7708,7 @@ QDeclarativeListProperty<QGraphicsObject> QGraphicsItemPrivate::childrenList()
if (isObject) {
QGraphicsObject *that = static_cast<QGraphicsObject *>(q);
return QDeclarativeListProperty<QGraphicsObject>(that, &children, children_append,
- children_count, children_at);
+ children_count, children_at, children_clear);
} else {
//QGraphicsItem is not supported for this property
return QDeclarativeListProperty<QGraphicsObject>();
@@ -11166,14 +11185,8 @@ QRectF QGraphicsItemEffectSourcePrivate::boundingRect(Qt::CoordinateSystem syste
}
QRectF rect = item->boundingRect();
- if (!item->d_ptr->children.isEmpty()) {
- if (dirtyChildrenBoundingRect) {
- childrenBoundingRect = QRectF();
- item->d_ptr->childrenBoundingRectHelper(0, &childrenBoundingRect, true);
- dirtyChildrenBoundingRect = false;
- }
- rect |= childrenBoundingRect;
- }
+ if (!item->d_ptr->children.isEmpty())
+ rect |= item->childrenBoundingRect();
if (deviceCoordinates) {
Q_ASSERT(info->painter);
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index d60dffb38c..77e4054cfa 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -300,10 +300,10 @@ public:
QDeclarativeListProperty<QGraphicsObject> childrenList();
void setParentItemHelper(QGraphicsItem *parent, const QVariant *newParentVariant,
const QVariant *thisPointerVariant);
- void childrenBoundingRectHelper(QTransform *x, QRectF *rect, bool doClip = true);
+ void childrenBoundingRectHelper(QTransform *x, QRectF *rect, QGraphicsItem *topMostEffectItem);
void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform,
const QRegion &exposedRegion, bool allItems = false) const;
- QRectF effectiveBoundingRect() const;
+ QRectF effectiveBoundingRect(QGraphicsItem *topMostEffectItem = 0) const;
QRectF sceneEffectiveBoundingRect() const;
QRectF effectiveBoundingRect(const QRectF &rect) const;
@@ -487,6 +487,7 @@ public:
static void children_append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item);
static int children_count(QDeclarativeListProperty<QGraphicsObject> *list);
static QGraphicsObject *children_at(QDeclarativeListProperty<QGraphicsObject> *list, int);
+ static void children_clear(QDeclarativeListProperty<QGraphicsObject> *list);
inline QTransform transformToParent() const;
inline void ensureSortedChildren();
@@ -660,7 +661,7 @@ class QGraphicsItemEffectSourcePrivate : public QGraphicsEffectSourcePrivate
{
public:
QGraphicsItemEffectSourcePrivate(QGraphicsItem *i)
- : QGraphicsEffectSourcePrivate(), dirtyChildrenBoundingRect(true), item(i), info(0)
+ : QGraphicsEffectSourcePrivate(), item(i), info(0)
{}
inline void detach()
@@ -711,9 +712,6 @@ public:
QGraphicsEffect::PixmapPadMode mode) const;
QRect paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded = 0) const;
- mutable bool dirtyChildrenBoundingRect;
- mutable QRectF childrenBoundingRect;
-
QGraphicsItem *item;
QGraphicsItemPaintInfo *info;
QTransform lastEffectTransform;
@@ -871,12 +869,9 @@ inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect)
#ifndef QT_NO_GRAPHICSEFFECT
if (parentp->graphicsEffect) {
if (updateBoundingRect) {
- QGraphicsItemEffectSourcePrivate *sourcep =
- static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()
- ->source->d_func());
- parentp->dirtyChildrenBoundingRect = 1;
+ static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()
+ ->source->d_func())->invalidateCache();
parentp->notifyInvalidated = 1;
- sourcep->invalidateCache();
}
if (parentp->scene && parentp->graphicsEffect->isEnabled()) {
parentp->dirty = 1;
diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp
index 23f9923d97..34ec4e048e 100644
--- a/src/gui/graphicsview/qgraphicslayoutitem.cpp
+++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp
@@ -234,7 +234,7 @@ void QGraphicsLayoutItemPrivate::setSize(Qt::SizeHint which, const QSizeF &size)
if (userSizeHints) {
if (size == userSizeHints[which])
return;
- } else if (!size.isValid()) {
+ } else if (size.width() < 0 && size.height() < 0) {
return;
}
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 99851db155..7cb442f2ae 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4751,7 +4751,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
ENSURE_TRANSFORM_PTR
QRect viewBoundingRect = translateOnlyTransform ? brect.translated(transformPtr->dx(), transformPtr->dy()).toAlignedRect()
: transformPtr->mapRect(brect).toAlignedRect();
- viewBoundingRect.adjust(-rectAdjust, -rectAdjust, rectAdjust, rectAdjust);
+ viewBoundingRect.adjust(-int(rectAdjust), -int(rectAdjust), rectAdjust, rectAdjust);
if (widget)
item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect);
drawItem = exposedRegion ? exposedRegion->intersects(viewBoundingRect)
@@ -4984,14 +4984,15 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b
return;
}
- bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents
- && !item->d_ptr->graphicsEffect;
+ bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents;
if (!hasNoContents) {
item->d_ptr->dirty = 1;
if (fullItemUpdate)
item->d_ptr->fullUpdatePending = 1;
else if (!item->d_ptr->fullUpdatePending)
item->d_ptr->needsRepaint |= rect;
+ } else if (item->d_ptr->graphicsEffect) {
+ invalidateChildren = true;
}
if (invalidateChildren) {
@@ -5270,7 +5271,6 @@ void QGraphicsScene::drawItems(QPainter *painter,
if (!d->unpolishedItems.isEmpty())
d->_q_polishItems();
- d->updateAll = false;
QTransform viewTransform = painter->worldTransform();
Q_UNUSED(options);
@@ -5279,6 +5279,7 @@ void QGraphicsScene::drawItems(QPainter *painter,
QRegion *expose = 0;
const quint32 oldRectAdjust = d->rectAdjust;
if (view) {
+ d->updateAll = false;
expose = &view->d_func()->exposedRegion;
if (view->d_func()->optimizationFlags & QGraphicsView::DontAdjustForAntialiasing)
d->rectAdjust = 1;
@@ -6137,7 +6138,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
<< g << item.data();
}
// remember the first item that received the override event
- // as it most likely become a target if noone else accepts
+ // as it most likely become a target if no one else accepts
// the override event
if (!gestureTargets.contains(g) && item)
gestureTargets.insert(g, item.data());
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 34f40a94f0..0ae54fca1b 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -151,7 +151,7 @@ QStringList QIconLoader::themeSearchPaths() const
{
if (m_iconDirs.isEmpty()) {
m_iconDirs = qt_guiPlatformPlugin()->iconThemeSearchPaths();
- // Allways add resource directory as search path
+ // Always add resource directory as search path
m_iconDirs.append(QLatin1String(":/icons"));
}
return m_iconDirs;
@@ -266,7 +266,7 @@ QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName,
PixmapEntry *iconEntry = new PixmapEntry;
iconEntry->dir = dirInfo;
iconEntry->filename = currentDir.filePath(iconName + pngext);
- // Notice we ensure that pixmap entries allways come before
+ // Notice we ensure that pixmap entries always come before
// scalable to preserve search order afterwards
entries.prepend(iconEntry);
} else if (m_supportsSvg &&
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index eda5efb9a1..e6856941de 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -134,15 +134,18 @@ static void qt_init_source(j_decompress_ptr)
static boolean qt_fill_input_buffer(j_decompress_ptr cinfo)
{
my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src;
+ qint64 num_read = 0;
if (src->memDevice) {
src->next_input_byte = (const JOCTET *)(src->memDevice->data().constData() + src->memDevice->pos());
- src->bytes_in_buffer = (size_t)(src->memDevice->data().size() - src->memDevice->pos());
- return true;
+ num_read = src->memDevice->data().size() - src->memDevice->pos();
+ src->device->seek(src->memDevice->data().size());
+ } else {
+ src->next_input_byte = src->buffer;
+ num_read = src->device->read((char*)src->buffer, max_buf);
}
- src->next_input_byte = src->buffer;
- int num_read = src->device->read((char*)src->buffer, max_buf);
if (num_read <= 0) {
// Insert a fake EOI marker - as per jpeglib recommendation
+ src->next_input_byte = src->buffer;
src->buffer[0] = (JOCTET) 0xFF;
src->buffer[1] = (JOCTET) JPEG_EOI;
src->bytes_in_buffer = 2;
@@ -183,13 +186,7 @@ static void qt_term_source(j_decompress_ptr cinfo)
{
my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src;
if (!src->device->isSequential())
- {
- // read() isn't used for memDevice, so seek past everything that was used
- if (src->memDevice)
- src->device->seek(src->device->pos() + (src->memDevice->data().size() - src->memDevice->pos() - src->bytes_in_buffer));
- else
- src->device->seek(src->device->pos() - src->bytes_in_buffer);
- }
+ src->device->seek(src->device->pos() - src->bytes_in_buffer);
}
#if defined(Q_C_CALLBACKS)
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index d5db431423..4cfadf8c5d 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -579,7 +579,7 @@ int QPixmap::height() const
*/
QSize QPixmap::size() const
{
- return data ? QSize(data->width(), data->height()) : QSize();
+ return data ? QSize(data->width(), data->height()) : QSize(0, 0);
}
/*!
@@ -1177,8 +1177,12 @@ Qt::HANDLE QPixmap::handle() const
{
#if defined(Q_WS_X11)
const QPixmapData *pd = pixmapData();
- if (pd && pd->classId() == QPixmapData::X11Class)
- return static_cast<const QX11PixmapData*>(pd)->handle();
+ if (pd) {
+ if (pd->classId() == QPixmapData::X11Class)
+ return static_cast<const QX11PixmapData*>(pd)->handle();
+ else
+ qWarning("QPixmap::handle(): Pixmap is not an X11 class pixmap");
+ }
#endif
return 0;
}
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index 70770c47ce..26bffcc866 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -764,10 +764,17 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp
}
if (transposed == 0) {
- qt_memrotate90(reinterpret_cast<const quint32*>(temp.bits()),
- temp.width(), temp.height(), temp.bytesPerLine(),
- reinterpret_cast<quint32*>(img.bits()),
- img.bytesPerLine());
+ if (img.depth() == 8) {
+ qt_memrotate90(reinterpret_cast<const quint8*>(temp.bits()),
+ temp.width(), temp.height(), temp.bytesPerLine(),
+ reinterpret_cast<quint8*>(img.bits()),
+ img.bytesPerLine());
+ } else {
+ qt_memrotate90(reinterpret_cast<const quint32*>(temp.bits()),
+ temp.width(), temp.height(), temp.bytesPerLine(),
+ reinterpret_cast<quint32*>(img.bits()),
+ img.bytesPerLine());
+ }
} else {
img = temp;
}
diff --git a/src/gui/itemviews/qabstractproxymodel.cpp b/src/gui/itemviews/qabstractproxymodel.cpp
index 4d4b3d83fa..51dfa7a86e 100644
--- a/src/gui/itemviews/qabstractproxymodel.cpp
+++ b/src/gui/itemviews/qabstractproxymodel.cpp
@@ -190,8 +190,12 @@ QItemSelection QAbstractProxyModel::mapSelectionToSource(const QItemSelection &p
{
QModelIndexList proxyIndexes = proxySelection.indexes();
QItemSelection sourceSelection;
- for (int i = 0; i < proxyIndexes.size(); ++i)
- sourceSelection << QItemSelectionRange(mapToSource(proxyIndexes.at(i)));
+ for (int i = 0; i < proxyIndexes.size(); ++i) {
+ const QModelIndex proxyIdx = mapToSource(proxyIndexes.at(i));
+ if (!proxyIdx.isValid())
+ continue;
+ sourceSelection << QItemSelectionRange(proxyIdx);
+ }
return sourceSelection;
}
@@ -204,8 +208,12 @@ QItemSelection QAbstractProxyModel::mapSelectionFromSource(const QItemSelection
{
QModelIndexList sourceIndexes = sourceSelection.indexes();
QItemSelection proxySelection;
- for (int i = 0; i < sourceIndexes.size(); ++i)
- proxySelection << QItemSelectionRange(mapFromSource(sourceIndexes.at(i)));
+ for (int i = 0; i < sourceIndexes.size(); ++i) {
+ const QModelIndex srcIdx = mapFromSource(sourceIndexes.at(i));
+ if (!srcIdx.isValid())
+ continue;
+ proxySelection << QItemSelectionRange(srcIdx);
+ }
return proxySelection;
}
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index 953a7f1774..dc8d93814f 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -2230,6 +2230,14 @@ void QSortFilterProxyModel::setFilterFixedString(const QString &pattern)
\brief whether the proxy model is dynamically sorted and filtered
whenever the contents of the source model change
+ Note that you should not update the source model through the proxy
+ model when dynamicSortFilter is true. For instance, if you set the
+ proxy model on a QComboBox, then using functions that update the
+ model, e.g., \l{QComboBox::}{addItem()}, will not work as
+ expected. An alternative is to set dynamicSortFilter to false and
+ call \l{QSortFilterProxyModel::}{sort()} after adding items to the
+ QComboBox.
+
The default value is false.
*/
bool QSortFilterProxyModel::dynamicSortFilter() const
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index a6d2594f6f..f7e07510fc 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -82,8 +82,9 @@ static QString qt_strippedText(QString s)
QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0),
visible(1), forceInvisible(0), checkable(0), checked(0), separator(0), fontSet(false),
forceEnabledInSoftkeys(false), menuActionSoftkeys(false),
+ iconVisibleInMenu(-1),
menuRole(QAction::TextHeuristicRole), softKeyRole(QAction::NoSoftKey),
- priority(QAction::NormalPriority), iconVisibleInMenu(-1)
+ priority(QAction::NormalPriority)
{
#ifdef QT3_SUPPORT
static int qt_static_action_id = -1;
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 5103f10891..d97a57ef0f 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -65,6 +65,7 @@
#include "qcolormap.h"
#include "qdebug.h"
#include "private/qgraphicssystemfactory_p.h"
+#include "private/qgraphicssystem_p.h"
#include "private/qstylesheetstyle_p.h"
#include "private/qstyle_p.h"
#include "qmessagebox.h"
@@ -94,6 +95,10 @@
#include <stdlib.h>
+#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
+#include <link.h>
+#endif
+
#include "qapplication_p.h"
#include "qevent_p.h"
#include "qwidget_p.h"
@@ -487,6 +492,7 @@ bool QApplicationPrivate::fade_tooltip = false;
bool QApplicationPrivate::animate_toolbox = false;
bool QApplicationPrivate::widgetCount = false;
bool QApplicationPrivate::load_testability = false;
+QString QApplicationPrivate::qmljsDebugArguments;
#ifdef QT_KEYPAD_NAVIGATION
# ifdef Q_OS_SYMBIAN
Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional;
@@ -558,6 +564,8 @@ void QApplicationPrivate::process_cmdline()
QString s;
if (arg == "-qdevel" || arg == "-qdebug") {
// obsolete argument
+ } else if (arg.indexOf("-qmljsdebugger=", 0) != -1) {
+ qmljsDebugArguments = QString::fromLocal8Bit(arg.right(arg.length() - 15));
} else if (arg.indexOf("-style=", 0) != -1) {
s = QString::fromLocal8Bit(arg.right(arg.length() - 7).toLower());
} else if (arg == "-style" && i < argc-1) {
@@ -663,6 +671,9 @@ void QApplicationPrivate::process_cmdline()
Qt::RightToLeft
\o -graphicssystem, sets the backend to be used for on-screen widgets
and QPixmaps. Available options are \c{raster} and \c{opengl}.
+ \o -qmljsdebugger=, activates the QML/JS debugger with a specified port.
+ The value must be of format port:1234[,block], where block is optional
+ and will make the application wait until a debugger connects to it.
\endlist
The X11 version of Qt supports some traditional X11 command line options:
@@ -766,6 +777,13 @@ QApplication::QApplication(int &argc, char **argv, Type type , int _internal)
: QCoreApplication(*new QApplicationPrivate(argc, argv, type, _internal))
{ Q_D(QApplication); d->construct(); }
+#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
+static int qt_matchLibraryName(dl_phdr_info *info, size_t, void *data)
+{
+ const char *name = static_cast<const char *>(data);
+ return strstr(info->dlpi_name, name) != 0;
+}
+#endif
/*!
\internal
@@ -783,6 +801,19 @@ void QApplicationPrivate::construct(
// the environment variable has the lowest precedence of runtime graphicssystem switches
if (graphics_system_name.isEmpty())
graphics_system_name = QString::fromLocal8Bit(qgetenv("QT_GRAPHICSSYSTEM"));
+
+#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
+ if (graphics_system_name.isEmpty()) {
+ bool linksWithMeeGoTouch = dl_iterate_phdr(qt_matchLibraryName, const_cast<char *>("libmeegotouchcore"));
+ bool linksWithMeeGoGraphicsSystemHelper = dl_iterate_phdr(qt_matchLibraryName, const_cast<char *>("libQtMeeGoGraphicsSystemHelper"));
+
+ if (linksWithMeeGoTouch && !linksWithMeeGoGraphicsSystemHelper) {
+ qWarning("Running non-meego graphics system enabled MeeGo touch, forcing native graphicssystem\n");
+ graphics_system_name = QLatin1String("native");
+ }
+ }
+#endif
+
// Must be called before initialize()
qt_init(this, qt_appType
#ifdef Q_WS_X11
@@ -1114,6 +1145,8 @@ QApplication::~QApplication()
QApplicationPrivate::app_style = 0;
delete QApplicationPrivate::app_icon;
QApplicationPrivate::app_icon = 0;
+ delete QApplicationPrivate::graphics_system;
+ QApplicationPrivate::graphics_system = 0;
#ifndef QT_NO_CURSOR
d->cursor_list.clear();
#endif
@@ -4333,11 +4366,13 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
eventAccepted = ge.isAccepted();
for (int i = 0; i < gestures.size(); ++i) {
QGesture *g = gestures.at(i);
- if ((res && eventAccepted) || (!eventAccepted && ge.isAccepted(g))) {
+ // Ignore res [event return value] because handling of multiple gestures
+ // packed into a single QEvent depends on not consuming the event
+ if (eventAccepted || ge.isAccepted(g)) {
// if the gesture was accepted, mark the target widget for it
gestureEvent->d_func()->targetWidgets[g->gestureType()] = w;
gestureEvent->setAccepted(g, true);
- } else if (!eventAccepted && !ge.isAccepted(g)) {
+ } else {
// if the gesture was explicitly ignored by the application,
// put it back so a parent can get it
allGestures.append(g);
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 5f200c0763..18ec0dfabc 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -446,6 +446,8 @@ public:
static bool animate_toolbox;
static bool widgetCount; // Coupled with -widgetcount switch
static bool load_testability; // Coupled with -testability switch
+ static QString qmljsDebugArguments; // a string containing arguments for js/qml debugging.
+
#ifdef Q_WS_MAC
static bool native_modal_dialog_active;
#endif
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index cb36b4596d..b4cebd7cad 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -400,11 +400,39 @@ QTabletDeviceDataList *qt_tablet_devices()
extern bool qt_tabletChokeMouse;
#endif
+typedef bool(*QX11FilterFunction)(XEvent *event);
+
+Q_GLOBAL_STATIC(QList<QX11FilterFunction>, x11Filters)
+
+Q_GUI_EXPORT void qt_installX11EventFilter(QX11FilterFunction func)
+{
+ Q_ASSERT(func);
+
+ if (QList<QX11FilterFunction> *list = x11Filters())
+ list->append(func);
+}
+
+Q_GUI_EXPORT void qt_removeX11EventFilter(QX11FilterFunction func)
+{
+ Q_ASSERT(func);
+
+ if (QList<QX11FilterFunction> *list = x11Filters())
+ list->removeOne(func);
+}
+
+
static bool qt_x11EventFilter(XEvent* ev)
{
long unused;
if (qApp->filterEvent(ev, &unused))
return true;
+ if (const QList<QX11FilterFunction> *list = x11Filters()) {
+ for (QList<QX11FilterFunction>::const_iterator it = list->constBegin(); it != list->constEnd(); ++it) {
+ if ((*it)(ev))
+ return true;
+ }
+ }
+
return qApp->x11EventFilter(ev);
}
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index 13274c4630..5725a228a0 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -775,4 +775,6 @@ int QTapAndHoldGesturePrivate::Timeout = 700; // in ms
QT_END_NAMESPACE
+#include <moc_qgesture.cpp>
+
#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h
index dcb02648a1..841670817d 100644
--- a/src/gui/kernel/qgesture.h
+++ b/src/gui/kernel/qgesture.h
@@ -54,6 +54,7 @@
QT_BEGIN_HEADER
Q_DECLARE_METATYPE(Qt::GestureState)
+Q_DECLARE_METATYPE(Qt::GestureType)
QT_BEGIN_NAMESPACE
@@ -112,6 +113,8 @@ class Q_GUI_EXPORT QPanGesture : public QGesture
Q_PROPERTY(QPointF offset READ offset WRITE setOffset)
Q_PROPERTY(QPointF delta READ delta STORED false)
Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration)
+ Q_PRIVATE_PROPERTY(QPanGesture::d_func(), qreal horizontalVelocity READ horizontalVelocity WRITE setHorizontalVelocity)
+ Q_PRIVATE_PROPERTY(QPanGesture::d_func(), qreal verticalVelocity READ verticalVelocity WRITE setVerticalVelocity)
public:
QPanGesture(QObject *parent = 0);
@@ -210,6 +213,7 @@ class Q_GUI_EXPORT QSwipeGesture : public QGesture
Q_PROPERTY(SwipeDirection horizontalDirection READ horizontalDirection STORED false)
Q_PROPERTY(SwipeDirection verticalDirection READ verticalDirection STORED false)
Q_PROPERTY(qreal swipeAngle READ swipeAngle WRITE setSwipeAngle)
+ Q_PRIVATE_PROPERTY(QSwipeGesture::d_func(), qreal velocity READ velocity WRITE setVelocity)
public:
enum SwipeDirection { NoDirection, Left, Right, Up, Down };
diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h
index 29b923e156..6a856acee6 100644
--- a/src/gui/kernel/qgesture_p.h
+++ b/src/gui/kernel/qgesture_p.h
@@ -88,14 +88,21 @@ class QPanGesturePrivate : public QGesturePrivate
public:
QPanGesturePrivate()
- : acceleration(0)
+ : acceleration(0), xVelocity(0), yVelocity(0)
{
}
+ qreal horizontalVelocity() const { return xVelocity; }
+ void setHorizontalVelocity(qreal value) { xVelocity = value; }
+ qreal verticalVelocity() const { return yVelocity; }
+ void setVerticalVelocity(qreal value) { yVelocity = value; }
+
QPointF lastOffset;
QPointF offset;
QPoint startPosition;
qreal acceleration;
+ qreal xVelocity;
+ qreal yVelocity;
};
class QPinchGesturePrivate : public QGesturePrivate
@@ -105,7 +112,7 @@ class QPinchGesturePrivate : public QGesturePrivate
public:
QPinchGesturePrivate()
: totalChangeFlags(0), changeFlags(0),
- totalScaleFactor(0), lastScaleFactor(0), scaleFactor(0),
+ totalScaleFactor(1), lastScaleFactor(1), scaleFactor(1),
totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0),
isNewSequence(true)
{
@@ -139,17 +146,20 @@ public:
: horizontalDirection(QSwipeGesture::NoDirection),
verticalDirection(QSwipeGesture::NoDirection),
swipeAngle(0),
- started(false), speed(0)
+ started(false), velocityValue(0)
{
}
+ qreal velocity() const { return velocityValue; }
+ void setVelocity(qreal value) { velocityValue = value; }
+
QSwipeGesture::SwipeDirection horizontalDirection;
QSwipeGesture::SwipeDirection verticalDirection;
qreal swipeAngle;
QPoint lastPositions[3];
bool started;
- qreal speed;
+ qreal velocityValue;
QElapsedTimer time;
};
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index 5c8034082e..6dd8127690 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -184,7 +184,7 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ
// get or create a QGesture object that will represent the state for a given object, used by the recognizer
QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recognizer, Qt::GestureType type)
{
- // if the widget is being deleted we should be carefull and not to
+ // if the widget is being deleted we should be careful not to
// create a new state, as it will create QWeakPointer which doesnt work
// from the destructor.
if (object->isWidgetType()) {
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 562227acf6..e14a9198a6 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -590,7 +590,7 @@ static const struct {
//: Button that will hang up if we're in call, or make a call if we're not.
{ Qt::Key_ToggleCallHangup, QT_TRANSLATE_NOOP("QShortcut", "Toggle Call/Hangup") },
{ Qt::Key_Flip, QT_TRANSLATE_NOOP("QShortcut", "Flip") },
- //: Button to trigger voice dialling
+ //: Button to trigger voice dialing
{ Qt::Key_VoiceDial, QT_TRANSLATE_NOOP("QShortcut", "Voice Dial") },
//: Button to redial the last number called
{ Qt::Key_LastNumberRedial, QT_TRANSLATE_NOOP("QShortcut", "Last Number Redial") },
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index 127e150979..893ba2b282 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -199,6 +199,7 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state,
d->startPosition[1] = p2.screenPos();
}
QLineF line(p1.screenPos(), p2.screenPos());
+ QLineF lastLine(p1.lastScreenPos(), p2.lastScreenPos());
QLineF tmp(line);
tmp.setLength(line.length() / 2.);
QPointF centerPoint = tmp.p2();
@@ -207,16 +208,15 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state,
d->centerPoint = centerPoint;
d->changeFlags |= QPinchGesture::CenterPointChanged;
- const qreal scaleFactor =
- QLineF(p1.screenPos(), p2.screenPos()).length()
- / QLineF(d->startPosition[0], d->startPosition[1]).length();
+ const qreal scaleFactor = line.length() / lastLine.length();
+
if (d->isNewSequence) {
d->lastScaleFactor = scaleFactor;
} else {
d->lastScaleFactor = d->scaleFactor;
}
d->scaleFactor = scaleFactor;
- d->totalScaleFactor += d->scaleFactor - d->lastScaleFactor;
+ d->totalScaleFactor = d->totalScaleFactor * scaleFactor;
d->changeFlags |= QPinchGesture::ScaleFactorChanged;
qreal angle = QLineF(p1.screenPos(), p2.screenPos()).angle();
@@ -266,7 +266,7 @@ void QPinchGestureRecognizer::reset(QGesture *state)
d->totalChangeFlags = d->changeFlags = 0;
d->startCenterPoint = d->lastCenterPoint = d->centerPoint = QPointF();
- d->totalScaleFactor = d->lastScaleFactor = d->scaleFactor = 0;
+ d->totalScaleFactor = d->lastScaleFactor = d->scaleFactor = 1;
d->totalRotationAngle = d->lastRotationAngle = d->rotationAngle = 0;
d->isNewSequence = true;
@@ -304,7 +304,7 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state,
switch (event->type()) {
case QEvent::TouchBegin: {
- d->speed = 1;
+ d->velocityValue = 1;
d->time.start();
d->started = true;
result = QGestureRecognizer::MayBeGesture;
@@ -345,7 +345,7 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state,
int elapsedTime = d->time.restart();
if (!elapsedTime)
elapsedTime = 1;
- d->speed = 0.9 * d->speed + distance / elapsedTime;
+ d->velocityValue = 0.9 * d->velocityValue + distance / elapsedTime;
d->swipeAngle = QLineF(p1.startScreenPos(), p1.screenPos()).angle();
static const int MoveThreshold = 50;
@@ -407,7 +407,7 @@ void QSwipeGestureRecognizer::reset(QGesture *state)
d->lastPositions[0] = d->lastPositions[1] = d->lastPositions[2] = QPoint();
d->started = false;
- d->speed = 0;
+ d->velocityValue = 0;
d->time.invalidate();
QGestureRecognizer::reset(state);
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 9e50d880ee..cffad1d4c6 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -1194,7 +1194,7 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w)
flags |= Qt::WindowTitleHint;
}
if (customize)
- ; // don't modify window flags if the user explicitely set them.
+ ; // don't modify window flags if the user explicitly set them.
else if (type == Qt::Dialog || type == Qt::Sheet)
#ifndef Q_WS_WINCE
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint;
@@ -7489,7 +7489,7 @@ void QWidgetPrivate::hide_helper()
A hidden widget will only become visible when show() is called on
it. It will not be automatically shown when the parent is shown.
- To check visiblity, use !isVisible() instead (notice the exclamation mark).
+ To check visibility, use !isVisible() instead (notice the exclamation mark).
isHidden() implies !isVisible(), but a widget can be not visible
and not hidden at the same time. This is the case for widgets that are children of
@@ -11105,7 +11105,7 @@ void QWidget::updateMicroFocus()
{
#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN))
Q_D(QWidget);
- // and optimisation to update input context only it has already been created.
+ // and optimization to update input context only it has already been created.
if (d->ic || qApp->d_func()->inputContext) {
QInputContext *ic = inputContext();
if (ic)
@@ -11850,8 +11850,8 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction)
Tells us if it there is currently a reachable widget by keypad navigation in
a certain \a orientation.
- If no navigation is possible, occuring key events in that \a orientation may
- be used to interact with the value in the focussed widget, even though it
+ If no navigation is possible, occurring key events in that \a orientation may
+ be used to interact with the value in the focused widget, even though it
currently has not the editFocus.
\sa QWidgetPrivate::widgetInNavigationDirection(), QWidget::hasEditFocus()
@@ -11871,7 +11871,7 @@ bool QWidgetPrivate::canKeypadNavigate(Qt::Orientation orientation)
one, left/right key events will be used to switch between tabs in keypad
navigation. If there is no QTabWidget, the horizontal key events can be used
to
- interact with the value in the focussed widget, even though it currently has
+ interact with the value in the focused widget, even though it currently has
not the editFocus.
\sa QWidget::hasEditFocus()
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index ef7e1d3ec7..5e41efa42e 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -114,6 +114,9 @@
QT_BEGIN_NAMESPACE
+// qmainwindow.cpp
+extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);
+
#define XCOORD_MAX 16383
#define WRECT_MAX 8191
@@ -2375,7 +2378,8 @@ void QWidgetPrivate::recreateMacWindow()
HIViewRemoveFromSuperview(myView);
determineWindowClass();
createWindow_sys();
- if (QMainWindowLayout *mwl = qobject_cast<QMainWindowLayout *>(q->layout())) {
+
+ if (QMainWindowLayout *mwl = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q))) {
mwl->updateHIToolBarStatus();
}
@@ -2912,7 +2916,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
// We do this down below for wasCreated, so avoid doing this twice
// (only for performance, it gets called a lot anyway).
if (!wasCreated) {
- if (QMainWindowLayout *mwl = qobject_cast<QMainWindowLayout *>(q->layout())) {
+ if (QMainWindowLayout *mwl = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q))) {
mwl->updateHIToolBarStatus();
}
}
@@ -2937,7 +2941,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
// If we were a unified window, We just transfered our toolbars out of the unified toolbar.
// So redo the status one more time. It apparently is not an issue with Cocoa.
if (q->isWindow()) {
- if (QMainWindowLayout *mwl = qobject_cast<QMainWindowLayout *>(q->layout())) {
+ if (QMainWindowLayout *mwl = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q))) {
mwl->updateHIToolBarStatus();
}
}
@@ -5138,7 +5142,7 @@ void QWidgetPrivate::macUpdateMetalAttribute()
return;
recreateMacWindow();
#else
- QMainWindowLayout *layout = qobject_cast<QMainWindowLayout *>(q->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q));
if (q->testAttribute(Qt::WA_MacBrushedMetal)) {
if (layout)
layout->updateHIToolBarStatus();
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 04104fae3f..91e74b558d 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -522,7 +522,7 @@ void QWidgetPrivate::show_sys()
if (q->windowState() & Qt::WindowMaximized) {
TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
id->SetExtent(r.iTl, r.Size());
- } else if (!q->testAttribute(Qt::WA_Moved)) {
+ } else if (!q->testAttribute(Qt::WA_Moved) && q->windowType() != Qt::Dialog) {
id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl);
}
}
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index d3061d8a2b..d0788c70dc 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -1218,17 +1218,16 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
\o QConicalGradient
\endtable
- The colors in a gradient is defined using stop points of the
- QGradientStop type, i.e. a position and a color. Use the
- setColorAt() function to define a single stop
- point. Alternatively, use the setStops() function to define
- several stop points in one go. Note that the latter function \e
- replaces the current set of stop points.
+ The colors in a gradient are defined using stop points of the
+ QGradientStop type; i.e., a position and a color. Use the setColorAt()
+ function to define a single stop point. Alternatively, use the
+ setStops() function to define several stop points in one go. Note that
+ the latter function \e replaces the current set of stop points.
It is the gradient's complete set of stop points (accessible
through the stops() function) that describes how the gradient area
- should be filled. If no stop points have been specified, a
- gradient of black at 0 to white at 1 is used.
+ should be filled. If no stop points have been specified, a gradient
+ of black at 0 to white at 1 is used.
A diagonal linear gradient from black at (100, 100) to white at
(200, 200) could be specified like this:
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index bd5b0bdf09..5f190ba1ce 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -4835,7 +4835,7 @@ void QT_FASTCALL blendUntransformed_dest24(DST *dest, const SRC *src,
if (SRC::hasAlpha()) {
while (length >= 4) {
- const quint32 alpha = BYTE_MUL(uint(alpha_4(src)), uint(coverage));
+ const quint32 alpha = QT_PREPEND_NAMESPACE(BYTE_MUL)(uint(alpha_4(src)), uint(coverage));
if (alpha)
interpolate_pixel_4(dest, src, alpha);
length -= 4;
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index ba2ba323f9..f97d86540c 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -266,10 +266,10 @@ void qt_memfill32_sse2(quint32 *dest, quint32 value, int count)
int n = (count128 + 3) / 4;
switch (count128 & 0x3) {
- case 0: do { _mm_store_si128(dst128++, value128);
- case 3: _mm_store_si128(dst128++, value128);
- case 2: _mm_store_si128(dst128++, value128);
- case 1: _mm_store_si128(dst128++, value128);
+ case 0: do { _mm_stream_si128(dst128++, value128);
+ case 3: _mm_stream_si128(dst128++, value128);
+ case 2: _mm_stream_si128(dst128++, value128);
+ case 1: _mm_stream_si128(dst128++, value128);
} while (--n > 0);
}
@@ -300,11 +300,14 @@ void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, u
const __m128i half = _mm_set1_epi16(0x80);
const __m128i minusAlphaOfColorVector = _mm_set1_epi16(minusAlphaOfColor);
+ ALIGNMENT_PROLOGUE_16BYTES(dst, x, length)
+ destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
+
for (; x < length-3; x += 4) {
- __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]);
+ __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);
BYTE_MUL_SSE2(dstVector, dstVector, minusAlphaOfColorVector, colorMask, half);
dstVector = _mm_add_epi8(colorVector, dstVector);
- _mm_storeu_si128((__m128i *)&dst[x], dstVector);
+ _mm_store_si128((__m128i *)&dst[x], dstVector);
}
for (;x < length; ++x)
destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp
index 4cb40895ba..fb5602e5c3 100644
--- a/src/gui/painting/qdrawhelper_ssse3.cpp
+++ b/src/gui/painting/qdrawhelper_ssse3.cpp
@@ -79,69 +79,6 @@ inline static void blend_pixel(quint32 &dst, const quint32 src)
}
-#define BLEND_SOURCE_OVER_ARGB32_FIRST_ROW_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \
- int x = 0; \
-\
- /* First, get dst aligned. */ \
- const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;\
- const int prologLength = qMin(length, offsetToAlignOn16Bytes);\
-\
- for (; x < prologLength; ++x) {\
- blend_pixel(dst[x], src[x]); \
- } \
-\
- const int minusOffsetToAlignSrcOn16Bytes = (reinterpret_cast<quintptr>(&(src[x])) >> 2) & 0x3;\
-\
- if (!minusOffsetToAlignSrcOn16Bytes) {\
- /* src is aligned, usual algorithm but with aligned operations.\
- See the SSE2 version for more documentation on the algorithm itself. */\
- const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\
- for (; x < length-3; x += 4) { \
- const __m128i srcVector = _mm_load_si128((__m128i *)&src[x]); \
- const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \
- if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \
- _mm_store_si128((__m128i *)&dst[x], srcVector); \
- } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \
- __m128i alphaChannel = _mm_shuffle_epi8(srcVector, alphaShuffleMask); \
- alphaChannel = _mm_sub_epi16(one, alphaChannel); \
- const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \
- __m128i destMultipliedByOneMinusAlpha; \
- BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \
- const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \
- _mm_store_si128((__m128i *)&dst[x], result); \
- } \
- } /* end for() */\
- } else if ((length - x) >= 8) {\
- /* We are at the first line, so "x - minusOffsetToAlignSrcOn16Bytes" could go before src, and\
- generate an invalid access. */\
-\
- /* We use two vectors to extract the src: prevLoaded for the first pixels, lastLoaded for the current pixels. */\
- __m128i srcVectorPrevLoaded;\
- if (minusOffsetToAlignSrcOn16Bytes > prologLength) {\
- /* We go forward 4 pixels to avoid reading before src. */\
- for (; x < prologLength + 4; ++x)\
- blend_pixel(dst[x], src[x]); \
- }\
- srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\
- const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;\
-\
- const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\
- switch (palignrOffset) {\
- case 4:\
- BLENDING_LOOP(4, length)\
- break;\
- case 8:\
- BLENDING_LOOP(8, length)\
- break;\
- case 12:\
- BLENDING_LOOP(12, length)\
- break;\
- }\
- }\
- for (; x < length; ++x) \
- blend_pixel(dst[x], src[x]); \
-}
-
// Basically blend src over dst with the const alpha defined as constAlphaVector.
// nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as:
//const __m128i nullVector = _mm_set1_epi32(0);
@@ -153,7 +90,7 @@ inline static void blend_pixel(quint32 &dst, const quint32 src)
// The computation being done is:
// result = s + d * (1-alpha)
// with shortcuts if fully opaque or fully transparent.
-#define BLEND_SOURCE_OVER_ARGB32_MAIN_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \
+#define BLEND_SOURCE_OVER_ARGB32_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \
int x = 0; \
\
/* First, get dst aligned. */ \
@@ -218,14 +155,8 @@ void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl,
const __m128i one = _mm_set1_epi16(0xff);
const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
- // We have to unrol the first row in order to deal with the load on unaligned data
- // prior to the src pointer.
- BLEND_SOURCE_OVER_ARGB32_FIRST_ROW_SSSE3(dst, src, w, nullVector, half, one, colorMask, alphaMask);
- dst = (quint32 *)(((uchar *) dst) + dbpl);
- src = (const quint32 *)(((const uchar *) src) + sbpl);
-
- for (int y = 1; y < h; ++y) {
- BLEND_SOURCE_OVER_ARGB32_MAIN_SSSE3(dst, src, w, nullVector, half, one, colorMask, alphaMask);
+ for (int y = 0; y < h; ++y) {
+ BLEND_SOURCE_OVER_ARGB32_SSSE3(dst, src, w, nullVector, half, one, colorMask, alphaMask);
dst = (quint32 *)(((uchar *) dst) + dbpl);
src = (const quint32 *)(((const uchar *) src) + sbpl);
}
diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp
index 2828e9db61..a9fbbeeb2f 100644
--- a/src/gui/painting/qgraphicssystem_runtime.cpp
+++ b/src/gui/painting/qgraphicssystem_runtime.cpp
@@ -94,7 +94,8 @@ QRuntimePixmapData::QRuntimePixmapData(const QRuntimeGraphicsSystem *gs, PixelTy
QRuntimePixmapData::~QRuntimePixmapData()
{
- m_graphicsSystem->removePixmapData(this);
+ if (QApplicationPrivate::graphics_system)
+ m_graphicsSystem->removePixmapData(this);
delete m_data;
}
@@ -258,7 +259,8 @@ QRuntimeWindowSurface::QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, Q
QRuntimeWindowSurface::~QRuntimeWindowSurface()
{
- m_graphicsSystem->removeWindowSurface(this);
+ if (QApplicationPrivate::graphics_system)
+ m_graphicsSystem->removeWindowSurface(this);
}
QPaintDevice *QRuntimeWindowSurface::paintDevice()
diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h
index 02322418fe..421fbeb941 100644
--- a/src/gui/painting/qgraphicssystem_runtime_p.h
+++ b/src/gui/painting/qgraphicssystem_runtime_p.h
@@ -177,6 +177,7 @@ private:
friend class QRuntimePixmapData;
friend class QRuntimeWindowSurface;
+ friend class QMeeGoGraphicsSystem;
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 881bd6e145..1e857e4c91 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -768,7 +768,7 @@ void QPaintEngineEx::drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yR
x1, y2 - (1 - KAPPA) * yRadius,
x1, y2 - yRadius,
x1, y1 + yRadius, // LineTo
- x1, y1 + KAPPA * yRadius, // CurveTo
+ x1, y1 + (1 - KAPPA) * yRadius, // CurveTo
x1 + (1 - KAPPA) * xRadius, y1,
x1 + xRadius, y1
};
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 004d9cd7e9..8f54a2e944 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -8932,7 +8932,7 @@ QPainterPath QPaintEngineState::clipPath() const
}
/*!
- Returns wether clipping is enabled or not in the current paint
+ Returns whether clipping is enabled or not in the current paint
engine state.
This variable should only be used when the state() returns a
diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp
index dd4de997b5..afae0a51e5 100644
--- a/src/gui/painting/qprintengine_win.cpp
+++ b/src/gui/painting/qprintengine_win.cpp
@@ -851,7 +851,7 @@ void QWin32PrintEnginePrivate::strokePath_dev(const QPainterPath &path, const QC
HPEN pen = ExtCreatePen(((penWidth == 0) ? PS_COSMETIC : PS_GEOMETRIC)
| PS_SOLID | capStyle | joinStyle,
- penWidth, &brush, 0, 0);
+ (penWidth == 0) ? 1 : penWidth, &brush, 0, 0);
HGDIOBJ old_pen = SelectObject(hdc, pen);
StrokePath(hdc);
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index bfeef725f8..3412f9b21a 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -1699,8 +1699,8 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include <limits.h>
QT_END_INCLUDE_NAMESPACE
-/* 1 if two BOXs overlap.
- * 0 if two BOXs do not overlap.
+/* 1 if two BOXes overlap.
+ * 0 if two BOXes do not overlap.
* Remember, x2 and y2 are not in the region
*/
#define EXTENTCHECK(r1, r2) \
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index eabbd8a602..9cff3390be 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -609,7 +609,7 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine
}
QLineF miterLine(QPointF(qt_fixed_to_real(focal_x),
qt_fixed_to_real(focal_y)), isect);
- if (miterLine.length() > qt_fixed_to_real(m_strokeWidth * m_miterLimit) / 2) {
+ if (type == QLineF::NoIntersection || miterLine.length() > qt_fixed_to_real(m_strokeWidth * m_miterLimit) / 2) {
emitLineTo(qt_real_to_fixed(nextLine.x1()),
qt_real_to_fixed(nextLine.y1()));
} else {
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index f02c798f62..9116a1e061 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -491,6 +491,24 @@ QPalette* QS60StylePrivate::themePalette()
return m_themePalette;
}
+bool QS60StylePrivate::equalToThemePalette(QColor color, QPalette::ColorRole role)
+{
+ if (!m_themePalette)
+ return false;
+ if (color == m_themePalette->color(role))
+ return true;
+ return false;
+}
+
+bool QS60StylePrivate::equalToThemePalette(qint64 cacheKey, QPalette::ColorRole role)
+{
+ if (!m_themePalette)
+ return false;
+ if (cacheKey == m_themePalette->brush(role).texture().cacheKey())
+ return true;
+ return false;
+}
+
void QS60StylePrivate::setBackgroundTexture(QApplication *app) const
{
Q_UNUSED(app)
@@ -1430,11 +1448,25 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &voptAdj, widget);
QRect textRect = subElementRect(SE_ItemViewItemText, &voptAdj, widget);
const QAbstractItemView *itemView = qobject_cast<const QAbstractItemView *>(widget);
+ const bool singleSelection =
+ (itemView->selectionMode() == QAbstractItemView::SingleSelection ||
+ itemView->selectionMode() == QAbstractItemView::NoSelection);
+ const bool selectItems = (itemView->selectionBehavior() == QAbstractItemView::SelectItems);
- // draw themed background for table unless background brush has been defined.
+ // draw themed background for itemview unless background brush has been defined.
if (vopt->backgroundBrush == Qt::NoBrush) {
if (itemView) {
+ //With single item selection, use highlight focus as selection indicator.
+ if (singleSelection && isSelected){
+ voptAdj.state = voptAdj.state | State_HasFocus;
+ if (!hasFocus && selectItems) {
+ painter->save();
+ painter->setOpacity(0.5);
+ }
+ }
drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);
+ if (singleSelection && isSelected && !hasFocus && selectItems)
+ painter->restore();
}
} else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);}
@@ -1443,28 +1475,20 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
const QIcon::State state = (voptAdj.state & State_Open) ? QIcon::On : QIcon::Off;
voptAdj.icon.paint(painter, iconRect, voptAdj.decorationAlignment, mode, state);
- // Draw selection check mark. Show check mark only in multi selection modes.
- if (itemView) {
- const bool singleSelection =
- (itemView->selectionMode() == QAbstractItemView::SingleSelection ||
- itemView->selectionMode() == QAbstractItemView::NoSelection)||
- (itemView->selectionModel()->selectedIndexes().count() < 2 );
-
- const bool selectItemsOnly = (itemView->selectionBehavior() == QAbstractItemView::SelectItems);
-
+ // Draw selection check mark or checkbox
+ if (itemView && (!singleSelection || (vopt->features & QStyleOptionViewItemV2::HasCheckIndicator))) {
const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget);
QStyleOptionViewItemV4 checkMarkOption(voptAdj);
if (selectionRect.isValid())
checkMarkOption.rect = selectionRect;
// Draw selection mark.
- if (isSelected && !singleSelection && selectItemsOnly) {
+ if (isSelected && selectItems) {
proxy()->drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget);
// @todo: this should happen in the rect retrievel i.e. subElementRect()
if (textRect.right() > selectionRect.left())
textRect.setRight(selectionRect.left());
- } else if (singleSelection &&
- voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) {
+ } else if (voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) {
checkMarkOption.state = checkMarkOption.state & ~State_HasFocus;
switch (vopt->checkState) {
@@ -1484,7 +1508,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
// draw the text
if (!voptAdj.text.isEmpty()) {
- if (isSelected || hasFocus )
+ if (hasFocus)
painter->setPen(voptAdj.palette.highlightedText().color());
else
painter->setPen(voptAdj.palette.text().color());
@@ -2044,7 +2068,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
}
break;
case CE_Splitter:
- if (option->state & State_Sunken && option->state & State_Enabled) {
+ if (option->state & State_Sunken && option->state & State_Enabled && QS60StylePrivate::themePalette()) {
painter->save();
painter->setOpacity(0.5);
painter->setBrush(QS60StylePrivate::themePalette()->light());
@@ -2071,7 +2095,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
case PE_FrameFocusRect: {
//Draw themed highlight to radiobuttons and checkboxes.
//For other widgets skip, unless palette has been modified. In that case, draw with commonstyle.
- if (option->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color()) {
+ if (QS60StylePrivate::equalToThemePalette(option->palette.highlight().color(), QPalette::Highlight)) {
if ((qstyleoption_cast<const QStyleOptionFocusRect *>(option) &&
(qobject_cast<const QRadioButton *>(widget) || qobject_cast<const QCheckBox *>(widget))))
QS60StylePrivate::drawSkinElement(
@@ -2103,11 +2127,8 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
QS60StyleEnums::SP_QgnIndiCheckboxOn : QS60StyleEnums::SP_QgnIndiCheckboxOff;
painter->save();
- const QColor themeColor = QS60StylePrivate::themePalette()->windowText().color();
- const QColor windowTextColor = option->palette.windowText().color();
-
- if (themeColor != windowTextColor)
- painter->setPen(windowTextColor);
+ if (QS60StylePrivate::equalToThemePalette(option->palette.windowText().color(), QPalette::WindowText))
+ painter->setPen(option->palette.windowText().color());
QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags | QS60StylePrivate::SF_ColorSkinned );
painter->restore();
@@ -2260,8 +2281,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
) {
//Need extra check since dialogs have their own theme background
if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget) &&
- option->palette.window().texture().cacheKey() ==
- QS60StylePrivate::m_themePalette->window().texture().cacheKey())
+ QS60StylePrivate::equalToThemePalette(option->palette.window().texture().cacheKey(), QPalette::Window))
//todo: for combobox listviews, the background should include area for menu scrollers,
//but this produces drawing issues as we need to turn clipping off.
QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, option->rect, flags);
@@ -2308,13 +2328,13 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
const bool hasFocus = (vopt->state & State_HasFocus);
const bool isPressed = QS60StylePrivate::isWidgetPressed(widget);
- if (option->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color()) {
+ if (QS60StylePrivate::equalToThemePalette(option->palette.highlight().color(), QPalette::Highlight)) {
QRect highlightRect = vopt->rect.adjusted(1,1,-1,-1);
const QAbstractItemView *itemView = qobject_cast<const QAbstractItemView *>(widget);
QAbstractItemView::SelectionBehavior selectionBehavior =
itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems;
// Set the draw area for highlights (focus, select rect or pressed rect)
- if (hasFocus || isSelected || isPressed) {
+ if (hasFocus || isPressed) {
if (selectionBehavior != QAbstractItemView::SelectItems) {
// set highlight rect so that it is continuous from cell to cell, yet sligthly
// smaller than cell rect
@@ -2344,7 +2364,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
QRect elementRect = option->rect;
//draw item is drawn as pressed, if it already has focus.
- if (isPressed && (hasFocus || isSelected)) {
+ if (isPressed && hasFocus) {
themeGraphicDefined = true;
element = tableView ? QS60StylePrivate::SE_TableItemPressed : QS60StylePrivate::SE_ListItemPressed;
} else if (hasFocus || (isSelected && selectionBehavior != QAbstractItemView::SelectItems)) {
@@ -2433,7 +2453,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
case PE_PanelItemViewRow: // ### Qt 5: remove
#ifndef QT_NO_ITEMVIEWS
if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
- if (vopt->palette.base().texture().cacheKey() != QS60StylePrivate::m_themePalette->base().texture().cacheKey()) {
+ if (QS60StylePrivate::equalToThemePalette(vopt->palette.base().texture().cacheKey(), QPalette::Base)) {
//QPalette::Base has been changed, let commonstyle draw the item
commonStyleDraws = true;
} else {
@@ -2984,7 +3004,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con
case SE_ItemViewItemText:
case SE_ItemViewItemDecoration:
if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
- const QListWidget *listItem = qobject_cast<const QListWidget *>(widget);
+ const QAbstractItemView *listItem = qobject_cast<const QAbstractItemView *>(widget);
const bool multiSelection = !listItem ? false :
listItem->selectionMode() == QAbstractItemView::MultiSelection ||
listItem->selectionMode() == QAbstractItemView::ExtendedSelection ||
@@ -3054,7 +3074,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con
break;
case SE_ItemViewItemCheckIndicator:
if (const QStyleOptionViewItemV2 *vopt = qstyleoption_cast<const QStyleOptionViewItemV2 *>(opt)) {
- const QListWidget *listItem = qobject_cast<const QListWidget *>(widget);
+ const QAbstractItemView *listItem = qobject_cast<const QAbstractItemView *>(widget);
const bool singleSelection = listItem &&
(listItem->selectionMode() == QAbstractItemView::SingleSelection ||
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index 51ced96edb..b3f416018b 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -598,6 +598,8 @@ private:
void setThemePaletteHash(QPalette *palette) const;
static void storeThemePalette(QPalette *palette);
static void deleteThemePalette();
+ static bool equalToThemePalette(QColor color, QPalette::ColorRole role);
+ static bool equalToThemePalette(qint64 cacheKey, QPalette::ColorRole role);
static QSize partSize(QS60StyleEnums::SkinParts part,
SkinElementFlags flags = KDefaultSkinElementFlags);
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 6487e29bb7..70b7d65fab 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -645,10 +645,10 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph)
if (glyph_width <= 0 || glyph_height <= 0)
return QImage();
QFixedPoint pt;
- pt.x = 0;
+ pt.x = -glyph_x;
pt.y = -glyph_y; // the baseline
QPainterPath path;
- QImage im(glyph_width + qAbs(glyph_x) + 4, glyph_height, QImage::Format_ARGB32_Premultiplied);
+ QImage im(glyph_width + 4, glyph_height, QImage::Format_ARGB32_Premultiplied);
im.fill(Qt::transparent);
QPainter p(&im);
p.setRenderHint(QPainter::Antialiasing);
@@ -737,7 +737,7 @@ void QFontEngine::setGlyphCache(void *key, QFontEngineGlyphCache *data)
return;
// Limit the glyph caches to 4. This covers all 90 degree rotations and limits
- // memory use when there is continous or random rotation
+ // memory use when there is continuous or random rotation
if (m_glyphCaches.size() == 4)
m_glyphCaches.removeLast();
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index ac13b59ab0..3006776040 100644
--- a/src/gui/text/qfontengine_win.cpp
+++ b/src/gui/text/qfontengine_win.cpp
@@ -1296,6 +1296,7 @@ QFontEngineMultiWin::QFontEngineMultiWin(QFontEngineWin *first, const QStringLis
engines[0] = first;
first->ref.ref();
fontDef = engines[0]->fontDef;
+ cache_cost = first->cache_cost;
}
void QFontEngineMultiWin::loadEngine(int at)
@@ -1317,6 +1318,8 @@ void QFontEngineMultiWin::loadEngine(int at)
engines[at] = new QFontEngineWin(fam, hfont, stockFont, lf);
engines[at]->ref.ref();
engines[at]->fontDef = fontDef;
+
+ // TODO: increase cost in QFontCache for the font engine loaded here
}
QT_END_NAMESPACE
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index b950b13028..95060067f7 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -43,6 +43,7 @@
#include "qstatictext_p.h"
#include <private/qtextengine_p.h>
#include <private/qfontengine_p.h>
+#include <qabstracttextdocumentlayout.h>
#include <QtGui/qapplication.h>
@@ -448,7 +449,6 @@ namespace {
currentItem.font = ti.font();
currentItem.charOffset = m_chars.size();
currentItem.numChars = ti.num_chars;
- currentItem.numGlyphs = ti.glyphs.numGlyphs;
currentItem.glyphOffset = m_glyphs.size(); // Store offset into glyph pool
currentItem.positionOffset = m_glyphs.size(); // Offset into position pool
currentItem.useBackendOptimizations = m_useBackendOptimizations;
@@ -463,8 +463,8 @@ namespace {
ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
int size = glyphs.size();
- Q_ASSERT(size == ti.glyphs.numGlyphs);
Q_ASSERT(size == positions.size());
+ currentItem.numGlyphs = size;
m_glyphs.resize(m_glyphs.size() + size);
m_positions.resize(m_glyphs.size());
@@ -655,7 +655,9 @@ void QStaticTextPrivate::paintText(const QPointF &topLeftPosition, QPainter *p)
p->save();
p->translate(topLeftPosition);
- document.drawContents(p);
+ QAbstractTextDocumentLayout::PaintContext ctx;
+ ctx.palette.setColor(QPalette::Text, p->pen().color());
+ document.documentLayout()->draw(p, ctx);
p->restore();
if (textWidth >= 0.0)
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 887ac6caf4..3aa6795755 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -291,7 +291,18 @@ QTextCodec *Qt::codecForHtml(const QByteArray &ba)
by an editor widget through the undo() and redo() slots; the document also
provides contentsChanged(), undoAvailable(), and redoAvailable() signals
that inform connected editor widgets about the state of the undo/redo
- system.
+ system. The following are the undo/redo operations of a QTextDocument:
+
+ \list
+ \o Insertion or removal of characters. A sequence of insertions or removals
+ within the same text block are regarded as a single undo/redo operation.
+ \o Insertion or removal of text blocks. Sequences of insertion or removals
+ in a single operation (e.g., by selecting and then deleting text) are
+ regarded as a single undo/redo operation.
+ \o Text character format changes.
+ \o Text block format changes.
+ \o Text block group format changes.
+ \endlist
\sa QTextCursor, QTextEdit, \link richtext.html Rich Text Processing\endlink , {Text Object Example}
*/
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index 12a8924bcf..65fd36e938 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -616,6 +616,7 @@ void QTextFramePrivate::remove_me()
/*!
Returns an iterator pointing to the first document element inside the frame.
+ Please see the document \l{STL-style-Iterators} for more information.
\sa end()
*/
@@ -628,8 +629,8 @@ QTextFrame::iterator QTextFrame::begin() const
}
/*!
- Returns an iterator pointing to the last document element inside the frame.
-
+ Returns an iterator pointing to the position past the last document element inside the frame.
+ Please see the document \l{STL-Style Iterators} for more information.
\sa begin()
*/
QTextFrame::iterator QTextFrame::end() const
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index 171000bde1..b540e76503 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -60,6 +60,9 @@
QT_BEGIN_NAMESPACE
+// qmainwindow.cpp
+extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);
+
enum { StateFlagVisible = 1, StateFlagFloating = 2 };
/******************************************************************************
@@ -1480,7 +1483,7 @@ QList<int> QDockAreaLayoutInfo::indexOf(QWidget *widget) const
QMainWindowLayout *QDockAreaLayoutInfo::mainWindowLayout() const
{
- QMainWindowLayout *result = qobject_cast<QMainWindowLayout*>(mainWindow->layout());
+ QMainWindowLayout *result = qt_mainwindow_layout(mainWindow);
Q_ASSERT(result != 0);
return result;
}
@@ -3070,8 +3073,7 @@ void QDockAreaLayout::splitDockWidget(QDockWidget *after,
void QDockAreaLayout::apply(bool animate)
{
- QWidgetAnimator &widgetAnimator
- = qobject_cast<QMainWindowLayout*>(mainWindow->layout())->widgetAnimator;
+ QWidgetAnimator &widgetAnimator = qt_mainwindow_layout(mainWindow)->widgetAnimator;
for (int i = 0; i < QInternal::DockCount; ++i)
docks[i].apply(animate);
@@ -3176,7 +3178,7 @@ void QDockAreaLayout::updateSeparatorWidgets() const
if (j < separatorWidgets.size()) {
sepWidget = separatorWidgets.at(j);
} else {
- sepWidget = qobject_cast<QMainWindowLayout*>(mainWindow->layout())->getSeparatorWidget();
+ sepWidget = qt_mainwindow_layout(mainWindow)->getSeparatorWidget();
separatorWidgets.append(sepWidget);
}
j++;
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp
index 11f0a94eb4..df9b1713be 100644
--- a/src/gui/widgets/qdockwidget.cpp
+++ b/src/gui/widgets/qdockwidget.cpp
@@ -68,6 +68,9 @@ QT_BEGIN_NAMESPACE
extern QString qt_setWindowTitle_helperHelper(const QString&, const QWidget*); // qwidget.cpp
+// qmainwindow.cpp
+extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);
+
static inline bool hasFeature(const QDockWidgetPrivate *priv, QDockWidget::DockWidgetFeature feature)
{ return (priv->features & feature) == feature; }
@@ -690,7 +693,7 @@ void QDockWidgetPrivate::initDrag(const QPoint &pos, bool nca)
QMainWindow *win = qobject_cast<QMainWindow*>(parent);
Q_ASSERT(win != 0);
- QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(win);
Q_ASSERT(layout != 0);
if (layout->pluggingWidget != 0) // the main window is animating a docking operation
return;
@@ -711,8 +714,7 @@ void QDockWidgetPrivate::startDrag()
if (state == 0 || state->dragging)
return;
- QMainWindowLayout *layout
- = qobject_cast<QMainWindowLayout *>(q->parentWidget()->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget()));
Q_ASSERT(layout != 0);
state->widgetItem = layout->unplug(q);
@@ -739,8 +741,7 @@ void QDockWidgetPrivate::endDrag(bool abort)
q->releaseMouse();
if (state->dragging) {
- QMainWindowLayout *mwLayout =
- qobject_cast<QMainWindowLayout *>(q->parentWidget()->layout());
+ QMainWindowLayout *mwLayout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget()));
Q_ASSERT(mwLayout != 0);
if (abort || !mwLayout->plug(state->widgetItem)) {
@@ -780,8 +781,7 @@ bool QDockWidgetPrivate::isAnimating() const
if (mainWin == 0)
return false;
- QMainWindowLayout *mainWinLayout
- = qobject_cast<QMainWindowLayout*>(mainWin->layout());
+ QMainWindowLayout *mainWinLayout = qt_mainwindow_layout(mainWin);
if (mainWinLayout == 0)
return false;
@@ -847,9 +847,8 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event)
return ret;
QDockWidgetLayout *dwlayout
- = qobject_cast<QDockWidgetLayout*>(layout);
- QMainWindowLayout *mwlayout
- = qobject_cast<QMainWindowLayout*>(q->parentWidget()->layout());
+ = qobject_cast<QDockWidgetLayout *>(layout);
+ QMainWindowLayout *mwlayout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget()));
if (!dwlayout->nativeWindowDeco()) {
if (!state->dragging
&& mwlayout->pluggingWidget == 0
@@ -943,8 +942,7 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event)
}
#ifdef Q_OS_MAC
else { // workaround for lack of mouse-grab on Mac
- QMainWindowLayout *layout
- = qobject_cast<QMainWindowLayout *>(q->parentWidget()->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget()));
Q_ASSERT(layout != 0);
q->move(event->globalPos() - state->pressPos);
@@ -980,8 +978,7 @@ void QDockWidgetPrivate::moveEvent(QMoveEvent *event)
if (state->ctrlDrag)
return;
- QMainWindowLayout *layout
- = qobject_cast<QMainWindowLayout *>(q->parentWidget()->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget()));
Q_ASSERT(layout != 0);
QPoint globalMousePos = event->pos() + state->pressPos;
@@ -1009,7 +1006,7 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
Q_Q(QDockWidget);
if (!floating && parent) {
- QMainWindowLayout *mwlayout = qobject_cast<QMainWindowLayout *>(q->parentWidget()->layout());
+ QMainWindowLayout *mwlayout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget()));
if (mwlayout && mwlayout->dockWidgetArea(q) == Qt::NoDockWidgetArea)
return; // this dockwidget can't be redocked
}
@@ -1055,7 +1052,7 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
if (floating != wasFloating) {
emit q->topLevelChanged(floating);
if (!floating && parent) {
- QMainWindowLayout *mwlayout = qobject_cast<QMainWindowLayout *>(q->parentWidget()->layout());
+ QMainWindowLayout *mwlayout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget()));
if (mwlayout)
emit q->dockLocationChanged(mwlayout->dockWidgetArea(q));
}
@@ -1326,10 +1323,10 @@ void QDockWidget::changeEvent(QEvent *event)
#ifndef QT_NO_TABBAR
{
QMainWindow *win = qobject_cast<QMainWindow*>(parentWidget());
- if (QMainWindowLayout *winLayout =
- (win ? qobject_cast<QMainWindowLayout*>(win->layout()) : 0))
+ if (QMainWindowLayout *winLayout = qt_mainwindow_layout(win)) {
if (QDockAreaLayoutInfo *info = winLayout->layoutState.dockAreaLayout.info(this))
info->updateTabBar();
+ }
}
#endif // QT_NO_TABBAR
break;
@@ -1382,9 +1379,7 @@ bool QDockWidget::event(QEvent *event)
Q_D(QDockWidget);
QMainWindow *win = qobject_cast<QMainWindow*>(parentWidget());
- QMainWindowLayout *layout = 0;
- if (win != 0)
- layout = qobject_cast<QMainWindowLayout*>(win->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(win);
switch (event->type()) {
#ifndef QT_NO_ACTION
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index 4d47c82663..f338f40d02 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -536,7 +536,7 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl
\internal
Sets the selection to cover the word at the given cursor position.
- The word boundries is defined by the behavior of QTextLayout::SkipWords
+ The word boundaries are defined by the behavior of QTextLayout::SkipWords
cursor mode.
*/
void QLineControl::selectWordAtPos(int cursor)
@@ -1211,7 +1211,7 @@ void QLineControl::internalRedo()
/*!
\internal
- If the current cursor position differs from the last emited cursor
+ If the current cursor position differs from the last emitted cursor
position, emits cursorPositionChanged().
*/
void QLineControl::emitCursorPositionChanged()
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index 0378d2d485..4ca11b039f 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -39,6 +39,8 @@
**
****************************************************************************/
+//#define QT_EXPERIMENTAL_CLIENT_DECORATIONS
+
#include "qmainwindow.h"
#include "qmainwindowlayout_p.h"
@@ -99,12 +101,70 @@ public:
uint hasOldCursor : 1;
uint cursorAdjusted : 1;
#endif
+
+ static inline QMainWindowLayout *mainWindowLayout(const QMainWindow *mainWindow)
+ {
+ return mainWindow ? mainWindow->d_func()->layout : static_cast<QMainWindowLayout *>(0);
+ }
};
+QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *mainWindow)
+{
+ return QMainWindowPrivate::mainWindowLayout(mainWindow);
+}
+
+#ifdef QT_EXPERIMENTAL_CLIENT_DECORATIONS
+Q_GUI_EXPORT void qt_setMainWindowTitleWidget(QMainWindow *mainWindow, Qt::DockWidgetArea area, QWidget *widget)
+{
+ QGridLayout *topLayout = qobject_cast<QGridLayout *>(mainWindow->layout());
+ Q_ASSERT(topLayout);
+
+ int row = 0;
+ int column = 0;
+
+ switch (area) {
+ case Qt::LeftDockWidgetArea:
+ row = 1;
+ column = 0;
+ break;
+ case Qt::TopDockWidgetArea:
+ row = 0;
+ column = 1;
+ break;
+ case Qt::BottomDockWidgetArea:
+ row = 2;
+ column = 1;
+ break;
+ case Qt::RightDockWidgetArea:
+ row = 1;
+ column = 2;
+ break;
+ default:
+ Q_ASSERT_X(false, "qt_setMainWindowTitleWidget", "Unknown area");
+ return;
+ }
+
+ if (QLayoutItem *oldItem = topLayout->itemAtPosition(row, column))
+ delete oldItem->widget();
+ topLayout->addWidget(widget, row, column);
+}
+#endif
+
void QMainWindowPrivate::init()
{
Q_Q(QMainWindow);
- layout = new QMainWindowLayout(q);
+
+#ifdef QT_EXPERIMENTAL_CLIENT_DECORATIONS
+ QGridLayout *topLayout = new QGridLayout(q);
+ topLayout->setContentsMargins(0, 0, 0, 0);
+
+ layout = new QMainWindowLayout(q, topLayout);
+
+ topLayout->addItem(layout, 1, 1);
+#else
+ layout = new QMainWindowLayout(q, 0);
+#endif
+
const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q);
iconSize = QSize(metric, metric);
q->setAttribute(Qt::WA_Hover);
@@ -461,10 +521,11 @@ QMenuBar *QMainWindow::menuBar() const
*/
void QMainWindow::setMenuBar(QMenuBar *menuBar)
{
- Q_D(QMainWindow);
- if (d->layout->menuBar() && d->layout->menuBar() != menuBar) {
+ QLayout *topLayout = layout();
+
+ if (topLayout->menuBar() && topLayout->menuBar() != menuBar) {
// Reparent corner widgets before we delete the old menu bar.
- QMenuBar *oldMenuBar = qobject_cast<QMenuBar *>(d->layout->menuBar());
+ QMenuBar *oldMenuBar = qobject_cast<QMenuBar *>(topLayout->menuBar());
if (menuBar) {
// TopLeftCorner widget.
QWidget *cornerWidget = oldMenuBar->cornerWidget(Qt::TopLeftCorner);
@@ -478,7 +539,7 @@ void QMainWindow::setMenuBar(QMenuBar *menuBar)
oldMenuBar->hide();
oldMenuBar->deleteLater();
}
- d->layout->setMenuBar(menuBar);
+ topLayout->setMenuBar(menuBar);
}
/*!
diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp
index 62ee398e9e..4dd5208e26 100644
--- a/src/gui/widgets/qmainwindowlayout.cpp
+++ b/src/gui/widgets/qmainwindowlayout.cpp
@@ -160,7 +160,7 @@ static void dumpLayout(QTextStream &qout, const QDockAreaLayout &layout, QString
void qt_dumpLayout(QTextStream &qout, QMainWindow *window)
{
- QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(window->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(window);
dumpLayout(qout, layout->layoutState.dockAreaLayout, QString());
}
@@ -235,7 +235,7 @@ void QMainWindowLayoutState::apply(bool animated)
dockAreaLayout.apply(animated);
#else
if (centralWidgetItem != 0) {
- QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(mainWindow->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(mainWindow);
Q_ASSERT(layout != 0);
layout->widgetAnimator.animate(centralWidgetItem->widget(), centralWidgetRect, animated);
}
@@ -1674,8 +1674,8 @@ void QMainWindowLayout::restore(bool keepSavedState)
updateGapIndicator();
}
-QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow)
- : QLayout(mainwindow)
+QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLayout)
+ : QLayout(parentLayout ? static_cast<QWidget *>(0) : mainwindow)
, layoutState(mainwindow)
, savedState(mainwindow)
, dockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks)
@@ -1698,6 +1698,9 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow)
, blockVisiblityCheck(false)
#endif
{
+ if (parentLayout)
+ setParent(parentLayout);
+
#ifndef QT_NO_DOCKWIDGET
#ifndef QT_NO_TABBAR
sep = mainwindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainwindow);
diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h
index 955693dad7..e1b981c1cd 100644
--- a/src/gui/widgets/qmainwindowlayout_p.h
+++ b/src/gui/widgets/qmainwindowlayout_p.h
@@ -159,7 +159,7 @@ class Q_AUTOTEST_EXPORT QMainWindowLayout : public QLayout
public:
QMainWindowLayoutState layoutState, savedState;
- explicit QMainWindowLayout(QMainWindow *mainwindow);
+ QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLayout);
~QMainWindowLayout();
QMainWindow::DockOptions dockOptions;
diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp
index c643a1ebc7..652e65c8fe 100644
--- a/src/gui/widgets/qmenu_symbian.cpp
+++ b/src/gui/widgets/qmenu_symbian.cpp
@@ -168,11 +168,11 @@ static void qt_symbian_insert_action(QSymbianMenuAction* action, QList<SymbianMe
if (action->action->menu()->actions().size() > 0) {
for (int c2= 0; c2 < action->action->menu()->actions().size(); ++c2) {
- QSymbianMenuAction *symbianAction2 = new QSymbianMenuAction;
+ QScopedPointer<QSymbianMenuAction> symbianAction2(new QSymbianMenuAction);
symbianAction2->action = action->action->menu()->actions().at(c2);
QMenu * menu = symbianAction2->action->menu();
symbianAction2->command = qt_symbian_menu_static_cmd_id++;
- qt_symbian_insert_action(symbianAction2, &(menuItem->children));
+ qt_symbian_insert_action(symbianAction2.data(), &(menuItem->children));
}
}
@@ -433,11 +433,11 @@ void QMenuBarPrivate::QSymbianMenuBarPrivate::removeAction(QSymbianMenuAction *a
void QMenuBarPrivate::QSymbianMenuBarPrivate::insertNativeMenuItems(const QList<QAction*> &actions)
{
for (int i = 0; i <actions.size(); ++i) {
- QSymbianMenuAction *symbianActionTopLevel = new QSymbianMenuAction;
+ QScopedPointer<QSymbianMenuAction> symbianActionTopLevel(new QSymbianMenuAction);
symbianActionTopLevel->action = actions.at(i);
symbianActionTopLevel->parent = 0;
symbianActionTopLevel->command = qt_symbian_menu_static_cmd_id++;
- qt_symbian_insert_action(symbianActionTopLevel, &symbianMenus);
+ qt_symbian_insert_action(symbianActionTopLevel.data(), &symbianMenus);
}
}
diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp
index 7ed27ea33d..316bb440c8 100644
--- a/src/gui/widgets/qtoolbar.cpp
+++ b/src/gui/widgets/qtoolbar.cpp
@@ -82,6 +82,9 @@ static void qt_mac_updateToolBarButtonHint(QWidget *parentWidget)
}
#endif
+// qmainwindow.cpp
+extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);
+
/******************************************************************************
** QToolBarPrivate
*/
@@ -197,7 +200,7 @@ void QToolBarPrivate::initDrag(const QPoint &pos)
QMainWindow *win = qobject_cast<QMainWindow*>(parent);
Q_ASSERT(win != 0);
- QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(win);
Q_ASSERT(layout != 0);
if (layout->pluggingWidget != 0) // the main window is animating a docking operation
return;
@@ -223,7 +226,7 @@ void QToolBarPrivate::startDrag(bool moving)
QMainWindow *win = qobject_cast<QMainWindow*>(parent);
Q_ASSERT(win != 0);
- QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(win);
Q_ASSERT(layout != 0);
if (!moving) {
@@ -247,8 +250,7 @@ void QToolBarPrivate::endDrag()
q->releaseMouse();
if (state->dragging) {
- QMainWindowLayout *layout =
- qobject_cast<QMainWindowLayout *>(q->parentWidget()->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget()));
Q_ASSERT(layout != 0);
if (!layout->plug(state->widgetItem)) {
@@ -340,7 +342,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
if (win == 0)
return true;
- QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(win);
Q_ASSERT(layout != 0);
if (layout->pluggingWidget == 0
@@ -588,7 +590,7 @@ QToolBar::~QToolBar()
QMainWindow *mainwindow = qobject_cast<QMainWindow *>(parentWidget());
if (mainwindow) {
#ifdef Q_WS_MAC
- QMainWindowLayout *mainwin_layout = qobject_cast<QMainWindowLayout *>(mainwindow->layout());
+ QMainWindowLayout *mainwin_layout = qt_mainwindow_layout(mainwindow);
if (mainwin_layout && mainwin_layout->layoutState.toolBarAreaLayout.isEmpty()
&& mainwindow->testAttribute(Qt::WA_WState_Created))
macWindowToolbarShow(mainwindow, false);
@@ -1135,7 +1137,7 @@ bool QToolBar::event(QEvent *event)
if (toolbarInUnifiedToolBar(this)) {
// I can static_cast because I did the qobject_cast in the if above, therefore
// we must have a QMainWindowLayout here.
- QMainWindowLayout *mwLayout = static_cast<QMainWindowLayout *>(parentWidget()->layout());
+ QMainWindowLayout *mwLayout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(parentWidget()));
mwLayout->fixSizeInUnifiedToolbar(this);
mwLayout->syncUnifiedToolbarVisibility();
}
@@ -1289,6 +1291,8 @@ QWidget *QToolBar::widgetForAction(QAction *action) const
return d->layout->itemAt(index)->widget();
}
+extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);
+
/*!
\internal
*/
@@ -1315,7 +1319,7 @@ void QToolBar::initStyleOption(QStyleOptionToolBar *option) const
if (!mainWindow)
return;
- QMainWindowLayout *layout = qobject_cast<QMainWindowLayout *>(mainWindow->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(mainWindow);
Q_ASSERT_X(layout != 0, "QToolBar::initStyleOption()",
"QMainWindow->layout() != QMainWindowLayout");
diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp
index 8327af5376..b312751cef 100644
--- a/src/gui/widgets/qtoolbararealayout.cpp
+++ b/src/gui/widgets/qtoolbararealayout.cpp
@@ -59,6 +59,9 @@
QT_BEGIN_NAMESPACE
+// qmainwindow.cpp
+extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *mainWindow);
+
QSize QToolBarAreaLayoutItem::minimumSize() const
{
if (skip())
@@ -872,7 +875,7 @@ void QToolBarAreaLayout::insertItem(QToolBar *before, QLayoutItem *item)
void QToolBarAreaLayout::apply(bool animate)
{
- QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(mainWindow->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(mainWindow);
Q_ASSERT(layout != 0);
Qt::LayoutDirection dir = mainWindow->layoutDirection();
diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp
index f87510ffd1..59b027ec18 100644
--- a/src/gui/widgets/qtoolbarlayout.cpp
+++ b/src/gui/widgets/qtoolbarlayout.cpp
@@ -57,6 +57,9 @@
QT_BEGIN_NAMESPACE
+// qmainwindow.cpp
+extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);
+
/******************************************************************************
** QToolBarItem
*/
@@ -404,7 +407,7 @@ void QToolBarLayout::setGeometry(const QRect &rect)
if (QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget())) {
Qt::ToolBarArea area = win->toolBarArea(tb);
if (win->unifiedTitleAndToolBarOnMac() && area == Qt::TopToolBarArea) {
- static_cast<QMainWindowLayout *>(win->layout())->fixSizeInUnifiedToolbar(tb);
+ qt_mainwindow_layout(win)->fixSizeInUnifiedToolbar(tb);
}
}
# endif
@@ -659,7 +662,7 @@ void QToolBarLayout::setExpanded(bool exp)
#else
animating = !tb->isWindow() && win->isAnimated();
#endif
- QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
+ QMainWindowLayout *layout = qt_mainwindow_layout(win);
if (expanded) {
tb->raise();
} else {