From 8ddf76989c80896d4cd1e759bbd2594609eebf6d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 24 Apr 2014 17:13:40 +0200 Subject: Remove old symbols from QOpenGLContext Task-number: QTBUG-38564 Change-Id: I39a0482e4411cdc644ed34813626c39dacb5b6af Reviewed-by: Sean Harmer --- src/gui/kernel/qopenglcontext.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index c422d008c1..19aecee75a 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -196,19 +196,13 @@ public: enum OpenGLModuleType { LibGL, - LibGLES, - - // ### - DesktopGL = LibGL, - GLES2 = LibGLES + LibGLES }; static OpenGLModuleType openGLModuleType(); bool isOpenGLES() const; - bool isES() const { return isOpenGLES(); } // ### - Q_SIGNALS: void aboutToBeDestroyed(); -- cgit v1.2.3 From 1d372eddbe9e4eb75a0fcde4bdcdebcf75222075 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 18 Apr 2014 16:10:00 +0300 Subject: Fix identical sub-expressions in comparison Found by static analyzer (see http://www.viva64.com/en/b/0251/). Change-Id: I611def790a98abf7574e96e6039f10714316d81e Reviewed-by: Friedemann Kleint Reviewed-by: Jason McDonald --- src/testlib/qtest_gui.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h index a9ac7777c3..7c68b0fd77 100644 --- a/src/testlib/qtest_gui.h +++ b/src/testlib/qtest_gui.h @@ -98,7 +98,7 @@ inline bool qCompare(QImage const &t1, QImage const &t2, } if (t1Null && t2Null) return compare_helper(true, 0, 0, 0, actual, expected, file, line); - if (t1.width() != t2.width() || t2.height() != t2.height()) { + if (t1.width() != t2.width() || t1.height() != t2.height()) { qsnprintf(msg, 1024, "Compared QImages differ in size.\n" " Actual (%s): %dx%d\n" " Expected (%s): %dx%d", @@ -132,7 +132,7 @@ inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, c } if (t1Null && t2Null) return compare_helper(true, 0, 0, 0, actual, expected, file, line); - if (t1.width() != t2.width() || t2.height() != t2.height()) { + if (t1.width() != t2.width() || t1.height() != t2.height()) { qsnprintf(msg, 1024, "Compared QPixmaps differ in size.\n" " Actual (%s): %dx%d\n" " Expected (%s): %dx%d", -- cgit v1.2.3 From 373d858812a84b48be482dd64ad9d248ab2d5b3c Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Fri, 25 Apr 2014 17:55:04 +0200 Subject: [QtSql][QSqlTableModel] fix failure to refresh in selectRow() Caused by missing braces, leaving the break outside the scope of the if clause. Task-number: QTBUG-38509 Change-Id: I6b0a7f34512a3a9b0fbd790116f81f54f4a91cf0 Reviewed-by: Tobias Koenig Reviewed-by: Mark Brand Reviewed-by: Andy Shaw --- src/sql/models/qsqltablemodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 5c73705d4c..0eed6ea4d3 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -448,9 +448,10 @@ bool QSqlTableModel::selectRow(int row) // Look for changed values. Primary key fields are customarily first // and probably change less often than other fields, so start at the end. for (int f = curValues.count() - 1; f >= 0; --f) { - if (curValues.value(f) != newValues.value(f)) + if (curValues.value(f) != newValues.value(f)) { needsAddingToCache = true; break; + } } } } -- cgit v1.2.3 From 143eab87111f4ac0dd659b0a0cc217274603a2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 25 Apr 2014 16:21:55 +0200 Subject: iOS: Send application state changes synchronously The user might have a limited time to react when the application is suspended, so we need to send the event as soon as possible. Change-Id: Ib6c342f5426cf15e36ba4ef57edf30878f86d1c9 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosapplicationstate.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosapplicationstate.mm b/src/plugins/platforms/ios/qiosapplicationstate.mm index 8d77e608e5..afa3ecb21f 100644 --- a/src/plugins/platforms/ios/qiosapplicationstate.mm +++ b/src/plugins/platforms/ios/qiosapplicationstate.mm @@ -150,6 +150,7 @@ break; } QWindowSystemInterface::handleApplicationStateChanged(state); + QWindowSystemInterface::flushWindowSystemEvents(); } @end -- cgit v1.2.3 From 2222fdf3304e921b7441932827da72a46418b649 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 28 Apr 2014 13:04:56 +0200 Subject: Doc: Remove Qt Core documentation dependency to Qt QML When generating documentation, the Qt namespace declared in Qt Core collides with the Qt global object declared in Qt QML. This caused the C++ Qt namespace documentation to go missing. This change works around the issue by removing the dependency between Qt Core and Qt QML. Task-number: QTBUG-38630 Change-Id: Ifd250a19c476bc30e2a2ed561573c8b6b3b2dba5 Reviewed-by: Martin Smith --- src/corelib/doc/qtcore.qdocconf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index c8eb15a7f7..c9c8f1da54 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -26,7 +26,8 @@ qhp.QtCore.subprojects.classes.sortPages = true tagfile = ../../../doc/qtcore/qtcore.tags -depends += activeqt qtdbus qtgui qtwidgets qtnetwork qtdoc qtmacextras qtqml qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake +depends += activeqt qtdbus qtgui qtwidgets qtnetwork qtdoc qtmacextras qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake +# depends += qtqml # Qt namespace collides with QtQml::Qt, see QTBUG-38630 headerdirs += .. -- cgit v1.2.3 From 485b7424df5cb3474cc802bced77770d85bdcb37 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 28 Apr 2014 12:19:28 +0200 Subject: Avoid reentering processMouseEvents on embedded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-38597 Change-Id: I168c9401863bace711d0d8409bf3da30a34185bd Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind --- .../eglconvenience/qeglplatformcursor.cpp | 27 +++++++++++++++++++--- .../eglconvenience/qeglplatformcursor_p.h | 19 +++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp b/src/platformsupport/eglconvenience/qeglplatformcursor.cpp index 70e7c4e4db..e99581183e 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcursor.cpp @@ -69,7 +69,8 @@ QEGLPlatformCursor::QEGLPlatformCursor(QPlatformScreen *screen) m_vertexCoordEntry(0), m_textureCoordEntry(0), m_textureEntry(0), - m_deviceListener(0) + m_deviceListener(0), + m_updater(screen) { QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR"); if (!hideCursorVal.isEmpty()) @@ -270,12 +271,32 @@ bool QEGLPlatformCursor::setCurrentCursor(QCursor *cursor) } #endif -void QEGLPlatformCursor::update(const QRegion &rgn) +void QEGLPlatformCursorUpdater::update(const QPoint &pos, const QRegion &rgn) { - QWindowSystemInterface::handleExposeEvent(m_screen->topLevelAt(m_cursor.pos), rgn); + m_active = false; + QWindowSystemInterface::handleExposeEvent(m_screen->topLevelAt(pos), rgn); QWindowSystemInterface::flushWindowSystemEvents(); } +void QEGLPlatformCursorUpdater::scheduleUpdate(const QPoint &pos, const QRegion &rgn) +{ + if (m_active) + return; + + m_active = true; + + // Must not flush the window system events directly from here since we are likely to + // be a called directly from QGuiApplication's processMouseEvents. Flushing events + // could cause reentering by dispatching more queued mouse events. + QMetaObject::invokeMethod(this, "update", Qt::QueuedConnection, + Q_ARG(QPoint, pos), Q_ARG(QRegion, rgn)); +} + +void QEGLPlatformCursor::update(const QRegion &rgn) +{ + m_updater.scheduleUpdate(m_cursor.pos, rgn); +} + QRect QEGLPlatformCursor::cursorRect() const { return QRect(m_cursor.pos - m_cursor.hotSpot, m_cursor.size); diff --git a/src/platformsupport/eglconvenience/qeglplatformcursor_p.h b/src/platformsupport/eglconvenience/qeglplatformcursor_p.h index c9ff9a1198..6f4216874a 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcursor_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformcursor_p.h @@ -68,6 +68,24 @@ private: int m_mouseCount; }; +class QEGLPlatformCursorUpdater : public QObject +{ + Q_OBJECT + +public: + QEGLPlatformCursorUpdater(QPlatformScreen *screen) + : m_screen(screen), m_active(false) { } + + void scheduleUpdate(const QPoint &pos, const QRegion &rgn); + +private slots: + void update(const QPoint &pos, const QRegion &rgn); + +private: + QPlatformScreen *m_screen; + bool m_active; +}; + class QEGLPlatformCursor : public QPlatformCursor { public: @@ -130,6 +148,7 @@ private: int m_textureCoordEntry; int m_textureEntry; QEGLPlatformCursorDeviceListener *m_deviceListener; + QEGLPlatformCursorUpdater m_updater; }; QT_END_NAMESPACE -- cgit v1.2.3 From 9ab41425519510b5bfbe93ac916e3f40aa0e4510 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 25 Apr 2014 14:11:49 +0200 Subject: centralize auxiliary lib creation this covers convenience libraries which are linked into dlls (if we are not building statically) and "proper" (installed) builds of 3rdparty code. Change-Id: I2f00248c0baa0e73346e477724bf49bbc62ba925 Reviewed-by: Konstantin Ritt Reviewed-by: Laszlo Agocs Reviewed-by: Friedemann Kleint Reviewed-by: Joerg Bornemann --- src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro | 9 +-------- src/angle/src/common/common.pri | 1 + src/angle/src/compiler/preprocessor/preprocessor.pro | 3 --- src/angle/src/compiler/translator.pro | 3 --- src/angle/src/config.pri | 9 ++------- src/angle/src/d3dcompiler/d3dcompiler.pro | 9 +++------ src/angle/src/libEGL/libEGL.pro | 6 +----- src/angle/src/libGLESv2/libGLESv2.pro | 11 ++--------- src/plugins/platforms/xcb/xcb-static/xcb-static.pro | 5 ++--- 9 files changed, 12 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index d505c30aa6..bd0475fc05 100644 --- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -1,16 +1,11 @@ TARGET = qtharfbuzzng -TEMPLATE = lib CONFIG += \ static \ hide_symbols \ exceptions_off rtti_off -CONFIG -= qt -contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release -contains(QT_CONFIG, build_all):CONFIG += build_all - -DESTDIR = $$QT_BUILD_TREE/lib +load(qt_helper_lib) DEFINES += HAVE_CONFIG_H HEADERS += $$PWD/src/config.h @@ -133,5 +128,3 @@ mac { # even in 10.8 where they were also made available stand-alone. LIBS_PRIVATE += -framework ApplicationServices } - -TARGET = $$TARGET$$qtPlatformTargetSuffix() diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri index 58ad88673a..0943b3f299 100644 --- a/src/angle/src/common/common.pri +++ b/src/angle/src/common/common.pri @@ -1,3 +1,4 @@ +CONFIG += installed include (../config.pri) INCLUDEPATH += \ diff --git a/src/angle/src/compiler/preprocessor/preprocessor.pro b/src/angle/src/compiler/preprocessor/preprocessor.pro index 74cd97c5a4..420cb90b36 100644 --- a/src/angle/src/compiler/preprocessor/preprocessor.pro +++ b/src/angle/src/compiler/preprocessor/preprocessor.pro @@ -1,7 +1,4 @@ -TEMPLATE = lib CONFIG += static -TARGET = $$qtLibraryTarget(preprocessor) - include(../../config.pri) INCLUDEPATH = $$ANGLE_DIR/src/compiler/preprocessor diff --git a/src/angle/src/compiler/translator.pro b/src/angle/src/compiler/translator.pro index 0051486f82..18c3978e0f 100644 --- a/src/angle/src/compiler/translator.pro +++ b/src/angle/src/compiler/translator.pro @@ -1,7 +1,4 @@ -TEMPLATE = lib CONFIG += static -TARGET = $$qtLibraryTarget(translator) - include(../config.pri) # Mingw 4.7 chokes on implicit move semantics, so disable C++11 here diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri index 8e0f6b7f42..aa777c356f 100644 --- a/src/angle/src/config.pri +++ b/src/angle/src/config.pri @@ -59,17 +59,10 @@ CONFIG(debug, debug|release) { } # c++11 is needed by MinGW to get support for unordered_map. -CONFIG -= qt CONFIG += stl exceptions c++11 -contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release -contains(QT_CONFIG, build_all):CONFIG += build_all - INCLUDEPATH += . .. $$PWD/../include -DESTDIR = $$QT_BUILD_TREE/lib -DLLDESTDIR = $$QT_BUILD_TREE/bin - msvc { # Disabled Warnings: # 4100: 'identifier' : unreferenced formal parameter @@ -107,3 +100,5 @@ gcc { QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE + +load(qt_helper_lib) diff --git a/src/angle/src/d3dcompiler/d3dcompiler.pro b/src/angle/src/d3dcompiler/d3dcompiler.pro index 4d22080185..04b1de895d 100644 --- a/src/angle/src/d3dcompiler/d3dcompiler.pro +++ b/src/angle/src/d3dcompiler/d3dcompiler.pro @@ -1,9 +1,8 @@ -TEMPLATE = lib -TARGET = $$qtLibraryTarget(d3dcompiler_qt) - +TARGET = d3dcompiler_qt +CONFIG += installed include(../config.pri) -CONFIG += qt +CONFIG += qt QT = core DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII SOURCES += main.cpp @@ -16,5 +15,3 @@ winrt:equals(WINSDK_VER, 8.1) { # __stdcall exports get mangled, so use a def file DEF_FILE += $${TARGET}.def - -load(qt_installs) diff --git a/src/angle/src/libEGL/libEGL.pro b/src/angle/src/libEGL/libEGL.pro index 4f10583fc0..dc286ca11d 100644 --- a/src/angle/src/libEGL/libEGL.pro +++ b/src/angle/src/libEGL/libEGL.pro @@ -1,6 +1,4 @@ -TEMPLATE = lib -TARGET = $$qtLibraryTarget(libEGL) - +CONFIG += installed include(../common/common.pri) angle_d3d11: \ @@ -30,8 +28,6 @@ SOURCES += \ mingw:equals(QT_ARCH, i386): DEF_FILE = $$ANGLE_DIR/src/libEGL/$${TARGET}_mingw32.def } -load(qt_installs) - egl_headers.files = \ $$ANGLE_DIR/include/EGL/egl.h \ $$ANGLE_DIR/include/EGL/eglext.h \ diff --git a/src/angle/src/libGLESv2/libGLESv2.pro b/src/angle/src/libGLESv2/libGLESv2.pro index 6176016f13..70c58dc5a4 100644 --- a/src/angle/src/libGLESv2/libGLESv2.pro +++ b/src/angle/src/libGLESv2/libGLESv2.pro @@ -1,7 +1,4 @@ -TEMPLATE = lib -TARGET = $$qtLibraryTarget(libGLESv2) -CONFIG += simd - +CONFIG += simd installed include(../common/common.pri) INCLUDEPATH += $$OUT_PWD/.. $$ANGLE_DIR/src/libGLESv2 @@ -13,8 +10,8 @@ angle_d3d11: \ LIBS_PRIVATE += -ld3d9 LIBS_PRIVATE += -ldxguid -STATICLIBS = translator preprocessor +STATICLIBS = translator preprocessor for(libname, STATICLIBS) { # Appends 'd' to the library for debug builds and builds up the fully # qualified path to pass to the linker. @@ -238,8 +235,6 @@ for (vs, VERTEX_SHADERS_CLEAR) { angle_d3d11: QMAKE_EXTRA_COMPILERS += fxc_vs_$${vs} } -load(qt_installs) - khr_headers.files = $$ANGLE_DIR/include/KHR/khrplatform.h khr_headers.path = $$[QT_INSTALL_HEADERS]/QtANGLE/KHR gles2_headers.files = \ @@ -248,5 +243,3 @@ gles2_headers.files = \ $$ANGLE_DIR/include/GLES2/gl2platform.h gles2_headers.path = $$[QT_INSTALL_HEADERS]/QtANGLE/GLES2 INSTALLS += khr_headers gles2_headers - - diff --git a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro index 19852b74b1..dfdcb2e83a 100644 --- a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro +++ b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro @@ -3,9 +3,8 @@ # libxcb-fixes, libxcb-randr, libxcb-shm, libxcb-sync, libxcb-image, # libxcb-keysyms, libxcb-icccm, libxcb-renderutil, libxcb-xkb # -TEMPLATE = lib -TARGET = xcb-static -CONFIG += staticlib +CONFIG += static +load(qt_helper_lib) XCB_DIR = ../../../../3rdparty/xcb -- cgit v1.2.3 From 40b195d0f9ee7ef1b917a635bb073fa108b2ed40 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 25 Apr 2014 13:12:20 +0200 Subject: Fix font fallback handling with Harfbuzz and CoreText Comparing CGFontRefs is not reliable it seems, CFEqual on them appears to compare pointers and there's no guarantee that CTFontCopyGraphicsFont returns the same pointer all the time. So instead let's compare CTFontRefs, which we keep around and also provide as input to CoreText shaping. Task-number: 38363 Change-Id: I6073ea88f0c9f5ebf49d17cba0d76041ade32570 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Konstantin Ritt --- src/3rdparty/harfbuzz-ng/src/hb-coretext.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc index 4a905ee189..4fef861acc 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc +++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc @@ -690,13 +690,10 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, */ CFDictionaryRef attributes = CTRunGetAttributes (run); CTFontRef run_ct_font = static_cast(CFDictionaryGetValue (attributes, kCTFontAttributeName)); - CGFontRef run_cg_font = CTFontCopyGraphicsFont (run_ct_font, 0); CFRange range = CTRunGetStringRange (run); - if (!CFEqual (run_cg_font, face_data->cg_font)) + if (!CFEqual (run_ct_font, font_data->ct_font)) { - CFRelease (run_cg_font); - buffer->ensure (buffer->len + range.length); if (buffer->in_error) FAIL ("Buffer resize failed"); @@ -731,7 +728,6 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, } continue; } - CFRelease (run_cg_font); /* CoreText throws away the PDF token, while the OpenType backend will add a zero-advance * glyph for this. We need to make sure the two produce the same output. */ -- cgit v1.2.3 From 55e430a3b3f4f225da6b7192773f082b5411741b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Proulx Date: Mon, 28 Apr 2014 11:11:11 -0400 Subject: Fix double release in QTimeZone on Mac m_nstz is released in the destructor but not retained when using the QTimeZone(QByteArray) constructor. Task-number: QTBUG-35890 Task-number: QTBUG-37582 Change-Id: Ia569830bcd3c2f2cea04ad6696e681c4f2a3c137 Reviewed-by: Shawn Rutledge Reviewed-by: Jake Petroules Reviewed-by: Gabriel de Dietrich --- src/corelib/tools/qtimezoneprivate_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qtimezoneprivate_mac.mm b/src/corelib/tools/qtimezoneprivate_mac.mm index 49930490ff..3484ec79ef 100644 --- a/src/corelib/tools/qtimezoneprivate_mac.mm +++ b/src/corelib/tools/qtimezoneprivate_mac.mm @@ -89,7 +89,7 @@ QTimeZonePrivate *QMacTimeZonePrivate::clone() void QMacTimeZonePrivate::init(const QByteArray &ianaId) { if (availableTimeZoneIds().contains(ianaId)) { - m_nstz = [NSTimeZone timeZoneWithName:QCFString::toNSString(QString::fromUtf8(ianaId))]; + m_nstz = [[NSTimeZone timeZoneWithName:QCFString::toNSString(QString::fromUtf8(ianaId))] retain]; if (m_nstz) m_id = ianaId; } -- cgit v1.2.3 From b619c35d8507eee3ad9b456128f811b561513727 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 28 Apr 2014 11:45:44 +0200 Subject: Revert "Mac: fix bugs for font selection in QFontDialog" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3c09f6bc9aee0c97427fe8da6efdc73b4ac473aa. After fbaa6d3ca6fc2693c5c8a1cd8e565803adc97730, OS X/iOS no longer uses localized font names. Task-number: QTBUG-38548 Conflicts: src/gui/text/qfontdatabase.cpp Change-Id: Id7f7e1976e4ffc30c5c18cf57e2acb3aebafc301 Reviewed-by: Tor Arne Vestbø Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index dc22da0983..a18f721e04 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -92,16 +92,20 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) QFont newFont; if (cocoaFont) { int pSize = qRound([cocoaFont pointSize]); - CTFontDescriptorRef font = CTFontCopyFontDescriptor((CTFontRef)cocoaFont); - // QCoreTextFontDatabase::populateFontDatabase() is using localized names - QString family = QCFString::toQString((CFStringRef) CTFontDescriptorCopyLocalizedAttribute(font, kCTFontFamilyNameAttribute, NULL)); - QString style = QCFString::toQString((CFStringRef) CTFontDescriptorCopyLocalizedAttribute(font, kCTFontStyleNameAttribute, NULL)); + QString family(QCFString::toQString([cocoaFont familyName])); + QString typeface(QCFString::toQString([cocoaFont fontName])); + + int hyphenPos = typeface.indexOf(QLatin1Char('-')); + if (hyphenPos != -1) { + typeface.remove(0, hyphenPos + 1); + } else { + typeface = QLatin1String("Normal"); + } - newFont = QFontDatabase().font(family, style, pSize); + newFont = QFontDatabase().font(family, typeface, pSize); newFont.setUnderline(resolveFont.underline()); newFont.setStrikeOut(resolveFont.strikeOut()); - CFRelease(font); } return newFont; } -- cgit v1.2.3 From a3634e4b2b39fb7895a3c5795498d1a176e528b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 24 Apr 2014 15:33:20 +0200 Subject: iOS: Send updated expose events on application background/foregrounding When an application has background processing enabled, for example for communicating with an external accessory or getting location updates, it might trigger code that does UI updates, which will kill the app as doing UI in the background is not allowed on iOS. We guard against this by propagating the backgrounding as updated expose events with a non-exposed region and isExposed() returning false. This means clients who correctly use QWindow::isExposed() to guard their drawing code (including the scene-graph), will live to see another day. Task-number: QTBUG-36956 Change-Id: Ib708394d33093affe68c9f2c7abde7e54be5ec74 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.h | 1 + src/plugins/platforms/ios/qioswindow.mm | 32 +++++++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index fc99543aa6..6b6892e6e4 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -88,6 +88,7 @@ public: WId winId() const { return WId(m_view); }; private: + void applicationStateChanged(Qt::ApplicationState state); void applyGeometry(const QRect &rect); QUIView *m_view; diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 7d5c507972..ebff2c25a1 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -192,12 +192,25 @@ - (void)displayLayer:(CALayer *)layer { - QSize bounds = fromCGRect(layer.bounds).toRect().size(); + Q_UNUSED(layer); + Q_ASSERT(layer == self.layer); - Q_ASSERT(m_qioswindow->geometry().size() == bounds); - Q_ASSERT(self.hidden == !m_qioswindow->window()->isVisible()); + [self sendUpdatedExposeEvent]; +} + +- (void)sendUpdatedExposeEvent +{ + QRegion region; + + if (m_qioswindow->isExposed()) { + QSize bounds = fromCGRect(self.layer.bounds).toRect().size(); + + Q_ASSERT(m_qioswindow->geometry().size() == bounds); + Q_ASSERT(self.hidden == !m_qioswindow->window()->isVisible()); + + region = QRect(QPoint(), bounds); + } - QRegion region = self.hidden ? QRegion() : QRect(QPoint(), bounds); QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), region); QWindowSystemInterface::flushWindowSystemEvents(); } @@ -334,6 +347,8 @@ QIOSWindow::QIOSWindow(QWindow *window) , m_view([[QUIView alloc] initWithQIOSWindow:this]) , m_windowLevel(0) { + connect(qGuiApp, &QGuiApplication::applicationStateChanged, this, &QIOSWindow::applicationStateChanged); + setParent(QPlatformWindow::parent()); // Resolve default window geometry in case it was not set before creating the @@ -471,7 +486,8 @@ void QIOSWindow::applyGeometry(const QRect &rect) bool QIOSWindow::isExposed() const { - return window()->isVisible() && !window()->geometry().isEmpty(); + return qApp->applicationState() > Qt::ApplicationHidden + && window()->isVisible() && !window()->geometry().isEmpty(); } void QIOSWindow::setWindowState(Qt::WindowState state) @@ -593,6 +609,12 @@ void QIOSWindow::handleContentOrientationChange(Qt::ScreenOrientation orientatio [[UIApplication sharedApplication] setStatusBarOrientation:uiOrientation animated:NO]; } +void QIOSWindow::applicationStateChanged(Qt::ApplicationState) +{ + if (window()->isExposed() != isExposed()) + [m_view sendUpdatedExposeEvent]; +} + qreal QIOSWindow::devicePixelRatio() const { return m_view.contentScaleFactor; -- cgit v1.2.3 From 27ea8fa99f84d96618d75a8245364457585bc5e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 23 Apr 2014 14:55:38 +0200 Subject: QCocoaPrintDevice: Compile on Mac OS 10.6 MAXPATHLEN is not defined, use PATH_MAX. Change-Id: I5a8febce66584c15bdfe81df64fe3f1954972a47 Reviewed-by: Andy Shaw --- src/plugins/platforms/cocoa/qcocoaprintdevice.mm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoaprintdevice.mm b/src/plugins/platforms/cocoa/qcocoaprintdevice.mm index 57d5c800e0..7322025df6 100644 --- a/src/plugins/platforms/cocoa/qcocoaprintdevice.mm +++ b/src/plugins/platforms/cocoa/qcocoaprintdevice.mm @@ -463,7 +463,11 @@ bool QCocoaPrintDevice::openPpdFile() ppdClose(m_ppd); m_ppd = 0; CFURLRef ppdURL = NULL; +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 + char ppdPath[PATH_MAX]; +#else char ppdPath[MAXPATHLEN]; +#endif if (PMPrinterCopyDescriptionURL(m_printer, kPMPPDDescriptionType, &ppdURL) == noErr && ppdURL != NULL && CFURLGetFileSystemRepresentation(ppdURL, true, (UInt8*)ppdPath, sizeof(ppdPath))) { -- cgit v1.2.3 From ee85cdee67d164315e52a05462b03fe7091cc26d Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 23 Apr 2014 10:32:07 +0200 Subject: Logging: Mention 'best practices' for using QLoggingCategory QLoggingCategory objects are meant to be mere 'handles' for the registry. It's therefore not recommended to - manipulate them directly (via setEnabled()), except in a filter - export them across module boundaries - subclass them Subclassing QLoggingCategory also breaks compilations in a certain circumstances (no variadic macros). Task-number: QTBUG-37283 Change-Id: Ib12fb43d955902c7fa4583296d64afc5eca01200 Reviewed-by: Thiago Macieira --- src/corelib/io/qloggingcategory.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 08ecd67dc8..518052e537 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -62,6 +62,12 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, by a string - at runtime. Whether a category should be actually logged or not can be checked with the \l isEnabled() methods. + All objects are meant to be configured by a common registry (see also + \l{Configuring Categories}). Different objects can also represent the same + category. It's therefore not recommended to export objects across module + boundaries, nor to manipulate the objects directly, nor to inherit from + QLoggingCategory. + \section1 Creating category objects The Q_LOGGING_CATEGORY() and the Q_DECLARE_LOGGING_CATEGORY() macros -- cgit v1.2.3 From 88756dc46f019dd7d12c7b687233f707661b1ecc Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 29 Apr 2014 14:13:28 +0200 Subject: printsupport: only build cocoa backend for OS X Cocoa is not available on iOS, so the plugin should not be built. But recent build system changes exposed that we did. Change-Id: I000d54b330a075abb8f4a8b28a970bb5b5edfeb5 Reviewed-by: Oswald Buddenhagen --- src/plugins/printsupport/printsupport.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/printsupport/printsupport.pro b/src/plugins/printsupport/printsupport.pro index 93f3d65bc5..ed201f0744 100644 --- a/src/plugins/printsupport/printsupport.pro +++ b/src/plugins/printsupport/printsupport.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs -mac: SUBDIRS += cocoa +osx: SUBDIRS += cocoa win32: SUBDIRS += windows unix:!mac:contains(QT_CONFIG, cups): SUBDIRS += cups -- cgit v1.2.3 From 12eb3b51c4c8c7ce90302d2c356fea09f2c42a5c Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 29 Apr 2014 13:39:23 +0200 Subject: Fix incorrect repaints with plain text edit The plain text edit's smart repaint logic in QPlainTextDocumentLayout::documentChanged assumes that during a change inside just one block, the block is in the state before the edit and a call to layoutBlock() is going to bring it up-to-date. Then only a comparison of the bounding rect - before and after - is going to allow for smart repaints. The assumption of the layout being in the same state as before the edit got broken by commit cc57a2e90f18a39ce3c74b6ad0db9a64aa135ddf, which introduced code to use a QTextCursor within a slot connected to QTextDocument's contentsChange signal. The usage of the QTextCursor there ends up updating the layout of the block ahead of time, breaking the assumption and therefore the optimization, in the sense that during changes in the preedit that cause a change of height / line count, the old bounding rect in QPlainTextDocumentLayout::documentChanged and the new bounding rect will be the same. This causes a repaint of only the edited block, missing repaints of the following blocks, even though the line count effectively changed. So what's causing QTextCursor to mess with the layout is the attempt of updating the vertical movement x property. This patch inhibits the update, marking it as dirty for initialization later. This means that slots connected to this low-level signal cannot rely on the cursor's visual x position, but that doesn't seem useful anyway and isn't required for commit cc57a2e90f18a39ce3c74b6ad0db9a64aa135ddf. Task-number: QTBUG-38536 Change-Id: I5fae12d646a4b2d2cc22b9f2d021e5dc8cfdda94 Reviewed-by: Paul Olav Tvete Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Konstantin Ritt --- src/gui/text/qtextcursor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index ac9762b183..731b6adde8 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -132,7 +132,7 @@ QTextCursorPrivate::AdjustResult QTextCursorPrivate::adjustPosition(int position void QTextCursorPrivate::setX() { - if (priv->isInEditBlock()) { + if (priv->isInEditBlock() || priv->inContentsChange) { x = -1; // mark dirty return; } -- cgit v1.2.3 From 7eae50a52d63b7f0434fdb75fc09b0901a0140cc Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 29 Apr 2014 09:06:08 +0200 Subject: Fix assert on justification of QTextLine with only spaces In the justification code, we unconditionally subtracted one from the line_length, but then compared the result to 0 afterwards, so we did not support when the line_length is 0 initially, which can happen if it only consists of spaces (in which case trailingSpaces will be non-zero and line_length will be zero.) The fix is to bail out for both strings of length 1 and length 0. [ChangeLog][Text] Fixed an assert when justifying a QTextLine which only contains spaces. Task-number: QTBUG-38520 Change-Id: Ib04993f47eb2f9f7fc49c4a5400f18f9682a72f2 Reviewed-by: Simon Hausmann Reviewed-by: Konstantin Ritt Reviewed-by: Lars Knoll --- src/gui/text/qtextengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 34788dc4dc..67dedca760 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2057,7 +2057,7 @@ void QTextEngine::justify(const QScriptLine &line) // subtract one char more, as we can't justfy after the last character --line_length; - if (!line_length) + if (line_length <= 0) return; int firstItem = findItem(line.from); -- cgit v1.2.3 From 8605f44097a986e10c2ddaf4b4eae0b2331d98d1 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 30 Apr 2014 16:46:22 +0200 Subject: Cocoa QPA Menu: Clear menu items' Cocoa ancestor on destruction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Valid for both the item and the menu destructions. Task-number: QTBUG-38685 Change-Id: I024b93c8bb8facefeaad5e8b6c7be6bf049898ea Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoamenu.mm | 4 ++++ src/plugins/platforms/cocoa/qcocoamenuitem.mm | 2 ++ 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 6acc062eb9..9b5753035a 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -234,6 +234,10 @@ QCocoaMenu::QCocoaMenu() : QCocoaMenu::~QCocoaMenu() { + foreach (QCocoaMenuItem *item, m_menuItems) { + if (COCOA_MENU_ANCESTOR(item) == this) + SET_COCOA_MENU_ANCESTOR(item, 0); + } QCocoaAutoReleasePool pool; [m_nativeItem setSubmenu:nil]; [m_nativeMenu release]; diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index 58fe07bc62..da5475496a 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -105,6 +105,8 @@ QCocoaMenuItem::QCocoaMenuItem() : QCocoaMenuItem::~QCocoaMenuItem() { + if (m_menu && COCOA_MENU_ANCESTOR(m_menu) == this) + SET_COCOA_MENU_ANCESTOR(m_menu, 0); if (m_merged) { [m_native setHidden:YES]; } else { -- cgit v1.2.3 From d17e48108df864c446892c0a4318b41b30685de6 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Proulx Date: Wed, 30 Apr 2014 13:01:36 -0400 Subject: Fix more double release in QTimeZone on Mac MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Several objects are released without being retained. This causes double free crash. Task-number: QTBUG-37582 Task-number: QTBUG-35890 Change-Id: Ic64419c22ab555ba77ada1864feaff247798d3ad Reviewed-by: Jake Petroules Reviewed-by: Morten Johan Sørvig --- src/corelib/tools/qtimezoneprivate_mac.mm | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qtimezoneprivate_mac.mm b/src/corelib/tools/qtimezoneprivate_mac.mm index 3484ec79ef..7985b78712 100644 --- a/src/corelib/tools/qtimezoneprivate_mac.mm +++ b/src/corelib/tools/qtimezoneprivate_mac.mm @@ -142,7 +142,6 @@ QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType, NSString *macLocaleCode = QCFString::toNSString(locale.name()); NSLocale *macLocale = [[NSLocale alloc] initWithLocaleIdentifier:macLocaleCode]; const QString result = QCFString::toQString([m_nstz localizedName:style locale:macLocale]); - [macLocaleCode release]; [macLocale release]; return result; } @@ -192,7 +191,6 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::data(qint64 forMSecsSinceEpoch) cons data.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:date]; data.standardTimeOffset = data.offsetFromUtc - data.daylightTimeOffset; data.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:date]); - [date release]; return data; } @@ -203,8 +201,6 @@ bool QMacTimeZonePrivate::hasTransitions() const NSDate *epoch = [NSDate dateWithTimeIntervalSince1970:0]; const NSDate *date = [m_nstz nextDaylightSavingTimeTransitionAfterDate:epoch]; const bool result = ([date timeIntervalSince1970] > [epoch timeIntervalSince1970]); - [epoch release]; - [date release]; return result; } @@ -224,7 +220,6 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::nextTransition(qint64 afterMSecsSinc tran.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:nextDate]; tran.standardTimeOffset = tran.offsetFromUtc - tran.daylightTimeOffset; tran.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:nextDate]); - [nextDate release]; return tran; } @@ -246,7 +241,6 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate]; nextSecs = [nextDate timeIntervalSince1970]; } - [nextDate release]; } if (secsList.size() >= 1) return data(qint64(secsList.last()) * 1000); -- cgit v1.2.3 From 3db5e58dd39fd14a2b9cf16f5396d1ffa1c9280e Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 1 May 2014 14:01:41 -0700 Subject: Revision new signal As it's meant for QML anyways, this allows it to coexist peacefully with existing code. Task-number: QTBUG-29806 Change-Id: Ib04993f47eb2f9f7fc49c4a5400f18f9682a7aaa Reviewed-by: Simon Hausmann --- src/gui/kernel/qwindow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 3278b7233c..0d13cfa648 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -297,7 +297,7 @@ Q_SIGNALS: void screenChanged(QScreen *screen); void modalityChanged(Qt::WindowModality modality); void windowStateChanged(Qt::WindowState windowState); - void windowTitleChanged(const QString &title); + Q_REVISION(2) void windowTitleChanged(const QString &title); void xChanged(int arg); void yChanged(int arg); -- cgit v1.2.3 From 9ae89313e43689483282ac330ad189db89bfcbba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 23 Apr 2014 19:10:35 +0000 Subject: Add a comment about not obvious code in VariantData. Change-Id: I943af28c47b396aa35173da2a1294b86c8a522fa Reviewed-by: Thiago Macieira --- src/corelib/kernel/qmetatype.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 80567d6a71..3b35a51e2c 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -777,6 +777,7 @@ struct VariantData const void *data; const uint flags; private: + // copy constructor allowed to be implicit to silence level 4 warning from MSVC VariantData &operator=(const VariantData &) Q_DECL_EQ_DELETE; }; -- cgit v1.2.3