From fe44e724e7742b17b765fcd6aa9d740e4d8860ba Mon Sep 17 00:00:00 2001
From: Alexis Menard <alexis.menard@nokia.com>
Date: Mon, 18 Oct 2010 16:26:12 +0200
Subject: Send the hoverLeave not properly sent on the widget inside QGPW.

We need to send the hover leave event on the proper receiver in case
the widget we embed in a complex hierarchy not the widget itself.

Task-number:QTBUG-6986
Reviewed-by:bnilsen
---
 src/gui/graphicsview/qgraphicsproxywidget.cpp      |  4 +-
 .../tst_qgraphicsproxywidget.cpp                   | 62 ++++++++++++++++++++++
 2 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp
index 320395e..ce63659 100644
--- a/src/gui/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp
@@ -266,8 +266,8 @@ void QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(QGraphicsSceneMouseEvent
     }
 
     if (!lastWidgetUnderMouse) {
-        QApplicationPrivate::dispatchEnterLeave(embeddedMouseGrabber ? embeddedMouseGrabber : widget, 0);
-        lastWidgetUnderMouse = widget;
+        QApplicationPrivate::dispatchEnterLeave(embeddedMouseGrabber ? embeddedMouseGrabber : receiver, 0);
+        lastWidgetUnderMouse = receiver;
     }
 
     // Map event position from us to the receiver
diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 411c790..bc962c5 100644
--- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -183,6 +183,7 @@ private slots:
     void inputMethod();
     void clickFocus();
     void windowFrameMargins();
+    void QTBUG_6986_sendMouseEventToAlienWidget();
 };
 
 // Subclass that exposes the protected functions.
@@ -3583,6 +3584,67 @@ void tst_QGraphicsProxyWidget::windowFrameMargins()
     QVERIFY(top > 0);
 }
 
+class HoverButton : public QPushButton
+{
+public:
+    HoverButton(QWidget *parent = 0) : QPushButton(parent), hoverLeaveReceived(false)
+    {}
+
+    bool hoverLeaveReceived;
+
+    bool event(QEvent* e)
+    {
+        if(QEvent::HoverLeave == e->type())
+            hoverLeaveReceived = true;
+        return QPushButton::event(e);
+    }
+};
+
+class Scene : public QGraphicsScene
+{
+Q_OBJECT
+public:
+    Scene() {
+        QWidget *background = new QWidget;
+        background->setGeometry(0, 0, 500, 500);
+        hoverButton = new HoverButton;
+        hoverButton->setParent(background);
+        hoverButton->setText("Second button");
+        hoverButton->setGeometry(10, 10, 200, 50);
+        addWidget(background);
+
+        QPushButton *hideButton = new QPushButton("I'm a button with a very very long text");
+        hideButton->setGeometry(10, 10, 400, 50);
+        topButton = addWidget(hideButton);
+        connect(hideButton, SIGNAL(clicked()), this, SLOT(hideButton()));
+        topButton->setFocus();
+    }
+
+    QGraphicsProxyWidget *topButton;
+    HoverButton *hoverButton;
+
+public slots:
+    void hideButton() {
+       QCursor::setPos(600,600);
+       topButton->hide();
+    }
+};
+
+void tst_QGraphicsProxyWidget::QTBUG_6986_sendMouseEventToAlienWidget()
+{
+    QGraphicsView view;
+    Scene scene;
+    view.setScene(&scene);
+    view.resize(600, 600);
+    QApplication::setActiveWindow(&view);
+    view.show();
+    QTest::qWaitForWindowShown(&view);
+    QTRY_COMPARE(QApplication::activeWindow(), &view);
+    QCursor::setPos(view.mapToGlobal(view.mapFromScene(scene.topButton->boundingRect().center())));
+    QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(scene.topButton->scenePos()));
+    QTRY_COMPARE(scene.hoverButton->hoverLeaveReceived, true);
+}
+
 QTEST_MAIN(tst_QGraphicsProxyWidget)
 #include "tst_qgraphicsproxywidget.moc"
 
-- 
cgit v0.12


From fbf11a9584c011e5fb10bf008cc3c8ad99c3103f Mon Sep 17 00:00:00 2001
From: Stephen Kelly <stephen.kelly@kdab.com>
Date: Thu, 23 Sep 2010 14:16:14 +0200
Subject: Emit beginResetModel before updating the strings.

Reviewed-by: gabi
Merge-request: 694
---
 src/gui/itemviews/qstringlistmodel.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gui/itemviews/qstringlistmodel.cpp b/src/gui/itemviews/qstringlistmodel.cpp
index 8d69ee4..60ff952 100644
--- a/src/gui/itemviews/qstringlistmodel.cpp
+++ b/src/gui/itemviews/qstringlistmodel.cpp
@@ -290,8 +290,9 @@ QStringList QStringListModel::stringList() const
 */
 void QStringListModel::setStringList(const QStringList &strings)
 {
+    emit beginResetModel();
     lst = strings;
-    reset();
+    emit endResetModel();
 }
 
 /*!
-- 
cgit v0.12


From 6f1384fcbeea993d5be47590c696de60215b7608 Mon Sep 17 00:00:00 2001
From: Stephen Kelly <stephen.kelly@kdab.com>
Date: Thu, 23 Sep 2010 14:14:18 +0200
Subject: Provide the resetInternalData slot to cleanly reset data in proxy
 subclasses.

Direct subclasses of QAbstractItemModel are unnaffected as they can update
internal data in a slot connected to the sourceModel's modelReset signal or
layoutChanged signal.

Reviewed-by: gabi
Merge-request: 694
---
 .../code/src_corelib_kernel_qabstractitemmodel.cpp |  35 ++++++
 src/corelib/kernel/qabstractitemmodel.cpp          |  22 ++++
 src/corelib/kernel/qabstractitemmodel.h            |   3 +
 .../tst_qsortfilterproxymodel.cpp                  | 138 +++++++++++++++++++++
 4 files changed, 198 insertions(+)

diff --git a/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp b/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp
index 59e6ae0..07ff2a0 100644
--- a/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp
+++ b/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp
@@ -86,3 +86,38 @@ beginMoveRows(parent, 2, 2, parent, 0);
 //! [9]
 beginMoveRows(parent, 2, 2, parent, 4);
 //! [9]
+
+
+//! [10]
+class CustomDataProxy : public QSortFilterProxyModel
+{
+    Q_OBJECT
+public:
+    CustomDataProxy(QObject *parent)
+      : QSortFilterProxyModel(parent)
+    {
+    }
+
+    ...
+
+    QVariant data(const QModelIndex &index, int role)
+    {
+        if (role != Qt::BackgroundRole)
+            return QSortFilterProxyModel::data(index, role);
+
+        if (m_customData.contains(index.row()))
+            return m_customData.value(index.row());
+        return QSortFilterProxyModel::data(index, role);
+    }
+
+private slots:
+    void resetInternalData()
+    {
+        m_customData.clear();
+    }
+
+private:
+  QHash<int, QVariant> m_customData;
+};
+//! [10]
+
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index 4fc9792..2affc91 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -1349,6 +1349,26 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent,
 */
 
 /*!
+    \since 4.8
+
+    This slot is called just after the internal data of a model is cleared
+    while it is being reset.
+
+    This slot is provided the convenience of subclasses of concrete proxy
+    models, such as subclasses of QSortFilterProxyModel which maintain extra
+    data.
+
+    \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 10
+
+    \sa modelAboutToBeReset(), modelReset()
+*/
+void QAbstractItemModel::resetInternalData()
+{
+
+}
+
+
+/*!
     Constructs an abstract item model with the given \a parent.
 */
 QAbstractItemModel::QAbstractItemModel(QObject *parent)
@@ -2889,6 +2909,7 @@ void QAbstractItemModel::reset()
     Q_D(QAbstractItemModel);
     emit modelAboutToBeReset();
     d->invalidatePersistentIndexes();
+    QMetaObject::invokeMethod(this, "resetInternalData");
     emit modelReset();
 }
 
@@ -2931,6 +2952,7 @@ void QAbstractItemModel::endResetModel()
 {
     Q_D(QAbstractItemModel);
     d->invalidatePersistentIndexes();
+    QMetaObject::invokeMethod(this, "resetInternalData");
     emit modelReset();
 }
 
diff --git a/src/corelib/kernel/qabstractitemmodel.h b/src/corelib/kernel/qabstractitemmodel.h
index 63d9e6f..18b43fe 100644
--- a/src/corelib/kernel/qabstractitemmodel.h
+++ b/src/corelib/kernel/qabstractitemmodel.h
@@ -302,6 +302,9 @@ protected:
 
     void setRoleNames(const QHash<int,QByteArray> &roleNames);
 
+protected slots:
+    void resetInternalData();
+
 private:
     Q_DECLARE_PRIVATE(QAbstractItemModel)
     Q_DISABLE_COPY(QAbstractItemModel)
diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 2b62ccc..bc6ba77 100644
--- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -144,6 +144,7 @@ private slots:
 
     void testMultipleProxiesWithSelection();
     void mapSelectionFromSource();
+    void testResetInternalData();
 
 protected:
     void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
@@ -3176,5 +3177,142 @@ void tst_QSortFilterProxyModel::taskQTBUG_10287_unnecessaryMapCreation()
     // No assert failure, it passes.
 }
 
+/**
+ * A proxy which changes the background color for items ending in 'y' or 'r'
+ */
+class CustomDataProxy : public QSortFilterProxyModel
+{
+    Q_OBJECT
+
+public:
+    CustomDataProxy(QObject *parent = 0)
+        : QSortFilterProxyModel(parent)
+    {
+        setDynamicSortFilter(true);
+    }
+
+    void setSourceModel(QAbstractItemModel *sourceModel)
+    {
+        // It would be possible to use only the modelReset signal of the source model to clear
+        // the data in *this, however, this requires that the slot is connected
+        // before QSortFilterProxyModel::setSourceModel is called, and even then depends
+        // on the order of invokation of slots being the same as the order of connection.
+        // ie, not reliable.
+//         connect(sourceModel, SIGNAL(modelReset()), SLOT(resetInternalData()));
+        QSortFilterProxyModel::setSourceModel(sourceModel);
+        // Making the connect after the setSourceModel call clears the data too late.
+//         connect(sourceModel, SIGNAL(modelReset()), SLOT(resetInternalData()));
+
+        // This could be done in data(), but the point is to need to cache something in the proxy
+        // which needs to be cleared on reset.
+        for (int i = 0; i < sourceModel->rowCount(); ++i)
+        {
+            if (sourceModel->index(i, 0).data().toString().endsWith(QLatin1Char('y')))
+            {
+                m_backgroundColours.insert(i, Qt::blue);
+            } else if (sourceModel->index(i, 0).data().toString().endsWith(QLatin1Char('r')))
+            {
+                m_backgroundColours.insert(i, Qt::red);
+            }
+        }
+    }
+
+    QVariant data(const QModelIndex &index, int role) const
+    {
+        if (role != Qt::BackgroundRole)
+            return QSortFilterProxyModel::data(index, role);
+        return m_backgroundColours.value(index.row());
+    }
+
+private slots:
+  void resetInternalData()
+  {
+      m_backgroundColours.clear();
+  }
+
+private:
+    QHash<int, QColor> m_backgroundColours;
+};
+
+class ModelObserver : public QObject
+{
+    Q_OBJECT
+public:
+  ModelObserver(QAbstractItemModel *model, QObject *parent = 0)
+    : QObject(parent), m_model(model)
+  {
+    connect(m_model, SIGNAL(modelAboutToBeReset()), SLOT(modelAboutToBeReset()));
+    connect(m_model, SIGNAL(modelReset()), SLOT(modelReset()));
+  }
+
+public slots:
+  void modelAboutToBeReset()
+  {
+    int reds = 0, blues = 0;
+    for (int i = 0; i < m_model->rowCount(); ++i)
+    {
+      QColor color = m_model->index(i, 0).data(Qt::BackgroundRole).value<QColor>();
+      if (color == Qt::blue)
+        ++blues;
+      if (color == Qt::red)
+        ++reds;
+    }
+    QCOMPARE(blues, 11);
+    QCOMPARE(reds, 4);
+  }
+
+  void modelReset()
+  {
+    int reds = 0, blues = 0;
+    for (int i = 0; i < m_model->rowCount(); ++i)
+    {
+      QColor color = m_model->index(i, 0).data(Qt::BackgroundRole).value<QColor>();
+      if (color == Qt::blue)
+        ++blues;
+      if (color == Qt::red)
+        ++reds;
+    }
+    QCOMPARE(reds, 0);
+    QCOMPARE(blues, 0);
+  }
+
+private:
+  QAbstractItemModel * const m_model;
+
+};
+
+void tst_QSortFilterProxyModel::testResetInternalData()
+{
+
+    QStringListModel model(QStringList() << "Monday"
+                                         << "Tuesday"
+                                         << "Wednesday"
+                                         << "Thursday"
+                                         << "Friday"
+                                         << "January"
+                                         << "February"
+                                         << "March"
+                                         << "April"
+                                         << "May"
+                                         << "Saturday"
+                                         << "June"
+                                         << "Sunday"
+                                         << "July"
+                                         << "August"
+                                         << "September"
+                                         << "October"
+                                         << "November"
+                                         << "December");
+
+    CustomDataProxy proxy;
+    proxy.setSourceModel(&model);
+
+    ModelObserver observer(&proxy);
+
+    // Cause the source model to reset.
+    model.setStringList(QStringList() << "Spam" << "Eggs");
+
+}
+
 QTEST_MAIN(tst_QSortFilterProxyModel)
 #include "tst_qsortfilterproxymodel.moc"
-- 
cgit v0.12


From 0916a68056154ecb60e4ea2c79726ab2e49b1532 Mon Sep 17 00:00:00 2001
From: Gabriel de Dietrich <gabriel.dietrich-de@nokia.com>
Date: Mon, 18 Oct 2010 19:18:28 +0200
Subject: Moving the resetInternalData slot to QAbstractProxyModel

Patch provided by Stephen Kelly <stephen.kelly@kdab.com>

Reviewed-by: gabi
Merge-request: 694
---
 src/corelib/kernel/qabstractitemmodel.cpp | 22 ----------------------
 src/corelib/kernel/qabstractitemmodel.h   |  3 ---
 src/gui/itemviews/qabstractproxymodel.cpp | 24 +++++++++++++++++++++++-
 src/gui/itemviews/qabstractproxymodel.h   |  3 +++
 4 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index 2affc91..4fc9792 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -1349,26 +1349,6 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent,
 */
 
 /*!
-    \since 4.8
-
-    This slot is called just after the internal data of a model is cleared
-    while it is being reset.
-
-    This slot is provided the convenience of subclasses of concrete proxy
-    models, such as subclasses of QSortFilterProxyModel which maintain extra
-    data.
-
-    \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 10
-
-    \sa modelAboutToBeReset(), modelReset()
-*/
-void QAbstractItemModel::resetInternalData()
-{
-
-}
-
-
-/*!
     Constructs an abstract item model with the given \a parent.
 */
 QAbstractItemModel::QAbstractItemModel(QObject *parent)
@@ -2909,7 +2889,6 @@ void QAbstractItemModel::reset()
     Q_D(QAbstractItemModel);
     emit modelAboutToBeReset();
     d->invalidatePersistentIndexes();
-    QMetaObject::invokeMethod(this, "resetInternalData");
     emit modelReset();
 }
 
@@ -2952,7 +2931,6 @@ void QAbstractItemModel::endResetModel()
 {
     Q_D(QAbstractItemModel);
     d->invalidatePersistentIndexes();
-    QMetaObject::invokeMethod(this, "resetInternalData");
     emit modelReset();
 }
 
diff --git a/src/corelib/kernel/qabstractitemmodel.h b/src/corelib/kernel/qabstractitemmodel.h
index 18b43fe..63d9e6f 100644
--- a/src/corelib/kernel/qabstractitemmodel.h
+++ b/src/corelib/kernel/qabstractitemmodel.h
@@ -302,9 +302,6 @@ protected:
 
     void setRoleNames(const QHash<int,QByteArray> &roleNames);
 
-protected slots:
-    void resetInternalData();
-
 private:
     Q_DECLARE_PRIVATE(QAbstractItemModel)
     Q_DISABLE_COPY(QAbstractItemModel)
diff --git a/src/gui/itemviews/qabstractproxymodel.cpp b/src/gui/itemviews/qabstractproxymodel.cpp
index 51dfa7a..12c4c7b 100644
--- a/src/gui/itemviews/qabstractproxymodel.cpp
+++ b/src/gui/itemviews/qabstractproxymodel.cpp
@@ -121,12 +121,15 @@ QAbstractProxyModel::~QAbstractProxyModel()
 void QAbstractProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
 {
     Q_D(QAbstractProxyModel);
-    if (d->model)
+    if (d->model) {
         disconnect(d->model, SIGNAL(destroyed()), this, SLOT(_q_sourceModelDestroyed()));
+        disconnect(d->model, SIGNAL(modelReset()), this, SLOT(resetInternalData()));
+    }
 
     if (sourceModel) {
         d->model = sourceModel;
         connect(d->model, SIGNAL(destroyed()), this, SLOT(_q_sourceModelDestroyed()));
+        connect(d->model, SIGNAL(modelReset()), this, SLOT(resetInternalData()));
     } else {
         d->model = QAbstractItemModelPrivate::staticEmptyModel();
     }
@@ -380,6 +383,25 @@ Qt::DropActions QAbstractProxyModel::supportedDropActions() const
     return d->model->supportedDropActions();
 }
 
+/*
+    \since 4.8
+
+    This slot is called just after the internal data of a model is cleared
+    while it is being reset.
+
+    This slot is provided the convenience of subclasses of concrete proxy
+    models, such as subclasses of QSortFilterProxyModel which maintain extra
+    data.
+
+    \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 10
+
+    \sa modelAboutToBeReset(), modelReset()
+*/
+void QAbstractProxyModel::resetInternalData()
+{
+
+}
+
 QT_END_NAMESPACE
 
 #include "moc_qabstractproxymodel.cpp"
diff --git a/src/gui/itemviews/qabstractproxymodel.h b/src/gui/itemviews/qabstractproxymodel.h
index a5a1168..14eaa5a 100644
--- a/src/gui/itemviews/qabstractproxymodel.h
+++ b/src/gui/itemviews/qabstractproxymodel.h
@@ -95,6 +95,9 @@ public:
     QStringList mimeTypes() const;
     Qt::DropActions supportedDropActions() const;
 
+protected slots:
+    void resetInternalData();
+
 protected:
     QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent);
 
-- 
cgit v0.12


From 7be892eaeff8aad62b5e7ae2300322c9c1a5420e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= <tor.arne.vestbo@nokia.com>
Date: Tue, 19 Oct 2010 11:01:53 +0200
Subject: configure: Don't use character class when looking for
 QMAKE_CONF_COMPILER
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: Alexis Ménard <alexis.menard@nokia.com>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 5539851..bc53bae 100755
--- a/configure
+++ b/configure
@@ -3161,7 +3161,7 @@ else
     CFG_FRAMEWORK=no
 fi
 
-QMAKE_CONF_COMPILER=`getQMakeConf "$XQMAKESPEC" | grep "\(^\|\s\)QMAKE_CXX[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1," | tail -1`
+QMAKE_CONF_COMPILER=`getQMakeConf "$XQMAKESPEC" | grep "\(^\| \)QMAKE_CXX[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1," | tail -1`
 TEST_COMPILER="$CXX"
 
 [ -z "$TEST_COMPILER" ] && TEST_COMPILER=$QMAKE_CONF_COMPILER
-- 
cgit v0.12


From ea614c822c0075b939cc8a56bbc53aaf9c68228d Mon Sep 17 00:00:00 2001
From: Fabien Freling <fabien.freling@nokia.com>
Date: Tue, 19 Oct 2010 13:36:13 +0200
Subject: Enable the unified toolbar with the raster engine only in the Cocoa
 port.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: Tor Arne Vestbø
---
 src/gui/kernel/qwidget.cpp                      | 4 ++--
 src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 4 ++++
 src/gui/painting/qunifiedtoolbarsurface_mac_p.h | 4 ++++
 src/gui/painting/qwindowsurface_raster.cpp      | 8 ++++++--
 src/gui/widgets/qmainwindow.cpp                 | 2 ++
 src/gui/widgets/qmainwindowlayout_mac.mm        | 2 ++
 6 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index a75fc38..a773e7a 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -5322,12 +5322,12 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
     if (rgn.isEmpty())
         return;
 
-#ifdef Q_WS_MAC
+#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
     // We disable the rendering of QToolBar in the backingStore if
     // it's supposed to be in the unified toolbar on Mac OS X.
     if (backingStore && isInUnifiedToolbar)
         return;
-#endif // Q_WS_MAC
+#endif // Q_WS_MAC && QT_MAC_USE_COCOA
 
 
     Q_Q(QWidget);
diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
index 722355e..b90b061 100644
--- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
+++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
@@ -39,6 +39,8 @@
 **
 ****************************************************************************/
 
+#ifdef QT_MAC_USE_COCOA
+
 #include "qunifiedtoolbarsurface_mac_p.h"
 #include <private/qt_cocoa_helpers_mac_p.h>
 #include <private/qbackingstore_p.h>
@@ -231,3 +233,5 @@ void QUnifiedToolbarSurface::prepareBuffer(QImage::Format format, QWidget *widge
 }
 
 QT_END_NAMESPACE
+
+#endif // QT_MAC_USE_COCOA
diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
index d7805e8..c2ec854 100644
--- a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
+++ b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
@@ -53,6 +53,8 @@
 // We mean it.
 //
 
+#ifdef QT_MAC_USE_COCOA
+
 #include <private/qwindowsurface_raster_p.h>
 #include <QWidget>
 #include <private/qwidget_p.h>
@@ -92,4 +94,6 @@ private:
 
 QT_END_NAMESPACE
 
+#endif // QT_MAC_USE_COCOA
+
 #endif // QUNIFIEDTOOLBARSURFACE_MAC_P_H
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
index 99f8597..217723f 100644
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ b/src/gui/painting/qwindowsurface_raster.cpp
@@ -251,6 +251,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
 
 #ifdef Q_WS_MAC
 
+#ifdef QT_MAC_USE_COCOA
     // Unified toolbar hack.
     QMainWindow* mWindow = qobject_cast<QMainWindow*>(widget->window());
     if (mWindow) {
@@ -267,6 +268,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
             }
         }
     }
+#endif // QT_MAC_USE_COCOA
 
     Q_UNUSED(offset);
     // Get a context for the widget.
@@ -338,7 +340,8 @@ void QRasterWindowSurface::setGeometry(const QRect &rect)
             prepareBuffer(QNativeImage::systemFormat(), window());
     }
     d->inSetGeometry = false;
-#ifdef Q_WS_MAC
+
+#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
     QMainWindow* mWindow = qobject_cast<QMainWindow*>(window());
     if (mWindow) {
         QMainWindowLayout *mLayout = qobject_cast<QMainWindowLayout*>(mWindow->layout());
@@ -354,7 +357,8 @@ void QRasterWindowSurface::setGeometry(const QRect &rect)
             }
         }
     }
-#endif // Q_WS_MAC
+#endif // Q_WS_MAC && QT_MAC_USE_COCOA
+
 }
 
 // from qwindowsurface.cpp
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index 861cfaa..d4118bd 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -1524,10 +1524,12 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set)
     d->useHIToolBar = set;
     createWinId(); // We need the hiview for down below.
 
+#ifdef QT_MAC_USE_COCOA
     // Activate the unified toolbar with the raster engine.
     if (windowSurface()) {
         d->layout->unifiedSurface = new QUnifiedToolbarSurface(this);
     }
+#endif // QT_MAC_USE_COCOA
 
     d->layout->updateHIToolBarStatus();
     // Enabling the unified toolbar clears the opaque size grip setting, update it.
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index 21f6067..126cc4a 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -452,7 +452,9 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar
         for (int i = 0; i < beforeIndex; ++i) {
             offset.setX(offset.x() + qtoolbarsInUnifiedToolbarList.at(i)->size().width());
         }
+#ifdef QT_MAC_USE_COCOA
         unifiedSurface->insertToolbar(toolbar, offset);
+#endif // QT_MAC_USE_COCOA
     }
 
 #ifndef QT_MAC_USE_COCOA
-- 
cgit v0.12


From 8705b07a8b6a723ff620f8593e24916ddac70e9d Mon Sep 17 00:00:00 2001
From: Alexis Menard <alexis.menard@nokia.com>
Date: Wed, 20 Oct 2010 13:17:16 +0200
Subject: Deactivate the auto-test on problematic platforms.

Reviewed-by:TrustMe
---
 tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index bc962c5..ad7ccf7 100644
--- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -3632,6 +3632,9 @@ public slots:
 
 void tst_QGraphicsProxyWidget::QTBUG_6986_sendMouseEventToAlienWidget()
 {
+#if defined(Q_OS_MAC) || defined(Q_OS_WIN) || defined(QT_NO_CURSOR)
+    QSKIP("Test case unstable on this platform", SkipAll);
+#endif
     QGraphicsView view;
     Scene scene;
     view.setScene(&scene);
-- 
cgit v0.12


From 065ce8db6ff006c465bc6909c99836f5349d6a5d Mon Sep 17 00:00:00 2001
From: Fabien Freling <fabien.freling@nokia.com>
Date: Wed, 20 Oct 2010 13:33:15 +0200
Subject: Fix the #ifdef position.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: Tor Arne Vestbø
---
 src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 4 ++--
 src/gui/painting/qunifiedtoolbarsurface_mac_p.h | 4 ++--
 src/gui/widgets/qmainwindowlayout_p.h           | 3 +++
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
index b90b061..ab05dbd 100644
--- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
+++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
@@ -39,14 +39,14 @@
 **
 ****************************************************************************/
 
-#ifdef QT_MAC_USE_COCOA
-
 #include "qunifiedtoolbarsurface_mac_p.h"
 #include <private/qt_cocoa_helpers_mac_p.h>
 #include <private/qbackingstore_p.h>
 
 #include <QDebug>
 
+#ifdef QT_MAC_USE_COCOA
+
 QT_BEGIN_NAMESPACE
 
 QUnifiedToolbarSurface::QUnifiedToolbarSurface(QWidget *widget)
diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
index c2ec854..4d72ff9 100644
--- a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
+++ b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
@@ -53,13 +53,13 @@
 // We mean it.
 //
 
-#ifdef QT_MAC_USE_COCOA
-
 #include <private/qwindowsurface_raster_p.h>
 #include <QWidget>
 #include <private/qwidget_p.h>
 #include <private/qnativeimage_p.h>
 
+#ifdef QT_MAC_USE_COCOA
+
 QT_BEGIN_NAMESPACE
 
 class QNativeImage;
diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h
index 3eb2545..e882d11 100644
--- a/src/gui/widgets/qmainwindowlayout_p.h
+++ b/src/gui/widgets/qmainwindowlayout_p.h
@@ -342,7 +342,10 @@ public:
     void syncUnifiedToolbarVisibility();
     bool blockVisiblityCheck;
 
+#ifdef QT_MAC_USE_COCOA
     QUnifiedToolbarSurface *unifiedSurface;
+#endif // QT_MAC_USE_COCOA
+
 #endif // Q_WS_MAC
 };
 QT_END_NAMESPACE
-- 
cgit v0.12


From 35d304b8e0c21b1df869089aa52f14023a4c0004 Mon Sep 17 00:00:00 2001
From: Tasuku Suzuki <tasuku.suzuki@nokia.com>
Date: Wed, 20 Oct 2010 16:46:02 +0200
Subject: Replaced sample text for Japanese font

The previous word was improper because it means "lazy"

Task-number: QTBUG-14527

Merge-request: 868
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
---
 src/gui/text/qfontdatabase.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 2b26638..9ed09c2 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -2423,10 +2423,12 @@ QString QFontDatabase::writingSystemSample(WritingSystem writingSystem)
         sample += QChar(0x4f8b);
         break;
     case Japanese:
-        sample += QChar(0x3050);
-        sample += QChar(0x3060);
-        sample += QChar(0x30b0);
-        sample += QChar(0x30c0);
+        sample += QChar(0x30b5);
+        sample += QChar(0x30f3);
+        sample += QChar(0x30d7);
+        sample += QChar(0x30eb);
+        sample += QChar(0x3067);
+        sample += QChar(0x3059);
         break;
     case Korean:
         sample += QChar(0xac00);
-- 
cgit v0.12


From 03c1445ed4be734a82cea59d107c51a4be43c5f4 Mon Sep 17 00:00:00 2001
From: Olivier Goffart <olivier.goffart@nokia.com>
Date: Thu, 21 Oct 2010 10:03:32 +0200
Subject: Fix compilation with QT_NO_KEYWORDS

Reviewed-by: Gabriel
---
 src/gui/itemviews/qabstractproxymodel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gui/itemviews/qabstractproxymodel.h b/src/gui/itemviews/qabstractproxymodel.h
index 14eaa5a..0daa7f8 100644
--- a/src/gui/itemviews/qabstractproxymodel.h
+++ b/src/gui/itemviews/qabstractproxymodel.h
@@ -95,7 +95,7 @@ public:
     QStringList mimeTypes() const;
     Qt::DropActions supportedDropActions() const;
 
-protected slots:
+protected Q_SLOTS:
     void resetInternalData();
 
 protected:
-- 
cgit v0.12