summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-01 17:55:37 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-01 17:55:37 (GMT)
commitec3bcad12f8984325053c944a9914d1f0021cc0b (patch)
tree9ad9169e19557ed7e948b0c4102255d8c038321b
parentfe7c8626af168ca29fd74930b9baa16c6dacdc30 (diff)
parentf97df3f53f133c7ea68816d9275dde5c153f3257 (diff)
downloadQt-ec3bcad12f8984325053c944a9914d1f0021cc0b.zip
Qt-ec3bcad12f8984325053c944a9914d1f0021cc0b.tar.gz
Qt-ec3bcad12f8984325053c944a9914d1f0021cc0b.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Doc: QRegExp::WillcardUnix: the documentation did not show the slash Fix crash using openPersistentEditor and setRowHidden on a QTableView QObject: fix crash when deleteing the receiver object withing a DirectConncetion involving two threads. Fixed qDrawPixmaps() to draw on integer coordinates on Mac OS X. handle WM_GESTURE events on WinCE, only if QT_WINCE_GESTURES is defined Fixed QPixmap::load() to not modify referenced copies (again!) fix bad performance penalty for tab widgets for Windows mobile 6.5
-rw-r--r--src/corelib/kernel/qobject.cpp17
-rw-r--r--src/corelib/tools/qregexp.cpp4
-rw-r--r--src/gui/image/qpixmap.cpp19
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp8
-rw-r--r--src/gui/kernel/qapplication_win.cpp2
-rw-r--r--src/gui/painting/qdrawutil.cpp15
-rw-r--r--src/gui/styles/qwindowsmobilestyle.cpp37
-rw-r--r--tests/auto/qobject/tst_qobject.cpp20
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp46
9 files changed, 122 insertions, 46 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 5298fff..689e44c 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3264,12 +3264,14 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
const int method = c->method;
QObjectPrivate::Sender currentSender;
- currentSender.sender = sender;
- currentSender.signal = signal_absolute_index;
- currentSender.ref = 1;
+ const bool receiverInSameThread = currentThreadData == receiver->d_func()->threadData;
QObjectPrivate::Sender *previousSender = 0;
- if (currentThreadData == receiver->d_func()->threadData)
+ if (receiverInSameThread) {
+ currentSender.sender = sender;
+ currentSender.signal = signal_absolute_index;
+ currentSender.ref = 1;
previousSender = QObjectPrivate::setCurrentSender(receiver, &currentSender);
+ }
locker.unlock();
if (qt_signal_spy_callback_set.slot_begin_callback != 0) {
@@ -3285,8 +3287,8 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv);
} QT_CATCH(...) {
locker.relock();
-
- QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
+ if (receiverInSameThread)
+ QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
--connectionLists->inUse;
Q_ASSERT(connectionLists->inUse >= 0);
@@ -3301,7 +3303,8 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
locker.relock();
- QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
+ if (receiverInSameThread)
+ QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
if (connectionLists->orphaned)
break;
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index 25255f9..b9e273f 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -523,7 +523,7 @@ int qFindString(const QChar *haystack, int haystackLen, int from,
\endtable
In the mode Wildcard, the wildcard characters cannot be
- escaped. In the mode WildcardUnix, the character '\' escapes the
+ escaped. In the mode WildcardUnix, the character '\\' escapes the
wildcard.
For example if we are in wildcard mode and have strings which
@@ -3774,7 +3774,7 @@ static void invalidateEngine(QRegExpPrivate *priv)
\value WildcardUnix This is similar to Wildcard but with the
behavior of a Unix shell. The wildcard characters can be escaped
- with the character "\".
+ with the character "\\".
\value FixedString The pattern is a fixed string. This is
equivalent to using the RegExp pattern on a string in
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 08003e5..7b225eb 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -831,21 +831,14 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
if (QPixmapCache::find(key, *this))
return true;
- bool ok;
-
- if (data) {
- ok = data->fromFile(fileName, format, flags);
- } else {
- QScopedPointer<QPixmapData> tmp(QPixmapData::create(0, 0, QPixmapData::PixmapType));
- ok = tmp->fromFile(fileName, format, flags);
- if (ok)
- data = tmp.take();
- }
-
- if (ok)
+ QScopedPointer<QPixmapData> tmp(QPixmapData::create(0, 0, data ? data->type : QPixmapData::PixmapType));
+ if (tmp->fromFile(fileName, format, flags)) {
+ data = tmp.take();
QPixmapCache::insert(key, *this);
+ return true;
+ }
- return ok;
+ return false;
}
/*!
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 4931b46..2faf755 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -2568,6 +2568,7 @@ void QAbstractItemView::updateEditorGeometries()
QStyleOptionViewItemV4 option = d->viewOptionsV4();
QList<QEditorInfo>::iterator it = d->editors.begin();
QWidgetList editorsToRelease;
+ QWidgetList editorsToHide;
while (it != d->editors.end()) {
QModelIndex index = it->index;
QWidget *editor = it->editor;
@@ -2579,7 +2580,7 @@ void QAbstractItemView::updateEditorGeometries()
if (delegate)
delegate->updateEditorGeometry(editor, option, index);
} else {
- editor->hide();
+ editorsToHide << editor;
}
++it;
} else {
@@ -2588,8 +2589,11 @@ void QAbstractItemView::updateEditorGeometries()
}
}
- //we release the editor outside of the loop because it might change the focus and try
+ //we hide and release the editor outside of the loop because it might change the focus and try
//to change the d->editors list.
+ for (int i = 0; i < editorsToHide.count(); ++i) {
+ editorsToHide.at(i)->hide();
+ }
for (int i = 0; i < editorsToRelease.count(); ++i) {
d->releaseEditor(editorsToRelease.at(i));
}
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index aac834d..da6869d 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -2524,6 +2524,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
}
result = false;
break;
+#if !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES)
case WM_GESTURE: {
GESTUREINFO gi;
memset(&gi, 0, sizeof(GESTUREINFO));
@@ -2556,6 +2557,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
result = true;
break;
}
+#endif // !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES)
default:
result = false; // event was not processed
break;
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp
index 5619a2e..35bf2bf 100644
--- a/src/gui/painting/qdrawutil.cpp
+++ b/src/gui/painting/qdrawutil.cpp
@@ -1361,14 +1361,21 @@ void qDrawPixmaps(QPainter *painter, const QDrawPixmaps::Data *drawingData, int
for (int i = 0; i < dataCount; ++i) {
QTransform transform = oldTransform;
- transform.translate(drawingData[i].point.x(), drawingData[i].point.y());
- transform.rotate(drawingData[i].rotation);
- painter->setOpacity(oldOpacity * drawingData[i].opacity);
+ qreal xOffset = 0;
+ qreal yOffset = 0;
+ if (drawingData[i].rotation == 0) {
+ xOffset = drawingData[i].point.x();
+ yOffset = drawingData[i].point.y();
+ } else {
+ transform.translate(drawingData[i].point.x(), drawingData[i].point.y());
+ transform.rotate(drawingData[i].rotation);
+ }
painter->setTransform(transform);
+ painter->setOpacity(oldOpacity * drawingData[i].opacity);
qreal w = drawingData[i].scaleX * drawingData[i].source.width();
qreal h = drawingData[i].scaleY * drawingData[i].source.height();
- painter->drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, drawingData[i].source);
+ painter->drawPixmap(QRectF(-0.5 * w + xOffset, -0.5 * h + yOffset, w, h), pixmap, drawingData[i].source);
}
painter->setOpacity(oldOpacity);
diff --git a/src/gui/styles/qwindowsmobilestyle.cpp b/src/gui/styles/qwindowsmobilestyle.cpp
index a264b1b..6e77409 100644
--- a/src/gui/styles/qwindowsmobilestyle.cpp
+++ b/src/gui/styles/qwindowsmobilestyle.cpp
@@ -4040,25 +4040,26 @@ enum QSliderDirection { SliderUp, SliderDown, SliderLeft, SliderRight };
void QWindowsMobileStylePrivate::tintImagesButton(QColor color)
{
- if (currentTintButton == color)
+ if (currentTintButton == color)
return;
-
- imageTabEnd = QImage(tabend_xpm);
- imageTabSelectedEnd = QImage(tabselectedend_xpm);
- imageTabSelectedBegin = QImage(tabselectedbeginn_xpm);
- imageTabMiddle = QImage(tabmiddle_xpm);
- tintImage(&imageTabEnd, color, 0.0);
- tintImage(&imageTabSelectedEnd, color, 0.0);
- tintImage(&imageTabSelectedBegin, color, 0.0);
- tintImage(&imageTabMiddle, color, 0.0);
-
- if (!doubleControls) {
- int height = imageTabMiddle.height() / 2 + 1;
- imageTabEnd = imageTabEnd.scaledToHeight(height);
- imageTabMiddle = imageTabMiddle.scaledToHeight(height);
- imageTabSelectedEnd = imageTabSelectedEnd.scaledToHeight(height);
- imageTabSelectedBegin = imageTabSelectedBegin.scaledToHeight(height);
- }
+ currentTintButton = color;
+
+ imageTabEnd = QImage(tabend_xpm);
+ imageTabSelectedEnd = QImage(tabselectedend_xpm);
+ imageTabSelectedBegin = QImage(tabselectedbeginn_xpm);
+ imageTabMiddle = QImage(tabmiddle_xpm);
+ tintImage(&imageTabEnd, color, 0.0);
+ tintImage(&imageTabSelectedEnd, color, 0.0);
+ tintImage(&imageTabSelectedBegin, color, 0.0);
+ tintImage(&imageTabMiddle, color, 0.0);
+
+ if (!doubleControls) {
+ int height = imageTabMiddle.height() / 2 + 1;
+ imageTabEnd = imageTabEnd.scaledToHeight(height);
+ imageTabMiddle = imageTabMiddle.scaledToHeight(height);
+ imageTabSelectedEnd = imageTabSelectedEnd.scaledToHeight(height);
+ imageTabSelectedBegin = imageTabSelectedBegin.scaledToHeight(height);
+ }
}
void QWindowsMobileStylePrivate::tintImagesHigh(QColor color)
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index 4fa6aaa..985dfa4 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -2647,6 +2647,16 @@ void tst_QObject::installEventFilter()
QVERIFY(spy.eventList().isEmpty());
}
+class EmitThread : public QThread
+{ Q_OBJECT
+public:
+ void run(void) {
+ emit work();
+ }
+signals:
+ void work();
+};
+
class DeleteObject : public QObject
{
Q_OBJECT
@@ -2712,6 +2722,16 @@ void tst_QObject::deleteSelfInSlot()
QVERIFY(thread.wait(10000));
}
+
+ {
+ EmitThread sender;
+ DeleteObject *receiver = new DeleteObject();
+ connect(&sender, SIGNAL(work()), receiver, SLOT(deleteSelf()), Qt::DirectConnection);
+ QPointer<DeleteObject> p = receiver;
+ sender.start();
+ QVERIFY(sender.wait(10000));
+ QVERIFY(p.isNull());
+ }
}
class DisconnectObject : public QObject
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index 430712c..a5cbbd4 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -199,6 +199,7 @@ private slots:
void taskQTBUG_5062_spansInconsistency();
void taskQTBUG_4516_clickOnRichTextLabel();
void taskQTBUG_5237_wheelEventOnHeader();
+ void taskQTBUG_8585_crashForNoGoodReason();
void mouseWheel_data();
void mouseWheel();
@@ -3948,5 +3949,50 @@ void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader()
QVERIFY(sbValueBefore != sbValueAfter);
}
+class TestTableView : public QTableView {
+Q_OBJECT
+public:
+ TestTableView(QWidget *parent = 0) : QTableView(parent)
+ {
+ connect(this, SIGNAL(entered(const QModelIndex&)), this, SLOT(openEditor(const QModelIndex&)));
+ }
+ ~TestTableView(){}
+public slots:
+ void onDataChanged()
+ {
+ for (int i = 0; i < model()->rowCount(); i++) {
+ setRowHidden(i, model()->data(model()->index(i, 0)).toBool());
+ }
+ }
+
+ void openEditor(const QModelIndex& index)
+ { openPersistentEditor(index); }
+};
+
+
+void tst_QTableView::taskQTBUG_8585_crashForNoGoodReason()
+{
+ QStandardItemModel model;
+ model.insertColumn(0, QModelIndex());
+ for(int i = 0; i < 20; i++)
+ {
+ model.insertRow(i);
+ }
+
+ TestTableView w;
+ w.setMouseTracking(true);
+ w.setModel(&model);
+ connect(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), &w, SLOT(onDataChanged()));
+ w.show();
+ QTest::qWaitForWindowShown(&w);
+ for (int i = 0; i < 10; i++)
+ {
+ QTest::mouseMove(w.viewport(), QPoint(50, 20));
+ w.model()->setData(w.indexAt(QPoint(50, 20)), true);
+ QTest::mouseMove(w.viewport(), QPoint(50, 25));
+ }
+}
+
+
QTEST_MAIN(tst_QTableView)
#include "tst_qtableview.moc"