diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-12 17:46:51 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-12 17:46:51 (GMT) |
commit | d366c69bbd02a25c61df2e99ed842fa14ec2d643 (patch) | |
tree | fb635f7643878d0990b56e6b93791ecc6d5828b2 | |
parent | 97f7299854197c6093aaefc1ec174209d68892e7 (diff) | |
parent | 3ee89bc0830f69d44f272eff5a0c886bff33c92e (diff) | |
download | Qt-d366c69bbd02a25c61df2e99ed842fa14ec2d643.zip Qt-d366c69bbd02a25c61df2e99ed842fa14ec2d643.tar.gz Qt-d366c69bbd02a25c61df2e99ed842fa14ec2d643.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Properly emit geometryChanged() when the position change.
QCoreApplication::library path, ensure mutex lock ordering
Fix memory leak.
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 2 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget.cpp | 3 | ||||
-rw-r--r-- | src/opengl/qgl_mac.mm | 11 | ||||
-rw-r--r-- | tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 20 |
4 files changed, 31 insertions, 5 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 0a5e06e..512e193 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2308,6 +2308,7 @@ void QCoreApplication::setLibraryPaths(const QStringList &paths) if (!coreappdata()->app_libpaths) coreappdata()->app_libpaths = new QStringList; *(coreappdata()->app_libpaths) = paths; + locker.unlock(); QFactoryLoader::refreshAll(); } @@ -2341,6 +2342,7 @@ void QCoreApplication::addLibraryPath(const QString &path) if (!canonicalPath.isEmpty() && !coreappdata()->app_libpaths->contains(canonicalPath)) { coreappdata()->app_libpaths->prepend(canonicalPath); + locker.unlock(); QFactoryLoader::refreshAll(); } } diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index c486c45..0fabd18 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -385,12 +385,12 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) if (wd->inSetPos) { //set the new pos d->geom.moveTopLeft(pos()); + emit geometryChanged(); return; } } QSizeF oldSize = size(); QGraphicsLayoutItem::setGeometry(newGeom); - emit geometryChanged(); // Send resize event bool resized = newGeom.size() != oldSize; if (resized) { @@ -403,6 +403,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) emit heightChanged(); QApplication::sendEvent(this, &re); } + emit geometryChanged(); } /*! diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm index 4d7532e..66fe7d3 100644 --- a/src/opengl/qgl_mac.mm +++ b/src/opengl/qgl_mac.mm @@ -804,17 +804,22 @@ void QGLContext::generateFontDisplayLists(const QFont & /* fnt */, int /* listBa static CFBundleRef qt_getOpenGLBundle() { CFBundleRef bundle = 0; + CFStringRef urlString = QCFString::toCFStringRef(QLatin1String("/System/Library/Frameworks/OpenGL.framework")); QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, - QCFString::toCFStringRef(QLatin1String("/System/Library/Frameworks/OpenGL.framework")), kCFURLPOSIXPathStyle, false); + urlString, kCFURLPOSIXPathStyle, false); if (url) bundle = CFBundleCreate(kCFAllocatorDefault, url); + CFRelease(urlString); return bundle; } void *QGLContext::getProcAddress(const QString &proc) const { - return CFBundleGetFunctionPointerForName(QCFType<CFBundleRef>(qt_getOpenGLBundle()), - QCFString(proc)); + CFStringRef procName = QCFString(proc).toCFStringRef(proc); + void *result = CFBundleGetFunctionPointerForName(QCFType<CFBundleRef>(qt_getOpenGLBundle()), + procName); + CFRelease(procName); + return result; } #ifndef QT_MAC_USE_COCOA /***************************************************************************** diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index a771332..bda22eb 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -111,6 +111,7 @@ private slots: void fontPropagationSceneChange(); void geometry_data(); void geometry(); + void geometryChanged(); void width(); void height(); void getContentsMargins_data(); @@ -776,11 +777,28 @@ void tst_QGraphicsWidget::geometry() QFETCH(QSizeF, size); widget.setPos(pos); widget.resize(size); - if (!size.isNull()) + if (!size.isNull() && !pos.isNull()) + QCOMPARE(spy.count(), 2); + if (!size.isNull() && pos.isNull()) QCOMPARE(spy.count(), 1); QCOMPARE(widget.geometry(), QRectF(pos, size)); } +void tst_QGraphicsWidget::geometryChanged() +{ + QGraphicsWidget w; + w.setGeometry(0, 0, 200, 200); + QCOMPARE(w.geometry(), QRectF(0, 0, 200, 200)); + QSignalSpy spy(&w, SIGNAL(geometryChanged())); + w.setGeometry(0, 0, 100, 100); + QCOMPARE(spy.count(), 1); + QCOMPARE(w.geometry(), QRectF(0, 0, 100, 100)); + w.setPos(10, 10); + QCOMPARE(spy.count(), 2); + QCOMPARE(w.geometry(), QRectF(10, 10, 100, 100)); + +} + void tst_QGraphicsWidget::width() { QGraphicsWidget w; |