summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-07-28 11:43:13 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-07-28 11:43:13 +0200
commit84294f47e55073914bcbcdbaf85df1a0e2e2d845 (patch)
tree1166be97fcfcc6a71b9603443ef6360d33aef276 /src/gui
parent80e13f5bd418395bd64396e359a288b748ae1dfb (diff)
parent7b10151cb6550fe8060217fad8549950eadd5fca (diff)
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: src/gui/kernel/qapplication.cpp tests/auto/qfileinfo/tst_qfileinfo.cpp tools/qdoc3/test/assistant.qdocconf tools/qdoc3/test/designer.qdocconf tools/qdoc3/test/linguist.qdocconf tools/qdoc3/test/qmake.qdocconf tools/qdoc3/test/qt-build-docs.qdocconf tools/qdoc3/test/qt.qdocconf
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qwizard_win.cpp42
-rw-r--r--src/gui/dialogs/qwizard_win_p.h21
-rw-r--r--src/gui/graphicsview/qgraphicsgridlayout.cpp7
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp50
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h15
-rw-r--r--src/gui/graphicsview/qgraphicslinearlayout.cpp7
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp7
-rw-r--r--src/gui/gui.pro25
-rw-r--r--src/gui/image/image.pri1
-rw-r--r--src/gui/image/qimage.cpp54
-rw-r--r--src/gui/image/qimage_ssse3.cpp150
-rw-r--r--src/gui/image/qpixmap_s60.cpp20
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp4
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp2
-rw-r--r--src/gui/itemviews/qfileiconprovider.cpp71
-rw-r--r--src/gui/itemviews/qheaderview.cpp2
-rw-r--r--src/gui/kernel/qapplication.cpp2
-rw-r--r--src/gui/kernel/qapplication.h3
-rw-r--r--src/gui/kernel/qapplication_s60.cpp6
-rw-r--r--src/gui/kernel/qapplication_win.cpp2
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h4
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm43
-rw-r--r--src/gui/kernel/qcocoaview_mac_p.h1
-rw-r--r--src/gui/kernel/qdesktopwidget_s60.cpp22
-rw-r--r--src/gui/kernel/qevent.cpp8
-rw-r--r--src/gui/kernel/qgesture.cpp35
-rw-r--r--src/gui/kernel/qgesture.h6
-rw-r--r--src/gui/kernel/qgesture_p.h1
-rw-r--r--src/gui/kernel/qgesturemanager.cpp4
-rw-r--r--src/gui/kernel/qguifunctions_wince.cpp28
-rw-r--r--src/gui/kernel/qpalette.cpp10
-rw-r--r--src/gui/kernel/qstandardgestures.cpp15
-rw-r--r--src/gui/kernel/qwidget.cpp4
-rw-r--r--src/gui/kernel/qwidget_mac.mm11
-rw-r--r--src/gui/kernel/qwidget_win.cpp1
-rw-r--r--src/gui/kernel/qwidget_wince.cpp1
-rw-r--r--src/gui/painting/qdrawhelper.cpp135
-rw-r--r--src/gui/painting/qdrawhelper_iwmmxt.cpp25
-rw-r--r--src/gui/painting/qdrawhelper_mmx.cpp23
-rw-r--r--src/gui/painting/qdrawhelper_mmx3dnow.cpp25
-rw-r--r--src/gui/painting/qdrawhelper_p.h40
-rw-r--r--src/gui/painting/qdrawhelper_sse.cpp25
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp81
-rw-r--r--src/gui/painting/qdrawhelper_sse3dnow.cpp25
-rw-r--r--src/gui/painting/qdrawingprimitive_sse2_p.h33
-rw-r--r--src/gui/painting/qrgb.h2
-rw-r--r--src/gui/styles/qstyle.cpp4
-rw-r--r--src/gui/styles/qstyle.h2
-rw-r--r--src/gui/styles/qstyleoption.cpp6
-rw-r--r--src/gui/styles/qstyleoption.h2
-rw-r--r--src/gui/text/qfontengine_s60.cpp4
-rw-r--r--src/gui/text/qstatictext.cpp16
-rw-r--r--src/gui/text/qtextcursor.cpp6
-rw-r--r--src/gui/text/qtextdocument_p.cpp2
-rw-r--r--src/gui/text/qtextlayout.cpp2
-rw-r--r--src/gui/text/qtextobject.cpp2
-rw-r--r--src/gui/text/qtextoption.cpp7
-rw-r--r--src/gui/text/qtexttable.cpp35
-rw-r--r--src/gui/text/text.pri2
-rw-r--r--src/gui/util/qcompleter.cpp4
-rw-r--r--src/gui/widgets/qlineedit.cpp8
-rw-r--r--src/gui/widgets/qtabbar.cpp6
62 files changed, 958 insertions, 249 deletions
diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp
index e406cba159..ad8801a094 100644
--- a/src/gui/dialogs/qwizard_win.cpp
+++ b/src/gui/dialogs/qwizard_win.cpp
@@ -180,7 +180,8 @@ QVistaBackButton::QVistaBackButton(QWidget *widget)
QSize QVistaBackButton::sizeHint() const
{
ensurePolished();
- int width = 32, height = 32;
+ int size = int(QStyleHelper::dpiScaled(32));
+ int width = size, height = size;
/*
HANDLE theme = pOpenThemeData(0, L"Navigation");
SIZE size;
@@ -213,8 +214,8 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
HANDLE theme = pOpenThemeData(0, L"Navigation");
//RECT rect;
RECT clipRect;
- int xoffset = QWidget::mapToParent(r.topLeft()).x();
- int yoffset = QWidget::mapToParent(r.topLeft()).y();
+ int xoffset = QWidget::mapToParent(r.topLeft()).x() - 1;
+ int yoffset = QWidget::mapToParent(r.topLeft()).y() - 1;
clipRect.top = r.top() + yoffset;
clipRect.bottom = r.bottom() + yoffset;
@@ -245,6 +246,11 @@ QVistaHelper::QVistaHelper(QWizard *wizard)
is_vista = resolveSymbols();
if (is_vista)
backButton_ = new QVistaBackButton(wizard);
+
+ // Handle diff between Windows 7 and Vista
+ iconSpacing = QStyleHelper::dpiScaled(7);
+ textSpacing = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ?
+ iconSpacing : QStyleHelper::dpiScaled(20);
}
QVistaHelper::~QVistaHelper()
@@ -308,18 +314,15 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type)
void QVistaHelper::drawTitleBar(QPainter *painter)
{
- if (vistaState() == VistaAero)
- drawBlackRect(
- QRect(0, 0, wizard->width(), titleBarSize() + topOffset()),
- painter->paintEngine()->getDC());
+ HDC hdc = painter->paintEngine()->getDC();
+ if (vistaState() == VistaAero)
+ drawBlackRect(QRect(0, 0, wizard->width(),
+ titleBarSize() + topOffset()), hdc);
Q_ASSERT(backButton_);
const int btnTop = backButton_->mapToParent(QPoint()).y();
const int btnHeight = backButton_->size().height();
- const int verticalCenter = (btnTop + btnHeight / 2);
-
- wizard->windowIcon().paint(
- painter, QRect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize()));
+ const int verticalCenter = (btnTop + btnHeight / 2) - 1;
const QString text = wizard->window()->windowTitle();
const QFont font = QApplication::font("QWorkspaceTitleBar");
@@ -327,14 +330,25 @@ void QVistaHelper::drawTitleBar(QPainter *painter)
const QRect brect = fontMetrics.boundingRect(text);
int textHeight = brect.height();
int textWidth = brect.width();
+ int glowOffset = 0;
+
if (vistaState() == VistaAero) {
textHeight += 2 * glowSize();
textWidth += 2 * glowSize();
+ glowOffset = glowSize();
}
+
drawTitleText(
painter, text,
- QRect(titleOffset(), verticalCenter - textHeight / 2, textWidth, textHeight),
- painter->paintEngine()->getDC());
+ QRect(titleOffset() - glowOffset, verticalCenter - textHeight / 2, textWidth, textHeight),
+ hdc);
+
+ if (!wizard->windowIcon().isNull()) {
+ QRect rect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize());
+ HICON hIcon = wizard->windowIcon().pixmap(iconSize()).toWinHICON();
+ DrawIconEx(hdc, rect.left(), rect.top(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT);
+ DestroyIcon(hIcon);
+ }
}
void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible)
@@ -734,7 +748,7 @@ bool QVistaHelper::resolveSymbols()
int QVistaHelper::titleOffset()
{
- int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + padding();
+ int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + textSpacing;
return leftMargin() + iconOffset;
}
diff --git a/src/gui/dialogs/qwizard_win_p.h b/src/gui/dialogs/qwizard_win_p.h
index 5f3b6c2bcb..caf018d0e7 100644
--- a/src/gui/dialogs/qwizard_win_p.h
+++ b/src/gui/dialogs/qwizard_win_p.h
@@ -61,6 +61,7 @@
#include <qwidget.h>
#include <qabstractbutton.h>
#include <QtGui/private/qwidget_p.h>
+#include <QtGui/private/qstylehelper_p.h>
QT_BEGIN_NAMESPACE
@@ -100,9 +101,14 @@ public:
enum VistaState { VistaAero, VistaBasic, Classic, Dirty };
static VistaState vistaState();
static int titleBarSize() { return frameSize() + captionSize(); }
- static int topPadding() { return 8; }
- static int topOffset() { return titleBarSize() + (vistaState() == VistaAero ? 13 : 3); }
-
+ static int topPadding() { // padding under text
+ return int(QStyleHelper::dpiScaled(
+ QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 4 : 6));
+ }
+ static int topOffset() {
+ static int aeroOffset = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ?
+ QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
+ return (titleBarSize() + (vistaState() == VistaAero ? aeroOffset : 3)); }
private:
static HFONT getCaptionFont(HANDLE hTheme);
bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);
@@ -111,11 +117,10 @@ private:
static int frameSize() { return GetSystemMetrics(SM_CYSIZEFRAME); }
static int captionSize() { return GetSystemMetrics(SM_CYCAPTION); }
- static int backButtonSize() { return 31; } // ### should be queried from back button itself
+ static int backButtonSize() { return int(QStyleHelper::dpiScaled(30)); }
static int iconSize() { return 16; } // Standard Aero
- static int padding() { return 7; } // Standard Aero
- static int leftMargin() { return backButtonSize() + padding(); }
static int glowSize() { return 10; }
+ int leftMargin() { return backButton_->isVisible() ? backButtonSize() + iconSpacing : 0; }
int titleOffset();
bool resolveSymbols();
@@ -139,6 +144,10 @@ private:
QRect rtTitle;
QWizard *wizard;
QVistaBackButton *backButton_;
+
+ int titleBarOffset; // Extra spacing above the text
+ int iconSpacing; // Space between button and icon
+ int textSpacing; // Space between icon and text
};
diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp
index 83db3ec124..062b5ac5f9 100644
--- a/src/gui/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp
@@ -94,14 +94,13 @@ public:
#endif
};
+Q_GLOBAL_STATIC(QWidget, globalStyleInfoWidget);
+
QLayoutStyleInfo QGraphicsGridLayoutPrivate::styleInfo() const
{
- static QWidget *wid = 0;
- if (!wid)
- wid = new QWidget;
QGraphicsItem *item = parentItem();
QStyle *style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : QApplication::style();
- return QLayoutStyleInfo(style, wid);
+ return QLayoutStyleInfo(style, globalStyleInfoWidget());
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 6a639cfe3d..d7a7c890ac 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -133,7 +133,8 @@
\img graphicsview-parentchild.png
- \section1 Transformation
+ \target Transformations
+ \section1 Transformations
QGraphicsItem supports projective transformations in addition to its base
position, pos(). There are several ways to change an item's transformation.
@@ -1149,6 +1150,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
if (q_ptr == fsi || q_ptr->isAncestorOf(fsi)) {
parentFocusScopeItem = fsi;
p->d_ptr->focusScopeItem = 0;
+ fsi->d_ptr->focusScopeItemChange(false);
}
break;
}
@@ -1181,6 +1183,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
while (p) {
if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) {
p->d_ptr->focusScopeItem = newFocusScopeItem;
+ newFocusScopeItem->d_ptr->focusScopeItemChange(true);
// Ensure the new item is no longer the subFocusItem. The
// only way to set focus on a child of a focus scope is
// by setting focus on the scope itself.
@@ -1269,8 +1272,14 @@ 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)
+void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rect, bool doClip)
{
+ Q_Q(QGraphicsItem);
+
+ QRectF childrenRect;
+ QRectF *result = rect;
+ rect = &childrenRect;
+
for (int i = 0; i < children.size(); ++i) {
QGraphicsItem *child = children.at(i);
QGraphicsItemPrivate *childd = child->d_ptr.data();
@@ -1292,6 +1301,15 @@ void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rec
childd->childrenBoundingRectHelper(x, rect);
}
}
+
+ if (doClip && (flags & QGraphicsItem::ItemClipsChildrenToShape)){
+ if (x)
+ *rect &= x->mapRect(q->boundingRect());
+ else
+ *rect &= q->boundingRect();
+ }
+
+ *result |= *rect;
}
void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform,
@@ -1435,9 +1453,10 @@ QGraphicsItem::~QGraphicsItem()
#ifndef QT_NO_GESTURES
if (d_ptr->isObject && !d_ptr->gestureContext.isEmpty()) {
QGraphicsObject *o = static_cast<QGraphicsObject *>(this);
- QGestureManager *manager = QGestureManager::instance();
- foreach (Qt::GestureType type, d_ptr->gestureContext.keys())
- manager->cleanupCachedGestures(o, type);
+ if (QGestureManager *manager = QGestureManager::instance()) {
+ foreach (Qt::GestureType type, d_ptr->gestureContext.keys())
+ manager->cleanupCachedGestures(o, type);
+ }
}
#endif
@@ -5571,6 +5590,16 @@ void QGraphicsItemPrivate::subFocusItemChange()
/*!
\internal
+ Subclasses can reimplement this function to be notified when an item
+ becomes a focusScopeItem (or is no longer a focusScopeItem).
+*/
+void QGraphicsItemPrivate::focusScopeItemChange(bool isSubFocusItem)
+{
+}
+
+/*!
+ \internal
+
Subclasses can reimplement this function to be notified when its
siblingIndex order is changed.
*/
@@ -7929,6 +7958,7 @@ void QGraphicsItemPrivate::resetHeight()
/*!
\property QGraphicsObject::effect
+ \since 4.7
\brief the effect attached to this item
\sa QGraphicsItem::setGraphicsEffect(), QGraphicsItem::graphicsEffect()
@@ -11116,8 +11146,14 @@ QRectF QGraphicsItemEffectSourcePrivate::boundingRect(Qt::CoordinateSystem syste
}
QRectF rect = item->boundingRect();
- if (!item->d_ptr->children.isEmpty())
- rect |= item->childrenBoundingRect();
+ if (!item->d_ptr->children.isEmpty()) {
+ if (dirtyChildrenBoundingRect) {
+ childrenBoundingRect = QRectF();
+ item->d_ptr->childrenBoundingRectHelper(0, &childrenBoundingRect, true);
+ dirtyChildrenBoundingRect = false;
+ }
+ rect |= childrenBoundingRect;
+ }
if (deviceCoordinates) {
Q_ASSERT(info->painter);
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index f9f5d3de18..d60dffb38c 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -300,7 +300,7 @@ public:
QDeclarativeListProperty<QGraphicsObject> childrenList();
void setParentItemHelper(QGraphicsItem *parent, const QVariant *newParentVariant,
const QVariant *thisPointerVariant);
- void childrenBoundingRectHelper(QTransform *x, QRectF *rect);
+ void childrenBoundingRectHelper(QTransform *x, QRectF *rect, bool doClip = true);
void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform,
const QRegion &exposedRegion, bool allItems = false) const;
QRectF effectiveBoundingRect() const;
@@ -482,6 +482,7 @@ public:
void clearSubFocus(QGraphicsItem *rootItem = 0);
void resetFocusProxy();
virtual void subFocusItemChange();
+ virtual void focusScopeItemChange(bool isSubFocusItem);
static void children_append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item);
static int children_count(QDeclarativeListProperty<QGraphicsObject> *list);
@@ -659,7 +660,7 @@ class QGraphicsItemEffectSourcePrivate : public QGraphicsEffectSourcePrivate
{
public:
QGraphicsItemEffectSourcePrivate(QGraphicsItem *i)
- : QGraphicsEffectSourcePrivate(), item(i), info(0)
+ : QGraphicsEffectSourcePrivate(), dirtyChildrenBoundingRect(true), item(i), info(0)
{}
inline void detach()
@@ -710,6 +711,9 @@ 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;
@@ -867,9 +871,12 @@ 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;
parentp->notifyInvalidated = 1;
- static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()
- ->source->d_func())->invalidateCache();
+ sourcep->invalidateCache();
}
if (parentp->scene && parentp->graphicsEffect->isEnabled()) {
parentp->dirty = 1;
diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp
index b82872240c..37408efc69 100644
--- a/src/gui/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp
@@ -171,14 +171,13 @@ int QGraphicsLinearLayoutPrivate::gridColumn(int index) const
return int(qMin(uint(index), uint(engine.columnCount())));
}
+Q_GLOBAL_STATIC(QWidget, globalStyleInfoWidget)
+
QLayoutStyleInfo QGraphicsLinearLayoutPrivate::styleInfo() const
{
- static QWidget *wid = 0;
- if (!wid)
- wid = new QWidget;
QGraphicsItem *item = parentItem();
QStyle *style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : QApplication::style();
- return QLayoutStyleInfo(style, wid);
+ return QLayoutStyleInfo(style, globalStyleInfoWidget());
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 4bc7f4c9e0..48a00937cf 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -5178,7 +5178,12 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
// Process children.
if (itemHasChildren && item->d_ptr->dirtyChildren) {
const bool itemClipsChildrenToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape;
- if (itemClipsChildrenToShape) {
+ // Items with no content are threated as 'dummy' items which means they are never drawn and
+ // 'processed', so the painted view bounding rect is never up-to-date. This means that whenever
+ // such an item changes geometry, its children have to take care of the update regardless
+ // of whether the item clips children to shape or not.
+ const bool bypassUpdateClip = !itemHasContents && wasDirtyParentViewBoundingRects;
+ if (itemClipsChildrenToShape && !bypassUpdateClip) {
// Make sure child updates are clipped to the item's bounding rect.
for (int i = 0; i < views.size(); ++i)
views.at(i)->d_func()->setUpdateClip(item);
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 41f1904f57..1b43ef2036 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -84,6 +84,11 @@ contains(QMAKE_MAC_XARCH, no) {
3dnow:DEFINES += QT_HAVE_3DNOW
sse:DEFINES += QT_HAVE_SSE QT_HAVE_MMXEXT
sse2:DEFINES += QT_HAVE_SSE2
+ sse3:DEFINES += QT_HAVE_SSE3
+ ssse3:DEFINES += QT_HAVE_SSSE3
+ sse4_1:DEFINES += QT_HAVE_SSE4_1
+ sse4_2:DEFINES += QT_HAVE_SSE4_2
+ avx:DEFINES += QT_HAVE_AVX
iwmmxt:DEFINES += QT_HAVE_IWMMXT
win32-g++*|!win32:!*-icc* {
@@ -182,6 +187,25 @@ contains(QMAKE_MAC_XARCH, no) {
silent:sse2_compiler.commands = @echo compiling[sse2] ${QMAKE_FILE_IN} && $$sse2_compiler.commands
QMAKE_EXTRA_COMPILERS += sse2_compiler
}
+ ssse3 {
+ ssse3_compiler.commands = $$QMAKE_CXX -c -Winline
+
+ mac {
+ ssse3_compiler.commands += -Xarch_i386 -mssse3
+ ssse3_compiler.commands += -Xarch_x86_64 -mssse3
+ } else {
+ ssse3_compiler.commands += -mssse3
+ }
+
+ ssse3_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
+ ssse3_compiler.dependency_type = TYPE_C
+ ssse3_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
+ ssse3_compiler.input = SSSE3_SOURCES
+ ssse3_compiler.variable_out = OBJECTS
+ ssse3_compiler.name = compiling[ssse3] ${QMAKE_FILE_IN}
+ silent:ssse3_compiler.commands = @echo compiling[ssse3] ${QMAKE_FILE_IN} && $$ssse3_compiler.commands
+ QMAKE_EXTRA_COMPILERS += ssse3_compiler
+ }
iwmmxt {
iwmmxt_compiler.commands = $$QMAKE_CXX -c -Winline
iwmmxt_compiler.commands += -mcpu=iwmmxt
@@ -200,6 +224,7 @@ contains(QMAKE_MAC_XARCH, no) {
3dnow:sse: SOURCES += $$SSE3DNOW_SOURCES
sse: SOURCES += $$SSE_SOURCES
sse2: SOURCES += $$SSE2_SOURCES
+ ssse3: SOURCES += $$SSSE3_SOURCES
iwmmxt: SOURCES += $$IWMMXT_SOURCES
}
}
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index 3a02d562ec..b20a04f104 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -95,3 +95,4 @@ contains(QT_CONFIG, gif):include($$PWD/qgifhandler.pri)
# SIMD
SSE2_SOURCES += image/qimage_sse2.cpp
+SSSE3_SOURCES += image/qimage_ssse3.cpp
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index e5930acda3..30cf758036 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -2343,8 +2343,15 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve
data->colortable.resize(256);
for (int i = 0; i < 256; ++i)
data->colortable[i] = qRgb(i, i, i);
+ } else {
+ for (int i = 0; i < data->colortable.size(); ++i)
+ data->colortable[i] = PREMUL(data->colortable.at(i));
+
+ // Fill the rest of the table in case src_data > colortable.size()
+ const int oldSize = data->colortable.size();
+ const QRgb lastColor = data->colortable.at(oldSize - 1);
+ data->colortable.insert(oldSize, 256 - oldSize, lastColor);
}
- const int tableSize = data->colortable.size() - 1;
for (int i = 0; i < data->height; ++i) {
src_data -= src_pad;
@@ -2352,11 +2359,11 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve
for (int pixI = 0; pixI < width; ++pixI) {
--src_data;
--dest_data;
- const uint pixel = data->colortable[qMin<int>(tableSize, *src_data)];
- *dest_data = (quint32) PREMUL(pixel);
+ *dest_data = data->colortable.at(*src_data);
}
}
+ data->colortable = QVector<QRgb>();
data->format = QImage::Format_ARGB32_Premultiplied;
data->bytes_per_line = dst_bytes_per_line;
data->depth = depth;
@@ -2388,8 +2395,12 @@ static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversio
data->colortable.resize(256);
for (int i = 0; i < 256; ++i)
data->colortable[i] = qRgb(i, i, i);
+ } else {
+ // Fill the rest of the table in case src_data > colortable.size()
+ const int oldSize = data->colortable.size();
+ const QRgb lastColor = data->colortable.at(oldSize - 1);
+ data->colortable.insert(oldSize, 256 - oldSize, lastColor);
}
- const int tableSize = data->colortable.size() - 1;
for (int i = 0; i < data->height; ++i) {
src_data -= src_pad;
@@ -2397,10 +2408,11 @@ static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversio
for (int pixI = 0; pixI < width; ++pixI) {
--src_data;
--dest_data;
- *dest_data = (quint32) data->colortable[qMin<int>(tableSize, *src_data)];
+ *dest_data = (quint32) data->colortable.at(*src_data);
}
}
+ data->colortable = QVector<QRgb>();
data->format = QImage::Format_RGB32;
data->bytes_per_line = dst_bytes_per_line;
data->depth = depth;
@@ -2428,12 +2440,23 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers
const int width = data->width;
const int src_pad = data->bytes_per_line - width;
const int dest_pad = (dst_bytes_per_line >> 1) - width;
- if (data->colortable.size() == 0) {
- data->colortable.resize(256);
+
+ quint16 colorTableRGB16[256];
+ if (data->colortable.isEmpty()) {
for (int i = 0; i < 256; ++i)
- data->colortable[i] = qRgb(i, i, i);
+ colorTableRGB16[i] = qt_colorConvert<quint16, quint32>(qRgb(i, i, i), 0);
+ } else {
+ // 1) convert the existing colors to RGB16
+ const int tableSize = data->colortable.size();
+ for (int i = 0; i < tableSize; ++i)
+ colorTableRGB16[i] = qt_colorConvert<quint16, quint32>(data->colortable.at(i), 0);
+ data->colortable = QVector<QRgb>();
+
+ // 2) fill the rest of the table in case src_data > colortable.size()
+ const quint16 lastColor = colorTableRGB16[tableSize - 1];
+ for (int i = tableSize; i < 256; ++i)
+ colorTableRGB16[i] = lastColor;
}
- const int tableSize = data->colortable.size() - 1;
for (int i = 0; i < data->height; ++i) {
src_data -= src_pad;
@@ -2441,8 +2464,7 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers
for (int pixI = 0; pixI < width; ++pixI) {
--src_data;
--dest_data;
- const uint pixel = data->colortable[qMin<int>(tableSize, *src_data)];
- *dest_data = qt_colorConvert<quint16, quint32>(pixel, 0);
+ *dest_data = colorTableRGB16[*src_data];
}
}
@@ -3332,7 +3354,7 @@ CONVERT_DECL(qargb4444, quint32)
// first index source, second dest
-static const Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormats] =
+static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormats] =
{
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
@@ -3739,6 +3761,14 @@ void qInitImageConversions()
inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_sse2;
}
#endif
+#ifdef QT_HAVE_SSSE3
+ if (features & SSSE3) {
+ extern void convert_RGB888_to_RGB32_ssse3(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
+ converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_ssse3;
+ converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_ssse3;
+ converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_ssse3;
+ }
+#endif
}
/*!
diff --git a/src/gui/image/qimage_ssse3.cpp b/src/gui/image/qimage_ssse3.cpp
new file mode 100644
index 0000000000..1c664f236d
--- /dev/null
+++ b/src/gui/image/qimage_ssse3.cpp
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qimage.h>
+#include <private/qimage_p.h>
+#include <private/qsimd_p.h>
+
+#ifdef QT_HAVE_SSSE3
+
+#include <stdio.h>
+QT_BEGIN_NAMESPACE
+
+// Convert a scanline of RGB888 (src) to RGB32 (dst)
+// src must be at least len * 3 bytes
+// dst must be at least len * 4 bytes
+inline void convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len)
+{
+ quint32 *const end = dst + len;
+
+ // Prologue, align dst to 16 bytes. The alignement is done on dst because it has 4 store()
+ // for each 3 load() of src.
+ const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;
+ const int prologLength = qMin(len, offsetToAlignOn16Bytes);
+
+ for (int i = 0; i < prologLength; ++i) {
+ *dst++ = qRgb(src[0], src[1], src[2]);
+ src += 3;
+ }
+
+ // Mask the 4 first colors of the RGB888 vector
+ const __m128i shuffleMask = _mm_set_epi8(0xff, 9, 10, 11, 0xff, 6, 7, 8, 0xff, 3, 4, 5, 0xff, 0, 1, 2);
+
+ // Mask the 4 last colors of a RGB888 vector with an offset of 1 (so the last 3 bytes are RGB)
+ const __m128i shuffleMaskEnd = _mm_set_epi8(0xff, 13, 14, 15, 0xff, 10, 11, 12, 0xff, 7, 8, 9, 0xff, 4, 5, 6);
+
+ // Mask to have alpha = 0xff
+ const __m128i alphaMask = _mm_set1_epi32(0xff000000);
+
+ __m128i *inVectorPtr = (__m128i *)src;
+ __m128i *dstVectorPtr = (__m128i *)dst;
+
+ const int simdRoundCount = (len - prologLength) / 16; // one iteration in the loop converts 16 pixels
+ for (int i = 0; i < simdRoundCount; ++i) {
+ /*
+ RGB888 has 5 pixels per vector, + 1 byte from the next pixel. The idea here is
+ to load vectors of RGB888 and use palignr to select a vector out of two vectors.
+
+ After 3 loads of RGB888 and 3 stores of RGB32, we have 4 pixels left in the last
+ vector of RGB888, we can mask it directly to get a last store or RGB32. After that,
+ the first next byte is a R, and we can loop for the next 16 pixels.
+
+ The conversion itself is done with a byte permutation (pshufb).
+ */
+ __m128i firstSrcVector = _mm_lddqu_si128(inVectorPtr);
+ __m128i outputVector = _mm_shuffle_epi8(firstSrcVector, shuffleMask);
+ _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask));
+ ++inVectorPtr;
+ ++dstVectorPtr;
+
+ // There are 4 unused bytes left in srcVector, we need to load the next 16 bytes
+ // and load the next input with palignr
+ __m128i secondSrcVector = _mm_lddqu_si128(inVectorPtr);
+ __m128i srcVector = _mm_alignr_epi8(secondSrcVector, firstSrcVector, 12);
+ outputVector = _mm_shuffle_epi8(srcVector, shuffleMask);
+ _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask));
+ ++inVectorPtr;
+ ++dstVectorPtr;
+ firstSrcVector = secondSrcVector;
+
+ // We now have 8 unused bytes left in firstSrcVector
+ secondSrcVector = _mm_lddqu_si128(inVectorPtr);
+ srcVector = _mm_alignr_epi8(secondSrcVector, firstSrcVector, 8);
+ outputVector = _mm_shuffle_epi8(srcVector, shuffleMask);
+ _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask));
+ ++inVectorPtr;
+ ++dstVectorPtr;
+
+ // There are now 12 unused bytes in firstSrcVector.
+ // We can mask them directly, almost there.
+ outputVector = _mm_shuffle_epi8(secondSrcVector, shuffleMaskEnd);
+ _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask));
+ ++dstVectorPtr;
+ }
+ src = (uchar *)inVectorPtr;
+ dst = (quint32 *)dstVectorPtr;
+
+ while (dst != end) {
+ *dst++ = qRgb(src[0], src[1], src[2]);
+ src += 3;
+ }
+}
+
+void convert_RGB888_to_RGB32_ssse3(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(src->format == QImage::Format_RGB888);
+ Q_ASSERT(dest->format == QImage::Format_RGB32 || dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied);
+ Q_ASSERT(src->width == dest->width);
+ Q_ASSERT(src->height == dest->height);
+
+ const uchar *src_data = (uchar *) src->data;
+ quint32 *dest_data = (quint32 *) dest->data;
+
+ for (int i = 0; i < src->height; ++i) {
+ convert_rgb888_to_rgb32_ssse3(dest_data, src_data, src->width);
+ src_data += src->bytes_per_line;
+ dest_data = (quint32 *)((uchar*)dest_data + dest->bytes_per_line);
+ }
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_HAVE_SSSE3
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index a13c8c82e9..9d571b518d 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -157,10 +157,10 @@ class QSymbianBitmapDataAccess
{
public:
- bool heapWasLocked;
+ static int heapRefCount;
QSysInfo::SymbianVersion symbianVersion;
- explicit QSymbianBitmapDataAccess() : heapWasLocked(false)
+ explicit QSymbianBitmapDataAccess()
{
symbianVersion = QSysInfo::symbianVersion();
};
@@ -169,16 +169,22 @@ public:
inline void beginDataAccess(CFbsBitmap *bitmap)
{
- if (symbianVersion == QSysInfo::SV_9_2)
- heapWasLocked = qt_symbianFbsClient()->lockHeap();
- else
+ if (symbianVersion == QSysInfo::SV_9_2) {
+ if (heapRefCount == 0)
+ qt_symbianFbsClient()->lockHeap();
+ } else {
bitmap->LockHeap(ETrue);
+ }
+
+ heapRefCount++;
}
inline void endDataAccess(CFbsBitmap *bitmap)
{
+ heapRefCount--;
+
if (symbianVersion == QSysInfo::SV_9_2) {
- if (!heapWasLocked)
+ if (heapRefCount == 0)
qt_symbianFbsClient()->unlockHeap();
} else {
bitmap->UnlockHeap(ETrue);
@@ -186,6 +192,8 @@ public:
}
};
+int QSymbianBitmapDataAccess::heapRefCount = 0;
+
#define UPDATE_BUFFER() \
{ \
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 4cdc4adb82..394d3748f3 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -297,6 +297,10 @@ void QCoeFepInputContext::commitTemporaryPreeditString()
return;
commitCurrentString(false);
+
+ //update cursor position, now this pre-edit text has been committed.
+ //this prevents next keypress overwriting it (QTBUG-11673)
+ m_cursorPos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt();
}
void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event)
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index ea2432879b..214c31fb7d 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -1364,7 +1364,7 @@ bool QAbstractItemView::dragEnabled() const
Note that the model used needs to provide support for drag and drop operations.
- \sa setDragDropMode() {Using Drag and Drop with Item Views}
+ \sa setDragDropMode() {Using drag & drop with item views}
*/
/*!
diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp
index 5dbd1f08b8..4748f89eb7 100644
--- a/src/gui/itemviews/qfileiconprovider.cpp
+++ b/src/gui/itemviews/qfileiconprovider.cpp
@@ -100,69 +100,80 @@ public:
QIcon getMacIcon(const QFileInfo &fi) const;
#endif
QFileIconProvider *q_ptr;
- QString homePath;
+ const QString homePath;
private:
- QIcon file;
- QIcon fileLink;
- QIcon directory;
- QIcon directoryLink;
- QIcon harddisk;
- QIcon floppy;
- QIcon cdrom;
- QIcon ram;
- QIcon network;
- QIcon computer;
- QIcon desktop;
- QIcon trashcan;
- QIcon generic;
- QIcon home;
+ mutable QIcon file;
+ mutable QIcon fileLink;
+ mutable QIcon directory;
+ mutable QIcon directoryLink;
+ mutable QIcon harddisk;
+ mutable QIcon floppy;
+ mutable QIcon cdrom;
+ mutable QIcon ram;
+ mutable QIcon network;
+ mutable QIcon computer;
+ mutable QIcon desktop;
+ mutable QIcon trashcan;
+ mutable QIcon generic;
+ mutable QIcon home;
};
-QFileIconProviderPrivate::QFileIconProviderPrivate()
+QFileIconProviderPrivate::QFileIconProviderPrivate() :
+ homePath(QDir::home().absolutePath())
{
- QStyle *style = QApplication::style();
- file = style->standardIcon(QStyle::SP_FileIcon);
- directory = style->standardIcon(QStyle::SP_DirIcon);
- fileLink = style->standardIcon(QStyle::SP_FileLinkIcon);
- directoryLink = style->standardIcon(QStyle::SP_DirLinkIcon);
- harddisk = style->standardIcon(QStyle::SP_DriveHDIcon);
- floppy = style->standardIcon(QStyle::SP_DriveFDIcon);
- cdrom = style->standardIcon(QStyle::SP_DriveCDIcon);
- network = style->standardIcon(QStyle::SP_DriveNetIcon);
- computer = style->standardIcon(QStyle::SP_ComputerIcon);
- desktop = style->standardIcon(QStyle::SP_DesktopIcon);
- trashcan = style->standardIcon(QStyle::SP_TrashIcon);
- home = style->standardIcon(QStyle::SP_DirHomeIcon);
- homePath = QDir::home().absolutePath();
}
QIcon QFileIconProviderPrivate::getIcon(QStyle::StandardPixmap name) const
{
switch (name) {
case QStyle::SP_FileIcon:
+ if (file.isNull())
+ file = QApplication::style()->standardIcon(name);
return file;
case QStyle::SP_FileLinkIcon:
+ if (fileLink.isNull())
+ fileLink = QApplication::style()->standardIcon(name);
return fileLink;
case QStyle::SP_DirIcon:
+ if (directory.isNull())
+ directory = QApplication::style()->standardIcon(name);
return directory;
case QStyle::SP_DirLinkIcon:
+ if (directoryLink.isNull())
+ directoryLink = QApplication::style()->standardIcon(name);
return directoryLink;
case QStyle::SP_DriveHDIcon:
+ if (harddisk.isNull())
+ harddisk = QApplication::style()->standardIcon(name);
return harddisk;
case QStyle::SP_DriveFDIcon:
+ if (floppy.isNull())
+ floppy = QApplication::style()->standardIcon(name);
return floppy;
case QStyle::SP_DriveCDIcon:
+ if (cdrom.isNull())
+ cdrom = QApplication::style()->standardIcon(name);
return cdrom;
case QStyle::SP_DriveNetIcon:
+ if (network.isNull())
+ network = QApplication::style()->standardIcon(name);
return network;
case QStyle::SP_ComputerIcon:
+ if (computer.isNull())
+ computer = QApplication::style()->standardIcon(name);
return computer;
case QStyle::SP_DesktopIcon:
+ if (desktop.isNull())
+ desktop = QApplication::style()->standardIcon(name);
return desktop;
case QStyle::SP_TrashIcon:
+ if (trashcan.isNull())
+ trashcan = QApplication::style()->standardIcon(name);
return trashcan;
case QStyle::SP_DirHomeIcon:
+ if (home.isNull())
+ home = QApplication::style()->standardIcon(name);
return home;
default:
return QIcon();
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index cd9ee15168..67854a3f9e 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -1871,7 +1871,7 @@ void QHeaderViewPrivate::_q_layoutChanged()
for (int i = 0; i < oldSectionHidden.count(); ++i) {
if (oldSectionHidden.testBit(i))
- q->setSectionHidden(logicalIndex(i), false);
+ q->setSectionHidden(i, false);
}
// the number of sections changed; we need to reread the state of the model
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 67f15a8bf5..cdcdfe2c10 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -5287,6 +5287,7 @@ bool QApplication::keypadNavigationEnabled()
\sa QCoreApplication::instance()
*/
+#ifndef QT_NO_IM
// ************************************************************************
// Input Method support
// ************************************************************************
@@ -5352,6 +5353,7 @@ QInputContext *QApplication::inputContext() const
#endif
return d->inputContext;
}
+#endif // QT_NO_IM
//Returns the current platform used by keyBindings
uint QApplicationPrivate::currentPlatform(){
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index ee31843202..404059e448 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -267,8 +267,11 @@ public:
virtual void commitData(QSessionManager& sm);
virtual void saveState(QSessionManager& sm);
#endif
+
+#ifndef QT_NO_IM
void setInputContext(QInputContext *);
QInputContext *inputContext() const;
+#endif
static QLocale keyboardInputLocale();
static Qt::LayoutDirection keyboardInputDirection();
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 4b983f75da..c51329a2bf 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -382,6 +382,10 @@ void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop)
QSymbianControl::~QSymbianControl()
{
+ // Ensure backing store is deleted before the top-level
+ // window is destroyed
+ qt_widget_private(qwidget)->topData()->backingStore.destroy();
+
if (S60->curWin == this)
S60->curWin = 0;
if (!QApplicationPrivate::is_app_closing) {
@@ -1456,6 +1460,8 @@ void qt_cleanup()
qt_S60Beep = 0;
}
QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles
+ QPixmapCache::clear(); // Has to happen now, since QS60PixmapData has FBS handles
+
qt_cleanup_symbianFontDatabaseExtras();
// S60 structure and window server session are freed in eventdispatcher destructor as they are needed there
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index d80f8f0fac..628a041812 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -2492,7 +2492,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
if (OkCommand)
QApplication::postEvent(widget, new QEvent(QEvent::OkRequest));
if (CancelCommand)
- QApplication::postEvent(widget, new QEvent(QEvent::Close));
+ widget->showMinimized();
else
#ifndef QT_NO_MENUBAR
QMenuBar::wceCommands(LOWORD(wParam));
diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
index 717cfa5ed7..430a661a03 100644
--- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
+++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
@@ -85,6 +85,8 @@ QT_END_NAMESPACE
- (BOOL)canBecomeKeyWindow
{
QWidget *widget = [self QT_MANGLE_NAMESPACE(qt_qwidget)];
+ if (!widget)
+ return NO; // This should happen only for qt_root_win
bool isToolTip = (widget->windowType() == Qt::ToolTip);
bool isPopup = (widget->windowType() == Qt::Popup);
@@ -94,6 +96,8 @@ QT_END_NAMESPACE
- (BOOL)canBecomeMainWindow
{
QWidget *widget = [self QT_MANGLE_NAMESPACE(qt_qwidget)];
+ if (!widget)
+ return NO; // This should happen only for qt_root_win
bool isToolTip = (widget->windowType() == Qt::ToolTip);
bool isPopup = (widget->windowType() == Qt::Popup);
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index c9fa79b83a..5780ebc6ff 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -269,6 +269,28 @@ static int qCocoaViewCount = 0;
dropData = new QCocoaDropData(dropPasteboard);
}
+- (void)changeDraggingCursor:(NSDragOperation)newOperation
+{
+ static SEL action = nil;
+ static bool operationSupported = false;
+ if (action == nil) {
+ action = NSSelectorFromString(@"operationNotAllowedCursor");
+ if ([NSCursor respondsToSelector:action]) {
+ operationSupported = true;
+ }
+ }
+ if (operationSupported) {
+ NSCursor *notAllowedCursor = [NSCursor performSelector:action];
+ bool isNotAllowedCursor = ([NSCursor currentCursor] == notAllowedCursor);
+ if (newOperation == NSDragOperationNone && !isNotAllowedCursor) {
+ [notAllowedCursor push];
+ } else if (newOperation != NSDragOperationNone && isNotAllowedCursor) {
+ [notAllowedCursor pop];
+ }
+
+ }
+}
+
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
// NB: This function is called from QCoocaWindow/QCocoaPanel rather than directly
@@ -300,6 +322,7 @@ static int qCocoaViewCount = 0;
if (!qDEEvent.isAccepted()) {
// widget is not interested in this drag, so ignore this drop data.
[self removeDropData];
+ [self changeDraggingCursor:NSDragOperationNone];
return NSDragOperationNone;
} else {
// save the mouse position, used by draggingExited handler.
@@ -321,6 +344,7 @@ static int qCocoaViewCount = 0;
nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDMEvent.dropAction());
}
QT_PREPEND_NAMESPACE(qt_mac_copy_answer_rect)(qDMEvent);
+ [self changeDraggingCursor:nsActions];
return nsActions;
}
}
@@ -335,16 +359,21 @@ static int qCocoaViewCount = 0;
if (dragEnterSequence != [sender draggingSequenceNumber])
[self draggingEntered:sender];
// drag enter event was rejected, so ignore the move event.
- if (dropData == 0)
+ if (dropData == 0) {
+ [self changeDraggingCursor:NSDragOperationNone];
return NSDragOperationNone;
+ }
// return last value, if we are still in the answerRect.
NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint];
NSPoint localPoint = [self convertPoint:windowPoint fromView:nil];
NSDragOperation nsActions = [sender draggingSourceOperationMask];
QPoint posDrag(localPoint.x, localPoint.y);
if (qt_mac_mouse_inside_answer_rect(posDrag)
- && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) == nsActions)
- return QT_PREPEND_NAMESPACE(qt_mac_mapDropActions)(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastAction));
+ && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) == nsActions) {
+ NSDragOperation operation = QT_PREPEND_NAMESPACE(qt_mac_mapDropActions)(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastAction));
+ [self changeDraggingCursor:operation];
+ return operation;
+ }
// send drag move event to the widget
QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) = nsActions;
Qt::DropActions qtAllowed = QT_PREPEND_NAMESPACE(qt_mac_mapNSDragOperations)(nsActions);
@@ -361,7 +390,10 @@ static int qCocoaViewCount = 0;
if (QDragManager::self()->source())
mimeData = QDragManager::self()->dragPrivate()->data;
QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers);
- qDMEvent.setDropAction(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction);
+ if (QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction != Qt::IgnoreAction
+ && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).buttons == qDMEvent.mouseButtons()
+ && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).modifiers == qDMEvent.keyboardModifiers())
+ qDMEvent.setDropAction(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction);
qDMEvent.accept();
QApplication::sendEvent(qwidget, &qDMEvent);
@@ -373,6 +405,7 @@ static int qCocoaViewCount = 0;
qDMEvent.setDropAction(Qt::IgnoreAction);
}
qt_mac_copy_answer_rect(qDMEvent);
+ [self changeDraggingCursor:operation];
return operation;
}
@@ -388,6 +421,8 @@ static int qCocoaViewCount = 0;
QApplication::sendEvent(qwidget, &de);
[self removeDropData];
}
+ [self changeDraggingCursor:NSDragOperationEvery];
+
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h
index 33aaa24f8b..b6b63ca3ca 100644
--- a/src/gui/kernel/qcocoaview_mac_p.h
+++ b/src/gui/kernel/qcocoaview_mac_p.h
@@ -106,6 +106,7 @@ Q_GUI_EXPORT
- (void) qt_clearQWidget;
- (BOOL)qt_leftButtonIsRightButton;
- (void)qt_setLeftButtonIsRightButton:(BOOL)isSwapped;
+- (void)changeDraggingCursor:(NSDragOperation)newOperation;
+ (DnDParams*)currentMouseEvent;
@end
diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp
index e4d0bf3538..a07f4a7e16 100644
--- a/src/gui/kernel/qdesktopwidget_s60.cpp
+++ b/src/gui/kernel/qdesktopwidget_s60.cpp
@@ -103,6 +103,10 @@ void QDesktopWidgetPrivate::init(QDesktopWidget *that)
rects->resize(QDesktopWidgetPrivate::screenCount);
workrects->resize(QDesktopWidgetPrivate::screenCount);
+
+ (*rects)[0].setRect(0, 0, S60->screenWidthInPixels, S60->screenHeightInPixels);
+ QRect wr = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect());
+ (*workrects)[0].setRect(wr.x(), wr.y(), wr.width(), wr.height());
}
void QDesktopWidgetPrivate::cleanup()
@@ -146,17 +150,23 @@ QWidget *QDesktopWidget::screen(int /* screen */)
return this;
}
-const QRect QDesktopWidget::availableGeometry(int /* screen */) const
+const QRect QDesktopWidget::availableGeometry(int screen) const
{
- TRect clientRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
- return qt_TRect2QRect(clientRect);
+ Q_D(const QDesktopWidget);
+ if (screen < 0 || screen >= d->screenCount)
+ screen = d->primaryScreen;
+
+ return d->workrects->at(screen);
}
-const QRect QDesktopWidget::screenGeometry(int /* screen */) const
+const QRect QDesktopWidget::screenGeometry(int screen) const
{
Q_D(const QDesktopWidget);
- return QRect(0, 0, S60->screenWidthInPixels, S60->screenHeightInPixels);
- }
+ if (screen < 0 || screen >= d->screenCount)
+ screen = d->primaryScreen;
+
+ return d->rects->at(screen);
+}
int QDesktopWidget::screenNumber(const QWidget * /* widget */) const
{
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index f75495a008..fc2c995a67 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3627,7 +3627,7 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar)
\brief The QTouchEvent class contains parameters that describe a touch event.
\since 4.6
\ingroup events
- \ingroup multitouch
+ \ingroup touch
\section1 Enabling Touch Events
@@ -3641,7 +3641,7 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar)
Similarly to QMouseEvent, Qt automatically grabs each touch point on the first press inside a
widget, and the widget will receive all updates for the touch point until it is released.
- Note that it is possible for a widget to receive events for multiple touch points, and that
+ Note that it is possible for a widget to receive events for numerous touch points, and that
multiple widgets may be receiving touch events at the same time.
\section1 Event Handling
@@ -3717,7 +3717,7 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar)
\i As mentioned above, enabling touch events means multiple widgets can be receiving touch
events simultaneously. Combined with the default QWidget::event() handling for QTouchEvents,
- this gives you great flexibility in designing multi-touch user interfaces. Be aware of the
+ this gives you great flexibility in designing touch user interfaces. Be aware of the
implications. For example, it is possible that the user is moving a QSlider with one finger and
pressing a QPushButton with another. The signals emitted by these widgets will be
interleaved.
@@ -3729,7 +3729,7 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar)
\i QTouchEvents are not affected by a \l{QWidget::grabMouse()}{mouse grab} or an
\l{QApplication::activePopupWidget()}{active pop-up widget}. The behavior of QTouchEvents is
- undefined when opening a pop-up or grabbing the mouse while there are multiple active touch
+ undefined when opening a pop-up or grabbing the mouse while there are more than one active touch
points.
\endlist
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index f5688f4f64..4a4452ab07 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -41,6 +41,7 @@
#include "qgesture.h"
#include "private/qgesture_p.h"
+#include "private/qstandardgestures_p.h"
#ifndef QT_NO_GESTURES
@@ -305,10 +306,10 @@ void QPanGesture::setAcceleration(qreal value)
\class QPinchGesture
\since 4.6
\brief The QPinchGesture class describes a pinch gesture made my the user.
- \ingroup multitouch
+ \ingroup touch
\ingroup gestures
- A pinch gesture is a form of multitouch user input in which the user typically
+ A pinch gesture is a form of touch user input in which the user typically
touches two points on the input device with a thumb and finger, before moving
them closer together or further apart to change the scale factor, zoom, or level
of detail of the user interface.
@@ -388,7 +389,7 @@ void QPanGesture::setAcceleration(qreal value)
\brief the current scale factor
The scale factor measures the scale factor associated with the distance
- between two of the user's inputs on a multitouch device.
+ between two of the user's inputs on a touch device.
\sa totalScaleFactor, lastScaleFactor
*/
@@ -726,6 +727,34 @@ void QTapAndHoldGesture::setPosition(const QPointF &value)
d_func()->position = value;
}
+/*!
+ Set the timeout, in milliseconds, before the gesture triggers.
+
+ The recognizer will detect a touch down and and if \a msecs
+ later the touch is still down, it will trigger the QTapAndHoldGesture.
+ The default value is 700 milliseconds.
+*/
+// static
+void QTapAndHoldGesture::setTimeout(int msecs)
+{
+ QTapAndHoldGesturePrivate::Timeout = msecs;
+}
+
+/*!
+ Gets the timeout, in milliseconds, before the gesture triggers.
+
+ The recognizer will detect a touch down and and if timeout()
+ later the touch is still down, it will trigger the QTapAndHoldGesture.
+ The default value is 700 milliseconds.
+*/
+// static
+int QTapAndHoldGesture::timeout()
+{
+ return QTapAndHoldGesturePrivate::Timeout;
+}
+
+int QTapAndHoldGesturePrivate::Timeout = 700; // in ms
+
QT_END_NAMESPACE
#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h
index 8c10895140..dcb02648a1 100644
--- a/src/gui/kernel/qgesture.h
+++ b/src/gui/kernel/qgesture.h
@@ -134,6 +134,7 @@ class Q_GUI_EXPORT QPinchGesture : public QGesture
{
Q_OBJECT
Q_DECLARE_PRIVATE(QPinchGesture)
+ Q_FLAGS(ChangeFlags ChangeFlag)
public:
enum ChangeFlag {
@@ -191,6 +192,8 @@ public:
friend class QPinchGestureRecognizer;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QPinchGesture::ChangeFlags)
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QPinchGesture::ChangeFlags)
@@ -252,6 +255,9 @@ public:
QPointF position() const;
void setPosition(const QPointF &pos);
+ static void setTimeout(int msecs);
+ static int timeout();
+
friend class QTapAndHoldGestureRecognizer;
};
diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h
index f5474c1fe4..29b923e156 100644
--- a/src/gui/kernel/qgesture_p.h
+++ b/src/gui/kernel/qgesture_p.h
@@ -177,6 +177,7 @@ public:
QPointF position;
int timerId;
+ static int Timeout;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index e43a560503..fe9dd8af6c 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -71,7 +71,7 @@
QT_BEGIN_NAMESPACE
QGestureManager::QGestureManager(QObject *parent)
- : QObject(parent), state(NotGesture), m_lastCustomGestureId(0)
+ : QObject(parent), state(NotGesture), m_lastCustomGestureId(Qt::CustomGesture)
{
qRegisterMetaType<Qt::GestureState>();
@@ -119,7 +119,7 @@ Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *r
if (type == Qt::CustomGesture) {
// generate a new custom gesture id
++m_lastCustomGestureId;
- type = Qt::GestureType(Qt::CustomGesture + m_lastCustomGestureId);
+ type = Qt::GestureType(m_lastCustomGestureId);
}
m_recognizers.insertMulti(type, recognizer);
delete dummy;
diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp
index cc98d43b3e..6e2ed76deb 100644
--- a/src/gui/kernel/qguifunctions_wince.cpp
+++ b/src/gui/kernel/qguifunctions_wince.cpp
@@ -76,6 +76,10 @@ struct AygSIPINFO
#define SHIDIF_SIZEDLGFULLSCREEN 0x0004
#endif
+#ifndef SHDB_HIDE
+#define SHDB_HIDE 0x0002
+#endif
+
#ifndef SHFS_SHOWTASKBAR
#define SHFS_SHOWTASKBAR 0x0001
#endif
@@ -112,10 +116,12 @@ struct AygSIPINFO
typedef BOOL (*AygInitDialog)(AygSHINITDLGINFO*);
typedef BOOL (*AygFullScreen)(HWND, DWORD);
typedef BOOL (*AygSHSipInfo)(UINT, UINT, PVOID, UINT);
+typedef BOOL (*AygSHDoneButton)(HWND, DWORD);
static AygInitDialog ptrAygInitDialog = 0;
static AygFullScreen ptrAygFullScreen = 0;
static AygSHSipInfo ptrAygSHSipInfo = 0;
+static AygSHDoneButton ptrAygSHDoneButton = 0;
static bool aygResolved = false;
static void resolveAygLibs()
@@ -126,18 +132,10 @@ static void resolveAygLibs()
ptrAygInitDialog = (AygInitDialog) ayglib.resolve("SHInitDialog");
ptrAygFullScreen = (AygFullScreen) ayglib.resolve("SHFullScreen");
ptrAygSHSipInfo = (AygSHSipInfo) ayglib.resolve("SHSipInfo");
+ ptrAygSHDoneButton = (AygSHDoneButton) ayglib.resolve("SHDoneButton");
}
}
-struct DIBINFO : public BITMAPINFO
-{
- RGBQUAD arColors[255];
-
- operator LPBITMAPINFO() { return (LPBITMAPINFO) this; }
- operator LPBITMAPINFOHEADER() { return &bmiHeader; }
- RGBQUAD* ColorTable() { return bmiColors; }
-};
-
int qt_wince_GetDIBits(HDC /*hdc*/ , HBITMAP hSourceBitmap, uint, uint, LPVOID lpvBits, LPBITMAPINFO, uint)
{
if (!lpvBits) {
@@ -321,6 +319,8 @@ void qt_wince_maximize(QWidget *widget)
shidi.dwFlags |= SHIDIF_CANCELBUTTON;
if (widget->windowFlags() & Qt::WindowOkButtonHint)
shidi.dwFlags |= SHIDIF_DONEBUTTON;
+ if (!(widget->windowFlags() & (Qt::WindowCancelButtonHint | Qt::WindowOkButtonHint)))
+ shidi.dwFlags |= SHIDIF_CANCELBUTTON;
resolveAygLibs();
if (ptrAygInitDialog)
ptrAygInitDialog(&shidi);
@@ -332,6 +332,16 @@ void qt_wince_maximize(QWidget *widget)
}
}
+void qt_wince_unmaximize(QWidget *widget)
+{
+ if (ptrAygSHDoneButton && qt_wince_is_mobile()
+ && !(widget->windowFlags() & (Qt::WindowCancelButtonHint | Qt::WindowOkButtonHint)))
+ {
+ // Hide the [X] button, we've added in qt_wince_maximize.
+ ptrAygSHDoneButton(widget->winId(), SHDB_HIDE);
+ }
+}
+
void qt_wince_minimize(HWND hwnd)
{
#ifdef Q_OS_WINCE_WM
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 98e8f66d74..38ec806327 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -868,11 +868,21 @@ void QPalette::detach()
Returns true (slowly) if this palette is different from \a p;
otherwise returns false (usually quickly).
+
+ \note The current ColorGroup is not taken into account when
+ comparing palettes
+
+ \sa operator==
*/
/*!
Returns true (usually quickly) if this palette is equal to \a p;
otherwise returns false (slowly).
+
+ \note The current ColorGroup is not taken into account when
+ comparing palettes
+
+ \sa operator!=
*/
bool QPalette::operator==(const QPalette &p) const
{
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index 62d8a5390d..127e150979 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -515,34 +515,39 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
const QMouseEvent *me = static_cast<const QMouseEvent *>(event);
+#ifndef QT_NO_GRAPHICSVIEW
const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
+#endif
- enum { TimerInterval = 2000 };
enum { TapRadius = 40 };
switch (event->type()) {
+#ifndef QT_NO_GRAPHICSVIEW
case QEvent::GraphicsSceneMousePress:
d->position = gsme->screenPos();
q->setHotSpot(d->position);
if (d->timerId)
q->killTimer(d->timerId);
- d->timerId = q->startTimer(TimerInterval);
+ d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout);
return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
+#endif
case QEvent::MouseButtonPress:
d->position = me->globalPos();
q->setHotSpot(d->position);
if (d->timerId)
q->killTimer(d->timerId);
- d->timerId = q->startTimer(TimerInterval);
+ d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout);
return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
case QEvent::TouchBegin:
d->position = ev->touchPoints().at(0).startScreenPos();
q->setHotSpot(d->position);
if (d->timerId)
q->killTimer(d->timerId);
- d->timerId = q->startTimer(TimerInterval);
+ d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout);
return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
+#ifndef QT_NO_GRAPHICSVIEW
case QEvent::GraphicsSceneMouseRelease:
+#endif
case QEvent::MouseButtonRelease:
case QEvent::TouchEnd:
return QGestureRecognizer::CancelGesture; // get out of the MayBeGesture state
@@ -560,12 +565,14 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
return QGestureRecognizer::MayBeGesture;
return QGestureRecognizer::CancelGesture;
}
+#ifndef QT_NO_GRAPHICSVIEW
case QEvent::GraphicsSceneMouseMove: {
QPoint delta = gsme->screenPos() - d->position.toPoint();
if (d->timerId && delta.manhattanLength() <= TapRadius)
return QGestureRecognizer::MayBeGesture;
return QGestureRecognizer::CancelGesture;
}
+#endif
default:
return QGestureRecognizer::Ignore;
}
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index b079df7c10..8c6e05ef1d 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -338,8 +338,10 @@ QInputContext *QWidgetPrivate::inputContext() const
#ifndef QT_NO_IM
if (ic)
return ic;
-#endif
return qApp->inputContext();
+#else
+ return 0;
+#endif
}
/*!
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 20e82a9cfd..c499d93e8b 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -1604,12 +1604,14 @@ void QWidgetPrivate::toggleDrawers(bool visible)
continue;
QWidget *widget = static_cast<QWidget*>(object);
if(qt_mac_is_macdrawer(widget)) {
+ bool oldState = widget->testAttribute(Qt::WA_WState_ExplicitShowHide);
if(visible) {
if (!widget->testAttribute(Qt::WA_WState_ExplicitShowHide))
widget->show();
} else {
widget->hide();
- widget->setAttribute(Qt::WA_WState_ExplicitShowHide, false);
+ if(!oldState)
+ widget->setAttribute(Qt::WA_WState_ExplicitShowHide, false);
}
}
}
@@ -4389,6 +4391,13 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM
data.window_state = data.window_state & ~Qt::WindowMaximized;
const bool visible = q->isVisible();
+ // Apply size restrictions, applicable for Windows & Widgets.
+ if (QWExtra *extra = extraData()) {
+ w = qMin(w, extra->maxw);
+ h = qMin(h, extra->maxh);
+ w = qMax(w, extra->minw);
+ h = qMax(h, extra->minh);
+ }
data.crect = QRect(x, y, w, h);
if (realWindow) {
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index a2024e007c..91521a8479 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -70,6 +70,7 @@
#include "qguifunctions_wince.h"
QT_USE_NAMESPACE
extern void qt_wince_maximize(QWidget *widget); //defined in qguifunctions_wince.cpp
+extern void qt_wince_unmaximize(QWidget *widget); //defined in qguifunctions_wince.cpp
extern void qt_wince_minimize(HWND hwnd); //defined in qguifunctions_wince.cpp
extern void qt_wince_full_screen(HWND hwnd, bool fullScreen, UINT swpf); //defined in qguifunctions_wince.cpp
extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp
diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp
index fc1e52caf9..76532ed791 100644
--- a/src/gui/kernel/qwidget_wince.cpp
+++ b/src/gui/kernel/qwidget_wince.cpp
@@ -498,6 +498,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
int style = GetWindowLong(internalWinId(), GWL_STYLE) | WS_BORDER | WS_POPUP | WS_CAPTION;
SetWindowLong(internalWinId(), GWL_STYLE, style);
SetWindowLong(internalWinId(), GWL_EXSTYLE, GetWindowLong (internalWinId(), GWL_EXSTYLE) & ~ WS_EX_NODRAG);
+ qt_wince_unmaximize(this);
}
if (isVisible() && newstate & Qt::WindowMaximized)
qt_wince_maximize(this);
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 8081a4ba26..f5641a44a2 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -1490,7 +1490,7 @@ static void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint
comp_func_Clear_impl(dest, length, const_alpha);
}
-static void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha)
{
comp_func_Clear_impl(dest, length, const_alpha);
}
@@ -1514,7 +1514,7 @@ static void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint colo
}
}
-static void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255) {
::memcpy(dest, src, length * sizeof(uint));
@@ -1532,7 +1532,7 @@ static void QT_FASTCALL comp_func_solid_Destination(uint *, int, uint, uint)
{
}
-static void QT_FASTCALL comp_func_Destination(uint *, const uint *, int, uint)
+void QT_FASTCALL comp_func_Destination(uint *, const uint *, int, uint)
{
}
@@ -1557,7 +1557,7 @@ static void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint
}
}
-static void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -1595,7 +1595,7 @@ static void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length,
}
}
-static void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -1637,7 +1637,7 @@ static void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint co
}
}
-static void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -1674,7 +1674,7 @@ static void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, ui
}
}
-static void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -1716,7 +1716,7 @@ static void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint c
}
}
-static void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -1752,7 +1752,7 @@ static void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, u
}
}
-static void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -1789,7 +1789,7 @@ static void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint
}
}
-static void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -1829,7 +1829,7 @@ static void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length,
}
}
-static void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -1871,7 +1871,7 @@ static void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color,
}
}
-static void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha)
{
PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
@@ -1891,11 +1891,6 @@ static void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, u
}
}
-static const uint AMASK = 0xff000000;
-static const uint RMASK = 0x00ff0000;
-static const uint GMASK = 0x0000ff00;
-static const uint BMASK = 0x000000ff;
-
struct QFullCoverage {
inline void store(uint *dest, const uint src) const
{
@@ -1970,7 +1965,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *dest, const uin
}
}
-static void QT_FASTCALL comp_func_Plus(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Plus(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Plus_impl(dest, src, length, QFullCoverage());
@@ -2042,7 +2037,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Multiply_impl(uint *dest, const
}
}
-static void QT_FASTCALL comp_func_Multiply(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Multiply(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Multiply_impl(dest, src, length, QFullCoverage());
@@ -2110,7 +2105,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Screen_impl(uint *dest, const u
}
}
-static void QT_FASTCALL comp_func_Screen(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Screen(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Screen_impl(dest, src, length, QFullCoverage());
@@ -2189,7 +2184,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Overlay_impl(uint *dest, const
}
}
-static void QT_FASTCALL comp_func_Overlay(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Overlay(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Overlay_impl(dest, src, length, QFullCoverage());
@@ -2262,7 +2257,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Darken_impl(uint *dest, const u
}
}
-static void QT_FASTCALL comp_func_Darken(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Darken(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Darken_impl(dest, src, length, QFullCoverage());
@@ -2335,7 +2330,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Lighten_impl(uint *dest, const
}
}
-static void QT_FASTCALL comp_func_Lighten(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Lighten(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Lighten_impl(dest, src, length, QFullCoverage());
@@ -2418,7 +2413,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorDodge_impl(uint *dest, con
}
}
-static void QT_FASTCALL comp_func_ColorDodge(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_ColorDodge(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_ColorDodge_impl(dest, src, length, QFullCoverage());
@@ -2501,7 +2496,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorBurn_impl(uint *dest, cons
}
}
-static void QT_FASTCALL comp_func_ColorBurn(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_ColorBurn(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_ColorBurn_impl(dest, src, length, QFullCoverage());
@@ -2581,7 +2576,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_HardLight_impl(uint *dest, cons
}
}
-static void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_HardLight_impl(dest, src, length, QFullCoverage());
@@ -2672,7 +2667,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_SoftLight_impl(uint *dest, cons
}
}
-static void QT_FASTCALL comp_func_SoftLight(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_SoftLight(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_SoftLight_impl(dest, src, length, QFullCoverage());
@@ -2745,7 +2740,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Difference_impl(uint *dest, con
}
}
-static void QT_FASTCALL comp_func_Difference(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Difference(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Difference_impl(dest, src, length, QFullCoverage());
@@ -2812,7 +2807,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Exclusion_impl(uint *dest, cons
}
}
-static void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, int length, uint const_alpha)
+void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255)
comp_func_Exclusion_impl(dest, src, length, QFullCoverage());
@@ -2835,10 +2830,10 @@ static void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest,
*dest++ |= color;
}
-static void QT_FASTCALL rasterop_SourceOrDestination(uint *dest,
- const uint *src,
- int length,
- uint const_alpha)
+void QT_FASTCALL rasterop_SourceOrDestination(uint *dest,
+ const uint *src,
+ int length,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
while (length--)
@@ -2856,10 +2851,10 @@ static void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest,
*dest++ &= color;
}
-static void QT_FASTCALL rasterop_SourceAndDestination(uint *dest,
- const uint *src,
- int length,
- uint const_alpha)
+void QT_FASTCALL rasterop_SourceAndDestination(uint *dest,
+ const uint *src,
+ int length,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
while (length--) {
@@ -2879,10 +2874,10 @@ static void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest,
*dest++ ^= color;
}
-static void QT_FASTCALL rasterop_SourceXorDestination(uint *dest,
- const uint *src,
- int length,
- uint const_alpha)
+void QT_FASTCALL rasterop_SourceXorDestination(uint *dest,
+ const uint *src,
+ int length,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
while (length--) {
@@ -2904,10 +2899,10 @@ static void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest,
}
}
-static void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest,
- const uint *src,
- int length,
- uint const_alpha)
+void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest,
+ const uint *src,
+ int length,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
while (length--) {
@@ -2929,10 +2924,10 @@ static void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest,
}
}
-static void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest,
- const uint *src,
- int length,
- uint const_alpha)
+void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest,
+ const uint *src,
+ int length,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
while (length--) {
@@ -2954,10 +2949,10 @@ static void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest,
}
}
-static void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest,
- const uint *src,
- int length,
- uint const_alpha)
+void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest,
+ const uint *src,
+ int length,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
while (length--) {
@@ -2973,8 +2968,8 @@ static void QT_FASTCALL rasterop_solid_NotSource(uint *dest, int length,
qt_memfill(dest, ~color | 0xff000000, length);
}
-static void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src,
- int length, uint const_alpha)
+void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src,
+ int length, uint const_alpha)
{
Q_UNUSED(const_alpha);
while (length--)
@@ -2994,10 +2989,10 @@ static void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest,
}
}
-static void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest,
- const uint *src,
- int length,
- uint const_alpha)
+void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest,
+ const uint *src,
+ int length,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
while (length--) {
@@ -3018,10 +3013,10 @@ static void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest,
}
}
-static void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest,
- const uint *src,
- int length,
- uint const_alpha)
+void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest,
+ const uint *src,
+ int length,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
while (length--) {
@@ -7893,6 +7888,7 @@ void qInitDrawhelperAsm()
#ifdef QT_HAVE_MMX
if (features & MMX) {
functionForModeAsm = qt_functionForMode_MMX;
+
functionForModeSolidAsm = qt_functionForModeSolid_MMX;
qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_mmx;
#ifdef QT_HAVE_3DNOW
@@ -7941,8 +7937,10 @@ void qInitDrawhelperAsm()
int length,
uint const_alpha);
extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha);
+ extern void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha);
functionForModeAsm[0] = comp_func_SourceOver_sse2;
+ functionForModeAsm[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2;
functionForModeSolidAsm[0] = comp_func_solid_SourceOver_sse2;
extern void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
@@ -8037,17 +8035,8 @@ void qInitDrawhelperAsm()
functionForModeSolid = functionForModeSolidAsm;
}
- if (functionForModeAsm) {
- const int destinationMode = QPainter::CompositionMode_Destination;
- functionForModeAsm[destinationMode] = functionForMode_C[destinationMode];
-
- // use the default qdrawhelper implementation for the
- // extended composition modes
- for (int mode = 12; mode < numCompositionFunctions; ++mode)
- functionForModeAsm[mode] = functionForMode_C[mode];
-
+ if (functionForModeAsm)
functionForMode = functionForModeAsm;
- }
qt_build_pow_tables();
}
diff --git a/src/gui/painting/qdrawhelper_iwmmxt.cpp b/src/gui/painting/qdrawhelper_iwmmxt.cpp
index 80b2c04864..d99045d347 100644
--- a/src/gui/painting/qdrawhelper_iwmmxt.cpp
+++ b/src/gui/painting/qdrawhelper_iwmmxt.cpp
@@ -106,14 +106,35 @@ CompositionFunction qt_functionForMode_IWMMXT[] = {
comp_func_DestinationOver<QIWMMXTIntrinsics>,
comp_func_Clear<QIWMMXTIntrinsics>,
comp_func_Source<QIWMMXTIntrinsics>,
- 0,
+ comp_func_Destination,
comp_func_SourceIn<QIWMMXTIntrinsics>,
comp_func_DestinationIn<QIWMMXTIntrinsics>,
comp_func_SourceOut<QIWMMXTIntrinsics>,
comp_func_DestinationOut<QIWMMXTIntrinsics>,
comp_func_SourceAtop<QIWMMXTIntrinsics>,
comp_func_DestinationAtop<QIWMMXTIntrinsics>,
- comp_func_XOR<QIWMMXTIntrinsics>
+ comp_func_XOR<QIWMMXTIntrinsics>,
+ comp_func_Plus,
+ comp_func_Multiply,
+ comp_func_Screen,
+ comp_func_Overlay,
+ comp_func_Darken,
+ comp_func_Lighten,
+ comp_func_ColorDodge,
+ comp_func_ColorBurn,
+ comp_func_HardLight,
+ comp_func_SoftLight,
+ comp_func_Difference,
+ comp_func_Exclusion,
+ rasterop_SourceOrDestination,
+ rasterop_SourceAndDestination,
+ rasterop_SourceXorDestination,
+ rasterop_NotSourceAndNotDestination,
+ rasterop_NotSourceOrNotDestination,
+ rasterop_NotSourceXorDestination,
+ rasterop_NotSource,
+ rasterop_NotSourceAndDestination,
+ rasterop_SourceAndNotDestination
};
void qt_blend_color_argb_iwmmxt(int count, const QSpan *spans, void *userData)
diff --git a/src/gui/painting/qdrawhelper_mmx.cpp b/src/gui/painting/qdrawhelper_mmx.cpp
index d49c5a12d2..ba92554ef9 100644
--- a/src/gui/painting/qdrawhelper_mmx.cpp
+++ b/src/gui/painting/qdrawhelper_mmx.cpp
@@ -77,7 +77,7 @@ CompositionFunction qt_functionForMode_MMX[numCompositionFunctions] = {
comp_func_DestinationOver<QMMXIntrinsics>,
comp_func_Clear<QMMXIntrinsics>,
comp_func_Source<QMMXIntrinsics>,
- 0,
+ comp_func_Destination,
comp_func_SourceIn<QMMXIntrinsics>,
comp_func_DestinationIn<QMMXIntrinsics>,
comp_func_SourceOut<QMMXIntrinsics>,
@@ -85,6 +85,27 @@ CompositionFunction qt_functionForMode_MMX[numCompositionFunctions] = {
comp_func_SourceAtop<QMMXIntrinsics>,
comp_func_DestinationAtop<QMMXIntrinsics>,
comp_func_XOR<QMMXIntrinsics>,
+ comp_func_Plus,
+ comp_func_Multiply,
+ comp_func_Screen,
+ comp_func_Overlay,
+ comp_func_Darken,
+ comp_func_Lighten,
+ comp_func_ColorDodge,
+ comp_func_ColorBurn,
+ comp_func_HardLight,
+ comp_func_SoftLight,
+ comp_func_Difference,
+ comp_func_Exclusion,
+ rasterop_SourceOrDestination,
+ rasterop_SourceAndDestination,
+ rasterop_SourceXorDestination,
+ rasterop_NotSourceAndNotDestination,
+ rasterop_NotSourceOrNotDestination,
+ rasterop_NotSourceXorDestination,
+ rasterop_NotSource,
+ rasterop_NotSourceAndDestination,
+ rasterop_SourceAndNotDestination
};
void qt_blend_color_argb_mmx(int count, const QSpan *spans, void *userData)
diff --git a/src/gui/painting/qdrawhelper_mmx3dnow.cpp b/src/gui/painting/qdrawhelper_mmx3dnow.cpp
index 8bffaa7a45..b1e81fce4f 100644
--- a/src/gui/painting/qdrawhelper_mmx3dnow.cpp
+++ b/src/gui/painting/qdrawhelper_mmx3dnow.cpp
@@ -85,14 +85,35 @@ CompositionFunction qt_functionForMode_MMX3DNOW[numCompositionFunctions] = {
comp_func_DestinationOver<QMMX3DNOWIntrinsics>,
comp_func_Clear<QMMX3DNOWIntrinsics>,
comp_func_Source<QMMX3DNOWIntrinsics>,
- 0,
+ comp_func_Destination,
comp_func_SourceIn<QMMX3DNOWIntrinsics>,
comp_func_DestinationIn<QMMX3DNOWIntrinsics>,
comp_func_SourceOut<QMMX3DNOWIntrinsics>,
comp_func_DestinationOut<QMMX3DNOWIntrinsics>,
comp_func_SourceAtop<QMMX3DNOWIntrinsics>,
comp_func_DestinationAtop<QMMX3DNOWIntrinsics>,
- comp_func_XOR<QMMX3DNOWIntrinsics>
+ comp_func_XOR<QMMX3DNOWIntrinsics>,
+ comp_func_Plus,
+ comp_func_Multiply,
+ comp_func_Screen,
+ comp_func_Overlay,
+ comp_func_Darken,
+ comp_func_Lighten,
+ comp_func_ColorDodge,
+ comp_func_ColorBurn,
+ comp_func_HardLight,
+ comp_func_SoftLight,
+ comp_func_Difference,
+ comp_func_Exclusion,
+ rasterop_SourceOrDestination,
+ rasterop_SourceAndDestination,
+ rasterop_SourceXorDestination,
+ rasterop_NotSourceAndNotDestination,
+ rasterop_NotSourceOrNotDestination,
+ rasterop_NotSourceXorDestination,
+ rasterop_NotSource,
+ rasterop_NotSourceAndDestination,
+ rasterop_SourceAndNotDestination
};
void qt_blend_color_argb_mmx3dnow(int count, const QSpan *spans, void *userData)
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 97c78bb0a2..1a87127f38 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -91,6 +91,11 @@ QT_BEGIN_NAMESPACE
# define Q_STATIC_INLINE_FUNCTION static inline
#endif
+static const uint AMASK = 0xff000000;
+static const uint RMASK = 0x00ff0000;
+static const uint GMASK = 0x0000ff00;
+static const uint BMASK = 0x000000ff;
+
/*******************************************************************************
* QSpan
*
@@ -1945,6 +1950,41 @@ const uint qt_bayer_matrix[16][16] = {
((((argb >> 24) * alpha) >> 8) << 24) | (argb & 0x00ffffff)
+// prototypes of all the composition functions
+void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha);
+void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_Destination(uint *, const uint *, int, uint);
+void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_Plus(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_Multiply(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_Screen(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_Overlay(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_Darken(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_Lighten(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_ColorDodge(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_ColorBurn(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_SoftLight(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_Difference(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL rasterop_SourceOrDestination(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL rasterop_SourceAndDestination(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL rasterop_SourceXorDestination(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest, const uint *src, int length, uint const_alpha);
+void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest, const uint *src, int length, uint const_alpha);
+
QT_END_NAMESPACE
#endif // QDRAWHELPER_P_H
diff --git a/src/gui/painting/qdrawhelper_sse.cpp b/src/gui/painting/qdrawhelper_sse.cpp
index 58a7fdd7db..8b17c29e92 100644
--- a/src/gui/painting/qdrawhelper_sse.cpp
+++ b/src/gui/painting/qdrawhelper_sse.cpp
@@ -77,14 +77,35 @@ CompositionFunction qt_functionForMode_SSE[numCompositionFunctions] = {
comp_func_DestinationOver<QSSEIntrinsics>,
comp_func_Clear<QSSEIntrinsics>,
comp_func_Source<QSSEIntrinsics>,
- 0,
+ comp_func_Destination,
comp_func_SourceIn<QSSEIntrinsics>,
comp_func_DestinationIn<QSSEIntrinsics>,
comp_func_SourceOut<QSSEIntrinsics>,
comp_func_DestinationOut<QSSEIntrinsics>,
comp_func_SourceAtop<QSSEIntrinsics>,
comp_func_DestinationAtop<QSSEIntrinsics>,
- comp_func_XOR<QSSEIntrinsics>
+ comp_func_XOR<QSSEIntrinsics>,
+ comp_func_Plus,
+ comp_func_Multiply,
+ comp_func_Screen,
+ comp_func_Overlay,
+ comp_func_Darken,
+ comp_func_Lighten,
+ comp_func_ColorDodge,
+ comp_func_ColorBurn,
+ comp_func_HardLight,
+ comp_func_SoftLight,
+ comp_func_Difference,
+ comp_func_Exclusion,
+ rasterop_SourceOrDestination,
+ rasterop_SourceAndDestination,
+ rasterop_SourceXorDestination,
+ rasterop_NotSourceAndNotDestination,
+ rasterop_NotSourceOrNotDestination,
+ rasterop_NotSourceXorDestination,
+ rasterop_NotSource,
+ rasterop_NotSourceAndDestination,
+ rasterop_SourceAndNotDestination
};
void qt_blend_color_argb_sse(int count, const QSpan *spans, void *userData)
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index 346e177ecc..e090ae5f8c 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -110,13 +110,23 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
const __m128i oneMinusConstAlpha = _mm_set1_epi16(one_minus_const_alpha);
for (int y = 0; y < h; ++y) {
int x = 0;
+
+ // First, align dest to 16 bytes:
+ const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;
+ const int prologLength = qMin(w, offsetToAlignOn16Bytes);
+ for (; x < prologLength; ++x) {
+ quint32 s = src[x];
+ s = BYTE_MUL(s, const_alpha);
+ dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);
+ }
+
for (; x < w-3; x += 4) {
__m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]);
if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) {
- const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]);
+ const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);
__m128i result;
INTERPOLATE_PIXEL_255_SSE2(result, srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half);
- _mm_storeu_si128((__m128i *)&dst[x], result);
+ _mm_store_si128((__m128i *)&dst[x], result);
}
}
for (; x<w; ++x) {
@@ -135,7 +145,6 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha)
{
- Q_ASSERT(const_alpha >= 0);
Q_ASSERT(const_alpha < 256);
const quint32 *src = (const quint32 *) srcPixels;
@@ -154,6 +163,72 @@ void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixe
}
}
+inline int comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha)
+{
+#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
+ const int result = (MIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
+#undef MIX
+ return INTERPOLATE_PIXEL_255(result, const_alpha, d, one_minus_const_alpha);
+}
+
+inline int comp_func_Plus_one_pixel(uint d, const uint s)
+{
+#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
+ const int result = (MIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
+#undef MIX
+ return result;
+}
+
+void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha)
+{
+ int x = 0;
+ const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;
+ const int prologLength = qMin(length, offsetToAlignOn16Bytes);
+
+ if (const_alpha == 255) {
+ // 1) Prologue: align destination on 16 bytes
+ for (; x < prologLength; ++x)
+ dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]);
+
+ // 2) composition with SSE2
+ for (; x < length - 3; x += 4) {
+ const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]);
+ const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);
+
+ const __m128i result = _mm_adds_epu8(srcVector, dstVector);
+ _mm_store_si128((__m128i *)&dst[x], result);
+ }
+
+ // 3) Epilogue:
+ for (; x < length; ++x)
+ dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]);
+ } else {
+ const int one_minus_const_alpha = 255 - const_alpha;
+ const __m128i constAlphaVector = _mm_set1_epi16(const_alpha);
+ const __m128i oneMinusConstAlpha = _mm_set1_epi16(one_minus_const_alpha);
+
+ // 1) Prologue: align destination on 16 bytes
+ for (; x < prologLength; ++x)
+ dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha);
+
+ const __m128i half = _mm_set1_epi16(0x80);
+ const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
+ // 2) composition with SSE2
+ for (; x < length - 3; x += 4) {
+ const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]);
+ const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);
+
+ __m128i result = _mm_adds_epu8(srcVector, dstVector);
+ INTERPOLATE_PIXEL_255_SSE2(result, result, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half)
+ _mm_store_si128((__m128i *)&dst[x], result);
+ }
+
+ // 3) Epilogue:
+ for (; x < length; ++x)
+ dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha);
+ }
+}
+
void qt_memfill32_sse2(quint32 *dest, quint32 value, int count)
{
if (count < 7) {
diff --git a/src/gui/painting/qdrawhelper_sse3dnow.cpp b/src/gui/painting/qdrawhelper_sse3dnow.cpp
index c58cf13c5c..9ae0e0792b 100644
--- a/src/gui/painting/qdrawhelper_sse3dnow.cpp
+++ b/src/gui/painting/qdrawhelper_sse3dnow.cpp
@@ -85,14 +85,35 @@ CompositionFunction qt_functionForMode_SSE3DNOW[numCompositionFunctions] = {
comp_func_DestinationOver<QSSE3DNOWIntrinsics>,
comp_func_Clear<QSSE3DNOWIntrinsics>,
comp_func_Source<QSSE3DNOWIntrinsics>,
- 0,
+ comp_func_Destination,
comp_func_SourceIn<QSSE3DNOWIntrinsics>,
comp_func_DestinationIn<QSSE3DNOWIntrinsics>,
comp_func_SourceOut<QSSE3DNOWIntrinsics>,
comp_func_DestinationOut<QSSE3DNOWIntrinsics>,
comp_func_SourceAtop<QSSE3DNOWIntrinsics>,
comp_func_DestinationAtop<QSSE3DNOWIntrinsics>,
- comp_func_XOR<QSSE3DNOWIntrinsics>
+ comp_func_XOR<QSSE3DNOWIntrinsics>,
+ comp_func_Plus,
+ comp_func_Multiply,
+ comp_func_Screen,
+ comp_func_Overlay,
+ comp_func_Darken,
+ comp_func_Lighten,
+ comp_func_ColorDodge,
+ comp_func_ColorBurn,
+ comp_func_HardLight,
+ comp_func_SoftLight,
+ comp_func_Difference,
+ comp_func_Exclusion,
+ rasterop_SourceOrDestination,
+ rasterop_SourceAndDestination,
+ rasterop_SourceXorDestination,
+ rasterop_NotSourceAndNotDestination,
+ rasterop_NotSourceOrNotDestination,
+ rasterop_NotSourceXorDestination,
+ rasterop_NotSource,
+ rasterop_NotSourceAndDestination,
+ rasterop_SourceAndNotDestination
};
void qt_blend_color_argb_sse3dnow(int count, const QSpan *spans, void *userData)
diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h
index 3c9694644d..18355c278b 100644
--- a/src/gui/painting/qdrawingprimitive_sse2_p.h
+++ b/src/gui/painting/qdrawingprimitive_sse2_p.h
@@ -141,12 +141,24 @@ QT_BEGIN_NAMESPACE
// with shortcuts if fully opaque or fully transparent.
#define BLEND_SOURCE_OVER_ARGB32_SSE2(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) { \
+ uint s = src[x]; \
+ if (s >= 0xff000000) \
+ dst[x] = s; \
+ else if (s != 0) \
+ dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
+ } \
+\
for (; x < length-3; x += 4) { \
const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \
const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \
if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \
/* all opaque */ \
- _mm_storeu_si128((__m128i *)&dst[x], srcVector); \
+ _mm_store_si128((__m128i *)&dst[x], srcVector); \
} else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \
/* not fully transparent */ \
/* extract the alpha channel on 2 x 16 bits */ \
@@ -157,13 +169,13 @@ QT_BEGIN_NAMESPACE
alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); \
alphaChannel = _mm_sub_epi16(one, alphaChannel); \
\
- const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); \
+ const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \
__m128i destMultipliedByOneMinusAlpha; \
BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \
\
/* result = s + d * (1-alpha) */\
const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \
- _mm_storeu_si128((__m128i *)&dst[x], result); \
+ _mm_store_si128((__m128i *)&dst[x], result); \
} \
} \
for (; x < length; ++x) { \
@@ -189,6 +201,17 @@ QT_BEGIN_NAMESPACE
#define BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, length, nullVector, half, one, colorMask, constAlphaVector) \
{ \
int x = 0; \
+\
+ const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;\
+ const int prologLength = qMin(length, offsetToAlignOn16Bytes);\
+ for (; x < prologLength; ++x) { \
+ quint32 s = src[x]; \
+ if (s != 0) { \
+ s = BYTE_MUL(s, const_alpha); \
+ dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
+ } \
+ } \
+\
for (; x < length-3; x += 4) { \
__m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \
if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { \
@@ -198,12 +221,12 @@ QT_BEGIN_NAMESPACE
alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); \
alphaChannel = _mm_sub_epi16(one, alphaChannel); \
\
- const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); \
+ 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_storeu_si128((__m128i *)&dst[x], result); \
+ _mm_store_si128((__m128i *)&dst[x], result); \
} \
} \
for (; x < length; ++x) { \
diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h
index 8e635a8a51..ea5f3530df 100644
--- a/src/gui/painting/qrgb.h
+++ b/src/gui/painting/qrgb.h
@@ -64,7 +64,7 @@ Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb) // get blue part of RGB
{ return (rgb & 0xff); }
Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb) // get alpha part of RGBA
-{ return ((rgb >> 24) & 0xff); }
+{ return rgb >> 24; }
Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)// set RGB value
{ return (0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index 4cfa93f88f..687e587365 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -2421,9 +2421,10 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include <QDebug>
QT_END_INCLUDE_NAMESPACE
+#if !defined(QT_NO_DEBUG_STREAM)
QDebug operator<<(QDebug debug, QStyle::State state)
{
-#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
+#if !defined(QT_NO_DEBUG)
debug << "QStyle::State(";
QStringList states;
@@ -2458,6 +2459,7 @@ QDebug operator<<(QDebug debug, QStyle::State state)
#endif
return debug;
}
+#endif
/*!
\since 4.6
diff --git a/src/gui/styles/qstyle.h b/src/gui/styles/qstyle.h
index 439d62618a..439901a8f9 100644
--- a/src/gui/styles/qstyle.h
+++ b/src/gui/styles/qstyle.h
@@ -878,7 +878,9 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State)
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls)
+#if !defined(QT_NO_DEBUG_STREAM)
Q_GUI_EXPORT QDebug operator<<(QDebug debug, QStyle::State state);
+#endif
QT_END_NAMESPACE
diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp
index c057a2b2ea..4780edfbc0 100644
--- a/src/gui/styles/qstyleoption.cpp
+++ b/src/gui/styles/qstyleoption.cpp
@@ -5419,9 +5419,10 @@ QStyleHintReturnVariant::QStyleHintReturnVariant() : QStyleHintReturn(Version, T
Returns a T or 0 depending on the type of \a hint.
*/
+#if !defined(QT_NO_DEBUG_STREAM)
QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)
{
-#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
+#if !defined(QT_NO_DEBUG)
switch (optionType) {
case QStyleOption::SO_Default:
debug << "SO_Default"; break;
@@ -5488,7 +5489,7 @@ QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)
QDebug operator<<(QDebug debug, const QStyleOption &option)
{
-#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
+#if !defined(QT_NO_DEBUG)
debug << "QStyleOption(";
debug << QStyleOption::OptionType(option.type);
debug << ',' << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight");
@@ -5498,5 +5499,6 @@ QDebug operator<<(QDebug debug, const QStyleOption &option)
#endif
return debug;
}
+#endif
QT_END_NAMESPACE
diff --git a/src/gui/styles/qstyleoption.h b/src/gui/styles/qstyleoption.h
index 95de8d50ac..e79d9a4203 100644
--- a/src/gui/styles/qstyleoption.h
+++ b/src/gui/styles/qstyleoption.h
@@ -958,8 +958,10 @@ T qstyleoption_cast(QStyleHintReturn *hint)
return 0;
}
+#if !defined(QT_NO_DEBUG_STREAM)
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType);
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption &option);
+#endif
QT_END_NAMESPACE
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index f691413da5..74ef646fbb 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -94,7 +94,7 @@ bool QSymbianTypeFaceExtras::getSfntTableData(uint tag, uchar *buffer, uint *len
} else {
*length = tableByteLength;
if (buffer)
- qMemCopy(buffer, fontTable.TableContent(), tableByteLength);
+ memcpy(buffer, fontTable.TableContent(), tableByteLength);
}
fontTable.Close();
@@ -146,7 +146,7 @@ bool QSymbianTypeFaceExtras::getSfntTableData(uint tag, uchar *buffer, uint *len
} else {
*length = tableByteLength;
if (buffer)
- qMemCopy(buffer, table, tableByteLength);
+ memcpy(buffer, table, tableByteLength);
}
m_trueTypeExtension->ReleaseTrueTypeTable(table);
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index 91a6612baf..f6daed859d 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -148,9 +148,7 @@ QStaticText::QStaticText()
}
/*!
- Constructs a QStaticText object with the given \a text and bounded by the given \a size.
-
- If an invalid size is passed for \a size the text will be unbounded.
+ Constructs a QStaticText object with the given \a text.
*/
QStaticText::QStaticText(const QString &text)
: data(new QStaticTextPrivate)
@@ -465,13 +463,13 @@ namespace {
m_chars.resize(m_chars.size() + ti.num_chars);
glyph_t *glyphsDestination = m_glyphs.data() + currentItem.glyphOffset;
- qMemCopy(glyphsDestination, glyphs.constData(), sizeof(glyph_t) * currentItem.numGlyphs);
+ memcpy(glyphsDestination, glyphs.constData(), sizeof(glyph_t) * currentItem.numGlyphs);
QFixedPoint *positionsDestination = m_positions.data() + currentItem.positionOffset;
- qMemCopy(positionsDestination, positions.constData(), sizeof(QFixedPoint) * currentItem.numGlyphs);
+ memcpy(positionsDestination, positions.constData(), sizeof(QFixedPoint) * currentItem.numGlyphs);
QChar *charsDestination = m_chars.data() + currentItem.charOffset;
- qMemCopy(charsDestination, ti.chars, sizeof(QChar) * currentItem.numChars);
+ memcpy(charsDestination, ti.chars, sizeof(QChar) * currentItem.numChars);
m_items.append(currentItem);
}
@@ -681,13 +679,13 @@ void QStaticTextPrivate::init()
items = new QStaticTextItem[itemCount];
glyphPool = new glyph_t[glyphs.size()];
- qMemCopy(glyphPool, glyphs.constData(), glyphs.size() * sizeof(glyph_t));
+ memcpy(glyphPool, glyphs.constData(), glyphs.size() * sizeof(glyph_t));
positionPool = new QFixedPoint[positions.size()];
- qMemCopy(positionPool, positions.constData(), positions.size() * sizeof(QFixedPoint));
+ memcpy(positionPool, positions.constData(), positions.size() * sizeof(QFixedPoint));
charPool = new QChar[chars.size()];
- qMemCopy(charPool, chars.constData(), chars.size() * sizeof(QChar));
+ memcpy(charPool, chars.constData(), chars.size() * sizeof(QChar));
for (int i=0; i<itemCount; ++i) {
items[i] = deviceItems.at(i);
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index daa40a1aac..769ab2fb66 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -1283,7 +1283,7 @@ void QTextCursor::setVisualNavigation(bool b)
/*!
\since 4.7
- Sets the visual x position for vertical cursor movements.
+ Sets the visual x position for vertical cursor movements to \a x.
The vertical movement x position is cleared automatically when the cursor moves horizontally, and kept
unchanged when the cursor moves vertically. The mechanism allows the cursor to move up and down on a
@@ -1335,8 +1335,8 @@ bool QTextCursor::keepPositionOnInsert() const
Defines whether the cursor should keep its current position when text gets inserted at the current position of the
cursor.
- If \b is true, the cursor keeps its current position when text gets inserted at the positing of the cursor.
- If \b is false, the cursor moves along with the inserted text.
+ If \a b is true, the cursor keeps its current position when text gets inserted at the positing of the cursor.
+ If \a b is false, the cursor moves along with the inserted text.
The default is false.
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 7b3f9853c9..213db7ed9f 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -1649,7 +1649,7 @@ void QTextDocumentPrivate::compressPieceTable()
int newLen = 0;
for (FragmentMap::Iterator it = fragments.begin(); !it.atEnd(); ++it) {
- qMemCopy(newTextPtr, text.constData() + it->stringPosition, it->size_array[0] * sizeof(QChar));
+ memcpy(newTextPtr, text.constData() + it->stringPosition, it->size_array[0] * sizeof(QChar));
it->stringPosition = newLen;
newTextPtr += it->size_array[0];
newLen += it->size_array[0];
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 43900c0453..aff88f63b5 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1978,7 +1978,7 @@ void QTextLine::layout_helper(int maxGlyphs)
// We ignore the right bearing if the minimum negative bearing is too little to
// expand the text beyond the edge.
if (sb_or_ws|breakany) {
- if (lbh.calculateNewWidth(line) + lbh.minimumRightBearing > line.width)
+ if (lbh.calculateNewWidth(line) - lbh.minimumRightBearing > line.width)
lbh.adjustRightBearing();
if (lbh.checkFullOtherwiseExtend(line)) {
if (!breakany) {
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index f386871d5e..5fb3384d51 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -1148,7 +1148,7 @@ int QTextBlock::charFormatIndex() const
direction from the blocks content. Returns either Qt::LeftToRight
or Qt::RightToLeft.
- \sa QTextBlock::layoutDirection(), QString::isRightToLeft(), Qt::LayoutDirection
+ \sa QTextFormat::layoutDirection(), QString::isRightToLeft(), Qt::LayoutDirection
*/
Qt::LayoutDirection QTextBlock::textDirection() const
{
diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp
index 8f31e4603a..9eeec0bfae 100644
--- a/src/gui/text/qtextoption.cpp
+++ b/src/gui/text/qtextoption.cpp
@@ -392,7 +392,12 @@ QList<QTextOption::Tab> QTextOption::tabs() const
/*!
\fn Tab::Tab(qreal pos, TabType tabType, QChar delim = QChar())
- Creates a tab with the given position, tab type, and (for DelimiterTab) delimiter
+
+ Creates a tab with the given position, tab type, and delimiter
+ (\a pos, \a tabType, \a delim).
+
+ \note \a delim is only used when \a tabType is DelimiterTab.
+
\since 4.7
*/
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index 5100176bad..c291f25ff8 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -754,19 +754,39 @@ void QTextTable::insertColumns(int pos, int num)
QTextFormatCollection *c = p->formatCollection();
p->beginEditBlock();
+ QList<int> extendedSpans;
for (int i = 0; i < d->nRows; ++i) {
int cell;
if (i == d->nRows - 1 && pos == d->nCols)
cell = d->fragment_end;
else
cell = d->grid[i*d->nCols + pos];
- QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
- QTextCharFormat fmt = c->charFormat(it->format);
if (pos > 0 && pos < d->nCols && cell == d->grid[i*d->nCols + pos - 1]) {
// cell spans the insertion place, extend it
- fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num);
- p->setCharFormat(it.position(), 1, fmt);
+ if (!extendedSpans.contains(cell)) {
+ QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
+ QTextCharFormat fmt = c->charFormat(it->format);
+ fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num);
+ p->setCharFormat(it.position(), 1, fmt);
+ d->dirty = true;
+ extendedSpans << cell;
+ }
} else {
+ /* If the next cell is spanned from the row above, we need to find the right position
+ to insert to */
+ if (i > 0 && pos < d->nCols && cell == d->grid[(i-1) * d->nCols + pos]) {
+ int gridIndex = i*d->nCols + pos;
+ const int gridEnd = d->nRows * d->nCols - 1;
+ while (gridIndex < gridEnd && cell == d->grid[gridIndex]) {
+ ++gridIndex;
+ }
+ if (gridIndex == gridEnd)
+ cell = d->fragment_end;
+ else
+ cell = d->grid[gridIndex];
+ }
+ QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
+ QTextCharFormat fmt = c->charFormat(it->format);
fmt.setTableCellRowSpan(1);
fmt.setTableCellColumnSpan(1);
Q_ASSERT(fmt.objectIndex() == objectIndex());
@@ -915,12 +935,13 @@ void QTextTable::removeColumns(int pos, int num)
for (int r = 0; r < d->nRows; ++r) {
for (int c = pos; c < pos + num; ++c) {
int cell = d->grid[r*d->nCols + c];
- if (touchedCells.contains(cell))
- continue;
- touchedCells << cell;
QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
QTextCharFormat fmt = collection->charFormat(it->format);
int span = fmt.tableCellColumnSpan();
+ if (touchedCells.contains(cell) && span <= 1)
+ continue;
+ touchedCells << cell;
+
if (span > 1) {
fmt.setTableCellColumnSpan(span - 1);
p->setCharFormat(it.position(), 1, fmt);
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index 889fb2c4d3..102df4d41d 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -200,8 +200,6 @@ contains(QT_CONFIG, freetype) {
# pull in the proper freetype2 include directory
include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
LIBS_PRIVATE += -lfreetype
-} else {
- DEFINES *= QT_NO_FREETYPE
}
contains(QT_CONFIG, fontconfig) {
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp
index 1abc2d9250..04d6de937f 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -154,6 +154,7 @@
#include "QtGui/qevent.h"
#include "QtGui/qheaderview.h"
#include "QtGui/qdesktopwidget.h"
+#include "QtGui/qlineedit.h"
QT_BEGIN_NAMESPACE
@@ -920,8 +921,9 @@ void QCompleterPrivate::showPopup(const QRect& rect)
void QCompleterPrivate::_q_fileSystemModelDirectoryLoaded(const QString &path)
{
Q_Q(QCompleter);
+ QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget);
//the path given by QFileSystemModel does not end with /
- if (!q->completionPrefix().isEmpty() && q->completionPrefix() != path + QLatin1Char('/'))
+ if (lineEdit && !lineEdit->text().isEmpty() && !q->completionPrefix().isEmpty() && q->completionPrefix() != path + QLatin1Char('/'))
q->complete();
}
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 1bffde16f9..981e934ecf 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1663,8 +1663,11 @@ void QLineEdit::keyPressEvent(QKeyEvent *event)
}
#endif
d->control->processKeyEvent(event);
- if (event->isAccepted())
+ if (event->isAccepted()) {
+ if (layoutDirection() != d->control->layoutDirection())
+ setLayoutDirection(d->control->layoutDirection());
d->control->setCursorBlinkPeriod(0);
+ }
}
/*!
@@ -1946,7 +1949,8 @@ void QLineEdit::paintEvent(QPaintEvent *)
if (d->control->hasSelectedText() || (d->cursorVisible && !d->control->inputMask().isEmpty() && !d->control->isReadOnly())){
flags |= QLineControl::DrawSelections;
// Palette only used for selections/mask and may not be in sync
- if(d->control->palette() != pal)
+ if (d->control->palette() != pal
+ || d->control->palette().currentColorGroup() != pal.currentColorGroup())
d->control->setPalette(pal);
}
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index 318b75f3cb..8a470ee259 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -1219,6 +1219,12 @@ void QTabBar::setCurrentIndex(int index)
if (oldIndex >= 0 && oldIndex < count())
d->layoutTab(oldIndex);
d->layoutTab(index);
+#ifndef QT_NO_ACCESSIBILITY
+ if (QAccessible::isActive()) {
+ QAccessible::updateAccessibility(this, index + 1, QAccessible::Focus);
+ QAccessible::updateAccessibility(this, index + 1, QAccessible::Selection);
+ }
+#endif
#ifdef QT3_SUPPORT
emit selected(index);
#endif