From 954f0d93976362d29044439e4eaa11d2dff16624 Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Mon, 29 Jun 2015 10:16:36 +0200 Subject: Add test for invalid exif data Task-number: QTBUG-46870 Change-Id: Idfde92ca12336c6432798b4517e244c2f5a5ba4d Reviewed-by: Allan Sandfeld Jensen --- .../images/jpeg_exif_invalid_data_QTBUG-46870.jpg | Bin 0 -> 14122 bytes tests/auto/gui/image/qimage/tst_qimage.cpp | 8 ++++++++ 2 files changed, 8 insertions(+) create mode 100644 tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_QTBUG-46870.jpg diff --git a/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_QTBUG-46870.jpg b/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_QTBUG-46870.jpg new file mode 100644 index 0000000000..a51a1e3162 Binary files /dev/null and b/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_QTBUG-46870.jpg differ diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index f7c71f05bd..8286c800c2 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -185,6 +185,7 @@ private slots: void exifOrientation(); void exif_QTBUG45865(); + void exif_invalid_data_QTBUG46870(); void cleanupFunctions(); @@ -2872,6 +2873,13 @@ void tst_QImage::exif_QTBUG45865() QCOMPARE(image.size(), QSize(5, 8)); } +void tst_QImage::exif_invalid_data_QTBUG46870() +{ + QImage image; + QVERIFY(image.load(m_prefix + "jpeg_exif_invalid_data_QTBUG-46870.jpg")); + QVERIFY(!image.isNull()); +} + static void cleanupFunction(void* info) { bool *called = static_cast(info); -- cgit v1.2.3 From 58e4bbc83f4cd9ee2b87eff34403ac52b069aa1f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 11 Mar 2015 19:53:18 -0700 Subject: tst_QUdpSocket: send two bytes in a datagram I'm getting an error with WSARecvFrom in nativeBytesAvailable() and I don't know why. The number of bytes obtained is correct and the test works for 2 bytes, so let's use that. The Windows nativeBytesAvailable() function has a comment saying that WSAIoctl sometimes indicates 1 byte available when there's a pending error notification, so that function proceeds to do a WSARecvFrom to peek the number of bytes. Somehow that function in this test is getting a SOCKET_ERROR I can't explain. Change-Id: Ic5b19e556e572a72a9df9a405b1fee3b7efb8b24 Reviewed-by: Richard J. Moore --- tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 8de9987ed1..080f763f54 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -1574,7 +1574,7 @@ void tst_QUdpSocket::readyRead() QSignalSpy spy(&receiver, SIGNAL(readyRead())); // send a datagram to that port - sender.writeDatagram("a", makeNonAny(receiver.localAddress()), port); + sender.writeDatagram("aa", makeNonAny(receiver.localAddress()), port); // wait a little // if QTBUG-43857 is still going, we'll live-lock on socket notifications from receiver's socket @@ -1583,8 +1583,8 @@ void tst_QUdpSocket::readyRead() // make sure only one signal was emitted QCOMPARE(spy.count(), 1); QVERIFY(receiver.hasPendingDatagrams()); - QCOMPARE(receiver.bytesAvailable(), qint64(1)); - QCOMPARE(receiver.pendingDatagramSize(), qint64(1)); + QCOMPARE(receiver.bytesAvailable(), qint64(2)); + QCOMPARE(receiver.pendingDatagramSize(), qint64(2)); // write another datagram sender.writeDatagram("ab", makeNonAny(receiver.localAddress()), port); @@ -1594,7 +1594,7 @@ void tst_QUdpSocket::readyRead() QCOMPARE(spy.count(), 1); QVERIFY(receiver.hasPendingDatagrams()); QVERIFY(receiver.bytesAvailable() >= 1); // most likely is 1, but it could be 1 + 2 in the future - QCOMPARE(receiver.pendingDatagramSize(), qint64(1)); + QCOMPARE(receiver.pendingDatagramSize(), qint64(2)); // read all the datagrams (we could read one only, but we can't be sure the OS is queueing) while (receiver.hasPendingDatagrams()) -- cgit v1.2.3 From 9e6d3a8c9adc185319e791a0bffd95601f8cb051 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 1 Mar 2015 13:11:40 -0800 Subject: Fix GCC 4.9 warning about repeated attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qxcbscreen.cpp:701:21: error: ‘QDebug operator<<(QDebug, const QXcbScreen*)’: visibility attribute ignored because it qxcbscreen.h:149:21: error: conflicts with previous declaration here [- Werror=attributes] Change-Id: Ia0aac2f09e9245339951ffff13c77c23cb9430c5 Reviewed-by: Uli Schlachter Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index c7f811491c..3dcd6a713a 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -760,7 +760,7 @@ static inline void formatSizeF(QDebug &debug, const QSizeF s) debug << s.width() << 'x' << s.height() << "mm"; } -Q_XCB_EXPORT QDebug operator<<(QDebug debug, const QXcbScreen *screen) +QDebug operator<<(QDebug debug, const QXcbScreen *screen) { const QDebugStateSaver saver(debug); debug.nospace(); -- cgit v1.2.3 From 62f6866508d9ce42bfa6080ff53abe0d8d0b3461 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 30 Mar 2015 14:53:55 -0700 Subject: Autotest: rename sub tests from "test" to something meaningful Otherwise, if I open tests/auto/dbus/dbus.pro in Qt Creator, it shows me "test", "test2", "test3", "test4" and it's very hard to know which test is which. Change-Id: Iee8cbc07c4434ce9b560ffff13d0654696c025b7 Reviewed-by: Frederik Gladhorn --- .../dbus/qdbusabstractadaptor/qdbusabstractadaptor.pro | 2 +- .../qdbusabstractadaptor/qdbusabstractadaptor.pro | 8 ++++++++ tests/auto/dbus/qdbusabstractadaptor/test/test.pro | 8 -------- .../qdbusabstractinterface/qdbusabstractinterface.pro | 2 +- .../qdbusabstractinterface/qdbusabstractinterface.pro | 13 +++++++++++++ tests/auto/dbus/qdbusabstractinterface/test/test.pro | 13 ------------- tests/auto/dbus/qdbusinterface/qdbusinterface.pro | 2 +- .../dbus/qdbusinterface/qdbusinterface/qdbusinterface.pro | 8 ++++++++ tests/auto/dbus/qdbusinterface/test/test.pro | 8 -------- tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro | 2 +- .../dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro | 15 +++++++++++++++ tests/auto/dbus/qdbusmarshall/test/test.pro | 15 --------------- 12 files changed, 48 insertions(+), 48 deletions(-) create mode 100644 tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor/qdbusabstractadaptor.pro delete mode 100644 tests/auto/dbus/qdbusabstractadaptor/test/test.pro create mode 100644 tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/qdbusabstractinterface.pro delete mode 100644 tests/auto/dbus/qdbusabstractinterface/test/test.pro create mode 100644 tests/auto/dbus/qdbusinterface/qdbusinterface/qdbusinterface.pro delete mode 100644 tests/auto/dbus/qdbusinterface/test/test.pro create mode 100644 tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro delete mode 100644 tests/auto/dbus/qdbusmarshall/test/test.pro diff --git a/tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor.pro b/tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor.pro index d67d81e4bf..1b35019f94 100644 --- a/tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor.pro +++ b/tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor.pro @@ -3,4 +3,4 @@ TARGET = tst_qdbusabstractadaptor QT = core core-private testlib TEMPLATE = subdirs CONFIG += ordered -SUBDIRS = qmyserver test +SUBDIRS = qmyserver qdbusabstractadaptor diff --git a/tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor/qdbusabstractadaptor.pro b/tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor/qdbusabstractadaptor.pro new file mode 100644 index 0000000000..d95fa941f0 --- /dev/null +++ b/tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor/qdbusabstractadaptor.pro @@ -0,0 +1,8 @@ +CONFIG += testcase +SOURCES += ../tst_qdbusabstractadaptor.cpp +HEADERS += ../myobject.h +TARGET = ../tst_qdbusabstractadaptor +DESTDIR = ./ + +QT = core core-private dbus testlib +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusabstractadaptor/test/test.pro b/tests/auto/dbus/qdbusabstractadaptor/test/test.pro deleted file mode 100644 index d95fa941f0..0000000000 --- a/tests/auto/dbus/qdbusabstractadaptor/test/test.pro +++ /dev/null @@ -1,8 +0,0 @@ -CONFIG += testcase -SOURCES += ../tst_qdbusabstractadaptor.cpp -HEADERS += ../myobject.h -TARGET = ../tst_qdbusabstractadaptor -DESTDIR = ./ - -QT = core core-private dbus testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface.pro b/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface.pro index 623b07fcbd..99462b1b36 100644 --- a/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface.pro +++ b/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface.pro @@ -2,5 +2,5 @@ CONFIG += testcase TARGET = tst_qdbusabstractinterface TEMPLATE = subdirs CONFIG += ordered -SUBDIRS = qpinger test +SUBDIRS = qpinger qdbusabstractinterface OTHER_FILES += org.qtproject.QtDBus.Pinger.xml diff --git a/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/qdbusabstractinterface.pro b/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/qdbusabstractinterface.pro new file mode 100644 index 0000000000..a8cc4c2b38 --- /dev/null +++ b/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/qdbusabstractinterface.pro @@ -0,0 +1,13 @@ +CONFIG += testcase +SOURCES += ../tst_qdbusabstractinterface.cpp ../interface.cpp +HEADERS += ../interface.h + +TARGET = ../tst_qdbusabstractinterface +DESTDIR = ./ + +QT = core testlib +QT += dbus +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +DBUS_INTERFACES = ../org.qtproject.QtDBus.Pinger.xml +QDBUSXML2CPP_INTERFACE_HEADER_FLAGS += -i ../interface.h diff --git a/tests/auto/dbus/qdbusabstractinterface/test/test.pro b/tests/auto/dbus/qdbusabstractinterface/test/test.pro deleted file mode 100644 index a8cc4c2b38..0000000000 --- a/tests/auto/dbus/qdbusabstractinterface/test/test.pro +++ /dev/null @@ -1,13 +0,0 @@ -CONFIG += testcase -SOURCES += ../tst_qdbusabstractinterface.cpp ../interface.cpp -HEADERS += ../interface.h - -TARGET = ../tst_qdbusabstractinterface -DESTDIR = ./ - -QT = core testlib -QT += dbus -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 - -DBUS_INTERFACES = ../org.qtproject.QtDBus.Pinger.xml -QDBUSXML2CPP_INTERFACE_HEADER_FLAGS += -i ../interface.h diff --git a/tests/auto/dbus/qdbusinterface/qdbusinterface.pro b/tests/auto/dbus/qdbusinterface/qdbusinterface.pro index 093a888765..c8861cb2a4 100644 --- a/tests/auto/dbus/qdbusinterface/qdbusinterface.pro +++ b/tests/auto/dbus/qdbusinterface/qdbusinterface.pro @@ -3,4 +3,4 @@ TARGET = tst_qdbusinterface QT = core testlib TEMPLATE = subdirs CONFIG += ordered -SUBDIRS = qmyserver test +SUBDIRS = qmyserver qdbusinterface diff --git a/tests/auto/dbus/qdbusinterface/qdbusinterface/qdbusinterface.pro b/tests/auto/dbus/qdbusinterface/qdbusinterface/qdbusinterface.pro new file mode 100644 index 0000000000..170b555ee7 --- /dev/null +++ b/tests/auto/dbus/qdbusinterface/qdbusinterface/qdbusinterface.pro @@ -0,0 +1,8 @@ +CONFIG += testcase +SOURCES += ../tst_qdbusinterface.cpp +HEADERS += ../myobject.h +TARGET = ../tst_qdbusinterface +DESTDIR = ./ + +QT = core core-private dbus testlib +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusinterface/test/test.pro b/tests/auto/dbus/qdbusinterface/test/test.pro deleted file mode 100644 index 170b555ee7..0000000000 --- a/tests/auto/dbus/qdbusinterface/test/test.pro +++ /dev/null @@ -1,8 +0,0 @@ -CONFIG += testcase -SOURCES += ../tst_qdbusinterface.cpp -HEADERS += ../myobject.h -TARGET = ../tst_qdbusinterface -DESTDIR = ./ - -QT = core core-private dbus testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro b/tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro index dfbb206324..e9a41c0fb4 100644 --- a/tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro +++ b/tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro @@ -2,7 +2,7 @@ CONFIG += testcase TARGET = tst_qdbusmarshall TEMPLATE = subdirs CONFIG += ordered -SUBDIRS = qpong test +SUBDIRS = qpong qdbusmarshall QT = core-private testlib diff --git a/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro b/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro new file mode 100644 index 0000000000..b0656231d2 --- /dev/null +++ b/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro @@ -0,0 +1,15 @@ +CONFIG += testcase +SOURCES += ../tst_qdbusmarshall.cpp +TARGET = ../tst_qdbusmarshall +DESTDIR = ./ + +QT = core-private dbus-private testlib + +contains(QT_CONFIG, dbus-linked) { + DEFINES += QT_LINKED_LIBDBUS + LIBS += $$QT_LIBS_DBUS + QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS +} else { + SOURCES += ../../../../../src/dbus/qdbus_symbols.cpp +} +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusmarshall/test/test.pro b/tests/auto/dbus/qdbusmarshall/test/test.pro deleted file mode 100644 index b0656231d2..0000000000 --- a/tests/auto/dbus/qdbusmarshall/test/test.pro +++ /dev/null @@ -1,15 +0,0 @@ -CONFIG += testcase -SOURCES += ../tst_qdbusmarshall.cpp -TARGET = ../tst_qdbusmarshall -DESTDIR = ./ - -QT = core-private dbus-private testlib - -contains(QT_CONFIG, dbus-linked) { - DEFINES += QT_LINKED_LIBDBUS - LIBS += $$QT_LIBS_DBUS - QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS -} else { - SOURCES += ../../../../../src/dbus/qdbus_symbols.cpp -} -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -- cgit v1.2.3 From f9f4082ab60749a7b56c323fcc60f83257726427 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 3 Apr 2015 11:22:30 -0700 Subject: Don't complain about missing CPU features under Valgrind If you're running Qt under valgrind, it stands to reason that you know what you're doing. In particular, Valgrind does support AVX and AVX2 instructions, but some versions seem to be missing the necessary CPUID bits. Change-Id: I9a75ad8521ae4e5cbbe5ffff13d1940f6fa5c4f4 Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: David Faure --- src/corelib/tools/qsimd.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 52ffc161bf..4973da9cb1 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -36,6 +36,10 @@ #include #include +#ifdef Q_OS_LINUX +# include "../testlib/3rdparty/valgrind_p.h" +#endif + #if defined(Q_OS_WIN) # if defined(Q_OS_WINCE) # include @@ -552,7 +556,12 @@ void qDetectCpuFeatures() } } - if (minFeature != 0 && (f & minFeature) != minFeature) { +#ifdef RUNNING_ON_VALGRIND + bool runningOnValgrind = RUNNING_ON_VALGRIND; +#else + bool runningOnValgrind = false; +#endif + if (!runningOnValgrind && (minFeature != 0 && (f & minFeature) != minFeature)) { uint missing = minFeature & ~f; fprintf(stderr, "Incompatible processor. This Qt build requires the following features:\n "); for (int i = 0; i < features_count; ++i) { -- cgit v1.2.3 From 2806d1c00a72f093714ba9187ee1a0e463058ec2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Jul 2015 13:35:28 -0700 Subject: Also disable constexpr support in ICC with MSVC before MSVC2015 Because the MS standard library headers won't have the necessary constexpr markings, some types that should be literal (like std::atomic) aren't and some functions that should be constexpr (like std::numeric_limits:max()) aren't. Change-Id: Ib306f8f647014b399b87ffff13f1c74093b11af1 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/global/qcompilerdetection.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index c582b1f238..7ef2741746 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -572,6 +572,9 @@ # if _MSC_VER < 1900 // ICC disables unicode string support when compatibility mode with MSVC 2013 or lower is active # undef Q_COMPILER_UNICODE_STRINGS +// Disable constexpr unless the MS headers have constexpr in all the right places too +// (like std::numeric_limits::max()) +# undef Q_COMPILER_CONSTEXPR # endif # endif # endif -- cgit v1.2.3 From cf63c63d558227fdbef09699c261560e7474f5ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= Date: Wed, 15 Jul 2015 15:52:53 +0200 Subject: Fix build with clang 3.7 _Nullable is a language extension in clang 3.7 (indicating whether or not a pointer can be null). http://clang.llvm.org/docs/AttributeReference.html#nullable Using it as a class name breaks building with this compiler. Change-Id: I0c838dac872ca2c00bf57c95df17d24edb48007b Reviewed-by: Thiago Macieira --- src/tools/qlalr/lalr.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/qlalr/lalr.cpp b/src/tools/qlalr/lalr.cpp index 3d0d5de19b..3d780cd618 100644 --- a/src/tools/qlalr/lalr.cpp +++ b/src/tools/qlalr/lalr.cpp @@ -238,11 +238,11 @@ void Grammar::buildExtendedGrammar () non_terminals.insert (accept_symbol); } -struct _Nullable: public std::unary_function +struct Nullable: public std::unary_function { Automaton *_M_automaton; - _Nullable (Automaton *aut): + Nullable (Automaton *aut): _M_automaton (aut) {} bool operator () (Name name) const @@ -300,7 +300,7 @@ void Automaton::buildNullables () for (RulePointer rule = _M_grammar->rules.begin (); rule != _M_grammar->rules.end (); ++rule) { - NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (_Nullable (this))); + NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (Nullable (this))); if (nn == rule->rhs.end ()) changed |= nullables.insert (rule->lhs).second; @@ -635,7 +635,7 @@ void Automaton::buildIncludesDigraph () if (! _M_grammar->isNonTerminal (*A)) continue; - NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (_Nullable (this))); + NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (Nullable (this))); if (first_not_nullable != rule->rhs.end ()) continue; -- cgit v1.2.3 From 826a83937da18616ca5358f66598ad991b7c2cee Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Mon, 6 Jul 2015 10:23:56 +0900 Subject: QtTest: fix build error with -no-gui Change-Id: I6f4297c7f959394ca31dfb228dac8659ea6c854d Reviewed-by: Thiago Macieira --- src/testlib/testlib.pro | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro index 52bcdd097b..79fd342cca 100644 --- a/src/testlib/testlib.pro +++ b/src/testlib/testlib.pro @@ -98,7 +98,14 @@ mac { # Exclude these headers from the clean check if their dependencies aren't # being built -contains(QT_CONFIG, no-widgets): HEADERSCLEAN_EXCLUDE += qtest_widgets.h -contains(QT_CONFIG, no-gui): HEADERSCLEAN_EXCLUDE += qtest_gui.h +!qtHaveModule(gui) { + HEADERSCLEAN_EXCLUDE += qtest_gui.h \ + qtestaccessible.h \ + qtestkeyboard.h \ + qtestmouse.h \ + qtesttouch.h +} + +!qtHaveModule(widgets): HEADERSCLEAN_EXCLUDE += qtest_widgets.h load(qt_module) -- cgit v1.2.3 From 28f5207ca08bed5c16474091a205bc8351574584 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 5 Mar 2015 22:25:45 -0800 Subject: QtCore: Fix const correctness in old style casts Found with GCC's -Wcast-qual. Change-Id: Ia0aac2f09e9245339951ffff13c8d4b2920a11fb Reviewed-by: Thiago Macieira --- src/3rdparty/md5/md5.cpp | 2 +- src/corelib/codecs/qutfcodec.cpp | 12 ++++++------ src/corelib/io/qbuffer.cpp | 2 +- src/corelib/io/qfsfileengine.cpp | 4 ++-- src/corelib/io/qresource.cpp | 6 +++--- src/corelib/kernel/qcoreapplication.cpp | 2 +- src/corelib/kernel/qmetatype.cpp | 3 ++- src/corelib/kernel/qobject.cpp | 2 +- src/corelib/plugin/qlibrary_p.h | 2 +- src/corelib/plugin/quuid.cpp | 2 +- src/corelib/tools/qbytearray.cpp | 8 ++++---- src/corelib/tools/qstring.cpp | 30 +++++++++++++++--------------- 12 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/3rdparty/md5/md5.cpp b/src/3rdparty/md5/md5.cpp index cc69b56213..f9e04a93e3 100644 --- a/src/3rdparty/md5/md5.cpp +++ b/src/3rdparty/md5/md5.cpp @@ -36,7 +36,7 @@ static void byteSwap(UWORD32 *buf, unsigned words) { const quint32 byteOrderTest = 0x1; - if (((char *)&byteOrderTest)[0] == 0) { + if (((const char *)&byteOrderTest)[0] == 0) { md5byte *p = (md5byte *)buf; do { diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp index 64863cdb05..98d4b2e4e3 100644 --- a/src/corelib/codecs/qutfcodec.cpp +++ b/src/corelib/codecs/qutfcodec.cpp @@ -51,8 +51,8 @@ static inline bool simdEncodeAscii(uchar *&dst, const ushort *&nextAscii, const { // do sixteen characters at a time for ( ; end - src >= 16; src += 16, dst += 16) { - __m128i data1 = _mm_loadu_si128((__m128i*)src); - __m128i data2 = _mm_loadu_si128(1+(__m128i*)src); + __m128i data1 = _mm_loadu_si128((const __m128i*)src); + __m128i data2 = _mm_loadu_si128(1+(const __m128i*)src); // check if everything is ASCII @@ -90,7 +90,7 @@ static inline bool simdDecodeAscii(ushort *&dst, const uchar *&nextAscii, const { // do sixteen characters at a time for ( ; end - src >= 16; src += 16, dst += 16) { - __m128i data = _mm_loadu_si128((__m128i*)src); + __m128i data = _mm_loadu_si128((const __m128i*)src); #ifdef __AVX2__ const int BitSpacing = 2; @@ -390,7 +390,7 @@ QString QUtf8::convertToUnicode(const char *chars, int len, QTextCodec::Converte *dst++ = QChar::ReplacementCharacter; } - result.truncate(dst - (ushort *)result.unicode()); + result.truncate(dst - (const ushort *)result.unicode()); if (state) { state->invalidChars += invalid; if (headerdone) @@ -469,7 +469,7 @@ QString QUtf16::convertToUnicode(const char *chars, int len, QTextCodec::Convert endian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? BigEndianness : LittleEndianness; QString result(len, Qt::Uninitialized); // worst case - QChar *qch = (QChar *)result.unicode(); + QChar *qch = (QChar *)result.data(); while (len--) { if (half) { QChar ch; @@ -600,7 +600,7 @@ QString QUtf32::convertToUnicode(const char *chars, int len, QTextCodec::Convert QString result; result.resize((num + len) >> 2 << 1); // worst case - QChar *qch = (QChar *)result.unicode(); + QChar *qch = (QChar *)result.data(); const char *end = chars + len; while (chars < end) { diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp index 680f832909..fd74681663 100644 --- a/src/corelib/io/qbuffer.cpp +++ b/src/corelib/io/qbuffer.cpp @@ -425,7 +425,7 @@ qint64 QBuffer::writeData(const char *data, qint64 len) } } - memcpy(d->buf->data() + pos(), (uchar *)data, int(len)); + memcpy(d->buf->data() + pos(), data, int(len)); #ifndef QT_NO_QOBJECT d->writtenSinceLastEmit += len; diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index ddbd24338b..429c40da1a 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -819,13 +819,13 @@ bool QFSFileEngine::extension(Extension extension, const ExtensionOption *option return feof(d->fh); if (extension == MapExtension) { - const MapExtensionOption *options = (MapExtensionOption*)(option); + const MapExtensionOption *options = (const MapExtensionOption*)(option); MapExtensionReturn *returnValue = static_cast(output); returnValue->address = d->map(options->offset, options->size, options->flags); return (returnValue->address != 0); } if (extension == UnMapExtension) { - UnMapExtensionOption *options = (UnMapExtensionOption*)option; + const UnMapExtensionOption *options = (const UnMapExtensionOption*)option; return d->unmap(options->address); } diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 4b85645a90..6671333ffb 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -956,7 +956,7 @@ public: } else #endif { - delete [] (uchar *)mappingBuffer(); + delete [] mappingBuffer(); } } QString mappingFile() const { return fileName; } @@ -1450,13 +1450,13 @@ bool QResourceFileEngine::extension(Extension extension, const ExtensionOption * { Q_D(QResourceFileEngine); if (extension == MapExtension) { - const MapExtensionOption *options = (MapExtensionOption*)(option); + const MapExtensionOption *options = (const MapExtensionOption*)(option); MapExtensionReturn *returnValue = static_cast(output); returnValue->address = d->map(options->offset, options->size, options->flags); return (returnValue->address != 0); } if (extension == UnMapExtension) { - UnMapExtensionOption *options = (UnMapExtensionOption*)option; + const UnMapExtensionOption *options = (const UnMapExtensionOption*)option; return d->unmap(options->address); } return false; diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 8f58d1b7ad..37a26cf556 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -438,7 +438,7 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint static const char *const empty = ""; if (argc == 0 || argv == 0) { argc = 0; - argv = (char **)∅ + argv = const_cast(&empty); } #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) if (!isArgvModified(argc, argv)) { diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 58912e3fb7..729ca0e0d1 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1840,7 +1840,8 @@ public: void delegate(const T *where) { DestructorImpl::Destruct(m_type, const_cast(where)); } void delegate(const void *) {} void delegate(const QMetaTypeSwitcher::UnknownType*) {} - void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestructor(m_type, (void*)where); } + void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) + { customTypeDestructor(m_type, const_cast(static_cast(where))); } private: static void customTypeDestructor(const int type, void *where) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index cc6970eaeb..d07120e5a8 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4093,7 +4093,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) QDebugStateSaver saver(dbg); if (!o) return dbg << "QObject(0x0)"; - dbg.nospace() << o->metaObject()->className() << '(' << (void *)o; + dbg.nospace() << o->metaObject()->className() << '(' << (const void *)o; if (!o->objectName().isEmpty()) dbg << ", name = " << o->objectName(); dbg << ')'; diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h index 3965176ef7..ada90d7bfd 100644 --- a/src/corelib/plugin/qlibrary_p.h +++ b/src/corelib/plugin/qlibrary_p.h @@ -108,7 +108,7 @@ public: raw += strlen("QTMETADATA "); // the size of the embedded JSON object can be found 8 bytes into the data (see qjson_p.h), // but doesn't include the size of the header (8 bytes) - QByteArray json(raw, qFromLittleEndian(*(uint *)(raw + 8)) + 8); + QByteArray json(raw, qFromLittleEndian(*(const uint *)(raw + 8)) + 8); return QJsonDocument::fromBinaryData(json); } diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index 72f662dc1e..812e2c9fb6 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -543,7 +543,7 @@ QUuid QUuid::fromRfc4122(const QByteArray &bytes) QString QUuid::toString() const { QString result(38, Qt::Uninitialized); - ushort *data = (ushort *)result.unicode(); + ushort *data = (ushort *)result.data(); _q_uuidToHex(data, data1, data2, data3, data4); diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index da5d00311a..4138c8cb18 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -510,7 +510,7 @@ QByteArray qCompress(const uchar* data, int nbytes, int compressionLevel) int res; do { bazip.resize(len + 4); - res = ::compress2((uchar*)bazip.data()+4, &len, (uchar*)data, nbytes, compressionLevel); + res = ::compress2((uchar*)bazip.data()+4, &len, data, nbytes, compressionLevel); switch (res) { case Z_OK: @@ -601,7 +601,7 @@ QByteArray qUncompress(const uchar* data, int nbytes) d->size = 0; // Shut up valgrind "uninitialized variable" warning int res = ::uncompress((uchar*)d->data(), &len, - (uchar*)data+4, nbytes-4); + data+4, nbytes-4); switch (res) { case Z_OK: @@ -2148,9 +2148,9 @@ QByteArray &QByteArray::replace(const char *before, int bsize, const char *after } if (a != after) - ::free((char *)a); + ::free(const_cast(a)); if (b != before) - ::free((char *)b); + ::free(const_cast(b)); return *this; diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index d63982d1f5..b623c62043 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -216,7 +216,7 @@ void qt_from_latin1(ushort *dst, const char *str, size_t size) // we're going to read str[offset..offset+15] (16 bytes) for ( ; str + offset + 15 < e; offset += 16) { - const __m128i chunk = _mm_loadu_si128((__m128i*)(str + offset)); // load + const __m128i chunk = _mm_loadu_si128((const __m128i*)(str + offset)); // load #ifdef __AVX2__ // zero extend to an YMM register const __m256i extended = _mm256_cvtepu8_epi16(chunk); @@ -317,10 +317,10 @@ static void qt_to_latin1(uchar *dst, const ushort *src, int length) // we're going to write to dst[offset..offset+15] (16 bytes) for ( ; dst + offset + 15 < e; offset += 16) { - __m128i chunk1 = _mm_loadu_si128((__m128i*)(src + offset)); // load + __m128i chunk1 = _mm_loadu_si128((const __m128i*)(src + offset)); // load chunk1 = mergeQuestionMarks(chunk1); - __m128i chunk2 = _mm_loadu_si128((__m128i*)(src + offset + 8)); // load + __m128i chunk2 = _mm_loadu_si128((const __m128i*)(src + offset + 8)); // load chunk2 = mergeQuestionMarks(chunk2); // pack the two vector to 16 x 8bits elements @@ -459,8 +459,8 @@ static int ucstrncmp(const QChar *a, const QChar *b, int l) // we're going to read ptr[0..15] (16 bytes) for ( ; ptr + 15 < reinterpret_cast(a); ptr += 16) { - __m128i a_data = _mm_loadu_si128((__m128i*)ptr); - __m128i b_data = _mm_loadu_si128((__m128i*)(ptr + distance)); + __m128i a_data = _mm_loadu_si128((const __m128i*)ptr); + __m128i b_data = _mm_loadu_si128((const __m128i*)(ptr + distance)); __m128i result = _mm_cmpeq_epi16(a_data, b_data); uint mask = ~_mm_movemask_epi8(result); if (ushort(mask)) { @@ -542,14 +542,14 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l) for ( ; uc + offset + 15 < e; offset += 16) { // similar to fromLatin1_helper: // load 16 bytes of Latin 1 data - __m128i chunk = _mm_loadu_si128((__m128i*)(c + offset)); + __m128i chunk = _mm_loadu_si128((const __m128i*)(c + offset)); # ifdef __AVX2__ // expand Latin 1 data via zero extension __m256i ldata = _mm256_cvtepu8_epi16(chunk); // load UTF-16 data and compare - __m256i ucdata = _mm256_loadu_si256((__m256i*)(uc + offset)); + __m256i ucdata = _mm256_loadu_si256((const __m256i*)(uc + offset)); __m256i result = _mm256_cmpeq_epi16(ldata, ucdata); uint mask = ~_mm256_movemask_epi8(result); @@ -559,8 +559,8 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l) __m128i secondHalf = _mm_unpackhi_epi8(chunk, nullmask); // load UTF-16 data and compare - __m128i ucdata1 = _mm_loadu_si128((__m128i*)(uc + offset)); - __m128i ucdata2 = _mm_loadu_si128((__m128i*)(uc + offset + 8)); + __m128i ucdata1 = _mm_loadu_si128((const __m128i*)(uc + offset)); + __m128i ucdata2 = _mm_loadu_si128((const __m128i*)(uc + offset + 8)); __m128i result1 = _mm_cmpeq_epi16(firstHalf, ucdata1); __m128i result2 = _mm_cmpeq_epi16(secondHalf, ucdata2); @@ -578,10 +578,10 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l) // we'll read uc[offset..offset+7] (16 bytes) and c[offset..offset+7] (8 bytes) if (uc + offset + 7 < e) { // same, but we're using an 8-byte load - __m128i chunk = _mm_cvtsi64_si128(*(long long *)(c + offset)); + __m128i chunk = _mm_cvtsi64_si128(*(const long long *)(c + offset)); __m128i secondHalf = _mm_unpacklo_epi8(chunk, nullmask); - __m128i ucdata = _mm_loadu_si128((__m128i*)(uc + offset)); + __m128i ucdata = _mm_loadu_si128((const __m128i*)(uc + offset)); __m128i result = _mm_cmpeq_epi16(secondHalf, ucdata); uint mask = ~_mm_movemask_epi8(result); if (ushort(mask)) { @@ -673,7 +673,7 @@ static int findChar(const QChar *str, int len, QChar ch, int from, // we're going to read n[0..7] (16 bytes) for (const ushort *next = n + 8; next <= e; n = next, next += 8) { - __m128i data = _mm_loadu_si128((__m128i*)n); + __m128i data = _mm_loadu_si128((const __m128i*)n); __m128i result = _mm_cmpeq_epi16(data, mch); uint mask = _mm_movemask_epi8(result); if (ushort(mask)) { @@ -2622,7 +2622,7 @@ bool operator<(const QString &s1, const QString &s2) */ bool QString::operator<(QLatin1String other) const { - const uchar *c = (uchar *) other.latin1(); + const uchar *c = (const uchar *) other.latin1(); if (!c || *c == 0) return false; @@ -2727,7 +2727,7 @@ bool QString::operator<(QLatin1String other) const */ bool QString::operator>(QLatin1String other) const { - const uchar *c = (uchar *) other.latin1(); + const uchar *c = (const uchar *) other.latin1(); if (!c || *c == '\0') return !isEmpty(); @@ -5270,7 +5270,7 @@ int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2, { const ushort *uc = reinterpret_cast(data1); const ushort *uce = uc + length1; - const uchar *c = (uchar *)s2.latin1(); + const uchar *c = (const uchar *)s2.latin1(); if (!c) return length1; -- cgit v1.2.3 From baff532de01c2e7df9b43bd21cb463fd9056b446 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 17 Jul 2015 22:19:38 -0700 Subject: Fix Q_BASIC_ATOMIC_INITIALIZER for std::atomic We can't have too many braces: one pair is just enough because we're actually calling the QBasicAtomicInt's constructor. That is, we're using the uniform initialization procedure. Required for Clang 3.7: qmetatype.h:1772:46: error: braces around scalar initializer [-Werror,-Wbraced-scalar-init] static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qatomic_cxx11.h:331:43: note: expanded from macro 'Q_BASIC_ATOMIC_INITIALIZER' #define Q_BASIC_ATOMIC_INITIALIZER(a) { {a} } ^~~ Change-Id: Ib306f8f647014b399b87ffff13f1f2db1fabe393 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/arch/qatomic_cxx11.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/arch/qatomic_cxx11.h b/src/corelib/arch/qatomic_cxx11.h index 09e900f4ea..0e06ca951a 100644 --- a/src/corelib/arch/qatomic_cxx11.h +++ b/src/corelib/arch/qatomic_cxx11.h @@ -328,10 +328,10 @@ template struct QAtomicOps } }; -#ifdef ATOMIC_VAR_INIT -# define Q_BASIC_ATOMIC_INITIALIZER(a) { ATOMIC_VAR_INIT(a) } +#if defined(Q_COMPILER_CONSTEXPR) && defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS) +# define Q_BASIC_ATOMIC_INITIALIZER(a) { a } #else -# define Q_BASIC_ATOMIC_INITIALIZER(a) { {a} } +# define Q_BASIC_ATOMIC_INITIALIZER(a) { ATOMIC_VAR_INIT(a) } #endif QT_END_NAMESPACE -- cgit v1.2.3 From 6392927152c7ca66502bf8e0d3651e86a3151c54 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 17 Jul 2015 14:57:28 -0700 Subject: Remove attempt at detecting compile-time HLE There's no __HLE__ macro and there won't be, since the HLE prefix can be run on older CPUs. There's no need for runtime detection. Change-Id: Ib306f8f647014b399b87ffff13f1daba0e654b02 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qsimd.cpp | 3 +-- src/corelib/tools/qsimd_p.h | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 4973da9cb1..d12143b11c 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -499,8 +499,7 @@ static const int features_indices[] = { static const int features_count = (sizeof features_indices - 1) / (sizeof features_indices[0]); // record what CPU features were enabled by default in this Qt build -// don't define for HLE, since the HLE prefix can be run on older CPUs -static const uint minFeature = qCompilerCpuFeatures & ~HLE; +static const uint minFeature = qCompilerCpuFeatures; #ifdef Q_OS_WIN #if defined(Q_CC_GNU) diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 1f5e743b7f..dd93b4fd26 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -265,9 +265,6 @@ static const uint qCompilerCpuFeatures = 0 #if defined __RTM__ | RTM #endif -#if defined __HLE__ - | HLE -#endif #if defined __AVX2__ | AVX2 #endif -- cgit v1.2.3 From 4f15449bc2584ad299569c86f707994dca76d733 Mon Sep 17 00:00:00 2001 From: Jian Liang Date: Tue, 7 Jul 2015 22:23:33 +0800 Subject: Windows: register alias for application font Previously Qt didn't register an English name alias for application font files under Windows. Suppose we add an application font file using QFontDatabase::addApplicationFont(), the font family name returned by QFontDatabase::applicationFontFamilies() then was the English name of the font file, but the corresponding font family name returned by QFontDatabase::families() was the localized version. This prevented us from using the English font family to access the font since it was not registered as alias. Add an overload of populateFamily() which will register the English name of the application font file as alias. Task-number: QTBUG-47096 Change-Id: Idb89b7d8a419646c209426e826e7fd1ebee49662 Reviewed-by: Friedemann Kleint Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 15 ++++++++++----- src/plugins/platforms/windows/qwindowsfontdatabase.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 1c5b114efd..b1bb944fc6 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -933,7 +933,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, } static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, - int type, LPARAM) + int type, LPARAM registerAlias) { const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName); const uchar charSet = f->elfLogFont.lfCharSet; @@ -943,13 +943,13 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr // NEWTEXTMETRICEX is a NEWTEXTMETRIC, which according to the documentation is // identical to a TEXTMETRIC except for the last four members, which we don't use // anyway - addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type, false); + addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type, registerAlias); // keep on enumerating return 1; } -void QWindowsFontDatabase::populateFamily(const QString &familyName) +void QWindowsFontDatabase::populateFamily(const QString &familyName, bool registerAlias) { qCDebug(lcQpaFonts) << familyName; if (familyName.size() >= LF_FACESIZE) { @@ -962,10 +962,15 @@ void QWindowsFontDatabase::populateFamily(const QString &familyName) familyName.toWCharArray(lf.lfFaceName); lf.lfFaceName[familyName.size()] = 0; lf.lfPitchAndFamily = 0; - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, 0, 0); + EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, (LPARAM)registerAlias, 0); ReleaseDC(0, dummy); } +void QWindowsFontDatabase::populateFamily(const QString &familyName) +{ + populateFamily(familyName, false); +} + namespace { // Context for enumerating system fonts, records whether the default font has been encountered, // which is normally not enumerated by EnumFontFamiliesEx(). @@ -1382,7 +1387,7 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData, // Fonts based on files are added via populate, as they will show up in font enumeration. for (int j = 0; j < families.count(); ++j) - populateFamily(families.at(j)); + populateFamily(families.at(j), true); } m_applicationFonts << font; diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h index 3615612c78..efb5421996 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.h +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h @@ -100,6 +100,7 @@ public: static QString familyForStyleHint(QFont::StyleHint styleHint); private: + void populateFamily(const QString &familyName, bool registerAlias); void removeApplicationFonts(); struct WinApplicationFont { -- cgit v1.2.3 From f3e1dfb786c8c425562a29bd2ca18dbeb1d4ea84 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 20 Jul 2015 16:30:35 +0200 Subject: Windows: Fix handling of cursor flash time. Check for special return value INFINITE (unsigned -1) of GetCaretBlinkTime() (indicating cursor should not flash) and return 0 in that case. Change-Id: Iead41a20a68b79d04b03f77a3caf063d4e1d577e Task-number: QTBUG-47208 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 9b0f126241..79df6ce720 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -491,7 +491,7 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co switch (hint) { case QPlatformIntegration::CursorFlashTime: if (const unsigned timeMS = GetCaretBlinkTime()) - return QVariant(int(timeMS) * 2); + return QVariant(timeMS != INFINITE ? int(timeMS) * 2 : 0); break; #ifdef SPI_GETKEYBOARDSPEED case KeyboardAutoRepeatRate: -- cgit v1.2.3 From b922e59cf7e6e7b5962932e3128da553aba0b6ab Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Thu, 16 Jul 2015 22:28:13 +0200 Subject: qglobal: Clarify that Q_OS_WINRT also implies Q_OS_WIN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes the docs match the code from qsystemdetection.h. Change-Id: Iec75e24d13e21f1800777bac5fa98b47b47e6001 Reviewed-by: Oswald Buddenhagen Reviewed-by: Topi Reiniö Reviewed-by: Friedemann Kleint --- src/corelib/global/qglobal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 0c3d309277..e77a9eef31 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1199,7 +1199,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \relates Defined on all supported versions of Windows. That is, if - \l Q_OS_WIN32, \l Q_OS_WIN64 or \l Q_OS_WINCE is defined. + \l Q_OS_WIN32, \l Q_OS_WIN64, \l Q_OS_WINCE or \l Q_OS_WINRT is defined. */ /*! -- cgit v1.2.3 From 0e9b51ebac1c9ba70d703c5729def6e2aab764f9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 14 Jul 2015 10:15:35 +0200 Subject: tst_qmimedatabase.cpp: Set write permission on files extracted from resources. Set QFileDevice::WriteUser on all files extracted from resources. These are read-only, which is preserved by QFile::copy(). This caused the deletion of the temporary directory to fail on Windows. Change-Id: Id99de9160471c38bcec68025c89cfabbe209bdbe Reviewed-by: Oswald Buddenhagen Reviewed-by: David Faure --- .../mimetypes/qmimedatabase/tst_qmimedatabase.cpp | 46 ++++++++++++++++++---- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index a0edf29607..1c9add86f7 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -72,6 +72,34 @@ static inline QString testSuiteWarning() return result; } +static bool copyResourceFile(const QString &sourceFileName, const QString &targetFileName, + QString *errorMessage) +{ + + QFile sourceFile(sourceFileName); + if (!sourceFile.exists()) { + *errorMessage = QDir::toNativeSeparators(sourceFileName) + QLatin1String(" does not exist."); + return false; + } + if (!sourceFile.copy(targetFileName)) { + *errorMessage = QLatin1String("Cannot copy ") + + QDir::toNativeSeparators(sourceFileName) + QLatin1String(" to ") + + QDir::toNativeSeparators(targetFileName) + QLatin1String(": ") + + sourceFile.errorString(); + return false; + } + // QFile::copy() sets the permissions of the source file which are read-only for + // resource files. Set write permission to enable deletion of the temporary directory. + QFile targetFile(targetFileName); + if (!targetFile.setPermissions(targetFile.permissions() | QFileDevice::WriteUser)) { + *errorMessage = QLatin1String("Cannot set write permission on ") + + QDir::toNativeSeparators(targetFileName) + QLatin1String(": ") + + targetFile.errorString(); + return false; + } + return true; +} + // Set LANG before QCoreApplication is created Q_CONSTRUCTOR_FUNCTION(initializeLang) @@ -101,15 +129,15 @@ void tst_QMimeDatabase::initTestCase() const QString freeDesktopXml = QStringLiteral("freedesktop.org.xml"); const QString xmlFileName = QLatin1String(RESOURCE_PREFIX) + freeDesktopXml; - QVERIFY2(QFileInfo(xmlFileName).exists(), qPrintable(xmlFileName + QStringLiteral(" does not exist"))); - QFile xml(xmlFileName); - QVERIFY(xml.copy(globalPackageDir + '/' + freeDesktopXml)); + const QString xmlTargetFileName = globalPackageDir + QLatin1Char('/') + freeDesktopXml; + QString errorMessage; + QVERIFY2(copyResourceFile(xmlFileName, xmlTargetFileName, &errorMessage), qPrintable(errorMessage)); m_testSuite = QFINDTESTDATA("testfiles"); if (m_testSuite.isEmpty()) qWarning("%s", qPrintable(testSuiteWarning())); - const QString errorMessage = QString::fromLatin1("Cannot find '%1'"); + errorMessage = QString::fromLatin1("Cannot find '%1'"); m_yastMimeTypes = QLatin1String(RESOURCE_PREFIX) + yastFileName; QVERIFY2(QFile::exists(m_yastMimeTypes), qPrintable(errorMessage.arg(yastFileName))); m_qmlAgainFileName = QLatin1String(RESOURCE_PREFIX) + qmlAgainFileName; @@ -830,8 +858,9 @@ void tst_QMimeDatabase::installNewGlobalMimeType() if (!QFileInfo(destDir).isDir()) QVERIFY(QDir(m_globalXdgDir).mkpath(destDir)); - QVERIFY(QFile::copy(m_yastMimeTypes, destFile)); - QVERIFY(QFile::copy(m_qmlAgainFileName, destQmlFile)); + QString errorMessage; + QVERIFY2(copyResourceFile(m_yastMimeTypes, destFile, &errorMessage), qPrintable(errorMessage)); + QVERIFY2(copyResourceFile(m_qmlAgainFileName, destQmlFile, &errorMessage), qPrintable(errorMessage)); if (!waitAndRunUpdateMimeDatabase(mimeDir)) QSKIP("shared-mime-info not found, skipping mime.cache test"); @@ -876,8 +905,9 @@ void tst_QMimeDatabase::installNewLocalMimeType() QFile::remove(destFile); const QString destQmlFile = destDir + QLatin1String(qmlAgainFileName); QFile::remove(destQmlFile); - QVERIFY(QFile::copy(m_yastMimeTypes, destFile)); - QVERIFY(QFile::copy(m_qmlAgainFileName, destQmlFile)); + QString errorMessage; + QVERIFY2(copyResourceFile(m_yastMimeTypes, destFile, &errorMessage), qPrintable(errorMessage)); + QVERIFY2(copyResourceFile(m_qmlAgainFileName, destQmlFile, &errorMessage), qPrintable(errorMessage)); if (!runUpdateMimeDatabase(mimeDir)) { const QString skipWarning = QStringLiteral("shared-mime-info not found, skipping mime.cache test (") + QDir::toNativeSeparators(mimeDir) + QLatin1Char(')'); -- cgit v1.2.3 From 328199d52daa446d18dad3ea0da98d65b5cc5a3f Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Fri, 17 Jul 2015 15:35:07 +0200 Subject: Protect against a null widget pointer. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a crash when using the style for painting without a corresponding widget. Change-Id: I0742e4559ed7a78270dab3a1b0162c9617343053 Reviewed-by: André Klitzing Reviewed-by: Friedemann Kleint --- src/widgets/styles/qstylesheetstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index ae7accf7d0..ce10b92d85 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -4142,7 +4142,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op switch (pe) { case PE_FrameStatusBar: { - QRenderRule subRule = renderRule(w->parentWidget(), opt, PseudoElement_Item); + QRenderRule subRule = renderRule(w ? w->parentWidget() : Q_NULLPTR, opt, PseudoElement_Item); if (subRule.hasDrawable()) { subRule.drawRule(p, opt->rect); return; -- cgit v1.2.3 From e81b955b41e7c7f21160cfd4faa6de8b99d78fe1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 19 Jul 2015 16:08:42 -0700 Subject: Doc: update the Q_OS_MAC documentation to be less misleading The "open source" version it's talking about is that of Darwin, not of Qt. Change-Id: Ib306f8f647014b399b87ffff13f27bc651d78707 Reviewed-by: Martin Smith Reviewed-by: Dirk Hohndel --- src/corelib/global/qglobal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index e77a9eef31..2c57999ed0 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1177,7 +1177,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \relates Defined on Darwin-based operating systems distributed by Apple, which - currently includes OS X and iOS, but not the open source version. + currently includes OS X and iOS, but not the open source versions of Darwin. */ /*! -- cgit v1.2.3 From 9072edb5f7f2b9f634fac5b5de7090e94ee491f7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Jul 2015 16:23:51 -0700 Subject: Use jom instead of nmake to compile configure.exe Change-Id: Ib463f09c2031e41515a7e3b1f9d1961712915413 Reviewed-by: Oswald Buddenhagen --- configure.bat | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/configure.bat b/configure.bat index 8c0819aeb5..1220bfedc2 100644 --- a/configure.bat +++ b/configure.bat @@ -37,7 +37,7 @@ set QTDIR=%CD% if not exist %QTSRC%.gitignore goto sconf echo Please wait while bootstrapping configure ... -for %%C in (cl.exe icl.exe g++.exe perl.exe) do set %%C=%%~$PATH:C +for %%C in (cl.exe icl.exe g++.exe perl.exe jom.exe) do set %%C=%%~$PATH:C if "%perl.exe%" == "" ( echo Perl not found in PATH. Aborting. >&2 @@ -57,6 +57,9 @@ if not exist tools\configure ( cd tools\configure if errorlevel 1 goto exit +set make=nmake +if not "%jom.exe%" == "" set make=jom + echo #### Generated by configure.bat - DO NOT EDIT! ####> Makefile echo/>> Makefile for /f "tokens=3 usebackq" %%V in (`findstr QT_VERSION_STR %QTSRC%src\corelib\global\qglobal.h`) do @echo QTVERSION = %%~V>> Makefile @@ -66,14 +69,12 @@ if not "%icl.exe%" == "" ( rem This must have a trailing space. echo QTSRC = %QTSRC% >> Makefile set tmpl=win32 - set make=nmake ) else if not "%cl.exe%" == "" ( echo CXX = cl>>Makefile echo EXTRA_CXXFLAGS =>>Makefile rem This must have a trailing space. echo QTSRC = %QTSRC% >> Makefile set tmpl=win32 - set make=nmake ) else if not "%g++.exe%" == "" ( echo CXX = g++>>Makefile echo EXTRA_CXXFLAGS =>>Makefile -- cgit v1.2.3 From 5c67ce5d6da11b8c4e445bba2a3ffb7b6e7f45d9 Mon Sep 17 00:00:00 2001 From: Cesar Garcia Naranjo Date: Mon, 6 Jul 2015 13:23:10 +0000 Subject: QTimeZone: Convert fractional timezones properly. [ChangeLog][QtCore][QTimeZone] Fixed a wrong timezone conversion when the POSIX timezone rule contains a fractional timezone (e.g. VET4:30). Task-number: QTBUG-47037 Change-Id: I5d9052929bbcde174614ccf07c329264603e6431 Reviewed-by: Thiago Macieira --- src/corelib/tools/qtimezoneprivate_tz.cpp | 19 +++++++++++++------ tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp index 29f0e17012..35380b882a 100644 --- a/src/corelib/tools/qtimezoneprivate_tz.cpp +++ b/src/corelib/tools/qtimezoneprivate_tz.cpp @@ -389,12 +389,19 @@ static int parsePosixOffset(const QByteArray &timeRule) // Format "[+|-]hh[:mm[:ss]]" QList parts = timeRule.split(':'); int count = parts.count(); - if (count == 3) - return (parts.at(0).toInt() * -60 * 60) + (parts.at(1).toInt() * 60) + parts.at(2).toInt(); - else if (count == 2) - return (parts.at(0).toInt() * -60 * 60) + (parts.at(1).toInt() * 60); - else if (count == 1) - return (parts.at(0).toInt() * -60 * 60); + if (count == 3) { + int hour = parts.at(0).toInt(); + int sign = hour >= 0 ? -1 : 1; + return sign * ((qAbs(hour) * 60 * 60) + (parts.at(1).toInt() * 60) + parts.at(2).toInt()); + } else if (count == 2) { + int hour = parts.at(0).toInt(); + int sign = hour >= 0 ? -1 : 1; + return sign * ((qAbs(hour) * 60 * 60) + (parts.at(1).toInt() * 60)); + } else if (count == 1) { + int hour = parts.at(0).toInt(); + int sign = hour >= 0 ? -1 : 1; + return sign * (qAbs(hour) * 60 * 60); + } return 0; } diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp index 2af37eb86e..b511abf670 100644 --- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp @@ -823,6 +823,24 @@ void tst_QTimeZone::tzTest() QCOMPARE(dat.offsetFromUtc, 3600); QCOMPARE(dat.standardTimeOffset, 3600); QCOMPARE(dat.daylightTimeOffset, 0); + + // Test TZ timezone vs UTC timezone for fractionary negative offset + QTzTimeZonePrivate tztz1("America/Caracas"); + QUtcTimeZonePrivate tzutc1("UTC-04:30"); + QVERIFY(tztz1.isValid()); + QVERIFY(tzutc1.isValid()); + QTzTimeZonePrivate::Data datatz1 = tztz1.data(std); + QTzTimeZonePrivate::Data datautc1 = tzutc1.data(std); + QCOMPARE(datatz1.offsetFromUtc, datautc1.offsetFromUtc); + + // Test TZ timezone vs UTC timezone for fractionary positive offset + QTzTimeZonePrivate tztz2("Asia/Calcutta"); + QUtcTimeZonePrivate tzutc2("UTC+05:30"); + QVERIFY(tztz2.isValid()); + QVERIFY(tzutc2.isValid()); + QTzTimeZonePrivate::Data datatz2 = tztz2.data(std); + QTzTimeZonePrivate::Data datautc2 = tzutc2.data(std); + QCOMPARE(datatz2.offsetFromUtc, datautc2.offsetFromUtc); #endif // Q_OS_UNIX } -- cgit v1.2.3 From 99e0fbbe1fb82163fd7bcd6b3d4895c97009854d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 7 Jul 2015 17:35:11 -0700 Subject: Add the GPLv3 license text LGPLv3 refers to it but does not include it in its body. Change-Id: Ib056b47dde3341ef9a52ffff13eed18cf3504738 Reviewed-by: Lars Knoll --- LICENSE.GPLv3 | 686 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE.LGPLv3 | 4 +- 2 files changed, 689 insertions(+), 1 deletion(-) create mode 100644 LICENSE.GPLv3 diff --git a/LICENSE.GPLv3 b/LICENSE.GPLv3 new file mode 100644 index 0000000000..afa69d94b9 --- /dev/null +++ b/LICENSE.GPLv3 @@ -0,0 +1,686 @@ + GNU GENERAL PUBLIC LICENSE + + The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ + + You may use, distribute and copy the Qt GUI Toolkit under the terms of + GNU Lesser General Public License version 3. That license references + the General Public License version 3, that is displayed below. Other + portions of the Qt Toolkit may be licensed directly other this license. + +------------------------------------------------------------------------- + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/LICENSE.LGPLv3 b/LICENSE.LGPLv3 index 8fbb74390c..2a0988d97b 100644 --- a/LICENSE.LGPLv3 +++ b/LICENSE.LGPLv3 @@ -4,7 +4,9 @@ Contact: http://www.qt.io/licensing/ You may use, distribute and copy the Qt GUI Toolkit under the terms of - GNU Lesser General Public License version 3, which is displayed below. + GNU Lesser General Public License version 3, which is displayed + below. This license makes reference to the version 3 of the GNU General + Public License, which you can find in the LICENSE.GPLv3 file. ------------------------------------------------------------------------- -- cgit v1.2.3 From b0b08cc0e4e38504d6b833702f7477aee4e2a192 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 5 Jul 2015 12:15:29 +0200 Subject: When a screen comes back online, the windows need to be told about it On my system, this fixes the misbehavior of Qt applications when the (only) active screen is switched, e.g. from an external screen to the laptop. This behavior is caused by the screen() of widgets to be set to NULL when their screen goes away. When a new screen comes online, the widgets *should* be told about it, but they are not. The only place that "maybeSetScreen" is called is when an existing screen changes its geometry, but not when a screen gets enabled without its geometry being affected in any way (e.g. because it was just disabled via xrandr, but has been connected all along). This makes sure that "maybeSetScreen" is also called when a screen gets enabled. Task-number: QTBUG-47041 Change-Id: Ic72d6beaa544bf9a4efdbea0830b1bc0d6ce5362 Reviewed-by: Dmitry Shachnev Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 74f48b0136..08676152dc 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -252,6 +252,14 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event) otherScreen->addVirtualSibling(screen); m_screens << screen; QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary()); + + // Windows which had null screens have already had expose events by now. + // They need to be told the screen is back, it's OK to render. + foreach (QWindow *window, QGuiApplication::topLevelWindows()) { + QXcbWindow *xcbWin = static_cast(window->handle()); + if (xcbWin) + xcbWin->maybeSetScreen(screen); + } } // else ignore disabled screens } else if (screen) { -- cgit v1.2.3 From ae51e360f986698eaf41fdb38f8a878a50f69be1 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Fri, 19 Jun 2015 13:34:11 +0300 Subject: xcb: Ignore disabling of outputs in the middle of the mode switch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X server may send RROutputChangeNotify event with null crtc and mode, when it switches an output mode. Request RROutputInfo to distinguish this case from the case when the output is explicitly disabled. Change-Id: I4c2356ec71dbcc8013009ea8a6f46dd11f19d6bb Task-number: QTBUG-44158 Task-number: QTBUG-46786 Task-number: QTBUG-46822 Reviewed-by: Daniel Vrátil Reviewed-by: Gatis Paeglis Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 08676152dc..29e1fd145d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -265,11 +265,19 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event) } else if (screen) { // Screen has been disabled -> remove if (output.crtc == XCB_NONE && output.mode == XCB_NONE) { - qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled"; - m_screens.removeOne(screen); - foreach (QXcbScreen *otherScreen, m_screens) - otherScreen->removeVirtualSibling((QPlatformScreen *) screen); - QXcbIntegration::instance()->destroyScreen(screen); + xcb_randr_get_output_info_cookie_t outputInfoCookie = + xcb_randr_get_output_info(xcb_connection(), output.output, output.config_timestamp); + QScopedPointer outputInfo( + xcb_randr_get_output_info_reply(xcb_connection(), outputInfoCookie, NULL)); + if (outputInfo->crtc == XCB_NONE) { + qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled"; + m_screens.removeOne(screen); + foreach (QXcbScreen *otherScreen, m_screens) + otherScreen->removeVirtualSibling((QPlatformScreen *) screen); + QXcbIntegration::instance()->destroyScreen(screen); + } else { + qCDebug(lcQpaScreen) << "output" << screen->name() << "has been temporarily disabled for the mode switch"; + } } else { // Just update existing screen screen->updateGeometry(output.config_timestamp); -- cgit v1.2.3 From 9499cf33b7284d1a2626fecc1abde75e1dc52c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Tue, 21 Jul 2015 19:14:57 +0200 Subject: Replace old C-style cast User gets compiler warnings for plugins if "-Wold-style-cast" is enabled Change-Id: I142ae2676ca7690c8e8e10c73a4007e85d8f448d Reviewed-by: Thiago Macieira --- src/corelib/plugin/qplugin.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h index 4b5cafaa06..efab6523ac 100644 --- a/src/corelib/plugin/qplugin.h +++ b/src/corelib/plugin/qplugin.h @@ -112,7 +112,7 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin); # define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \ static QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGINCLASSNAME() \ Q_PLUGIN_INSTANCE(PLUGINCLASS) \ - static const char *qt_plugin_query_metadata_##PLUGINCLASSNAME() { return (const char *)qt_pluginMetaData; } \ + static const char *qt_plugin_query_metadata_##PLUGINCLASSNAME() { return reinterpret_cast(qt_pluginMetaData); } \ const QT_PREPEND_NAMESPACE(QStaticPlugin) qt_static_plugin_##PLUGINCLASSNAME() { \ QT_PREPEND_NAMESPACE(QStaticPlugin) plugin = { qt_plugin_instance_##PLUGINCLASSNAME, qt_plugin_query_metadata_##PLUGINCLASSNAME}; \ return plugin; \ @@ -123,7 +123,7 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin); # define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \ Q_EXTERN_C Q_DECL_EXPORT \ const char *qt_plugin_query_metadata() \ - { return (const char *)qt_pluginMetaData; } \ + { return reinterpret_cast(qt_pluginMetaData); } \ Q_EXTERN_C Q_DECL_EXPORT QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance() \ Q_PLUGIN_INSTANCE(PLUGINCLASS) -- cgit v1.2.3 From e6ddae07e1e571a7a6e0c531b961dbddcd217643 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 19 May 2015 15:03:12 +0200 Subject: Doc:added doc to undocumented functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-36985 Change-Id: Ic358682b276d67ef804f727bcf14191718613469 Reviewed-by: Topi Reiniö --- src/corelib/codecs/qtextcodec.cpp | 9 -- src/corelib/itemmodels/qitemselectionmodel.cpp | 8 +- src/corelib/kernel/qmetaobject.cpp | 23 ++++ src/corelib/kernel/qmetatype.cpp | 13 +- src/corelib/kernel/qobject.cpp | 7 ++ src/corelib/tools/qcollator.cpp | 2 +- src/corelib/tools/qpair.qdoc | 5 +- src/corelib/tools/qset.qdoc | 3 +- src/corelib/xml/qxmlstream.cpp | 6 + src/dbus/qdbusunixfiledescriptor.cpp | 2 +- src/gui/accessible/qaccessible.cpp | 131 +++++++++++++++++++-- src/gui/image/qicon.cpp | 7 ++ src/gui/image/qimage.cpp | 4 + src/gui/image/qpixmapcache.cpp | 14 +++ src/gui/kernel/qevent.cpp | 56 +++++++++ src/gui/math3d/qgenericmatrix.cpp | 6 - src/gui/opengl/qopengldebug.cpp | 6 + src/gui/opengl/qopenglversionfunctions.cpp | 10 ++ src/gui/painting/qbackingstore.cpp | 14 +++ src/gui/painting/qpaintengine_raster.cpp | 4 + src/gui/text/qfontmetrics.cpp | 5 + src/gui/text/qtextdocument.cpp | 3 +- src/opengl/qgl.cpp | 8 +- .../xcbfunctions/qxcbwindowfunctions.qdoc | 1 + src/printsupport/kernel/qprinter.cpp | 10 +- src/widgets/kernel/qwidget.cpp | 49 ++++++++ src/widgets/widgets/qmacnativewidget_mac.mm | 5 + 27 files changed, 375 insertions(+), 36 deletions(-) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 8fef333a77..c6d5c7388d 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -1153,17 +1153,8 @@ QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba) Returns the codec used by QObject::tr() on its argument. If this function returns 0 (the default), tr() assumes Latin-1. - - \sa setCodecForTr() */ -/*! - \fn QTextCodec::setCodecForTr ( QTextCodec * c ) - \obsolete - - Sets the codec used by QObject::tr() on its argument to c. If c - is 0 (the default), tr() assumes Latin-1. -*/ /*! \internal diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index 47fcab9b24..de28953fb5 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -1736,13 +1736,19 @@ const QItemSelection QItemSelectionModel::selection() const \property QItemSelectionModel::selectedIndexes */ + /*! \since 5.5 - \property QItemSelectionModel::model + \property QItemSelectionModel::selection \internal */ +/*! + \since 5.5 + \property QItemSelectionModel::model + \internal +*/ /*! \since 5.5 diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index fc161e6f89..6858209b12 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1533,6 +1533,29 @@ bool QMetaObject::invokeMethod(QObject *obj, ignores return values. */ +/*! + \fn QMetaObject::Connection::Connection(const Connection &other) + + Constructs a copy of \a other. +*/ + +/*! + \fn QMetaObject::Connection::Connection &operator=(const Connection &other) + + Assigns \a other to this connection and returns a reference to this connection. +*/ + +/*! + \fn QMetaObject::Connection &QMetaObject::Connection::operator=(Connection &&other) + + Move-assigns \a other to this object. +*/ +/*! + \fn QMetaObject::Connection::Connection(Connection &&o) + + Move-constructs a Connection instance, making it point to the same object that \a o was pointing to. +*/ + /*! \class QMetaMethod \inmodule QtCore diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 729ca0e0d1..7fadb66319 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -420,6 +420,16 @@ struct DefinedTypesFilter { \sa QMetaType::create() */ +/*! + \fn void *QMetaType::construct(int type, const void *copy) + \deprecated + + Constructs a value of the given type which is a copy of \a copy. + The default value for \a copy is 0. + + Deprecated, use the static function QMetaType::create(int type, + const void *copy) instead. +*/ /*! \fn void *QMetaType::construct(void *where, const void *copy = 0) const \since 5.0 @@ -1179,10 +1189,7 @@ bool QMetaType::isRegistered(int type) } /*! - \fn int qMetaTypeTypeImpl(const char *typeName, int length) \internal - - Implementation of QMetaType::type(). */ template static inline int qMetaTypeTypeImpl(const char *typeName, int length) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index d07120e5a8..6bc4d7e7ed 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4898,8 +4898,15 @@ QMetaObject::Connection& QMetaObject::Connection::operator=(const QMetaObject::C return *this; } +/*! + Creates a Connection instance. +*/ + QMetaObject::Connection::Connection() : d_ptr(0) {} +/*! + Destructor for QMetaObject::Connection. +*/ QMetaObject::Connection::~Connection() { if (d_ptr) diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp index 615b7a4e3e..59f8f66869 100644 --- a/src/corelib/tools/qcollator.cpp +++ b/src/corelib/tools/qcollator.cpp @@ -87,7 +87,7 @@ QCollator::QCollator(const QCollator &other) } /*! - Destructor for QCollator. + Destroys the collator. */ QCollator::~QCollator() { diff --git a/src/corelib/tools/qpair.qdoc b/src/corelib/tools/qpair.qdoc index 2a421a1bbf..7cba7480f0 100644 --- a/src/corelib/tools/qpair.qdoc +++ b/src/corelib/tools/qpair.qdoc @@ -109,7 +109,7 @@ \endcode Swap overloads are found in namespace \c std as well as via - argument-dependent lookup (ADL) in \c{T}'s namespace. + argument-dependent lookup (ADL) in the namespace of \c{T} . */ /*! @@ -136,8 +136,7 @@ \fn QPair::QPair(QPair &&p) \since 5.2 - Move-constructs a QPair instance, making it point to the same object that - \a p was pointing to. + Move-constructs a QPair instance, making it point to the same object that \a p was pointing to. */ /*! diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc index c38fe858fb..072e65af0e 100644 --- a/src/corelib/tools/qset.qdoc +++ b/src/corelib/tools/qset.qdoc @@ -129,7 +129,8 @@ /*! \fn QSet::QSet(QSet && other) - Move-constructs a QSet instance, making it point to the same object that \a other was pointing to. + Move-constructs a QSet instance, making it point to the same object that + \a other was pointing to. */ diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index bbd751efd0..13c84db9ae 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -2395,6 +2395,12 @@ QXmlStreamAttribute& QXmlStreamAttribute::operator=(const QXmlStreamAttribute &o \ingroup xml-tools */ +/*! + \fn QXmlStreamAttributes::QXmlStreamAttributes() + + A constructor for QXmlStreamAttributes. +*/ + /*! \typedef QXmlStreamNotationDeclarations \relates QXmlStreamNotationDeclaration diff --git a/src/dbus/qdbusunixfiledescriptor.cpp b/src/dbus/qdbusunixfiledescriptor.cpp index 77f48c03a4..6b167458b9 100644 --- a/src/dbus/qdbusunixfiledescriptor.cpp +++ b/src/dbus/qdbusunixfiledescriptor.cpp @@ -174,7 +174,7 @@ QDBusUnixFileDescriptor &QDBusUnixFileDescriptor::operator=(const QDBusUnixFileD } /*! - \fn QDBusUnixFileDescriptor &operator=(QDBusUnixFileDescriptor &&other) + \fn QDBusUnixFileDescriptor &QDBusUnixFileDescriptor::operator=(QDBusUnixFileDescriptor &&other) Move-assigns \a other to this QDBusUnixFileDescriptor. */ diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index fce92b9511..e0ebcd18ce 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -1381,10 +1381,18 @@ QAccessible::Id QAccessibleEvent::uniqueId() const */ /*! \fn QAccessibleValueChangeEvent::QAccessibleValueChangeEvent(QObject *object, const QVariant &value) + Constructs a new QAccessibleValueChangeEvent for \a object. The event contains the new \a value. */ +/*! \fn QAccessibleValueChangeEvent::QAccessibleValueChangeEvent(QAccessibleInterface *iface, const QVariant &val) + + Constructs a new QAccessibleValueChangeEvent for \a iface. + The event contains the new value \a val. +*/ + /*! \fn void QAccessibleValueChangeEvent::setValue(const QVariant & value) + Sets the new \a value for this event. */ /*! @@ -1406,11 +1414,13 @@ QAccessible::Id QAccessibleEvent::uniqueId() const \sa QAccessibleInterface::state() */ /*! \fn QAccessibleStateChangeEvent::QAccessibleStateChangeEvent(QObject *object, QAccessible::State state) + Constructs a new QAccessibleStateChangeEvent for \a object. The difference to the object's previous state is in \a state. */ /*! \fn QAccessibleStateChangeEvent::QAccessibleStateChangeEvent(QAccessibleInterface *iface, QAccessible::State state) + Constructs a new QAccessibleStateChangeEvent. \a iface is the interface associated with the event \a state is the state of the accessible object. @@ -1419,8 +1429,8 @@ QAccessible::Id QAccessibleEvent::uniqueId() const \fn QAccessible::State QAccessibleStateChangeEvent::changedStates() const \brief Returns the states that have been changed. - Be aware that the returned states are the ones that have changed, - to find out about the state of an object, use QAccessibleInterface::state(). + Keep in mind that the returned states are the ones that have changed. + To find out about the state of an object, use QAccessibleInterface::state(). For example, if an object used to have the focus but loses it, the object's state will have focused set to \c false. This event on the @@ -1443,7 +1453,7 @@ QAccessible::Id QAccessibleEvent::uniqueId() const */ /*! \enum QAccessibleTableModelChangeEvent::ModelChangeType - This enum describes different types of changes in the table model. + This enum describes the different types of changes in the table model. \value ModelReset The model has been reset, all previous knowledge about the model is now invalid. \value DataChanged No cells have been added or removed, but the data of the specified cell range is invalid. \value RowsInserted New rows have been inserted. @@ -1452,42 +1462,57 @@ QAccessible::Id QAccessibleEvent::uniqueId() const \value ColumnsRemoved Columns have been removed. */ /*! \fn QAccessibleTableModelChangeEvent::QAccessibleTableModelChangeEvent(QObject *object, ModelChangeType changeType) + Constructs a new QAccessibleTableModelChangeEvent for \a object of with \a changeType. */ /*! \fn int QAccessibleTableModelChangeEvent::firstColumn() const + Returns the first changed column. */ /*! \fn int QAccessibleTableModelChangeEvent::firstRow() const + Returns the first changed row. */ /*! \fn int QAccessibleTableModelChangeEvent::lastColumn() const + Returns the last changed column. */ /*! \fn int QAccessibleTableModelChangeEvent::lastRow() const + Returns the last changed row. */ /*! \fn QAccessibleTableModelChangeEvent::ModelChangeType QAccessibleTableModelChangeEvent::modelChangeType() const + Returns the type of change. */ /*! \fn void QAccessibleTableModelChangeEvent::setFirstColumn(int column) + Sets the first changed \a column. */ /*! \fn void QAccessibleTableModelChangeEvent::setFirstRow(int row) + Sets the first changed \a row. */ /*! \fn void QAccessibleTableModelChangeEvent::setLastColumn(int column) + Sets the last changed \a column. */ /*! \fn void QAccessibleTableModelChangeEvent::setLastRow(int row) + Sets the last changed \a row. */ /*! \fn void QAccessibleTableModelChangeEvent::setModelChangeType(ModelChangeType changeType) + Sets the type of change to \a changeType. */ +/*! + \fn QAccessibleTableModelChangeEvent::QAccessibleTableModelChangeEvent(QAccessibleInterface *iface, ModelChangeType changeType) - + Constructs a new QAccessibleTableModelChangeEvent for interface \a iface with a model + change type \a changeType. +*/ /*! - \class QAccessibleTextCursorEvent + \class QAccessibleTextCursorEvent \ingroup accessibility \inmodule QtGui @@ -1495,17 +1520,27 @@ QAccessible::Id QAccessibleEvent::uniqueId() const This class is used with \l QAccessible::updateAccessibility(). */ -/*! \fn QAccessibleTextCursorEvent::QAccessibleTextCursorEvent(QObject *object, int cursorPosition) +/*! \fn QAccessibleTextCursorEvent::QAccessibleTextCursorEvent(QObject *object, int cursorPos) + Create a new QAccessibleTextCursorEvent for \a object. - The \a cursorPosition is the new cursor position. + The \a cursorPos is the new cursor position. */ /*! \fn int QAccessibleTextCursorEvent::cursorPosition() const + Returns the cursor position. */ /*! \fn void QAccessibleTextCursorEvent::setCursorPosition(int position) + Sets the cursor \a position for this event. */ +/*! + \fn QAccessibleTextCursorEvent(QAccessibleInterface *iface, int cursorPos) + + Create a new QAccessibleTextCursorEvent for \a iface, + The \a cursorPos is the new cursor position. +*/ + /*! \class QAccessibleTextInsertEvent \ingroup accessibility @@ -1516,6 +1551,7 @@ QAccessible::Id QAccessibleEvent::uniqueId() const This class is used with \l QAccessible::updateAccessibility(). */ /*! \fn QAccessibleTextInsertEvent::QAccessibleTextInsertEvent(QObject *object, int position, const QString &text) + Constructs a new QAccessibleTextInsertEvent event for \a object. The \a text has been inserted at \a position. By default, it is assumed that the cursor has moved to the end @@ -1523,9 +1559,11 @@ QAccessible::Id QAccessibleEvent::uniqueId() const set it with \l QAccessibleTextCursorEvent::setCursorPosition() for this event. */ /*! \fn int QAccessibleTextInsertEvent::changePosition() const + Returns the position where the text was inserted. */ /*! \fn QString QAccessibleTextInsertEvent::textInserted() const + Returns the text that has been inserted. */ @@ -1539,19 +1577,54 @@ QAccessible::Id QAccessibleEvent::uniqueId() const This class is used with \l QAccessible::updateAccessibility(). */ /*! \fn QAccessibleTextRemoveEvent::QAccessibleTextRemoveEvent(QObject *object, int position, const QString &text) + Constructs a new QAccessibleTextRemoveEvent event for \a object. The \a text has been removed at \a position. By default it is assumed that the cursor has moved to \a position. If that is not the case, one needs to manually set it with \l QAccessibleTextCursorEvent::setCursorPosition() for this event. */ +/*! \fn QAccessibleTextRemoveEvent::QAccessibleTextRemoveEvent(QAccessibleInterface *iface, int position, const QString &text) + + Constructs a new QAccessibleTextRemoveEvent event for \a iface. + The \a text has been removed at \a position. + By default it is assumed that the cursor has moved to \a position. + If that is not the case, one needs to manually + set it with \l QAccessibleTextCursorEvent::setCursorPosition() for this event. +*/ /*! \fn int QAccessibleTextRemoveEvent::changePosition() const + Returns the position where the text was removed. */ /*! \fn QString QAccessibleTextRemoveEvent::textRemoved() const + Returns the text that has been removed. */ +/*! + \fn QAccessibleTextSelectionEvent::QAccessibleTextSelectionEvent(QAccessibleInterface *iface, int start, int end) + + Constructs a new QAccessibleTextSelectionEvent for \a iface. The new selection this + event notifies about is from position \a start to \a end. +*/ + +/*! + \fn QAccessibleTextInsertEvent::QAccessibleTextInsertEvent(QAccessibleInterface *iface, int position, const QString &text) + + Constructs a new QAccessibleTextInsertEvent event for \a iface. The text has been inserted at + \a position. +*/ + +/*! + \fn inline QAccessibleTextUpdateEvent::QAccessibleTextUpdateEvent(QAccessibleInterface *iface, int position, const QString &oldText, + const QString &text) + + Constructs a new QAccessibleTextUpdateEvent for \a iface. The text change takes place at + \a position where the \a oldText was removed and \a text inserted instead. + +*/ + + /*! \class QAccessibleTextUpdateEvent @@ -1566,16 +1639,20 @@ QAccessible::Id QAccessibleEvent::uniqueId() const This class is used with \l QAccessible::updateAccessibility(). */ /*! \fn QAccessibleTextUpdateEvent::QAccessibleTextUpdateEvent(QObject *object, int position, const QString &oldText, const QString &text) + Constructs a new QAccessibleTextUpdateEvent for \a object. The text change takes place at \a position where the \a oldText was removed and \a text inserted instead. */ /*! \fn int QAccessibleTextUpdateEvent::changePosition() const + Returns where the change took place. */ /*! \fn QString QAccessibleTextUpdateEvent::textInserted() const + Returns the inserted text. */ /*! \fn QString QAccessibleTextUpdateEvent::textRemoved() const + Returns the removed text. */ @@ -1589,16 +1666,20 @@ QAccessible::Id QAccessibleEvent::uniqueId() const This class is used with \l QAccessible::updateAccessibility(). */ /*! \fn QAccessibleTextSelectionEvent::QAccessibleTextSelectionEvent(QObject *object, int start, int end) + Constructs a new QAccessibleTextSelectionEvent for \a object. The new selection this event notifies about is from position \a start to \a end. */ /*! \fn int QAccessibleTextSelectionEvent::selectionEnd() const + Returns the position of the last selected character. */ /*! \fn int QAccessibleTextSelectionEvent::selectionStart() const + Returns the position of the first selected character. */ /*! \fn void QAccessibleTextSelectionEvent::setSelection(int start, int end) + Sets the selection for this event from position \a start to \a end. */ @@ -1840,11 +1921,13 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev) /*! \fn QAccessibleTextInterface::~QAccessibleTextInterface() + Destroys the QAccessibleTextInterface. */ /*! \fn void QAccessibleTextInterface::addSelection(int startOffset, int endOffset) + Select the text from \a startOffset to \a endOffset. The \a startOffset is the first character that will be selected. The \a endOffset is the first character that will not be selected. @@ -1857,6 +1940,7 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev) /*! \fn QString QAccessibleTextInterface::attributes(int offset, int *startOffset, int *endOffset) const + Returns the text attributes at the position \a offset. In addition the range of the attributes is returned in \a startOffset and \a endOffset. */ @@ -1869,6 +1953,7 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev) /*! \fn QRect QAccessibleTextInterface::characterRect(int offset) const + Returns the position and size of the character at position \a offset in screen coordinates. */ @@ -2222,6 +2307,7 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun /*! \fn QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface() + Destroys the QAccessibleEditableTextInterface. */ @@ -2263,6 +2349,7 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun /*! \fn QAccessibleValueInterface::~QAccessibleValueInterface() + Destructor. */ @@ -2335,46 +2422,55 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun /*! \fn virtual QAccessibleTableCellInterface::~QAccessibleTableCellInterface() + Destroys the QAccessibleTableCellInterface. */ /*! \fn virtual int QAccessibleTableCellInterface::columnExtent() const + Returns the number of columns occupied by this cell accessible. */ /*! \fn virtual QList QAccessibleTableCellInterface::columnHeaderCells() const + Returns the column headers as an array of cell accessibles. */ /*! \fn virtual int QAccessibleTableCellInterface::columnIndex() const + Translates this cell accessible into the corresponding column index. */ /*! \fn virtual int QAccessibleTableCellInterface::rowExtent() const + Returns the number of rows occupied by this cell accessible. */ /*! \fn virtual QList QAccessibleTableCellInterface::rowHeaderCells() const + Returns the row headers as an array of cell accessibles. */ /*! \fn virtual int QAccessibleTableCellInterface::rowIndex() const + Translates this cell accessible into the corresponding row index. */ /*! \fn virtual bool QAccessibleTableCellInterface::isSelected() const + Returns a boolean value indicating whether this cell is selected. */ /*! \fn virtual QAccessibleInterface *QAccessibleTableCellInterface::table() const + Returns the QAccessibleInterface of the table containing this cell. */ @@ -2391,105 +2487,125 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun /*! \fn virtual QAccessibleTableInterface::~QAccessibleTableInterface() + Destroys the QAccessibleTableInterface. */ /*! \fn virtual QAccessibleInterface *QAccessibleTableInterface::cellAt(int row, int column) const + Returns the cell at the specified \a row and \a column in the table. */ /*! \fn virtual QAccessibleInterface *QAccessibleTableInterface::caption() const + Returns the caption for the table. */ /*! \fn virtual QString QAccessibleTableInterface::columnDescription(int column) const + Returns the description text of the specified \a column in the table. */ /*! \fn virtual int QAccessibleTableInterface::columnCount() const + Returns the total number of columns in table. */ /*! \fn virtual int QAccessibleTableInterface::rowCount() const + Returns the total number of rows in table. */ /*! \fn virtual int QAccessibleTableInterface::selectedCellCount() const + Returns the total number of selected cells. */ /*! \fn virtual int QAccessibleTableInterface::selectedColumnCount() const + Returns the total number of selected columns. */ /*! \fn virtual int QAccessibleTableInterface::selectedRowCount() const + Returns the total number of selected rows. */ /*! \fn virtual QString QAccessibleTableInterface::rowDescription(int row) const + Returns the description text of the specified \a row in the table. */ /*! \fn virtual QList QAccessibleTableInterface::selectedCells() const + Returns the list of selected cell (by their index as \l QAccessibleInterface::child() accepts). */ /*! \fn virtual QList QAccessibleTableInterface::selectedColumns() const + Returns the list of currently selected columns. */ /*! \fn virtual QList QAccessibleTableInterface::selectedRows() const + Returns the list of currently selected columns. */ /*! \fn virtual QAccessibleInterface *QAccessibleTableInterface::summary() const + Returns a QAccessibleInterface that represents a summary of the table. This function may return 0 if no such interface exists. */ /*! \fn virtual bool QAccessibleTableInterface::isColumnSelected(int column) const + Returns a boolean value indicating whether the specified \a column is completely selected. */ /*! \fn virtual bool QAccessibleTableInterface::isRowSelected(int row) const + Returns a boolean value indicating whether the specified \a row is completely selected. */ /*! \fn virtual bool QAccessibleTableInterface::selectRow(int row) + Selects \a row. This function might unselect all previously selected rows. Returns \c true if the selection was successful. */ /*! \fn virtual bool QAccessibleTableInterface::selectColumn(int column) + Selects \a column. This function might unselect all previously selected columns. Returns \c true if the selection was successful. */ /*! \fn virtual bool QAccessibleTableInterface::unselectRow(int row) + Unselects \a row, leaving other selected rows selected (if any). Returns \c true if the selection was successful. */ /*! \fn virtual bool QAccessibleTableInterface::unselectColumn(int column) + Unselects \a column, leaving other selected columns selected (if any). Returns \c true if the selection was successful. */ @@ -2544,6 +2660,7 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun /*! \fn QAccessibleActionInterface::~QAccessibleActionInterface() + Destroys the QAccessibleActionInterface. */ diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index cafc966fbb..66bb77795e 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -630,6 +630,13 @@ QIcon::QIcon(const QIcon &other) d->ref.ref(); } +/*! + \fn QIcon::QIcon(QIcon &&other) + + Move-constructs a QIcon instance, making it point to the same object + that \a other was pointing to. +*/ + /*! Constructs an icon from the file with the given \a fileName. The file will be loaded on demand. diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index cd0cbf7f49..f0b3e89033 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4256,6 +4256,10 @@ int QImage::bitPlaneCount() const return bpc; } +/*! + Returns a smoothly scaled copy of the image. The returned image has a size + of width \a w by height \a h pixels. +*/ QImage QImage::smoothScaled(int w, int h) const { QImage src = *this; switch (src.format()) { diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index f9c362e194..3836976975 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -660,5 +660,19 @@ QList< QPair > QPixmapCache::allPixmaps() { return pm_cache()->allPixmaps(); } +/*! + \fn QPixmapCache::KeyData::KeyData() + + \internal +*/ +/*! + \fn QPixmapCache::KeyData::KeyData(const KeyData &other) + \internal +*/ +/*! + \fn QPixmapCache::KeyData::~KeyData() + + \internal +*/ QT_END_NAMESPACE diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 98fb0f1f20..c231c47576 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -82,6 +82,52 @@ QEnterEvent::~QEnterEvent() { } +/*! + \fn QPoint QEnterEvent::globalPos() const + + Returns the global position of the widget \e{at the time of the event}. +*/ +/*! + \fn int QEnterEvent::globalX() const + + Returns the global position on the X-axis of the mouse cursor relative to the the widget. +*/ +/*! + \fn int QEnterEvent::globalY() const + + Returns the global position on the Y-axis of the mouse cursor relative to the the widget. +*/ +/*! + \fn QPoint QEnterEvent::localPos() const + + Returns the mouse cursor's position relative to the receiving widget. +*/ +/*! + \fn QPoint QEnterEvent::pos() const + + Returns the position of the mouse cursor in global screen coordinates. +*/ +/*! + \fn QPoint QEnterEvent::screenPos() const + + Returns the position of the mouse cursor relative to the receiving screen. +*/ +/*! + \fn QPoint QEnterEvent::windowPos() const + + Returns the position of the mouse cursor relative to the receiving window. +*/ +/*! + \fn int QEnterEvent::x() const + + Returns the x position of the mouse cursor relative to the receiving widget. +*/ +/*! + \fn int QEnterEvent::y() const + + Returns the y position of the mouse cursor relative to the receiving widget. +*/ + /*! \class QInputEvent \ingroup events @@ -4161,6 +4207,12 @@ QTouchEvent::~QTouchEvent() \sa QTouchDevice::type(), QTouchEvent::device() */ +/*! \fn QTouchEvent::TouchPoint::TouchPoint(TouchPoint &&other) + + Move-constructs a TouchPoint instance, making it point to the same + object that \a other was pointing to. +*/ + /*! \fn Qt::TouchPointStates QTouchEvent::touchPointStates() const Returns a bitwise OR of all the touch point states for this event. @@ -4687,6 +4739,10 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags) \internal */ +/*! + \fn TouchPoint &TouchPoint::operator=(TouchPoint &&other) + \internal + */ /*! \fn void QTouchEvent::TouchPoint::swap(TouchPoint &other); \internal diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp index 7b46bb452c..2c9dfd8bb5 100644 --- a/src/gui/math3d/qgenericmatrix.cpp +++ b/src/gui/math3d/qgenericmatrix.cpp @@ -68,12 +68,6 @@ QT_BEGIN_NAMESPACE Constructs a NxM matrix without initializing the contents. */ -/*! - \fn QGenericMatrix::QGenericMatrix(const QGenericMatrix& other) - - Constructs a copy of \a other. -*/ - /*! \fn QGenericMatrix::QGenericMatrix(const T *values) diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp index e747372df9..8b2ffb1a20 100644 --- a/src/gui/opengl/qopengldebug.cpp +++ b/src/gui/opengl/qopengldebug.cpp @@ -915,6 +915,12 @@ QOpenGLDebugMessage &QOpenGLDebugMessage::operator=(const QOpenGLDebugMessage &d return *this; } +/*! + \fn QOpenGLDebugMessage &QOpenGLDebugMessage::operator=(QOpenGLDebugMessage &&debugMessage) + + Move-assigns \a debugMessage to this object. +*/ + /*! \fn void QOpenGLDebugMessage::swap(QOpenGLDebugMessage &debugMessage) diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp index 346a526054..17cd55720a 100644 --- a/src/gui/opengl/qopenglversionfunctions.cpp +++ b/src/gui/opengl/qopenglversionfunctions.cpp @@ -186,11 +186,17 @@ void QAbstractOpenGLFunctionsPrivate::removeExternalFunctions(QOpenGLContext *co \sa QOpenGLContext::versionFunctions() */ +/*! + Constructs a QAbstractOpenGLFunctions object. +*/ QAbstractOpenGLFunctions::QAbstractOpenGLFunctions() : d_ptr(new QAbstractOpenGLFunctionsPrivate) { } +/*! + Destroys a QAbstractOpenGLFunctions object. +*/ QAbstractOpenGLFunctions::~QAbstractOpenGLFunctions() { Q_D(QAbstractOpenGLFunctions); @@ -228,12 +234,16 @@ bool QAbstractOpenGLFunctions::isInitialized() const return d->initialized; } +/*! \internal + */ void QAbstractOpenGLFunctions::setOwningContext(const QOpenGLContext *context) { Q_D(QAbstractOpenGLFunctions); d->owningContext = const_cast(context); } +/*! \internal + */ QOpenGLContext *QAbstractOpenGLFunctions::owningContext() const { Q_D(const QAbstractOpenGLFunctions); diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 19074e4c47..f2fee99b99 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -197,16 +197,27 @@ bool QBackingStore::scroll(const QRegion &area, int dx, int dy) return d_ptr->platformBackingStore->scroll(area, dx, dy); } +/*! + Set \a region as the static contents of this window. +*/ void QBackingStore::setStaticContents(const QRegion ®ion) { d_ptr->staticContents = region; } +/*! + Returns a pointer to the QRegion that has the static contents + of this window. +*/ QRegion QBackingStore::staticContents() const { return d_ptr->staticContents; } +/*! + Returns a boolean indicating if this window + has static contents or not. +*/ bool QBackingStore::hasStaticContents() const { return !d_ptr->staticContents.isEmpty(); @@ -259,6 +270,9 @@ void Q_GUI_EXPORT qt_scrollRectInImage(QImage &img, const QRect &rect, const QPo } } +/*! + Returns a pointer to the QPlatformBackingStore implementation +*/ QPlatformBackingStore *QBackingStore::handle() const { return d_ptr->platformBackingStore; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 18522cb6d0..aabf4a9427 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3281,6 +3281,10 @@ bool QRasterPaintEngine::requiresPretransformedGlyphPositions(QFontEngine *fontE return QPaintEngineEx::requiresPretransformedGlyphPositions(fontEngine, m); } +/*! + Indicates whether glyph caching is supported by the font engine + \a fontEngine with the given transform \a m applied. +*/ bool QRasterPaintEngine::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const { // The raster engine does not support projected cached glyph drawing diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index e351d4d2c5..5bc9fe3c7f 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -208,6 +208,11 @@ QFontMetrics &QFontMetrics::operator=(const QFontMetrics &fm) \since 5.2 */ +/*! + \fn QFontMetricsF &QFontMetricsF::operator=(QFontMetricsF &&other) + + Move-assigns \a other to this QFontMetricsF instance. +*/ /*! \fn void QFontMetrics::swap(QFontMetrics &other) diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index d3b70aaf26..29e00d481e 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -135,9 +135,8 @@ bool Qt::mightBeRichText(const QString& text) return false; } -/*! - \fn QString Qt::convertFromPlainText(const QString &plain, WhiteSpaceMode mode) +/*! Converts the plain text string \a plain to an HTML-formatted paragraph while preserving most of its look. diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 0cb4ccd416..eae9a4c228 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2168,6 +2168,9 @@ QGLContext::QGLContext(QOpenGLContext *context) d->setupSharing(); } +/*! + Returns the OpenGL context handle. +*/ QOpenGLContext *QGLContext::contextHandle() const { Q_D(const QGLContext); @@ -2175,7 +2178,7 @@ QOpenGLContext *QGLContext::contextHandle() const } /*! - Returns a OpenGL context for the window context specified by the \a context + Returns an OpenGL context for the window context specified by the \a context parameter. */ QGLContext *QGLContext::fromOpenGLContext(QOpenGLContext *context) @@ -4354,6 +4357,9 @@ void QGLWidget::resizeOverlayGL(int, int) { } +/*! + Handles the event \a e passed as a parameter. +*/ bool QGLWidget::event(QEvent *e) { Q_D(QGLWidget); diff --git a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc index 414d0795fc..ab6ef9089f 100644 --- a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc +++ b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc @@ -81,3 +81,4 @@ This is a convenience function that can be used directly instead of resolving the function pointer. \a window and \a type will be relayed to the function retrieved by QGuiApplication */ + diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index a9dfcc8f09..e9009aa2f7 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -1092,11 +1092,19 @@ void QPrinter::setCreator(const QString &creator) To obtain the current page margins use pageLayout().pageMargins(). - Returns true if the page margins was successfully set to \a margins. + Returns \c true if the page margins was successfully set to \a margins. \sa pageLayout(), setPageLayout() */ +/*! + \fn bool QPrinter::setPageMargins(const QMarginsF &margins) + + Set the page margins to \a margins using the current units. + Returns \c true if the page margins were set successfully. + + \sa pageLayout(), setPageLayout() +*/ /*! \fn QPageLayout QPrinter::pageLayout() const \since 5.3 diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index b40d2fef5d..dbb229484b 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -12658,11 +12658,21 @@ void QWidget::initPainter(QPainter *painter) const painter->d_func()->state->font = f; } +/*! + \internal + + Do PaintDevice rendering with the specified \a offset. +*/ QPaintDevice *QWidget::redirected(QPoint *offset) const { return d_func()->redirected(offset); } +/*! + \internal + + A painter that is shared among other instances of QPainter. +*/ QPainter *QWidget::sharedPainter() const { // Someone sent a paint event directly to the widget @@ -12805,6 +12815,45 @@ void QWidgetPrivate::setWidgetParentHelper(QObject *widgetAsObject, QObject *new widget->setParent(static_cast(newParent)); } +/*! \fn Qt::HANDLE QWidget::macCGHandle() const + \internal + + Returns the CoreGraphics handle of the widget. Use of this function is not portable. + This function will return 0 if no painter context can be established, or if the handle + could not be created. + + \warning This function is only available on OS X. +*/ +/*! \fn Qt::HANDLE QWidget::macQDHandle() const + \internal + + Returns the QuickDraw handle of the widget. Use of this function is not portable. + This function will return 0 if QuickDraw is not supported, or if the handle could + not be created. + + \warning This function is only available on OS X. +*/ +/*! \fn const QX11Info &QWidget::x11Info() const + \internal + + Returns information about the configuration of the X display used to display + the widget. + + \warning This function is only available on X11. +*/ + +/*! \fn Qt::HANDLE QWidget::x11PictureHandle() const + \internal + + Returns the X11 picture handle of the widget for XRender + support. Use of this function is not portable. This function will + return 0 if XRender support is not compiled into Qt, if the + XRender extension is not supported on the X11 display, or if the + handle could not be created. + + \warning This function is only available on X11. + +*/ QT_END_NAMESPACE #include "moc_qwidget.cpp" diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm index 7a7492e717..46a43c4110 100644 --- a/src/widgets/widgets/qmacnativewidget_mac.mm +++ b/src/widgets/widgets/qmacnativewidget_mac.mm @@ -142,6 +142,11 @@ QSize QMacNativeWidget::sizeHint() const return QWidget::sizeHint(); } +/*! \fn NSView *QMacNativeWidget::nativeView() const + + Returns the native view backing the QMacNativeWidget. + +*/ NSView *QMacNativeWidget::nativeView() const { winId(); -- cgit v1.2.3 From f9eb2534de4633409246f1be8e154947d840de82 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 22 Jul 2015 10:52:10 +0200 Subject: Doc: Add Q_MV_IOS to ignored C++ directives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enumeration QSysInfo::MacVersion uses a macro to define enumeration values. QDoc gets confused about it and prints a lot of warnings. Adding the macro to ignored directives does not resolve the documentation issue completely (enum values still show up as '?'), but it gets rid of the warnings. Task-number: QTBUG-43810 Change-Id: Ie4009646a78c62b5f1860d29855d3941e79d9388 Reviewed-by: Topi Reiniö --- doc/global/qt-cpp-defines.qdocconf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/global/qt-cpp-defines.qdocconf b/doc/global/qt-cpp-defines.qdocconf index 3491e00402..7cc9e0f317 100644 --- a/doc/global/qt-cpp-defines.qdocconf +++ b/doc/global/qt-cpp-defines.qdocconf @@ -152,4 +152,5 @@ Cpp.ignoredirectives += \ QT_WARNING_DISABLE_CLANG \ QT_WARNING_DISABLE_GCC \ QT_WARNING_DISABLE_INTEL \ - QT_WARNING_DISABLE_MSVC + QT_WARNING_DISABLE_MSVC \ + Q_MV_IOS -- cgit v1.2.3 From a0e2e715f58134c7c913996e036b154df1f71d99 Mon Sep 17 00:00:00 2001 From: Ron Bessems Date: Wed, 8 Jul 2015 10:14:10 -0400 Subject: Fixed null pointer dereference Crash in qtwidgets.dll when Qt app is used with accessibility tools like Dragon. Crash due to null pointer dereference. Task-number: QTBUG-47093 Change-Id: I140196ba44b68dfaf229dd8a8e6031379ea1acac Reviewed-by: Frederik Gladhorn --- .../platforms/windows/accessible/qwindowsmsaaaccessible.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp index 8b67f235bb..2189938248 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp @@ -689,7 +689,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChild(VARIANT varChildI return E_INVALIDARG; QAccessibleInterface *acc = childPointer(accessible, varChildID); - if (acc) { + if (acc && acc->isValid()) { *ppdispChild = QWindowsAccessibility::wrap(acc); return S_OK; } @@ -778,7 +778,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accDescription(VARIANT var QString descr; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; descr = child->text(QAccessible::Description); } else { @@ -803,7 +803,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accHelp(VARIANT varID, BST QString help; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; help = child->text(QAccessible::Help); } else { @@ -862,7 +862,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accName(VARIANT varID, BST QString name; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; name = child->text(QAccessible::Name); if (name.isEmpty()) { @@ -910,7 +910,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accRole(VARIANT varID, VAR QAccessible::Role role; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; role = child->role(); } else { @@ -947,7 +947,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accState(VARIANT varID, VA QAccessible::State state; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; state = child->state(); } else { -- cgit v1.2.3 From 7089c98383e5e22ca1fbae9a4fff34b312810749 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 22 Jul 2015 08:39:29 +0200 Subject: QPdfEnginePrivate - fix for '-qreal float' build. Literals 1. or 0. have type double, but QGradientStop.first is qreal and thus can be float depending on platform/configuration, making qBound call invalid (qBound(0., qreal_value, 1.) for example). Change-Id: Idab668d417a148bffe2495009ae700de980b73cc Task-number: QTBUG-47319 Reviewed-by: Lars Knoll --- src/gui/painting/qpdf.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 6ea0800538..54e656e339 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1979,8 +1979,8 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from if (reflect && step % 2) { for (int i = stops.size() - 1; i > 0; --i) { QGradientBound b; - b.start = step + 1 - qBound(0., stops.at(i).first, 1.); - b.stop = step + 1 - qBound(0., stops.at(i - 1).first, 1.); + b.start = step + 1 - qBound(qreal(0.), stops.at(i).first, qreal(1.)); + b.stop = step + 1 - qBound(qreal(0.), stops.at(i - 1).first, qreal(1.)); b.function = functions.at(i - 1); b.reverse = true; gradientBounds << b; @@ -1988,8 +1988,8 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from } else { for (int i = 0; i < stops.size() - 1; ++i) { QGradientBound b; - b.start = step + qBound(0., stops.at(i).first, 1.); - b.stop = step + qBound(0., stops.at(i + 1).first, 1.); + b.start = step + qBound(qreal(0.), stops.at(i).first, qreal(1.)); + b.stop = step + qBound(qreal(0.), stops.at(i + 1).first, qreal(1.)); b.function = functions.at(i); b.reverse = false; gradientBounds << b; -- cgit v1.2.3 From 50f064f788c6a570ab01909f06a7fe629aa4a621 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 21 Jul 2015 18:09:38 +0200 Subject: fix -no-opengl build Change-Id: Id3570cf10d86908ddff35be65103d16b353dad04 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsnativeinterface.cpp | 4 +++- src/plugins/platforms/windows/qwindowswindow.cpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp index 6e58c55bbe..db8b2ec094 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp @@ -135,7 +135,9 @@ QVariantMap QWindowsNativeInterface::windowProperties(QPlatformWindow *window) c void *QWindowsNativeInterface::nativeResourceForIntegration(const QByteArray &resource) { -#ifndef QT_NO_OPENGL +#ifdef QT_NO_OPENGL + Q_UNUSED(resource) +#else if (resourceType(resource) == GlHandleType) return QWindowsIntegration::staticOpenGLContext()->moduleHandle(); #endif diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 543c08135f..853cf036a7 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2271,6 +2271,7 @@ void QWindowsWindow::setCustomMargins(const QMargins &newCustomMargins) void *QWindowsWindow::surface(void *nativeConfig, int *err) { #ifdef QT_NO_OPENGL + Q_UNUSED(err) Q_UNUSED(nativeConfig) return 0; #else -- cgit v1.2.3 From bfe4bca4986c033347d880e9bd3375f81093172b Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Fri, 17 Jul 2015 12:40:30 +0200 Subject: Doc: Amended the \inmodule statement for QSessionManager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sources for QSessionManager live under Qt Gui so it doesn't make sense to include the class under the Qt Widgets doc module. Task-number: QTBUG-47274 Change-Id: I18b58c2a274bff323c7364cebbb0429a5a3a97d6 Reviewed-by: Topi Reiniö --- src/gui/kernel/qsessionmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp index b54b7b468c..f4b56fd01b 100644 --- a/src/gui/kernel/qsessionmanager.cpp +++ b/src/gui/kernel/qsessionmanager.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \class QSessionManager \brief The QSessionManager class provides access to the session manager. - \inmodule QtWidgets + \inmodule QtGui A session manager in a desktop environment (in which Qt GUI applications live) keeps track of a session, which is a group of running applications, -- cgit v1.2.3 From a09b41bc9fc2bc6c837057f303fd82b19c6f5413 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 22 Jul 2015 13:14:29 +0200 Subject: Fix action shortcuts for QToolButton Reverting change 4db5d3ccd17d448b59db491e2f261892f31fec74, since it introduced two separate regressions: 1. QToolButton would prefer text() over iconText() 2. Actions with a mnemonic would create a shortcut when added to a tool button. There is a fundamental problem here, which is impossible to solve correctly: A menu item with the text "Short&cut" will create a mnemonic, i.e. it will be triggered by pressing 'c' when the menu is open. However, a button with the text "Short&cut" will create a shortcut that is triggered by Alt+C as long as the window has focus. Also, iconText() is used for tool tips, so it should not contain shortcut related '&'s. This patch attempts to find a sensible compromise: 1. If the text is set through QAction::setText(), QToolButton will not create a shortcut, and will not display an underline. 2. Using QAction::setIconText("Short&cut") will create the shortcut. 3. Tooltips will not show any extra '&'s when generated from text(), but when using setIconText() directly, any '&' characters used to create shortcuts will also be visible in the tooltip. Task-number: QTBUG-23396 Task-number: QTBUG-47306 Change-Id: Ieea2fc569807c862ca462349bf91922a4029700f Reviewed-by: Timur Pocheptsov --- src/widgets/kernel/qaction.cpp | 11 +++-------- src/widgets/widgets/qtoolbutton.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 9fbcf28aad..4dd10720d6 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -58,14 +58,9 @@ QT_BEGIN_NAMESPACE static QString qt_strippedText(QString s) { s.remove( QString::fromLatin1("...") ); - int i = 0; - while (i < s.size()) { - ++i; - if (s.at(i-1) != QLatin1Char('&')) - continue; - if (i < s.size() && s.at(i) == QLatin1Char('&')) - ++i; - s.remove(i-1,1); + for (int i = 0; i < s.size(); ++i) { + if (s.at(i) == QLatin1Char('&')) + s.remove(i, 1); } return s.trimmed(); } diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 93f0b60058..69432761e6 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -897,7 +897,12 @@ void QToolButton::setDefaultAction(QAction *action) return; if (!actions().contains(action)) addAction(action); - setText(action->text()); + QString buttonText = action->iconText(); + // If iconText() is generated from text(), we need to escape any '&'s so they + // don't turn into shortcuts + if (QActionPrivate::get(action)->iconText.isEmpty()) + buttonText.replace(QLatin1String("&"), QLatin1String("&&")); + setText(buttonText); setIcon(action->icon()); #ifndef QT_NO_TOOLTIP setToolTip(action->toolTip()); -- cgit v1.2.3 From 3627d8b171379e4f0d3b52d33fcce4767282f1d9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 23 Jul 2015 11:02:41 +0200 Subject: Windows/QClipboard: Fix crash in debug output of QMimeData. Rewrite QDebug operator<<(QDebug d, const QMimeData &mimeData) to take a pointer and handle 0 values. Change the formatting to the style commonly used in Qt. Make it static as it is not used anywhere else. Task-number: QTBUG-47393 Change-Id: I78174e10b75769bf4acd33a894acc0a51e525c39 Reviewed-by: Joerg Bornemann --- .../platforms/windows/qwindowsclipboard.cpp | 37 ++++++++++++---------- .../platforms/windows/qwindowsinternalmimedata.h | 2 -- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp index 4cea845c36..925427ac30 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.cpp +++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp @@ -69,25 +69,28 @@ static const char formatTextHtmlC[] = "text/html"; \ingroup qt-lighthouse-win */ -QDebug operator<<(QDebug d, const QMimeData &m) +static QDebug operator<<(QDebug d, const QMimeData *mimeData) { QDebugStateSaver saver(d); d.nospace(); - const QStringList formats = m.formats(); - d << "QMimeData: " << formats.join(QStringLiteral(", ")) << '\n' - << " Text=" << m.hasText() << " HTML=" << m.hasHtml() - << " Color=" << m.hasColor() << " Image=" << m.hasImage() - << " URLs=" << m.hasUrls() << '\n'; - if (m.hasText()) - d << " Text: '" << m.text() << "'\n"; - if (m.hasHtml()) - d << " HTML: '" << m.html() << "'\n"; - if (m.hasColor()) - d << " Color: " << qvariant_cast(m.colorData()) << '\n'; - if (m.hasImage()) - d << " Image: " << qvariant_cast(m.imageData()).size() << '\n'; - if (m.hasUrls()) - d << " URLs: " << m.urls() << '\n'; + d << "QMimeData("; + if (mimeData) { + const QStringList formats = mimeData->formats(); + d << "formats=" << formats.join(QStringLiteral(", ")); + if (mimeData->hasText()) + d << ", text=" << mimeData->text(); + if (mimeData->hasHtml()) + d << ", html=" << mimeData->html(); + if (mimeData->hasColor()) + d << ", colorData=" << qvariant_cast(mimeData->colorData()); + if (mimeData->hasImage()) + d << ", imageData=" << qvariant_cast(mimeData->imageData()); + if (mimeData->hasUrls()) + d << ", urls=" << mimeData->urls(); + } else { + d << '0'; + } + d << ')'; return d; } @@ -297,7 +300,7 @@ QMimeData *QWindowsClipboard::mimeData(QClipboard::Mode mode) void QWindowsClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode) { - qCDebug(lcQpaMime) << __FUNCTION__ << mode << *mimeData; + qCDebug(lcQpaMime) << __FUNCTION__ << mode << mimeData; if (mode != QClipboard::Clipboard) return; diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.h b/src/plugins/platforms/windows/qwindowsinternalmimedata.h index 09ab417268..6a60a9676a 100644 --- a/src/plugins/platforms/windows/qwindowsinternalmimedata.h +++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.h @@ -55,8 +55,6 @@ protected: virtual void releaseDataObject(IDataObject *) const {} }; -QDebug operator<<(QDebug d, const QMimeData &m); - QT_END_NAMESPACE #endif // QWINDOWSINTERNALMIME_H -- cgit v1.2.3 From f8be9b8321246e0ddf0eba0deb4816a6188144a9 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 19 Jun 2015 13:15:26 +0200 Subject: Doc: Don't advertise QLocale::system() in QTranslator::load documentation Usually you want to use just QLocale(), and not QLocale::system(). They are both the same except when the user called QLocale::setDefault() beforehand. Change-Id: I2d9b13ac3ffec0005b1d9bf661eccdea276d34b1 Reviewed-by: Oswald Buddenhagen Reviewed-by: Martin Smith --- src/corelib/kernel/qtranslator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index a405df567f..360c5873d4 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -723,7 +723,7 @@ static QString find_translation(const QLocale & locale, For example, an application running in the \a locale with the following \l{QLocale::uiLanguages()}{ui languages} - "es", "fr-CA", "de" might call - load(QLocale::system(), "foo", ".", "/opt/foolib", ".qm"). load() would + load(QLocale(), "foo", ".", "/opt/foolib", ".qm"). load() would replace '-' (dash) with '_' (underscore) in the ui language and then try to open the first existing readable file from this list: -- cgit v1.2.3 From 150aa19042bbee893c5b4f16cb230f9266a1f4b7 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 22 Jul 2015 15:31:17 +0200 Subject: ios: Do not drop the user-provided default QSurfaceFormat Task-number: QTBUG-47195 Change-Id: I40bc7be816f5e23a63a2fe6d32842143b52f9d58 Reviewed-by: jian liang Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosintegration.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 837d0e9143..8395db81ff 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -81,7 +81,7 @@ QIOSIntegration::QIOSIntegration() // QPlatformBackingStore. qApp->setAttribute(Qt::AA_ShareOpenGLContexts, true); // And that context must match the format used for the backingstore's context. - QSurfaceFormat fmt; + QSurfaceFormat fmt = QSurfaceFormat::defaultFormat(); fmt.setDepthBufferSize(16); fmt.setStencilBufferSize(8); QSurfaceFormat::setDefaultFormat(fmt); -- cgit v1.2.3 From f01f1943e49ac3a60c54dd3f3009a445474dc412 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 26 Jul 2015 14:14:31 +0200 Subject: Fix compilation error while instantiating operator<< explicitly Task-number: QTBUG-47375 Change-Id: Ibd260de88c174c1aa3833a56b153b8b74d337338 Reviewed-by: Thiago Macieira --- src/corelib/io/qdebug.h | 14 +++++++++++--- tests/auto/corelib/io/qdebug/tst_qdebug.cpp | 9 +++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 59bd32e9a4..3c3ceba249 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -278,7 +278,7 @@ template inline typename QtPrivate::QEnableIf< QtPrivate::IsQEnumHelper::Value || QtPrivate::IsQEnumHelper >::Value, QDebug>::Type -operator<<(QDebug debug, const QFlags &flags) +qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags &flags) { const QMetaObject *obj = qt_getEnumMetaObject(T()); const char *name = qt_getEnumName(T()); @@ -289,10 +289,10 @@ template inline typename QtPrivate::QEnableIf< !QtPrivate::IsQEnumHelper::Value && !QtPrivate::IsQEnumHelper >::Value, QDebug>::Type -operator<<(QDebug debug, const QFlags &flags) +qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags &flags) #else // !QT_NO_QOBJECT template -inline QDebug operator<<(QDebug debug, const QFlags &flags) +inline QDebug qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags &flags) #endif { QDebugStateSaver saver(debug); @@ -312,6 +312,14 @@ inline QDebug operator<<(QDebug debug, const QFlags &flags) return debug; } +template +inline QDebug operator<<(QDebug debug, const QFlags &flags) +{ + // We have to use an indirection otherwise specialisation of some other overload of the + // operator<< the compiler would try to instantiate QFlags for the QEnableIf + return qt_QMetaEnum_flagDebugOperator_helper(debug, flags); +} + #ifdef Q_OS_MAC // We provide QDebug stream operators for commonly used Core Foundation diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index 32344f1e26..4e5cfed019 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -625,5 +625,14 @@ void tst_QDebug::threadSafety() const } } +// Should compile: instentiation of unrelated operator<< should not cause cause compilation +// error in QDebug operators (QTBUG-47375) +class TestClassA {}; +class TestClassB {}; + +template +TestClassA& operator<< (TestClassA& s, T&) { return s; }; +template<> TestClassA& operator<< (TestClassA& s, TestClassB& l); + QTEST_MAIN(tst_QDebug); #include "tst_qdebug.moc" -- cgit v1.2.3 From 404430dca5b85bb197c8d4659060c5e3b4ac67f3 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 27 Jul 2015 11:11:08 +0200 Subject: iOS: use UIKeyboardTypeNumbersAndPunctuation for Qt::ImhPreferNumbers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using Qt::ImhPreferNumbers means that we should use a keyboard that has focus on typing numbers. But it's important that we don't restrict typing to numbers only, it also needs to support normal text input. And this seems to be exactly what UIKeyboardTypeNumbersAndPunctuation does. Task-number: QTBUG-47365 Change-Id: I5bb88cedcbe0e89ea884dc9c14d3ffd9fb368060 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiostextresponder.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 52336a4e69..09839790fa 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -199,6 +199,8 @@ self.keyboardType = UIKeyboardTypePhonePad; else if (hints & Qt::ImhLatinOnly) self.keyboardType = UIKeyboardTypeASCIICapable; + else if (hints & Qt::ImhPreferNumbers) + self.keyboardType = UIKeyboardTypeNumbersAndPunctuation; else self.keyboardType = UIKeyboardTypeDefault; -- cgit v1.2.3 From 5f276d7a5ff961568d69c3d94232527342728027 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 24 Jul 2015 11:37:42 +0200 Subject: iOS: add missing Q_DECL_OVERRIDE Add missing Q_DECL_OVERRIDE to silence clang. Change-Id: I57261a39f0dcf4e0ffd8d9c079a95f2d3347d34a Reviewed-by: Jake Petroules --- src/plugins/platforms/ios/qioscontext.h | 12 +++++----- .../platforms/ios/qiosfileengineassetslibrary.mm | 2 +- src/plugins/platforms/ios/qiosintegration.h | 26 +++++++++++----------- src/plugins/platforms/ios/qiosmenu.h | 2 +- src/plugins/platforms/ios/qiosscreen.h | 20 ++++++++--------- src/plugins/platforms/ios/qiostheme.h | 4 ++-- src/plugins/platforms/ios/qioswindow.h | 24 ++++++++++---------- 7 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/plugins/platforms/ios/qioscontext.h b/src/plugins/platforms/ios/qioscontext.h index e550efe7c3..ec678fee44 100644 --- a/src/plugins/platforms/ios/qioscontext.h +++ b/src/plugins/platforms/ios/qioscontext.h @@ -50,15 +50,15 @@ public: QIOSContext(QOpenGLContext *context); ~QIOSContext(); - QSurfaceFormat format() const; + QSurfaceFormat format() const Q_DECL_OVERRIDE; - void swapBuffers(QPlatformSurface *surface); + void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE; - bool makeCurrent(QPlatformSurface *surface); - void doneCurrent(); + bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE; + void doneCurrent() Q_DECL_OVERRIDE; - GLuint defaultFramebufferObject(QPlatformSurface *) const; - QFunctionPointer getProcAddress(const QByteArray &procName); + GLuint defaultFramebufferObject(QPlatformSurface *) const Q_DECL_OVERRIDE; + QFunctionPointer getProcAddress(const QByteArray &procName) Q_DECL_OVERRIDE; bool isSharing() const Q_DECL_OVERRIDE; bool isValid() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm b/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm index f0b6afce2d..761a89c989 100644 --- a/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm +++ b/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm @@ -304,7 +304,7 @@ public: return g_iteratorCurrentUrl.localData(); } - QFileInfo currentFileInfo() const + QFileInfo currentFileInfo() const Q_DECL_OVERRIDE { return QFileInfo(currentFileName()); } diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h index 0fe318dce7..7d23fe1d62 100644 --- a/src/plugins/platforms/ios/qiosintegration.h +++ b/src/plugins/platforms/ios/qiosintegration.h @@ -54,26 +54,26 @@ public: QIOSIntegration(); ~QIOSIntegration(); - bool hasCapability(Capability cap) const; + bool hasCapability(Capability cap) const Q_DECL_OVERRIDE; - QPlatformWindow *createPlatformWindow(QWindow *window) const; - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE; - QPlatformFontDatabase *fontDatabase() const; - QPlatformClipboard *clipboard() const; - QPlatformInputContext *inputContext() const; + QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; + QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; + QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE; QPlatformServices *services() const Q_DECL_OVERRIDE; - QVariant styleHint(StyleHint hint) const; + QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE; - QStringList themeNames() const; - QPlatformTheme *createPlatformTheme(const QString &name) const; + QStringList themeNames() const Q_DECL_OVERRIDE; + QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE; - QAbstractEventDispatcher *createEventDispatcher() const; - QPlatformNativeInterface *nativeInterface() const; + QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE; + QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; QTouchDevice *touchDevice(); QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE; @@ -86,7 +86,7 @@ public: // -- QPlatformNativeInterface -- - void *nativeResourceForWindow(const QByteArray &resource, QWindow *window); + void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) Q_DECL_OVERRIDE; void setDebugWindowManagement(bool); bool debugWindowManagement() const; diff --git a/src/plugins/platforms/ios/qiosmenu.h b/src/plugins/platforms/ios/qiosmenu.h index 15f200bb27..4fa0416df7 100644 --- a/src/plugins/platforms/ios/qiosmenu.h +++ b/src/plugins/platforms/ios/qiosmenu.h @@ -112,7 +112,7 @@ public: static id menuActionTarget() { return m_currentMenu ? m_currentMenu->m_menuController : 0; } protected: - bool eventFilter(QObject *obj, QEvent *event); + bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE; private: quintptr m_tag; diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h index a638210c00..a0aa922a31 100644 --- a/src/plugins/platforms/ios/qiosscreen.h +++ b/src/plugins/platforms/ios/qiosscreen.h @@ -50,17 +50,17 @@ public: QIOSScreen(UIScreen *screen); ~QIOSScreen(); - QRect geometry() const; - QRect availableGeometry() const; - int depth() const; - QImage::Format format() const; - QSizeF physicalSize() const; - QDpi logicalDpi() const; - qreal devicePixelRatio() const; + QRect geometry() const Q_DECL_OVERRIDE; + QRect availableGeometry() const Q_DECL_OVERRIDE; + int depth() const Q_DECL_OVERRIDE; + QImage::Format format() const Q_DECL_OVERRIDE; + QSizeF physicalSize() const Q_DECL_OVERRIDE; + QDpi logicalDpi() const Q_DECL_OVERRIDE; + qreal devicePixelRatio() const Q_DECL_OVERRIDE; - Qt::ScreenOrientation nativeOrientation() const; - Qt::ScreenOrientation orientation() const; - void setOrientationUpdateMask(Qt::ScreenOrientations mask); + Qt::ScreenOrientation nativeOrientation() const Q_DECL_OVERRIDE; + Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE; + void setOrientationUpdateMask(Qt::ScreenOrientations mask) Q_DECL_OVERRIDE; UIScreen *uiScreen() const; UIWindow *uiWindow() const; diff --git a/src/plugins/platforms/ios/qiostheme.h b/src/plugins/platforms/ios/qiostheme.h index 9ef179b4dc..58144cb239 100644 --- a/src/plugins/platforms/ios/qiostheme.h +++ b/src/plugins/platforms/ios/qiostheme.h @@ -47,7 +47,7 @@ public: ~QIOSTheme(); const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE; - QVariant themeHint(ThemeHint hint) const; + QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE; QPlatformMenuItem* createPlatformMenuItem() const Q_DECL_OVERRIDE; QPlatformMenu* createPlatformMenu() const Q_DECL_OVERRIDE; @@ -55,7 +55,7 @@ public: bool usePlatformNativeDialog(DialogType type) const Q_DECL_OVERRIDE; QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const Q_DECL_OVERRIDE; - const QFont *font(Font type = SystemFont) const; + const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE; static const char *name; diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index c53eee1afd..0c65cf8aa5 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -54,29 +54,29 @@ public: explicit QIOSWindow(QWindow *window); ~QIOSWindow(); - void setGeometry(const QRect &rect); + void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; - void setWindowState(Qt::WindowState state); - void setParent(const QPlatformWindow *window); - void handleContentOrientationChange(Qt::ScreenOrientation orientation); - void setVisible(bool visible); + void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE; + void setParent(const QPlatformWindow *window) Q_DECL_OVERRIDE; + void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE; + void setVisible(bool visible) Q_DECL_OVERRIDE; void setOpacity(qreal level) Q_DECL_OVERRIDE; bool isExposed() const Q_DECL_OVERRIDE; void propagateSizeHints() Q_DECL_OVERRIDE {} - void raise() { raiseOrLower(true); } - void lower() { raiseOrLower(false); } + void raise() Q_DECL_OVERRIDE{ raiseOrLower(true); } + void lower() Q_DECL_OVERRIDE { raiseOrLower(false); } bool shouldAutoActivateWindow() const; - void requestActivateWindow(); + void requestActivateWindow() Q_DECL_OVERRIDE; - qreal devicePixelRatio() const; + qreal devicePixelRatio() const Q_DECL_OVERRIDE; - bool setMouseGrabEnabled(bool grab) { return grab; } - bool setKeyboardGrabEnabled(bool grab) { return grab; } + bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE { return grab; } + bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE { return grab; } - WId winId() const { return WId(m_view); }; + WId winId() const Q_DECL_OVERRIDE { return WId(m_view); } void clearAccessibleCache(); -- cgit v1.2.3 From 17c236ad05353b91b7c738b877560e3215573972 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 7 Jul 2015 13:48:46 +0200 Subject: Clear qt_tablet_target only when all buttons are released. Task-number: QTBUG-46694 Change-Id: Ie95a452dfffd6685dd2a32068872dc18f727c288 Reviewed-by: Shawn Rutledge --- src/widgets/kernel/qwidgetwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index ba8c16e838..d4e73bcac4 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -892,7 +892,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event) QGuiApplication::sendSpontaneousEvent(qt_tablet_target, &ev); } - if (event->type() == QEvent::TabletRelease) + if (event->type() == QEvent::TabletRelease && event->buttons() == Qt::NoButton) qt_tablet_target = 0; } #endif // QT_NO_TABLETEVENT -- cgit v1.2.3 From 4ef3d985dd959d8e878ea9b1080691fca861f8ea Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 20 Jul 2015 11:01:39 +0200 Subject: Windows: Split code paths for touch/native gesture events. Fix up 2b5df245d6cdbfb3150ee815debccf655af8f19f which routed WM_GESTURE through QWindowsMouseHandler::translateTouchEvent() causing asserts on missing touch devices. Task-number: QTBUG-47184 Change-Id: Ie843ebb343e34487bcac9c9dbea88de641d51e28 Reviewed-by: Oliver Wolff Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowscontext.cpp | 6 +++++- .../platforms/windows/qwindowsmousehandler.cpp | 24 +++++++++++++++++----- .../platforms/windows/qwindowsmousehandler.h | 3 +++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index a532e92397..3f355db607 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -919,7 +919,11 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::InputMethodRequest: return QWindowsInputContext::instance()->handleIME_Request(wParam, lParam, result); case QtWindows::GestureEvent: - return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); +#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) + return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result); +#else + return d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result); +#endif case QtWindows::InputMethodOpenCandidateWindowEvent: case QtWindows::InputMethodCloseCandidateWindowEvent: // TODO: Release/regrab mouse if a popup has mouse grab. diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index db635b602b..e6b80f2b93 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -472,12 +472,11 @@ bool QWindowsMouseHandler::translateScrollEvent(QWindow *window, HWND, } // from bool QApplicationPrivate::translateTouchEvent() -bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd, +bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, QtWindows::WindowsEventType, MSG msg, LRESULT *) { #ifndef Q_OS_WINCE - Q_UNUSED(hwnd); typedef QWindowSystemInterface::TouchPoint QTouchPoint; typedef QList QTouchPointList; @@ -545,8 +544,24 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd, QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, touchPoints); +#else // !Q_OS_WINCE + Q_UNUSED(window) + Q_UNUSED(msg) +#endif return true; -#else //Q_OS_WINCE + +} + +bool QWindowsMouseHandler::translateGestureEvent(QWindow *window, HWND hwnd, + QtWindows::WindowsEventType, + MSG msg, LRESULT *) +{ +#ifndef Q_OS_WINCE + Q_UNUSED(window) + Q_UNUSED(hwnd) + Q_UNUSED(msg) + return false; +#else // !Q_OS_WINCE GESTUREINFO gi; memset(&gi, 0, sizeof(GESTUREINFO)); gi.cbSize = sizeof(GESTUREINFO); @@ -625,9 +640,8 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd, QWindowSystemInterface::handleEnterEvent(window); m_windowUnderMouse = window; } - return true; -#endif +#endif // Q_OS_WINCE } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h index ce3e6b6fc4..61aa8d6084 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.h +++ b/src/plugins/platforms/windows/qwindowsmousehandler.h @@ -59,6 +59,9 @@ public: bool translateTouchEvent(QWindow *widget, HWND hwnd, QtWindows::WindowsEventType t, MSG msg, LRESULT *result); + bool translateGestureEvent(QWindow *window, HWND hwnd, + QtWindows::WindowsEventType, + MSG msg, LRESULT *); bool translateScrollEvent(QWindow *window, HWND hwnd, MSG msg, LRESULT *result); -- cgit v1.2.3 From cb05a4e8be61306ec4b84f5dfdac361ac6473b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeremy=20Lain=C3=A9?= Date: Mon, 27 Jul 2015 17:04:11 +0200 Subject: ssl: fix native parsing of certificates with DSA keys Fixes a typo which breaks the parsing of certificates with DSA public keys when using a non-OpenSSL backend (WinRT, SecureTransport). Change-Id: I250ba9948d5bd7739e281d7cd1b95cfbcb10e402 Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslcertificate_qt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/ssl/qsslcertificate_qt.cpp b/src/network/ssl/qsslcertificate_qt.cpp index 2d1dd68198..dfc459ed19 100644 --- a/src/network/ssl/qsslcertificate_qt.cpp +++ b/src/network/ssl/qsslcertificate_qt.cpp @@ -366,7 +366,7 @@ bool QSslCertificatePrivate::parse(const QByteArray &data) const QByteArray oid = elem.toObjectId(); if (oid == RSA_ENCRYPTION_OID) publicKeyAlgorithm = QSsl::Rsa; - else if (oid == RSA_ENCRYPTION_OID) + else if (oid == DSA_ENCRYPTION_OID) publicKeyAlgorithm = QSsl::Dsa; else publicKeyAlgorithm = QSsl::Opaque; -- cgit v1.2.3 From 56a4a34eb3a69fe2740f06324e73b547ca4c4f50 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 30 Jun 2015 11:03:12 +0200 Subject: Fix the internal compositing flag for QOpenGL/QuickWidget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compositing stays active for the window even when all such widgets get destroyed. Task-number: QTBUG-46937 Change-Id: Ib4acc90689151fd7de234806c4b5c0c472c13a5c Reviewed-by: Jørgen Lind --- src/widgets/kernel/qwidgetbackingstore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index d1070839fa..2a339cda4c 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -74,7 +74,7 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion ®ion, QBack Q_UNUSED(widgetTextures); Q_ASSERT(!region.isEmpty()); #else - Q_ASSERT(!region.isEmpty() || (widgetTextures && widgetTextures->count())); + Q_ASSERT(!region.isEmpty() || widgetTextures); #endif Q_ASSERT(widget); Q_ASSERT(backingStore); @@ -1124,7 +1124,7 @@ void QWidgetBackingStore::doSync() widgetTextures = new QPlatformTextureList; findTextureWidgetsRecursively(tlw, tlw, widgetTextures); } - qt_window_private(tlw->windowHandle())->compositing = widgetTextures && !widgetTextures->isEmpty(); + qt_window_private(tlw->windowHandle())->compositing = widgetTextures; fullUpdatePending = false; #endif -- cgit v1.2.3 From 8d6ef359c82424fed03f9d6663d91aaf758d2b62 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 27 Jul 2015 15:27:07 +0200 Subject: iOS: ensure we don't overwrite a projects qmake variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consider a project that does the following: launch_images.files = $$PWD/LaunchImage.xib QMAKE_BUNDLE_DATA += launch_images In that case we end up overwriting launch_images.files in default_post, and at the same time, add launch_images a second time to QMAKE_BUNDLE_DATA. The result will be that we copy our own launch image twize into the bundle. To prevent this, prepend our internal variables with qmake_ Change-Id: I24f870874017b5388248e3bfadecd461422ffe35 Reviewed-by: Tor Arne Vestbø --- mkspecs/macx-ios-clang/features/default_post.prf | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf index c9d3a5d85b..172e34bac5 100644 --- a/mkspecs/macx-ios-clang/features/default_post.prf +++ b/mkspecs/macx-ios-clang/features/default_post.prf @@ -196,24 +196,24 @@ macx-xcode { # Set up default 4-inch iPhone/iPod launch image so that our apps # support the full screen resolution of those devices. - launch_image = Default-568h@2x.png - copy_image.input = $$QMAKESPEC/$$launch_image - copy_image.output = $$OUT_PWD/$${TARGET}.xcodeproj/$$launch_image - copy_image.CONFIG = verbatim - QMAKE_SUBSTITUTES += copy_image - launch_images.files = $$copy_image.output - QMAKE_BUNDLE_DATA += launch_images + qmake_launch_image = Default-568h@2x.png + qmake_copy_image.input = $$QMAKESPEC/$$qmake_launch_image + qmake_copy_image.output = $$OUT_PWD/$${TARGET}.xcodeproj/$$qmake_launch_image + qmake_copy_image.CONFIG = verbatim + QMAKE_SUBSTITUTES += qmake_copy_image + qmake_launch_images.files = $$qmake_copy_image.output + QMAKE_BUNDLE_DATA += qmake_launch_images lessThan(QMAKE_XCODE_VERSION, "6.0") { warning("You need to update Xcode to version 6 or newer to fully support iPhone6/6+") } else { # Set up default LaunchScreen to support iPhone6/6+ - launch_screen = LaunchScreen.xib - copy_launch_screen.input = $$QMAKESPEC/$$launch_screen - copy_launch_screen.output = $$OUT_PWD/$${TARGET}.xcodeproj/$$launch_screen - QMAKE_SUBSTITUTES += copy_launch_screen - launch_screens.files = $$copy_launch_screen.output - QMAKE_BUNDLE_DATA += launch_screens + qmake_launch_screen = LaunchScreen.xib + qmake_copy_launch_screen.input = $$QMAKESPEC/$$qmake_launch_screen + qmake_copy_launch_screen.output = $$OUT_PWD/$${TARGET}.xcodeproj/$$qmake_launch_screen + QMAKE_SUBSTITUTES += qmake_copy_launch_screen + qmake_launch_screens.files = $$qmake_copy_launch_screen.output + QMAKE_BUNDLE_DATA += qmake_launch_screens } } -- cgit v1.2.3 From 7e89c7b8552b670f090fefb4b40fce348ecc416c Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 28 Jul 2015 07:53:43 +0200 Subject: xcb: fix tablet proximity again Patch 53d289ec4c0f512a3475da4bbf1f940cd6838ace caused it not to select property change events, which are needed separately for each tablet device. It's not enough to select them on the master device. Change-Id: Ibb6c7990d2edd865019eacfa7eed4bf818f7557e Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 2f46436ce2..150047fe12 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -306,14 +306,13 @@ void QXcbConnection::xi2Select(xcb_window_t window) const bool pointerSelected = isAtLeastXI22() && xi2MouseEvents(); QSet tabletDevices; #ifndef QT_NO_TABLETEVENT - if (!m_tabletData.isEmpty() && !pointerSelected) { + if (!m_tabletData.isEmpty()) { unsigned int tabletBitMask; unsigned char *xiTabletBitMask = reinterpret_cast(&tabletBitMask); QVector xiEventMask(m_tabletData.count()); - tabletBitMask = XI_ButtonPressMask; - tabletBitMask |= XI_ButtonReleaseMask; - tabletBitMask |= XI_MotionMask; - tabletBitMask |= XI_PropertyEventMask; + tabletBitMask = XI_PropertyEventMask; + if (!pointerSelected) + tabletBitMask |= XI_ButtonPressMask | XI_ButtonReleaseMask | XI_MotionMask; for (int i = 0; i < m_tabletData.count(); ++i) { int deviceId = m_tabletData.at(i).deviceId; tabletDevices.insert(deviceId); -- cgit v1.2.3 From c2406341fcd515edbfb638b9645a24f664473b75 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Mon, 27 Jul 2015 16:30:41 +0200 Subject: Doc: uiplugin in the qmake variable reference Task-number: QTBUG-47180 Change-Id: Ia563445e36b0abb0ef7707e7a0e4241d70e60cfd Reviewed-by: Andy Shaw --- qmake/doc/src/qmake-manual.qdoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 56d9dd35ae..c39c6359d3 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -2264,6 +2264,10 @@ \snippet code/doc_src_qmake-manual.pro 47 + If your project is a \QD plugin, use the value \c uiplugin to specify that + the project is to be built as a library, but with specific plugin support + for \QD. For more information, see \l {Building and Installing the Plugin}. + \section1 QTPLUGIN Specifies a list of names of static Qt plugins that are to be -- cgit v1.2.3 From 2d43f8b79b00e7de7b7024f0e23d55c636fc9e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeremy=20Lain=C3=A9?= Date: Tue, 28 Jul 2015 07:31:07 -0700 Subject: ssl: fix QNAM self-signed certificate test for non-OpenSSL backends Non-OpenSSL backends are not able to report a specific error code for self-signed certificates. Change-Id: I56bf130335b2afa65cf2bd5248a40ac0e32f74c2 Reviewed-by: Timur Pocheptsov Reviewed-by: Richard J. Moore --- .../auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 262b380446..e30d01cb8e 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -88,6 +88,14 @@ Q_DECLARE_METATYPE(QSharedPointer) #include "../../../network-settings.h" +// Non-OpenSSL backends are not able to report a specific error code +// for self-signed certificates. +#ifndef QT_NO_OPENSSL +#define FLUKE_CERTIFICATE_ERROR QSslError::SelfSignedCertificate +#else +#define FLUKE_CERTIFICATE_ERROR QSslError::CertificateUntrusted +#endif + Q_DECLARE_METATYPE(QAuthenticator*) #ifndef QT_NO_NETWORKPROXY Q_DECLARE_METATYPE(QNetworkProxyQuery) @@ -6027,8 +6035,8 @@ void tst_QNetworkReply::ignoreSslErrorsList_data() QList expectedSslErrors; QList certs = QSslCertificate::fromPath(testDataDir + "/certs/qt-test-server-cacert.pem"); - QSslError rightError(QSslError::SelfSignedCertificate, certs.at(0)); - QSslError wrongError(QSslError::SelfSignedCertificate); + QSslError rightError(FLUKE_CERTIFICATE_ERROR, certs.at(0)); + QSslError wrongError(FLUKE_CERTIFICATE_ERROR); QTest::newRow("SSL-failure-empty-list") << "https://" + QtNetworkSettings::serverName() + "/index.html" << expectedSslErrors << QNetworkReply::SslHandshakeFailedError; expectedSslErrors.append(wrongError); -- cgit v1.2.3 From ce87d82d4ab141d40ec6fbe357e310f636fa0443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeremy=20Lain=C3=A9?= Date: Tue, 28 Jul 2015 07:35:18 -0700 Subject: ssl: fix comment typo in QSslSocket tests The comment about non-OpenSSL backends not reproting a specific error for self-signed certificates contained a typo, this fixes it. Change-Id: I3010981d5d87d68ebf5e984c003b8bbbfb019b96 Reviewed-by: Timur Pocheptsov --- tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index b0a19a6c2d..b95b72a41e 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -71,7 +71,7 @@ Q_DECLARE_METATYPE(QSslSocket::PeerVerifyMode); typedef QSharedPointer QSslSocketPtr; // Non-OpenSSL backends are not able to report a specific error code -// for self-signed certificate for certificates. +// for self-signed certificates. #ifndef QT_NO_OPENSSL #define FLUKE_CERTIFICATE_ERROR QSslError::SelfSignedCertificate #else -- cgit v1.2.3 From 5cc734e0a3e941f866af6e234fe1e36939044110 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 21 Jul 2015 09:12:40 -0700 Subject: forkfd: Fix build with uClibc <= 0.9.33 That version of uClibc has neither pipe2 nor eventfd. There were two problems with our detection. First, it checked for glibc incorrectly, so the comparison was always true as __GLIBC__ << 16 = 0x20000 Second, we needed to check for uClibc's version. Task-number: QTBUG-47337 Change-Id: Ib306f8f647014b399b87ffff13f3023b7f8d6d4a Reviewed-by: Rafael Roquetto --- src/3rdparty/forkfd/forkfd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c index 86e109358c..a95d486d9f 100644 --- a/src/3rdparty/forkfd/forkfd.c +++ b/src/3rdparty/forkfd/forkfd.c @@ -44,11 +44,13 @@ #include #ifdef __linux__ -# if (defined(__GLIBC__) && (__GLIBC__ << 16) + __GLIBC_MINOR__ >= 0x207) || defined(__BIONIC__) +# if defined(__BIONIC__) || (defined(__GLIBC__) && (__GLIBC__ << 8) + __GLIBC_MINOR__ >= 0x207 && \ + (!defined(__UCLIBC__) || ((__UCLIBC_MAJOR__ << 16) + (__UCLIBC_MINOR__ << 8) + __UCLIBC_SUBLEVEL__ > 0x921))) # include # define HAVE_EVENTFD 1 # endif -# if (defined(__GLIBC__) && (__GLIBC__ << 16) + __GLIBC_MINOR__ >= 0x209) || defined(__BIONIC__) +# if defined(__BIONIC__) || (defined(__GLIBC__) && (__GLIBC__ << 8) + __GLIBC_MINOR__ >= 0x209 && \ + (!defined(__UCLIBC__) || ((__UCLIBC_MAJOR__ << 16) + (__UCLIBC_MINOR__ << 8) + __UCLIBC_SUBLEVEL__ > 0x921))) # define HAVE_PIPE2 1 # endif #endif -- cgit v1.2.3 From 2bcb2ce8c976de7daea71cab7d2215fc1ce5a448 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Wed, 15 Jul 2015 23:01:31 +0300 Subject: xcb: Fix build with QT_NO_CURSOR Change-Id: I2391c2921274b7a178fbdde1d0f59f7fbaa3048e Reviewed-by: Friedemann Kleint --- src/plugins/platforms/xcb/qxcbcursor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index e51ab85e30..bd880698e6 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -336,8 +336,10 @@ QXcbCursor::~QXcbCursor() if (!--cursorCount) xcb_close_font(conn, cursorFont); +#ifndef QT_NO_CURSOR foreach (xcb_cursor_t cursor, m_cursorHash) xcb_free_cursor(conn, cursor); +#endif } #ifndef QT_NO_CURSOR -- cgit v1.2.3 From 0d7af31e83ec2de324546558e5c787e1d489cf5c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Jul 2015 10:35:10 -0700 Subject: Make the function pointer to xcb_poll_for_queued_event not a member In the normal case, this change is a no-op. In case RTLD_DEFAULT isn't defined, this makes the job of the optimizer easier to detect that the static variable is never modified and that it can do a lot of dead code elimination. This also enables the optimization in the next commit. Change-Id: Ib306f8f647014b399b87ffff13f12f40a359233b Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbconnection.cpp | 33 +++++++++++++++++----------- src/plugins/platforms/xcb/qxcbconnection.h | 3 --- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 29e1fd145d..2158300591 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -77,6 +77,21 @@ #include #endif +typedef xcb_generic_event_t * (*XcbPollForQueuedEventFunctionPointer)(xcb_connection_t *c); +static XcbPollForQueuedEventFunctionPointer local_xcb_poll_for_queued_event; + +static inline void checkXcbPollForQueuedEvent() +{ +#ifdef RTLD_DEFAULT + local_xcb_poll_for_queued_event = (XcbPollForQueuedEventFunctionPointer)dlsym(RTLD_DEFAULT, "xcb_poll_for_queued_event"); +#endif + +#ifdef Q_XCB_DEBUG + if (local_xcb_poll_for_queued_event) + qDebug("Using threaded event reader with xcb_poll_for_queued_event"); +#endif +} + QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcQpaXInput, "qt.qpa.input") @@ -1169,21 +1184,13 @@ void QXcbConnection::addPeekFunc(PeekFunc f) QXcbEventReader::QXcbEventReader(QXcbConnection *connection) : m_connection(connection) - , m_xcb_poll_for_queued_event(0) { -#ifdef RTLD_DEFAULT - m_xcb_poll_for_queued_event = (XcbPollForQueuedEventFunctionPointer)dlsym(RTLD_DEFAULT, "xcb_poll_for_queued_event"); -#endif - -#ifdef Q_XCB_DEBUG - if (m_xcb_poll_for_queued_event) - qDebug("Using threaded event reader with xcb_poll_for_queued_event"); -#endif + checkXcbPollForQueuedEvent(); } void QXcbEventReader::start() { - if (m_xcb_poll_for_queued_event) { + if (local_xcb_poll_for_queued_event) { connect(this, SIGNAL(eventPending()), m_connection, SLOT(processXcbEvents()), Qt::QueuedConnection); connect(this, SIGNAL(finished()), m_connection, SLOT(processXcbEvents())); QThread::start(); @@ -1209,7 +1216,7 @@ void QXcbEventReader::registerEventDispatcher(QAbstractEventDispatcher *dispatch // flush the xcb connection before the EventDispatcher is going to block // In the non-threaded case processXcbEvents is called before going to block, // which flushes the connection. - if (m_xcb_poll_for_queued_event) + if (local_xcb_poll_for_queued_event) connect(dispatcher, SIGNAL(aboutToBlock()), m_connection, SLOT(flush())); } @@ -1219,7 +1226,7 @@ void QXcbEventReader::run() while (m_connection && (event = xcb_wait_for_event(m_connection->xcb_connection()))) { m_mutex.lock(); addEvent(event); - while (m_connection && (event = m_xcb_poll_for_queued_event(m_connection->xcb_connection()))) + while (m_connection && (event = local_xcb_poll_for_queued_event(m_connection->xcb_connection()))) addEvent(event); m_mutex.unlock(); emit eventPending(); @@ -1243,7 +1250,7 @@ void QXcbEventReader::addEvent(xcb_generic_event_t *event) QXcbEventArray *QXcbEventReader::lock() { m_mutex.lock(); - if (!m_xcb_poll_for_queued_event) { + if (!local_xcb_poll_for_queued_event) { while (xcb_generic_event_t *event = xcb_poll_for_event(m_connection->xcb_connection())) m_events << event; } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index ee5ed8906a..a183a72353 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -324,9 +324,6 @@ private: QMutex m_mutex; QXcbEventArray m_events; QXcbConnection *m_connection; - - typedef xcb_generic_event_t * (*XcbPollForQueuedEventFunctionPointer)(xcb_connection_t *c); - XcbPollForQueuedEventFunctionPointer m_xcb_poll_for_queued_event; }; class QXcbWindowEventListener -- cgit v1.2.3 From 3a63bb0ea755bb15c03a82192773c481d5ae8574 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Jul 2015 10:40:29 -0700 Subject: Let the linker find xcb_poll_for_queued_event for us It's more efficient than we are. This also enables the code to work in the unlikely case of an ELF platform without RTLD_DEFAULT. Change-Id: Ib306f8f647014b399b87ffff13f12f8aeeb2589a Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbconnection.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 2158300591..d2e08aecee 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -55,7 +55,6 @@ #include -#include #include #include #include @@ -77,6 +76,14 @@ #include #endif +#if defined(Q_CC_GNU) && defined(Q_OF_ELF) +static xcb_generic_event_t *local_xcb_poll_for_queued_event(xcb_connection_t *c) + __attribute__((weakref("xcb_poll_for_queued_event"))); + +static inline void checkXcbPollForQueuedEvent() +{ } +#else +#include typedef xcb_generic_event_t * (*XcbPollForQueuedEventFunctionPointer)(xcb_connection_t *c); static XcbPollForQueuedEventFunctionPointer local_xcb_poll_for_queued_event; @@ -85,12 +92,8 @@ static inline void checkXcbPollForQueuedEvent() #ifdef RTLD_DEFAULT local_xcb_poll_for_queued_event = (XcbPollForQueuedEventFunctionPointer)dlsym(RTLD_DEFAULT, "xcb_poll_for_queued_event"); #endif - -#ifdef Q_XCB_DEBUG - if (local_xcb_poll_for_queued_event) - qDebug("Using threaded event reader with xcb_poll_for_queued_event"); -#endif } +#endif QT_BEGIN_NAMESPACE -- cgit v1.2.3 From 454690c6a609732c95bc3a6b57ac38317530cfd4 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Wed, 17 Jun 2015 00:19:50 +0200 Subject: Fix typo in filterAcceptsColumn docs: row is used in place of column Change-Id: Ic0ec62e4d5c4a4b1d71f14c5d3133657341d4fe3 Reviewed-by: Marc Mutz --- src/corelib/itemmodels/qsortfilterproxymodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index 38f8dfa788..6853cbd38f 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -2696,7 +2696,7 @@ bool QSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex & The default implementation returns \c true if the value held by the relevant item matches the filter string, wildcard string or regular expression. - \note By default, the Qt::DisplayRole is used to determine if the row + \note By default, the Qt::DisplayRole is used to determine if the column should be accepted or not. This can be changed by setting the \l filterRole property. -- cgit v1.2.3 From 2a382655718dcf8d00822d8fdc1dfdae1666c67e Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Thu, 9 Jul 2015 00:38:19 +0200 Subject: Fix typo in test results report for android Change-Id: Ibb2319b1e96ce34d4c61c8504b7700a78462c56c Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/android/runtests_androiddeployqt.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/android/runtests_androiddeployqt.pl b/tests/auto/android/runtests_androiddeployqt.pl index 3e62e8614a..a73ea054b3 100755 --- a/tests/auto/android/runtests_androiddeployqt.pl +++ b/tests/auto/android/runtests_androiddeployqt.pl @@ -390,7 +390,7 @@ sub startTest system("$adb_tool $device_serial pull /data/data/$packageName/output.txt $output_dir/$output_file.txt") if ($get_txt); if ($get_txt){ - print "Tesresults for $packageName:\n"; + print "Test results for $packageName:\n"; my $insig = print_output("$output_dir/$output_file.txt", $packageName, $insignificance); } -- cgit v1.2.3 From edb5f22b0a5f791728951bc77e272279e06b6ab6 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 23 Jul 2015 17:06:53 +0200 Subject: consistently handle empty program string in QProcess::start overloads All overloads of QProcess::start will now check whether the program string is empty and in that case - set error to FailedToStart, - set errorString to "No program defined", - emit error. Until now only one of the three overloads behaved like this. As a side effect, start(QString(), QStringList()) will not crash on Windows anymore. Task-number: QTBUG-47404 Change-Id: I2f93657204fe3643b1d74a74817843c05fc4a96b Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira Reviewed-by: Jake Petroules Reviewed-by: Kai Koehne --- src/corelib/io/qprocess.cpp | 12 +++++++- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 38 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 1842541644..914774b433 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -2062,6 +2062,13 @@ void QProcess::start(const QString &program, const QStringList &arguments, OpenM qWarning("QProcess::start: Process is already running"); return; } + if (program.isEmpty()) { + Q_D(QProcess); + d->processError = QProcess::FailedToStart; + setErrorString(tr("No program defined")); + emit error(d->processError); + return; + } d->program = program; d->arguments = arguments; @@ -2086,7 +2093,10 @@ void QProcess::start(OpenMode mode) return; } if (d->program.isEmpty()) { - qWarning("QProcess::start: program not set"); + Q_D(QProcess); + d->processError = QProcess::FailedToStart; + setErrorString(tr("No program defined")); + emit error(d->processError); return; } diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 0c65ceb0eb..99cb9ad6cb 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -156,6 +156,8 @@ private slots: void failToStart(); void failToStartWithWait(); void failToStartWithEventLoop(); + void failToStartEmptyArgs_data(); + void failToStartEmptyArgs(); protected slots: void readFromProcess(); @@ -1672,6 +1674,42 @@ void tst_QProcess::failToStartWithEventLoop() } } +void tst_QProcess::failToStartEmptyArgs_data() +{ + QTest::addColumn("startOverload"); + QTest::newRow("start(QString, QStringList, OpenMode)") << 0; + QTest::newRow("start(QString, OpenMode)") << 1; + QTest::newRow("start(OpenMode)") << 2; +} + +void tst_QProcess::failToStartEmptyArgs() +{ + QFETCH(int, startOverload); + qRegisterMetaType("QProcess::ProcessError"); + + QProcess process; + QSignalSpy errorSpy(&process, static_cast(&QProcess::error)); + QVERIFY(errorSpy.isValid()); + + switch (startOverload) { + case 0: + process.start(QString(), QStringList(), QIODevice::ReadWrite); + break; + case 1: + process.start(QString(), QIODevice::ReadWrite); + break; + case 2: + process.start(QIODevice::ReadWrite); + break; + default: + QFAIL("Unhandled QProcess::start overload."); + }; + + QVERIFY(!process.waitForStarted()); + QCOMPARE(errorSpy.count(), 1); + QCOMPARE(process.error(), QProcess::FailedToStart); +} + //----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE -- cgit v1.2.3 From 332d41d025b5e289821cf2bd81745471c76dce36 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 29 Jul 2015 13:55:05 +0200 Subject: Doc: QFileDialog::ShowDirsOnly not supported on Windows The native Windows file dialog does not support displaying files in the directory chooser. Task-number: QTBUG-46982 Change-Id: Ib58f3d888df564d42044b81ad8e67b8aeae5f3c6 Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qfiledialog.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index d2666026bb..64e3f5069e 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -189,7 +189,9 @@ Q_GLOBAL_STATIC(QUrl, lastVisitedDir) \value AnyFile The name of a file, whether it exists or not. \value ExistingFile The name of a single existing file. \value Directory The name of a directory. Both files and - directories are displayed. + directories are displayed. However, the native Windows + file dialog does not support displaying files in the + directory chooser. \value ExistingFiles The names of zero or more existing files. This value is obsolete since Qt 4.5: @@ -2388,9 +2390,12 @@ QUrl QFileDialog::getSaveFileUrl(QWidget *parent, pass. To ensure a native file dialog, \l{QFileDialog::}{ShowDirsOnly} must be set. - On Windows, and OS X, this static function will use the - native file dialog and not a QFileDialog. On Windows CE, if the device has - no native file dialog, a QFileDialog will be used. + On Windows and OS X, this static function will use the + native file dialog and not a QFileDialog. However, the native Windows file + dialog does not support displaying files in the directory chooser. You need + to pass \l{QFileDialog::}{DontUseNativeDialog} to display files using a + QFileDialog. On Windows CE, if the device has no native file dialog, a + QFileDialog will be used. On Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp}, @@ -2398,7 +2403,7 @@ QUrl QFileDialog::getSaveFileUrl(QWidget *parent, \a options includes DontResolveSymlinks, the file dialog will treat symlinks as regular directories. - On Windows the dialog will spin a blocking modal event loop that will not + On Windows, the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if \a parent is not 0 then it will position the dialog just below the parent's title bar. -- cgit v1.2.3 From 17caa9419045f88baceae6555deadfcf24f5d1b1 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 6 Jul 2015 15:22:34 +0300 Subject: Android: Start the application when we know the screen geometry. Until now we'se set the screenGemetry to 0,0 until the layout is created, but some controls needs it before that. Task-number: QTBUG-44271 Change-Id: I7d00e2a142572e27fc77e46566bb2cdb37f58035 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../qtproject/qt5/android/QtActivityDelegate.java | 30 +++++++++++++--------- .../src/org/qtproject/qt5/android/QtLayout.java | 8 +++++- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index f4d2645e9a..ba3ecfecd6 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -760,12 +760,6 @@ public class QtActivityDelegate if (null == m_surfaces) onCreate(null); - String nativeLibraryDir = QtNativeLibrariesDir.nativeLibrariesDir(m_activity); - QtNative.startApplication(m_applicationParameters, - m_environmentVariables, - m_mainLib, - nativeLibraryDir); - m_started = true; return true; } catch (Exception e) { e.printStackTrace(); @@ -781,14 +775,26 @@ public class QtActivityDelegate public void onCreate(Bundle savedInstanceState) { m_quitApp = true; + Runnable startApplication = null; if (null == savedInstanceState) { - DisplayMetrics metrics = new DisplayMetrics(); - m_activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); - QtNative.setApplicationDisplayMetrics(metrics.widthPixels, metrics.heightPixels, - 0, 0, - metrics.xdpi, metrics.ydpi, metrics.scaledDensity); + startApplication = new Runnable() { + @Override + public void run() { + try { + String nativeLibraryDir = QtNativeLibrariesDir.nativeLibrariesDir(m_activity); + QtNative.startApplication(m_applicationParameters, + m_environmentVariables, + m_mainLib, + nativeLibraryDir); + m_started = true; + } catch (Exception e) { + e.printStackTrace(); + m_activity.finish(); + } + } + }; } - m_layout = new QtLayout(m_activity); + m_layout = new QtLayout(m_activity, startApplication); m_editText = new QtEditText(m_activity, this); m_imm = (InputMethodManager)m_activity.getSystemService(Context.INPUT_METHOD_SERVICE); m_surfaces = new HashMap(); diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtLayout.java b/src/android/jar/src/org/qtproject/qt5/android/QtLayout.java index 09fef4a705..4d7ca47dde 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtLayout.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtLayout.java @@ -43,9 +43,11 @@ import android.view.ViewGroup; public class QtLayout extends ViewGroup { - public QtLayout(Context context) + private Runnable m_startApplicationRunnable; + public QtLayout(Context context, Runnable startRunnable) { super(context); + m_startApplicationRunnable = startRunnable; } public QtLayout(Context context, AttributeSet attrs) @@ -65,6 +67,10 @@ public class QtLayout extends ViewGroup ((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(metrics); QtNative.setApplicationDisplayMetrics(metrics.widthPixels, metrics.heightPixels, w, h, metrics.xdpi, metrics.ydpi, metrics.scaledDensity); + if (m_startApplicationRunnable != null) { + m_startApplicationRunnable.run(); + m_startApplicationRunnable = null; + } } @Override -- cgit v1.2.3 From d800047dc57a773149545d3705a70419884feb46 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Tue, 7 Jul 2015 16:23:21 +0300 Subject: QLineEdit should inherit the input methods from QComboBox. Task-number: QTBUG-39088 Change-Id: I4dfe9a052c20a4cb0a9d6b0d3337cb5095a3694f Reviewed-by: Marc Mutz --- src/widgets/widgets/qcombobox.cpp | 1 + tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index cc4c3416f0..17762eb39d 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -1764,6 +1764,7 @@ void QComboBox::setLineEdit(QLineEdit *edit) delete d->lineEdit; d->lineEdit = edit; + qt_widget_private(d->lineEdit)->inheritsInputMethodHints = 1; if (d->lineEdit->parent() != this) d->lineEdit->setParent(this); connect(d->lineEdit, SIGNAL(returnPressed()), this, SLOT(_q_returnPressed())); diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index c409698ec0..7824172812 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -164,6 +164,7 @@ private slots: void keyboardSelection(); void setCustomModelAndView(); void updateDelegateOnEditableChange(); + void task_QTBUG_39088_inputMethodHints(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -3169,5 +3170,13 @@ void tst_QComboBox::updateDelegateOnEditableChange() } } +void tst_QComboBox::task_QTBUG_39088_inputMethodHints() +{ + QComboBox box; + box.setEditable(true); + box.setInputMethodHints(Qt::ImhNoPredictiveText); + QCOMPARE(box.lineEdit()->inputMethodHints(), Qt::ImhNoPredictiveText); +} + QTEST_MAIN(tst_QComboBox) #include "tst_qcombobox.moc" -- cgit v1.2.3 From 0617834e0cfa00c8dadbac17877659196107be76 Mon Sep 17 00:00:00 2001 From: Martin Koller Date: Sat, 25 Jul 2015 16:33:01 +0200 Subject: xcb: Make it compile on systems with xinput2 < 2.2 Change-Id: I7e98d3540cd7717ac8af8d1993618d18320f811a Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 150047fe12..335236578b 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -457,17 +457,6 @@ static inline qreal fixed1616ToReal(FP1616 val) } #endif // defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT) -#if defined(XCB_USE_XINPUT21) -static qreal valuatorNormalized(double value, XIValuatorClassInfo *vci) -{ - if (value > vci->max) - value = vci->max; - if (value < vci->min) - value = vci->min; - return (value - vci->min) / (vci->max - vci->min); -} -#endif // XCB_USE_XINPUT21 - void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) { if (xi2PrepareXIGenericDeviceEvent(event, m_xiOpCode)) { @@ -480,9 +469,11 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) case XI_ButtonPress: case XI_ButtonRelease: case XI_Motion: +#ifdef XCB_USE_XINPUT22 case XI_TouchBegin: case XI_TouchUpdate: case XI_TouchEnd: +#endif { xiDeviceEvent = reinterpret_cast(event); eventListener = windowEventListenerFromId(xiDeviceEvent->event); @@ -547,6 +538,15 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) } #ifdef XCB_USE_XINPUT22 +static qreal valuatorNormalized(double value, XIValuatorClassInfo *vci) +{ + if (value > vci->max) + value = vci->max; + if (value < vci->min) + value = vci->min; + return (value - vci->min) / (vci->max - vci->min); +} + void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindow) { xXIDeviceEvent *xiDeviceEvent = static_cast(xiDevEvent); @@ -976,6 +976,8 @@ bool QXcbConnection::xi2HandleTabletEvent(void *event, TabletData *tabletData, Q // the pen on the XI 2.2+ path. if (xi2MouseEvents() && eventListener) eventListener->handleXIMouseEvent(reinterpret_cast(event)); +#else + Q_UNUSED(eventListener); #endif switch (xiEvent->evtype) { -- cgit v1.2.3 From d11307320393540a60a81cdd216b99352bbcd2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeremy=20Lain=C3=A9?= Date: Wed, 29 Jul 2015 14:22:12 +0200 Subject: ssl: add test certificates with DSA and EC keys The QSslCertificate tests only covered certificates with RSA keys, this extends the test coverage to DSA and EC keys. Change-Id: Ibee26f449cf6c1d97cbac6b511972eb44d6f0bd2 Reviewed-by: Richard J. Moore --- .../certificates/dsa-cert-ss.der.pubkey | Bin 0 -> 442 bytes .../qsslcertificate/certificates/dsa-cert-ss.pem | 16 +++++++ .../certificates/dsa-cert-ss.pem.digest-md5 | 1 + .../certificates/dsa-cert-ss.pem.digest-sha1 | 1 + .../certificates/dsa-cert-ss.pem.pubkey | 12 ++++++ .../certificates/ec-cert-ss.der.pubkey | Bin 0 -> 120 bytes .../qsslcertificate/certificates/ec-cert-ss.pem | 11 +++++ .../certificates/ec-cert-ss.pem.digest-md5 | 1 + .../certificates/ec-cert-ss.pem.digest-sha1 | 1 + .../certificates/ec-cert-ss.pem.pubkey | 5 +++ .../certificates/gencertificates.sh | 46 ++++++++++++++++++++- .../ssl/qsslcertificate/tst_qsslcertificate.cpp | 14 +++++-- 12 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.der.pubkey create mode 100644 tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem create mode 100644 tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem.digest-md5 create mode 100644 tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem.digest-sha1 create mode 100644 tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem.pubkey create mode 100644 tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.der.pubkey create mode 100644 tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem create mode 100644 tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem.digest-md5 create mode 100644 tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem.digest-sha1 create mode 100644 tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem.pubkey diff --git a/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.der.pubkey b/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.der.pubkey new file mode 100644 index 0000000000..4e46848106 Binary files /dev/null and b/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.der.pubkey differ diff --git a/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem b/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem new file mode 100644 index 0000000000..d81f8f1def --- /dev/null +++ b/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICijCCAkgCCQC7PDslmXiXHzALBglghkgBZQMEAwIwKTEaMBgGA1UEAwwRbmFt +ZS93aXRoL3NsYXNoZXMxCzAJBgNVBAYTAk5PMB4XDTE1MDcyOTEyMTAyNloXDTE1 +MDgyODEyMTAyNlowKTEaMBgGA1UEAwwRbmFtZS93aXRoL3NsYXNoZXMxCzAJBgNV +BAYTAk5PMIIBtjCCASsGByqGSM44BAEwggEeAoGBAMJjrSlWu595Nf9UAAeggH6k +US30P+pigB5WEgeToqTkpIwHO24GdEL+dGtFVWwT+r+rSuI+SZPMMSQWpVcgjeCq +oaPpn+9P5gCof1jmn4oegis4K8hJANnsDDdE1HRkeVDSzFlkmvk+FnVfB0wI0T8F +k7BV4wZDyvgTKko6t7YZAhUAoXZvBxhaUam1WnS18Yrk+1IT3u8CgYAx22xg8DQG +4HE2vGH0p3Ug2FziCtjpDaN1ryomPbroQSK7/x9dhuy/4b1H2KdJufawWTVPdBI5 +TfXXvCcJEmQKKegarq3DFPGkpH+rp72GejEgmBMUU22+1NHga3VzSspLjAK2e/+r ++foHHzJnGQs6JrvMNaXK+UVJxXRp878CGgOBhAACgYAKoweyuHdke1ngEmgXMPrC +NBJiPPHPcEX9CSZasSka7gI6OWZDk6H80W1KRPxHMeKb4V06wa02IbZvWA5zeStC +OtmMCylk5Tzav8/UqYeDAqjddbSm7i423/pjmUh+eD/wLHvJxYanRm8nqBQLe1jL +2NmVkb1OpCyMK+sRF+K+sjALBglghkgBZQMEAwIDLwAwLAIUHVt2TWRAe/JSEHY1 +x6+igQb3AFQCFHYwbrScyMUwuVkNft2ttDN1I7ak +-----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem.digest-md5 b/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem.digest-md5 new file mode 100644 index 0000000000..dba3fdff03 --- /dev/null +++ b/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem.digest-md5 @@ -0,0 +1 @@ +MD5 Fingerprint=35:B0:60:B2:37:14:43:31:01:71:C0:D9:CE:AF:20:CB diff --git a/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem.digest-sha1 b/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem.digest-sha1 new file mode 100644 index 0000000000..3879ef954f --- /dev/null +++ b/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem.digest-sha1 @@ -0,0 +1 @@ +SHA1 Fingerprint=BD:46:36:00:D7:31:3F:95:46:55:62:1A:FB:CA:36:A3:3D:27:15:92 diff --git a/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem.pubkey b/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem.pubkey new file mode 100644 index 0000000000..c44fd6f4a9 --- /dev/null +++ b/tests/auto/network/ssl/qsslcertificate/certificates/dsa-cert-ss.pem.pubkey @@ -0,0 +1,12 @@ +-----BEGIN PUBLIC KEY----- +MIIBtjCCASsGByqGSM44BAEwggEeAoGBAMJjrSlWu595Nf9UAAeggH6kUS30P+pi +gB5WEgeToqTkpIwHO24GdEL+dGtFVWwT+r+rSuI+SZPMMSQWpVcgjeCqoaPpn+9P +5gCof1jmn4oegis4K8hJANnsDDdE1HRkeVDSzFlkmvk+FnVfB0wI0T8Fk7BV4wZD +yvgTKko6t7YZAhUAoXZvBxhaUam1WnS18Yrk+1IT3u8CgYAx22xg8DQG4HE2vGH0 +p3Ug2FziCtjpDaN1ryomPbroQSK7/x9dhuy/4b1H2KdJufawWTVPdBI5TfXXvCcJ +EmQKKegarq3DFPGkpH+rp72GejEgmBMUU22+1NHga3VzSspLjAK2e/+r+foHHzJn +GQs6JrvMNaXK+UVJxXRp878CGgOBhAACgYAKoweyuHdke1ngEmgXMPrCNBJiPPHP +cEX9CSZasSka7gI6OWZDk6H80W1KRPxHMeKb4V06wa02IbZvWA5zeStCOtmMCylk +5Tzav8/UqYeDAqjddbSm7i423/pjmUh+eD/wLHvJxYanRm8nqBQLe1jL2NmVkb1O +pCyMK+sRF+K+sg== +-----END PUBLIC KEY----- diff --git a/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.der.pubkey b/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.der.pubkey new file mode 100644 index 0000000000..05e3f82ebd Binary files /dev/null and b/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.der.pubkey differ diff --git a/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem b/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem new file mode 100644 index 0000000000..c4843c4420 --- /dev/null +++ b/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBfjCCAQUCCQC0FR+dPQNT7TAKBggqhkjOPQQDAjApMRowGAYDVQQDDBFuYW1l +L3dpdGgvc2xhc2hlczELMAkGA1UEBhMCTk8wHhcNMTUwNzI5MTIyNDA2WhcNMTUw +ODI4MTIyNDA2WjApMRowGAYDVQQDDBFuYW1lL3dpdGgvc2xhc2hlczELMAkGA1UE +BhMCTk8wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQk+TMJ/Zu30xojWhWSFnllEgEF ++jBRIxSoJ8T7vaPy3dV0Dxomv5NxOi0kn1kzYUzMoMReK/IAJ3bfRGyFbV4i/KDJ +VAvyEevvMnp2ewKxmwlg9E9n+d4Tm7tf5+3Tz+EwCgYIKoZIzj0EAwIDZwAwZAIw +cM1DRkrcg4IPUZZaP96rI70H7OT3VDg5zSNMkEE/QBPGtE7T1Lzkxk96e/BkiQoV +AjB/t955UraOxLtnqjSHvVmiczWK+2b4QV+wiQBV6XTLI6FUeKLa70I0ruLdIgJ4 +zKU= +-----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem.digest-md5 b/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem.digest-md5 new file mode 100644 index 0000000000..69ad0aa247 --- /dev/null +++ b/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem.digest-md5 @@ -0,0 +1 @@ +MD5 Fingerprint=83:EF:5F:FF:C1:DB:E0:AC:4A:FA:E1:1C:9F:07:9B:1E diff --git a/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem.digest-sha1 b/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem.digest-sha1 new file mode 100644 index 0000000000..7547b5ce3f --- /dev/null +++ b/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem.digest-sha1 @@ -0,0 +1 @@ +SHA1 Fingerprint=06:07:56:98:99:A1:45:D7:94:14:5A:B9:92:97:35:35:C8:EA:7C:3E diff --git a/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem.pubkey b/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem.pubkey new file mode 100644 index 0000000000..1ced61d62c --- /dev/null +++ b/tests/auto/network/ssl/qsslcertificate/certificates/ec-cert-ss.pem.pubkey @@ -0,0 +1,5 @@ +-----BEGIN PUBLIC KEY----- +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEJPkzCf2bt9MaI1oVkhZ5ZRIBBfowUSMU +qCfE+72j8t3VdA8aJr+TcTotJJ9ZM2FMzKDEXivyACd230RshW1eIvygyVQL8hHr +7zJ6dnsCsZsJYPRPZ/neE5u7X+ft08/h +-----END PUBLIC KEY----- diff --git a/tests/auto/network/ssl/qsslcertificate/certificates/gencertificates.sh b/tests/auto/network/ssl/qsslcertificate/certificates/gencertificates.sh index b21776536b..50d17b9453 100755 --- a/tests/auto/network/ssl/qsslcertificate/certificates/gencertificates.sh +++ b/tests/auto/network/ssl/qsslcertificate/certificates/gencertificates.sh @@ -34,7 +34,8 @@ # This script generates digital certificates of different types. -#--- Certificates --------------------------------------------------------------------------- +#--- RSA Certificates ----------------------------------------------------------------------- + echo -e "\ngenerating 1024-bit RSA private key to PEM file ..." openssl genrsa -out rsa-pri-1024.pem 1024 @@ -57,6 +58,38 @@ openssl x509 -req -in req.pem -out cert.pem -CA ca-cert.pem -set_serial 17 echo -e "\n generating a certifificate signed by a dummy CA to DER file ..." openssl x509 -req -in req.pem -out cert.der -CA ca-cert.pem -set_serial 17 -outform der +#--- DSA Certificates ----------------------------------------------------------------------- +echo -e "\ngenerating DSA parameters to PEM file ..." +openssl dsaparam -out dsapar-1024.pem 1024 + +echo -e "\ngenerating DSA private key to PEM file ..." +openssl gendsa dsapar-1024.pem -out dsa-pri-1024.pem +/bin/rm dsapar-1024.pem + +echo -e "\ngenerating DSA public key to PEM and DER file ..." +openssl dsa -in dsa-pri-1024.pem -pubout -out dsa-pub-1024.pem +openssl dsa -in dsa-pri-1024.pem -pubout -out dsa-pub-1024.der -outform der + +echo -e "\ngenerating certificate signing request (CSR) ..." +openssl req -out req.pem -new -key dsa-pri-1024.pem -subj "/CN=name\/with\/slashes/C=NO" + +echo -e "\n generating a self-signed certifificate to PEM file ..." +openssl x509 -req -in req.pem -out dsa-cert-ss.pem -signkey dsa-pri-1024.pem + +#--- EC Certificates ------------------------------------------------------------------------ +echo -e "\ngenerating EC private key to PEM file ..." +openssl ecparam -name secp384r1 -genkey -noout -out ec-pri-384.pem + +echo -e "\ngenerating EC public key to PEM and DER file ..." +openssl ec -in ec-pri-384.pem -pubout -out ec-pub-384.pem +openssl ec -in ec-pri-384.pem -pubout -out ec-pub-384.der -outform DER + +echo -e "\ngenerating certificate signing request (CSR) ..." +openssl req -out req.pem -new -key ec-pri-384.pem -subj "/CN=name\/with\/slashes/C=NO" + +echo -e "\n generating a self-signed certifificate to PEM file ..." +openssl x509 -req -in req.pem -out ec-cert-ss.pem -signkey ec-pri-384.pem + #--- Public keys -------------------------------------------------------------------------------- echo -e "\n associate public keys with all certificates ..." # Note: For now, there is only one public key (encoded in both PEM and DER), but that could change. @@ -64,6 +97,10 @@ echo -e "\n associate public keys with all certificates ..." /bin/cp rsa-pub-1024.der cert-ss.der.pubkey /bin/cp rsa-pub-1024.pem cert.pem.pubkey /bin/cp rsa-pub-1024.der cert.der.pubkey +/bin/cp dsa-pub-1024.pem dsa-cert-ss.pem.pubkey +/bin/cp dsa-pub-1024.der dsa-cert-ss.der.pubkey +/bin/cp ec-pub-384.pem ec-cert-ss.pem.pubkey +/bin/cp ec-pub-384.der ec-cert-ss.der.pubkey #--- Digests -------------------------------------------------------------------------------- echo -e "\n generating md5 and sha1 digests of all certificates ..." @@ -72,6 +109,8 @@ do openssl x509 -in ca-cert.pem -noout -fingerprint -$digest > ca-cert.pem.digest-$digest openssl x509 -in cert-ss.pem -noout -fingerprint -$digest > cert-ss.pem.digest-$digest openssl x509 -in cert.pem -noout -fingerprint -$digest > cert.pem.digest-$digest + openssl x509 -in dsa-cert-ss.pem -noout -fingerprint -$digest > dsa-cert-ss.pem.digest-$digest + openssl x509 -in ec-cert-ss.pem -noout -fingerprint -$digest > ec-cert-ss.pem.digest-$digest done #--- Subjet Alternative Name extension ---------------------------------------------------- @@ -93,4 +132,7 @@ openssl req -x509 -in req-san.pem -out $outname -key rsa-pri-1024.pem \ /bin/cp san.cnf $outname.san echo -e "\n cleaning up ..." -/bin/rm rsa-pri-1024.pem rsa-pub-1024.* req*.pem +/bin/rm rsa-pri-1024.pem rsa-pub-1024.* +/bin/rm dsa-pri-1024.pem dsa-pub-1024.* +/bin/rm ec-pri-384.pem ec-pub-384.* +/bin/rm req*.pem diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp index 604c0ef782..748c240f3d 100644 --- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp @@ -494,12 +494,20 @@ void tst_QSslCertificate::publicKey() QFETCH(QSsl::EncodingFormat, format); QFETCH(QString, pubkeyFilePath); + QSsl::KeyAlgorithm algorithm; + if (QFileInfo(pubkeyFilePath).fileName().startsWith("dsa-")) + algorithm = QSsl::Dsa; + else if (QFileInfo(pubkeyFilePath).fileName().startsWith("ec-")) + algorithm = QSsl::Ec; + else + algorithm = QSsl::Rsa; + QByteArray encodedCert = readFile(certFilePath); QSslCertificate certificate(encodedCert, format); QVERIFY(!certificate.isNull()); QByteArray encodedPubkey = readFile(pubkeyFilePath); - QSslKey pubkey(encodedPubkey, QSsl::Rsa, format, QSsl::PublicKey); // ### support DSA as well! + QSslKey pubkey(encodedPubkey, algorithm, format, QSsl::PublicKey); QVERIFY(!pubkey.isNull()); QCOMPARE(certificate.publicKey(), pubkey); @@ -581,7 +589,7 @@ void tst_QSslCertificate::fromPath_data() QTest::newRow("\"certificates/*\" fixed der") << QString("certificates/*") << int(QRegExp::FixedString) << false << 0; QTest::newRow("\"certificates/*\" regexp pem") << QString("certificates/*") << int(QRegExp::RegExp) << true << 0; QTest::newRow("\"certificates/*\" regexp der") << QString("certificates/*") << int(QRegExp::RegExp) << false << 0; - QTest::newRow("\"certificates/*\" wildcard pem") << QString("certificates/*") << int(QRegExp::Wildcard) << true << 5; + QTest::newRow("\"certificates/*\" wildcard pem") << QString("certificates/*") << int(QRegExp::Wildcard) << true << 7; QTest::newRow("\"certificates/ca*\" wildcard pem") << QString("certificates/ca*") << int(QRegExp::Wildcard) << true << 1; QTest::newRow("\"certificates/cert*\" wildcard pem") << QString("certificates/cert*") << int(QRegExp::Wildcard) << true << 4; QTest::newRow("\"certificates/cert-[sure]*\" wildcard pem") << QString("certificates/cert-[sure]*") << int(QRegExp::Wildcard) << true << 3; @@ -612,7 +620,7 @@ void tst_QSslCertificate::fromPath_data() QTest::newRow("\"d.*/c.*.pem\" wildcard pem") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << true << 0; QTest::newRow("\"d.*/c.*.pem\" wildcard der") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << false << 0; #ifdef Q_OS_LINUX - QTest::newRow("absolute path wildcard pem") << (testDataDir + "/certificates/*.pem") << int(QRegExp::Wildcard) << true << 5; + QTest::newRow("absolute path wildcard pem") << (testDataDir + "/certificates/*.pem") << int(QRegExp::Wildcard) << true << 7; #endif QTest::newRow("trailing-whitespace") << QString("more-certificates/trailing-whitespace.pem") << int(QRegExp::FixedString) << true << 1; -- cgit v1.2.3 From 0d3c8feeeb3c49d01bcfbca63b672e20ab29aa9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Thu, 30 Jul 2015 10:08:36 +0200 Subject: Fix SNI for TlsV1_0OrLater, TlsV1_1OrLater and TlsV1_2OrLater Since SslV3, SslV2 and UnknownProtocol do not support it we can invert the IF clause here. Change-Id: I42e942337d01f3a8c97885b268bffa568e40d335 Task-number: QTBUG-47528 Reviewed-by: Mikkel Krautz Reviewed-by: Richard J. Moore --- src/network/ssl/qsslsocket_openssl.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 049666b70b..bc1df81ab2 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -377,12 +377,9 @@ bool QSslSocketBackendPrivate::initSslContext() return false; } - if ((configuration.protocol == QSsl::TlsV1SslV3 || - configuration.protocol == QSsl::TlsV1_0 || - configuration.protocol == QSsl::TlsV1_1 || - configuration.protocol == QSsl::TlsV1_2 || - configuration.protocol == QSsl::SecureProtocols || - configuration.protocol == QSsl::AnyProtocol) && + if (configuration.protocol != QSsl::SslV2 && + configuration.protocol != QSsl::SslV3 && + configuration.protocol != QSsl::UnknownProtocol && mode == QSslSocket::SslClientMode && q_SSLeay() >= 0x00090806fL) { // Set server hostname on TLS extension. RFC4366 section 3.1 requires it in ACE format. QString tlsHostName = verificationPeerName.isEmpty() ? q->peerName() : verificationPeerName; -- cgit v1.2.3 From 8f3e7e3b47a25eccddba35f512b00097fd5f6930 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 12 Jun 2015 13:53:39 +0200 Subject: qdoc: Add images used in examples into .qhp Images used as resources in examples were missing from the generated .qch files. Change-Id: I7cdfc65b646a418e3de0b22d9a075e9a413aca29 Task-number: QTBUG-46635 Reviewed-by: Martin Smith --- src/tools/qdoc/generator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index d22ec507f6..7f0d4b48b9 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -938,15 +938,17 @@ void Generator::generateFileList(const DocumentNode* dn, if (!file.isEmpty()) { QDir dirInfo; QString userFriendlyFilePath; + const QString prefix("/images/used-in-examples/"); QString srcPath = Config::findFile(dn->location(), QStringList(), exampleDirs, file, exampleImgExts, userFriendlyFilePath); + outFileNames_ << prefix.mid(1) + userFriendlyFilePath; userFriendlyFilePath.truncate(userFriendlyFilePath.lastIndexOf('/')); - QString imgOutDir = outDir_ + "/images/used-in-examples/" + userFriendlyFilePath; + QString imgOutDir = outDir_ + prefix + userFriendlyFilePath; if (!dirInfo.mkpath(imgOutDir)) dn->location().fatal(tr("Cannot create output directory '%1'") .arg(imgOutDir)); -- cgit v1.2.3 From f80143a69a7a3d79f7fe9a345ae89e385758367e Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 15 Jun 2015 14:02:50 +0200 Subject: Doc: Add a \target for license information within QImage documentation This allows us to link to it from the Qt licensing information page. Also, replace the \legalese command with \badcode in order to keep the license text formatting intact. Task-number: QTBUG-46478 Change-Id: I1b5100ca0373a533bd56852ab2a8f18e72404334 Reviewed-by: Sami Makkonen Reviewed-by: Pierre Rossi --- src/gui/image/qimage.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index f0b3e89033..08eb759ec2 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -568,12 +568,13 @@ bool QImageData::checkForAlphaPixels() const \endtable + \target qimage-legalese \section1 Legal Information For smooth scaling, the transformed() functions use code based on smooth scaling algorithm by Daniel M. Duley. - \legalese + \badcode Copyright (C) 2004, 2005 Daniel M. Duley Redistribution and use in source and binary forms, with or without @@ -596,7 +597,7 @@ bool QImageData::checkForAlphaPixels() const THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - \endlegalese + \endcode \sa QImageReader, QImageWriter, QPixmap, QSvgRenderer, {Image Composition Example}, {Image Viewer Example}, {Scribble Example}, {Pixelator Example} -- cgit v1.2.3 From 7a1045b647be1aa4357fcc9cf70749105d9a118b Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 8 Jul 2015 11:50:07 +0200 Subject: qdoc: Fix string used in compatibility members page Add a missing space in the comment generated at the top of the compatibility members page. Change-Id: I21e010f9fca41346bb50c4b400325b18ff672738 Reviewed-by: Martin Smith --- src/tools/qdoc/htmlgenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 10b7242c18..4aed6085cd 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -2658,7 +2658,7 @@ QString HtmlGenerator::generateLowStatusMemberFile(InnerNode *inner, out() << "

The following members of class " << "" << protectEnc(inner->name()) << "" - << "are part of the " + << " are part of the " "Qt compatibility layer. We advise against " "using them in new code.

\n"; } -- cgit v1.2.3 From 590d305f9994cdfa6075f5d305bfb795c9b479d0 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 9 Jul 2015 15:24:52 +0200 Subject: qdoc: Fix incorrect keyword details written to .qhp for QML properties QDoc tried to refer to an non-existing node (a parent of a parent) of a QML property when writing the unique ID of a QML property keyword. Change-Id: I90ab92b6ac95cfa688ca79a2c4d6c72f0e30d018 Task-number: QTCREATORBUG-3708 Reviewed-by: Martin Smith --- src/tools/qdoc/helpprojectwriter.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/tools/qdoc/helpprojectwriter.cpp b/src/tools/qdoc/helpprojectwriter.cpp index 90b1d9cfe3..d00f75e32d 100644 --- a/src/tools/qdoc/helpprojectwriter.cpp +++ b/src/tools/qdoc/helpprojectwriter.cpp @@ -196,13 +196,7 @@ QStringList HelpProjectWriter::keywordDetails(const Node *node) const { QStringList details; - if (node->isQmlProperty() || node->isJsProperty()) { - // "name" - details << node->name(); - // "id" - details << node->parent()->parent()->name()+"::"+node->name(); - } - else if (node->parent() && !node->parent()->name().isEmpty()) { + if (node->parent() && !node->parent()->name().isEmpty()) { // "name" if (node->type() == Node::Enum || node->type() == Node::Typedef) details << node->parent()->name()+"::"+node->name(); -- cgit v1.2.3 From 0aedca2f9756fa33420fb6b3f003f364424f9134 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 30 Jul 2015 22:05:57 +0000 Subject: Revert "Fix performance of recursive read-write locks" This reverts commit 666486b3efec871301b82244ec661e1eaa6cca9c, which removed the QHash that protected against reader recursion deadlocks. Without this hash, a reader will block on d->readerWait.wait() until the writer finishes its task. However, the writer never starts because there's a reader that hasn't released the lock. That's a deadlock. Change-Id: I792373bb361db35eb9e5504229c099008821a665 Task-number: QTBUG-47530 Reviewed-by: Thiago Macieira Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/thread/qreadwritelock.cpp | 57 +++++++++++++++++++++++++++++++++++ src/corelib/thread/qreadwritelock_p.h | 1 + 2 files changed, 58 insertions(+) diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp index e6477bf5e0..0ea8c4c00f 100644 --- a/src/corelib/thread/qreadwritelock.cpp +++ b/src/corelib/thread/qreadwritelock.cpp @@ -136,11 +136,27 @@ void QReadWriteLock::lockForRead() { QMutexLocker lock(&d->mutex); + Qt::HANDLE self = 0; + if (d->recursive) { + self = QThread::currentThreadId(); + + QHash::iterator it = d->currentReaders.find(self); + if (it != d->currentReaders.end()) { + ++it.value(); + ++d->accessCount; + Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::lockForRead()", + "Overflow in lock counter"); + return; + } + } + while (d->accessCount < 0 || d->waitingWriters) { ++d->waitingReaders; d->readerWait.wait(&d->mutex); --d->waitingReaders; } + if (d->recursive) + d->currentReaders.insert(self, 1); ++d->accessCount; Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::lockForRead()", "Overflow in lock counter"); @@ -166,8 +182,24 @@ bool QReadWriteLock::tryLockForRead() { QMutexLocker lock(&d->mutex); + Qt::HANDLE self = 0; + if (d->recursive) { + self = QThread::currentThreadId(); + + QHash::iterator it = d->currentReaders.find(self); + if (it != d->currentReaders.end()) { + ++it.value(); + ++d->accessCount; + Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::tryLockForRead()", + "Overflow in lock counter"); + return true; + } + } + if (d->accessCount < 0) return false; + if (d->recursive) + d->currentReaders.insert(self, 1); ++d->accessCount; Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::tryLockForRead()", "Overflow in lock counter"); @@ -198,6 +230,20 @@ bool QReadWriteLock::tryLockForRead(int timeout) { QMutexLocker lock(&d->mutex); + Qt::HANDLE self = 0; + if (d->recursive) { + self = QThread::currentThreadId(); + + QHash::iterator it = d->currentReaders.find(self); + if (it != d->currentReaders.end()) { + ++it.value(); + ++d->accessCount; + Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::tryLockForRead()", + "Overflow in lock counter"); + return true; + } + } + while (d->accessCount < 0 || d->waitingWriters) { ++d->waitingReaders; bool success = d->readerWait.wait(&d->mutex, timeout < 0 ? ULONG_MAX : ulong(timeout)); @@ -205,6 +251,8 @@ bool QReadWriteLock::tryLockForRead(int timeout) if (!success) return false; } + if (d->recursive) + d->currentReaders.insert(self, 1); ++d->accessCount; Q_ASSERT_X(d->accessCount > 0, "QReadWriteLock::tryLockForRead()", "Overflow in lock counter"); @@ -364,6 +412,15 @@ void QReadWriteLock::unlock() bool unlocked = false; if (d->accessCount > 0) { // releasing a read lock + if (d->recursive) { + Qt::HANDLE self = QThread::currentThreadId(); + QHash::iterator it = d->currentReaders.find(self); + if (it != d->currentReaders.end()) { + if (--it.value() <= 0) + d->currentReaders.erase(it); + } + } + unlocked = --d->accessCount == 0; } else if (d->accessCount < 0 && ++d->accessCount == 0) { // released a write lock diff --git a/src/corelib/thread/qreadwritelock_p.h b/src/corelib/thread/qreadwritelock_p.h index 15a6d1f57e..e57c0e403f 100644 --- a/src/corelib/thread/qreadwritelock_p.h +++ b/src/corelib/thread/qreadwritelock_p.h @@ -69,6 +69,7 @@ struct QReadWriteLockPrivate bool recursive; Qt::HANDLE currentWriter; + QHash currentReaders; }; QT_END_NAMESPACE -- cgit v1.2.3 From 76ce564674439ea05c35aadc149c86fdbd844d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeremy=20Lain=C3=A9?= Date: Mon, 27 Jul 2015 08:17:55 -0700 Subject: ssl: add support for EC keys to non-OpenSSL backends Adds basic support for QSslKey reading / writing Elliptic Curve keys on backends other than OpenSSL (i.e. WinRT / SecureTransport for now). Change-Id: I67012dbe6b844a3ed5b22b63e0cdbacf0497a74a Reviewed-by: Richard J. Moore --- src/network/ssl/qasn1element_p.h | 2 + src/network/ssl/qsslcertificate_qt.cpp | 2 + src/network/ssl/qsslkey_qt.cpp | 67 +++++++++++++++++++++++++++++++++- 3 files changed, 70 insertions(+), 1 deletion(-) diff --git a/src/network/ssl/qasn1element_p.h b/src/network/ssl/qasn1element_p.h index 68acbe33ee..e58b974661 100644 --- a/src/network/ssl/qasn1element_p.h +++ b/src/network/ssl/qasn1element_p.h @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE #define RSA_ENCRYPTION_OID QByteArrayLiteral("1.2.840.113549.1.1.1") #define DSA_ENCRYPTION_OID QByteArrayLiteral("1.2.840.10040.4.1") +#define EC_ENCRYPTION_OID QByteArrayLiteral("1.2.840.10045.2.1") class Q_AUTOTEST_EXPORT QAsn1Element { @@ -80,6 +81,7 @@ public: // context specific Context0Type = 0xA0, + Context1Type = 0xA1, Context3Type = 0xA3 }; diff --git a/src/network/ssl/qsslcertificate_qt.cpp b/src/network/ssl/qsslcertificate_qt.cpp index dfc459ed19..a283078998 100644 --- a/src/network/ssl/qsslcertificate_qt.cpp +++ b/src/network/ssl/qsslcertificate_qt.cpp @@ -368,6 +368,8 @@ bool QSslCertificatePrivate::parse(const QByteArray &data) publicKeyAlgorithm = QSsl::Rsa; else if (oid == DSA_ENCRYPTION_OID) publicKeyAlgorithm = QSsl::Dsa; + else if (oid == EC_ENCRYPTION_OID) + publicKeyAlgorithm = QSsl::Ec; else publicKeyAlgorithm = QSsl::Opaque; diff --git a/src/network/ssl/qsslkey_qt.cpp b/src/network/ssl/qsslkey_qt.cpp index 4f68912527..c4f8df86e2 100644 --- a/src/network/ssl/qsslkey_qt.cpp +++ b/src/network/ssl/qsslkey_qt.cpp @@ -59,6 +59,47 @@ static const quint8 bits_table[256] = { 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, }; +// OIDs of named curves allowed in TLS as per RFCs 4492 and 7027, +// see also https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8 + +typedef QMap OidLengthMap; +static OidLengthMap createOidMap() +{ + OidLengthMap oids; + oids.insert(oids.cend(), QByteArrayLiteral("1.2.840.10045.3.1.1"), 192); // secp192r1 a.k.a prime192v1 + oids.insert(oids.cend(), QByteArrayLiteral("1.2.840.10045.3.1.7"), 256); // secp256r1 a.k.a prime256v1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.1"), 193); // sect193r2 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.10"), 256); // secp256k1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.16"), 283); // sect283k1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.17"), 283); // sect283r1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.26"), 233); // sect233k1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.27"), 233); // sect233r1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.3"), 239); // sect239k1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.30"), 160); // secp160r2 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.31"), 192); // secp192k1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.32"), 224); // secp224k1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.33"), 224); // secp224r1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.34"), 384); // secp384r1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.35"), 521); // secp521r1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.36"), 409); // sect409k1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.37"), 409); // sect409r1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.38"), 571); // sect571k1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.39"), 571); // sect571r1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.8"), 160); // secp160r1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.9"), 160); // secp160k1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.11"), 384); // brainpoolP384r1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.13"), 521); // brainpoolP512r1 + oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.7"), 256); // brainpoolP256r1 + return oids; +} +Q_GLOBAL_STATIC_WITH_ARGS(OidLengthMap, oidLengthMap, (createOidMap())) + +static int curveBits(const QByteArray &oid) +{ + const int length = oidLengthMap->value(oid); + return length ? length : -1; +} + static int numberOfBits(const QByteArray &modulus) { int bits = modulus.size() * 8; @@ -146,6 +187,12 @@ void QSslKeyPrivate::decodeDer(const QByteArray &der, bool deepClear) if (params.isEmpty() || params[0].type() != QAsn1Element::IntegerType) return; keyLength = numberOfBits(params[0].value()); + } else if (algorithm == QSsl::Ec) { + if (infoItems[0].toObjectId() != EC_ENCRYPTION_OID) + return; + if (infoItems[1].type() != QAsn1Element::ObjectIdentifierType) + return; + keyLength = curveBits(infoItems[1].toObjectId()); } } else { @@ -154,17 +201,35 @@ void QSslKeyPrivate::decodeDer(const QByteArray &der, bool deepClear) return; // version - if (items[0].type() != QAsn1Element::IntegerType || items[0].value().toHex() != "00") + if (items[0].type() != QAsn1Element::IntegerType) return; + const QByteArray versionHex = items[0].value().toHex(); if (algorithm == QSsl::Rsa) { + if (versionHex != "00") + return; if (items.size() != 9 || items[1].type() != QAsn1Element::IntegerType) return; keyLength = numberOfBits(items[1].value()); } else if (algorithm == QSsl::Dsa) { + if (versionHex != "00") + return; if (items.size() != 6 || items[1].type() != QAsn1Element::IntegerType) return; keyLength = numberOfBits(items[1].value()); + } else if (algorithm == QSsl::Ec) { + if (versionHex != "01") + return; + if (items.size() != 4 + || items[1].type() != QAsn1Element::OctetStringType + || items[2].type() != QAsn1Element::Context0Type + || items[3].type() != QAsn1Element::Context1Type) + return; + QAsn1Element oidElem; + if (!oidElem.read(items[2].value()) + || oidElem.type() != QAsn1Element::ObjectIdentifierType) + return; + keyLength = curveBits(oidElem.toObjectId()); } } -- cgit v1.2.3 From 735cd0ccf3e51f9b3f0e9d30df08899ae54bf7ab Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Thu, 14 May 2015 02:48:42 +0400 Subject: [QFontDatabase] Defer the fallback families list initialization Use the same trick the WebKit related path has used for years: if there is no explicit list that takes a precedence over the default one (i.e. QFont("Arial,SimHei")), then defer the fallback families list initialization until it gets requested. Change-Id: If5a74294bdebb24865c619bc0d7328b3e706de76 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontdatabase.cpp | 28 +++++++++++++++------------- src/gui/text/qfontengine.cpp | 14 +++++++------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 6b7a9837cb..af03778e22 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -756,7 +756,7 @@ QString qt_resolveFontFamilyAlias(const QString &alias) return alias; } -static QStringList fallbackFamilies(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) +QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) { // make sure that the db has all fallback families QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script); @@ -884,17 +884,19 @@ QFontEngine *loadEngine(int script, const QFontDef &request, QFontEngine *engine = loadSingleEngine(script, request, family, foundry, style, size); Q_ASSERT(!engine || engine->type() != QFontEngine::Multi); if (engine && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol) { - QStringList fallbacks = request.fallBackFamilies; + QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); + QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script)); + if (!request.fallBackFamilies.isEmpty()) { + QStringList fallbacks = request.fallBackFamilies; - QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint); - if (styleHint == QFont::AnyStyle && request.fixedPitch) - styleHint = QFont::TypeWriter; + QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint); + if (styleHint == QFont::AnyStyle && request.fixedPitch) + styleHint = QFont::TypeWriter; - fallbacks += fallbackFamilies(family->name, QFont::Style(style->key.style), styleHint, QChar::Script(script)); + fallbacks += qt_fallbacksForFamily(family->name, QFont::Style(style->key.style), styleHint, QChar::Script(script)); - QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); - QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script)); - pfMultiEngine->setFallbackFamiliesList(fallbacks); + pfMultiEngine->setFallbackFamiliesList(fallbacks); + } engine = pfMultiEngine; // Cache Multi font engine as well in case we got the single @@ -2560,10 +2562,10 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script) styleHint = QFont::TypeWriter; QStringList fallbacks = request.fallBackFamilies - + fallbackFamilies(request.family, - QFont::Style(request.style), - styleHint, - QChar::Script(script)); + + qt_fallbacksForFamily(request.family, + QFont::Style(request.style), + styleHint, + QChar::Script(script)); if (script > QChar::Script_Common) fallbacks += QString(); // Find the first font matching the specified script. diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 6f5d178655..f9d924d10a 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1590,15 +1590,15 @@ QFontEngineMulti::~QFontEngineMulti() } } +QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script); + void QFontEngineMulti::ensureFallbackFamiliesQueried() { - if (QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration()) { - const QStringList fallbackFamilies = integration->fontDatabase()->fallbacksForFamily(fontDef.family, - QFont::Style(fontDef.style), - QFont::AnyStyle, - QChar::Script(m_script)); - setFallbackFamiliesList(fallbackFamilies); - } + QFont::StyleHint styleHint = QFont::StyleHint(fontDef.styleHint); + if (styleHint == QFont::AnyStyle && fontDef.fixedPitch) + styleHint = QFont::TypeWriter; + + setFallbackFamiliesList(qt_fallbacksForFamily(fontDef.family, QFont::Style(fontDef.style), styleHint, QChar::Script(m_script))); } void QFontEngineMulti::setFallbackFamiliesList(const QStringList &fallbackFamilies) -- cgit v1.2.3 From 5e3e34731b7880ac775e8f1fa156ce016e6820f1 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 18 May 2015 09:27:10 +0400 Subject: Default implementation for QPlatformFontDatabase::fallbacksForFamily() ...mainly for platforms that do not provide a native/unified way to obtain system-defined font fallbacks list (ie !CoreText && !FontConfig). Change-Id: I23c5589d79ddecb6311ccc52ec8b29977f06d408 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontdatabase.cpp | 40 ++++++++++++++++++++++ src/gui/text/qplatformfontdatabase.cpp | 14 ++++---- .../fontdatabases/basic/qbasicfontdatabase.cpp | 9 ----- .../fontdatabases/basic/qbasicfontdatabase_p.h | 1 - .../android/qandroidplatformfontdatabase.cpp | 24 +++++-------- .../android/qandroidplatformfontdatabase.h | 3 -- .../platforms/windows/qwindowsfontdatabase.cpp | 11 ++---- .../platforms/windows/qwindowsfontdatabase_ft.cpp | 6 ++-- 8 files changed, 60 insertions(+), 48 deletions(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index af03778e22..40e61f42ec 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -756,6 +756,46 @@ QString qt_resolveFontFamilyAlias(const QString &alias) return alias; } +QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const +{ + Q_UNUSED(family); + Q_UNUSED(styleHint); + + QStringList retList; + + size_t writingSystem = std::find(scriptForWritingSystem, + scriptForWritingSystem + QFontDatabase::WritingSystemsCount, + script) - scriptForWritingSystem; + if (writingSystem >= QFontDatabase::WritingSystemsCount) + writingSystem = QFontDatabase::Any; + + QFontDatabasePrivate *db = privateDb(); + for (int i = 0; i < db->count; ++i) { + QtFontFamily *f = db->families[i]; + + f->ensurePopulated(); + + if (writingSystem > QFontDatabase::Any && f->writingSystems[writingSystem] != QtFontFamily::Supported) + continue; + + for (int j = 0; j < f->count; ++j) { + QtFontFoundry *foundry = f->foundries[j]; + + for (int k = 0; k < foundry->count; ++k) { + if (style == foundry->styles[k]->key.style) { + if (foundry->name.isEmpty()) + retList.append(f->name); + else + retList.append(f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']')); + break; + } + } + } + } + + return retList; +} + QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) { // make sure that the db has all fallback families diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 502348a79a..8764c8cebf 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -343,17 +343,15 @@ QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal } /*! + \fn QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const + Returns a list of alternative fonts for the specified \a family and \a style and \a script using the \a styleHint given. + + Default implementation returns a list of fonts for which \a style and \a script support + has been reported during the font database population. */ -QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const -{ - Q_UNUSED(family); - Q_UNUSED(style); - Q_UNUSED(styleHint); - Q_UNUSED(script); - return QStringList(); -} +// implemented in qfontdatabase.cpp /*! Adds an application font described by the font contained supplied \a fontData diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp index 65cdabdf5b..9212383148 100644 --- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp @@ -176,15 +176,6 @@ QFontEngine *QBasicFontDatabase::fontEngine(const QByteArray &fontData, qreal pi return fe; } -QStringList QBasicFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const -{ - Q_UNUSED(family); - Q_UNUSED(style); - Q_UNUSED(script); - Q_UNUSED(styleHint); - return QStringList(); -} - QStringList QBasicFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) { return addTTFile(fontData,fileName.toLocal8Bit()); diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h index 3fe1a04b0f..87f4aad2b8 100644 --- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h @@ -63,7 +63,6 @@ public: void populateFontDatabase() Q_DECL_OVERRIDE; QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE; QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) Q_DECL_OVERRIDE; - QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const Q_DECL_OVERRIDE; QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) Q_DECL_OVERRIDE; void releaseHandle(void *handle) Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp index 9b60ab291c..b4b6123147 100644 --- a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp +++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp @@ -55,16 +55,7 @@ void QAndroidPlatformFontDatabase::populateFontDatabase() QList entries = dir.entryInfoList(QStringList() << QStringLiteral("*.ttf") << QStringLiteral("*.otf"), QDir::Files); for (int i = 0; i < int(entries.count()); ++i) { const QByteArray file = QFile::encodeName(entries.at(i).absoluteFilePath()); - QSupportedWritingSystems supportedWritingSystems; - QStringList families = addTTFile(QByteArray(), file, &supportedWritingSystems); - - extern int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem); - for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) { - if (i == QFontDatabase::Any || supportedWritingSystems.supported(QFontDatabase::WritingSystem(i))) { - QChar::Script script = QChar::Script(qt_script_for_writing_system(QFontDatabase::WritingSystem(i))); - m_fallbacks[script] += families; - } - } + QBasicFontDatabase::addTTFile(QByteArray(), file); } } @@ -73,15 +64,16 @@ QStringList QAndroidPlatformFontDatabase::fallbacksForFamily(const QString &fami QFont::StyleHint styleHint, QChar::Script script) const { - Q_UNUSED(family); - Q_UNUSED(style); - + QStringList result; if (styleHint == QFont::Monospace || styleHint == QFont::Courier) - return QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";") + m_fallbacks[script]; + result.append(QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";")); else if (styleHint == QFont::Serif) - return QString(qgetenv("QT_ANDROID_FONTS_SERIF")).split(";") + m_fallbacks[script]; + result.append(QString(qgetenv("QT_ANDROID_FONTS_SERIF")).split(";")); + else + result.append(QString(qgetenv("QT_ANDROID_FONTS")).split(";")); + result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script)); - return QString(qgetenv("QT_ANDROID_FONTS")).split(";") + m_fallbacks[script]; + return result; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.h b/src/plugins/platforms/android/qandroidplatformfontdatabase.h index 45de47a58c..89a9ed8bc0 100644 --- a/src/plugins/platforms/android/qandroidplatformfontdatabase.h +++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.h @@ -47,9 +47,6 @@ public: QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const; - -private: - QHash m_fallbacks; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index b1bb944fc6..3b27964b0e 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1080,11 +1080,7 @@ QWindowsFontDatabase::~QWindowsFontDatabase() QFontEngineMulti *QWindowsFontDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) { - if (script == QChar::Script_Common) - return new QWindowsMultiFontEngine(fontEngine, script); - // ### as long as fallbacksForFamily() does not take script parameter into account, - // prefer QFontEngineMulti's loadEngine() implementation for complex scripts - return QPlatformFontDatabase::fontEngineMulti(fontEngine, script); + return new QWindowsMultiFontEngine(fontEngine, script); } QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, void *handle) @@ -1666,11 +1662,10 @@ QString QWindowsFontDatabase::familyForStyleHint(QFont::StyleHint styleHint) QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const { - QStringList result = QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script); - if (!result.isEmpty()) - return result; + QStringList result; result.append(QWindowsFontDatabase::familyForStyleHint(styleHint)); result.append(QWindowsFontDatabase::extraTryFontsForFamily(family)); + result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script)); qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint << script << result; diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index ad75a0bd54..795554698c 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -661,9 +661,7 @@ QFontEngine *QWindowsFontDatabaseFT::fontEngine(const QByteArray &fontData, qrea QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const { - QStringList result = QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script); - if (!result.isEmpty()) - return result; + QStringList result; result.append(QWindowsFontDatabase::familyForStyleHint(styleHint)); @@ -679,6 +677,8 @@ QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QF result.append(QWindowsFontDatabase::extraTryFontsForFamily(family)); + result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script)); + qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint << script << result; -- cgit v1.2.3 From 839af2268e2b0b8079d1f107db71dcf0390c11ee Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 18 May 2015 09:32:14 +0400 Subject: Micro optimization to Basic/Android FDB::populateFontDatabase() Re-use QDir to check if dir exists (QDir::exists() also returns false if path specifies a file), and use somewhat faster QDir::entryInfoList() to iterate the font files. Change-Id: Iea3a6e5548928a01db71037425adf170cb722151 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../fontdatabases/basic/qbasicfontdatabase.cpp | 23 +++++++++++----------- .../android/qandroidplatformfontdatabase.cpp | 13 +++++++----- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp index 9212383148..abadede262 100644 --- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp @@ -55,23 +55,24 @@ QT_BEGIN_NAMESPACE void QBasicFontDatabase::populateFontDatabase() { QString fontpath = fontDir(); + QDir dir(fontpath); - if(!QFile::exists(fontpath)) { + if (!dir.exists()) { qWarning("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?", qPrintable(fontpath)); return; } - QDir dir(fontpath); - dir.setNameFilters(QStringList() << QLatin1String("*.ttf") - << QLatin1String("*.ttc") << QLatin1String("*.pfa") - << QLatin1String("*.pfb") - << QLatin1String("*.otf")); - dir.refresh(); - for (int i = 0; i < int(dir.count()); ++i) { - const QByteArray file = QFile::encodeName(dir.absoluteFilePath(dir[i])); -// qDebug() << "looking at" << file; - addTTFile(QByteArray(), file); + QStringList nameFilters; + nameFilters << QLatin1String("*.ttf") + << QLatin1String("*.ttc") + << QLatin1String("*.pfa") + << QLatin1String("*.pfb") + << QLatin1String("*.otf"); + + foreach (const QFileInfo &fi, dir.entryInfoList(nameFilters, QDir::Files)) { + const QByteArray file = QFile::encodeName(fi.absoluteFilePath()); + QBasicFontDatabase::addTTFile(QByteArray(), file); } } diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp index b4b6123147..be1a3d7bdf 100644 --- a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp +++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp @@ -45,16 +45,19 @@ QString QAndroidPlatformFontDatabase::fontDir() const void QAndroidPlatformFontDatabase::populateFontDatabase() { QString fontpath = fontDir(); + QDir dir(fontpath); - if (!QFile::exists(fontpath)) { + if (!dir.exists()) { qFatal("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?", qPrintable(fontpath)); } - QDir dir(fontpath); - QList entries = dir.entryInfoList(QStringList() << QStringLiteral("*.ttf") << QStringLiteral("*.otf"), QDir::Files); - for (int i = 0; i < int(entries.count()); ++i) { - const QByteArray file = QFile::encodeName(entries.at(i).absoluteFilePath()); + QStringList nameFilters; + nameFilters << QLatin1String("*.ttf") + << QLatin1String("*.otf"); + + foreach (const QFileInfo &fi, dir.entryInfoList(nameFilters, QDir::Files)) { + const QByteArray file = QFile::encodeName(fi.absoluteFilePath()); QBasicFontDatabase::addTTFile(QByteArray(), file); } } -- cgit v1.2.3 From 073f4f9bb21817d76d55324a74899d2f40118042 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 18 May 2015 09:33:10 +0400 Subject: [QBasicFontDatabase] Minor code clean-up We do not use supportedWritingSystems anymore -> simply remove. Change-Id: I8c8b4b0614bf396c943d810c396d18e2d0201eff Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp | 8 ++------ src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp index abadede262..c41061a9fd 100644 --- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp @@ -179,7 +179,7 @@ QFontEngine *QBasicFontDatabase::fontEngine(const QByteArray &fontData, qreal pi QStringList QBasicFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) { - return addTTFile(fontData,fileName.toLocal8Bit()); + return QBasicFontDatabase::addTTFile(fontData, fileName.toLocal8Bit()); } void QBasicFontDatabase::releaseHandle(void *handle) @@ -190,7 +190,7 @@ void QBasicFontDatabase::releaseHandle(void *handle) extern FT_Library qt_getFreetype(); -QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByteArray &file, QSupportedWritingSystems *supportedWritingSystems) +QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByteArray &file) { FT_Library library = qt_getFreetype(); @@ -229,8 +229,6 @@ QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByt if (cm->encoding == FT_ENCODING_ADOBE_CUSTOM || cm->encoding == FT_ENCODING_MS_SYMBOL) { writingSystems.setSupported(QFontDatabase::Symbol); - if (supportedWritingSystems) - supportedWritingSystems->setSupported(QFontDatabase::Symbol); break; } } @@ -249,8 +247,6 @@ QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByt }; writingSystems = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRange, codePageRange); - if (supportedWritingSystems) - *supportedWritingSystems = writingSystems; if (os2->usWeightClass) { weight = QPlatformFontDatabase::weightFromInteger(os2->usWeightClass); diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h index 87f4aad2b8..f78587e296 100644 --- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h @@ -66,7 +66,7 @@ public: QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) Q_DECL_OVERRIDE; void releaseHandle(void *handle) Q_DECL_OVERRIDE; - static QStringList addTTFile(const QByteArray &fontData, const QByteArray &file, QSupportedWritingSystems *supportedWritingSystems = 0); + static QStringList addTTFile(const QByteArray &fontData, const QByteArray &file); }; QT_END_NAMESPACE -- cgit v1.2.3 From c57c89b3c1b2b61c838b98458f6dbfad297dc7e3 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 1 May 2015 08:21:29 +0400 Subject: Don't expose qt_setQtEnableTestFont(bool) by default Build it only in -developer-build mode for tests that might depend on exact-matching font behavior. Return earlier to avoid doing any useless job. Change-Id: I966ee5689f03403e45f4c957b63e3113f0467803 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontdatabase.cpp | 17 +++-- tests/auto/gui/text/qfontcache/tst_qfontcache.cpp | 14 ++-- .../auto/gui/text/qtextlayout/tst_qtextlayout.cpp | 76 ++++++++++++++-------- .../widgets/widgets/qtextedit/tst_qtextedit.cpp | 5 +- 4 files changed, 73 insertions(+), 39 deletions(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 40e61f42ec..85a804acfe 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -72,12 +72,14 @@ QT_BEGIN_NAMESPACE #define SMOOTH_SCALABLE 0xffff +#if defined(QT_BUILD_INTERNAL) bool qt_enable_test_font = false; Q_AUTOTEST_EXPORT void qt_setQtEnableTestFont(bool value) { qt_enable_test_font = value; } +#endif static int getFontWeight(const QString &weightString) { @@ -2561,6 +2563,15 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script) QFontEngine *engine; +#if defined(QT_BUILD_INTERNAL) + // For testing purpose only, emulates an exact-matching monospace font + if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) { + engine = new QTestFontEngine(request.pixelSize); + engine->fontDef = request; + return engine; + } +#endif + // Until we specifically asked not to, try looking for Multi font engine // first, the last '1' indicates that we want Multi font engine instead // of single ones @@ -2576,12 +2587,6 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script) parseFontName(request.family, foundry_name, family_name); - if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) { - engine =new QTestFontEngine(request.pixelSize); - engine->fontDef = request; - return engine; - } - QtFontDesc desc; QList blackListed; int index = match(script, request, family_name, foundry_name, &desc, blackListed); diff --git a/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp b/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp index 0658d99fb2..272827e57b 100644 --- a/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp +++ b/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp @@ -51,15 +51,15 @@ private slots: void clear(); }; -QT_BEGIN_NAMESPACE -extern void qt_setQtEnableTestFont(bool value); // qfontdatabase.cpp - #ifdef QT_BUILD_INTERNAL +QT_BEGIN_NAMESPACE +// qfontdatabase.cpp +Q_AUTOTEST_EXPORT void qt_setQtEnableTestFont(bool value); // qfontengine.cpp -extern void QFontEngine_startCollectingEngines(); -extern QList QFontEngine_stopCollectingEngines(); -#endif +Q_AUTOTEST_EXPORT void QFontEngine_startCollectingEngines(); +Q_AUTOTEST_EXPORT QList QFontEngine_stopCollectingEngines(); QT_END_NAMESPACE +#endif tst_QFontCache::tst_QFontCache() { @@ -79,6 +79,7 @@ void tst_QFontCache::clear() QFontEngine *fontEngine = 0; +#ifdef QT_BUILD_INTERNAL { // we're never caching the box (and the "test") font engines // let's ensure we're not leaking them as well as the cached ones @@ -88,6 +89,7 @@ void tst_QFontCache::clear() f.setFamily("__Qt__Box__Engine__"); f.exactMatch(); // loads engine } +#endif { QFontDatabase db; diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index 105afa9a91..51f726ac86 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -68,6 +68,7 @@ public slots: private slots: void getSetCheck(); void lineBreaking(); +#ifdef QT_BUILD_INTERNAL void simpleBoundingRect(); void threeLineBoundingRect(); void boundingRectWithLongLineAndNoWrap(); @@ -83,16 +84,20 @@ private slots: void horizontalAlignment(); void horizontalAlignmentMultiline_data(); void horizontalAlignmentMultiline(); +#endif void defaultWordSeparators_data(); void defaultWordSeparators(); void cursorMovementFromInvalidPositions(); void cursorMovementInsideSpaces(); void charWordStopOnLineSeparator(); +#ifdef QT_BUILD_INTERNAL void xToCursorAtEndOfLine(); +#endif void boundingRectTopLeft(); void graphemeBoundaryForSurrogatePairs(); void tabStops(); void integerOverflow(); +#ifdef QT_BUILD_INTERNAL void testDefaultTabs(); void testTabs(); void testMultilineTab(); @@ -103,6 +108,7 @@ private slots: void testMultiTab(); void testTabDPIScale(); void tabsForRtl(); +#endif void tabHeight(); void capitalization_allUpperCase(); void capitalization_allUpperCase_newline(); @@ -119,12 +125,14 @@ private slots: void layoutWithCustomTabStops(); // QTextLine stuff +#ifdef QT_BUILD_INTERNAL void setNumColumnsWrapAtWordBoundaryOrAnywhere(); void setNumColumnsWordWrap(); void smallTextLengthNoWrap(); void smallTextLengthWordWrap(); void smallTextLengthWrapAtWordBoundaryOrAnywhere(); void testLineBreakingAllSpaces(); +#endif void lineWidthFromBOM(); void textWidthVsWIdth(); void textWithSurrogates_qtbug15679(); @@ -143,7 +151,7 @@ private: void tst_QTextLayout::getSetCheck() { QString str("Bogus text"); - QTextLayout layout(str, testFont); + QTextLayout layout(str); layout.beginLayout(); QTextEngine *engine = layout.engine(); QTextInlineObject obj1(0, engine); @@ -177,13 +185,18 @@ void tst_QTextLayout::getSetCheck() QCOMPARE(true, obj2.cacheEnabled()); } +#ifdef QT_BUILD_INTERNAL QT_BEGIN_NAMESPACE -extern void qt_setQtEnableTestFont(bool value); +// qfontdatabase.cpp +Q_AUTOTEST_EXPORT void qt_setQtEnableTestFont(bool value); QT_END_NAMESPACE +#endif tst_QTextLayout::tst_QTextLayout() { +#ifdef QT_BUILD_INTERNAL qt_setQtEnableTestFont(true); +#endif } tst_QTextLayout::~tst_QTextLayout() @@ -193,10 +206,14 @@ tst_QTextLayout::~tst_QTextLayout() void tst_QTextLayout::init() { testFont = QFont(); +#ifdef QT_BUILD_INTERNAL testFont.setFamily("__Qt__Box__Engine__"); +#endif testFont.setPixelSize(TESTFONT_SIZE); testFont.setWeight(QFont::Normal); +#ifdef QT_BUILD_INTERNAL QCOMPARE(QFontMetrics(testFont).width('a'), testFont.pixelSize()); +#endif } void tst_QTextLayout::cleanup() @@ -286,6 +303,7 @@ void tst_QTextLayout::lineBreaking() #endif } +#ifdef QT_BUILD_INTERNAL void tst_QTextLayout::simpleBoundingRect() { /* just check if boundingRect() gives sane values. The text is not broken. */ @@ -972,6 +990,7 @@ void tst_QTextLayout::horizontalAlignmentMultiline() QCOMPARE(rect.left(), lastLeft); QCOMPARE(rect.right(), lastRight); } +#endif void tst_QTextLayout::defaultWordSeparators_data() { @@ -1009,7 +1028,7 @@ void tst_QTextLayout::defaultWordSeparators() QFETCH(QString, text); QFETCH(int, startPos); QFETCH(int, endPos); - QTextLayout layout(text, testFont); + QTextLayout layout(text); QCOMPARE(layout.nextCursorPosition(startPos, QTextLayout::SkipWords), endPos); QCOMPARE(layout.previousCursorPosition(endPos, QTextLayout::SkipWords), startPos); @@ -1019,7 +1038,7 @@ void tst_QTextLayout::cursorMovementFromInvalidPositions() { int badpos = 10000; - QTextLayout layout("ABC", testFont); + QTextLayout layout("ABC"); QCOMPARE(layout.previousCursorPosition(-badpos, QTextLayout::SkipCharacters), -badpos); QCOMPARE(layout.nextCursorPosition(-badpos, QTextLayout::SkipCharacters), -badpos); @@ -1030,13 +1049,13 @@ void tst_QTextLayout::cursorMovementFromInvalidPositions() void tst_QTextLayout::cursorMovementInsideSpaces() { - QTextLayout layout("ABC DEF", testFont); + QTextLayout layout("ABC DEF"); QCOMPARE(layout.previousCursorPosition(6, QTextLayout::SkipWords), 0); QCOMPARE(layout.nextCursorPosition(6, QTextLayout::SkipWords), 15); - QTextLayout layout2("ABC\t\t\t\t\t\t\t\t\t\t\t\tDEF", testFont); + QTextLayout layout2("ABC\t\t\t\t\t\t\t\t\t\t\t\tDEF"); QCOMPARE(layout2.previousCursorPosition(6, QTextLayout::SkipWords), 0); QCOMPARE(layout2.nextCursorPosition(6, QTextLayout::SkipWords), 15); @@ -1048,13 +1067,14 @@ void tst_QTextLayout::charWordStopOnLineSeparator() QString txt; txt.append(lineSeparator); txt.append(lineSeparator); - QTextLayout layout(txt, testFont); + QTextLayout layout(txt); QTextEngine *engine = layout.engine(); const QCharAttributes *attrs = engine->attributes(); QVERIFY(attrs); QVERIFY(attrs[1].graphemeBoundary); } +#ifdef QT_BUILD_INTERNAL void tst_QTextLayout::xToCursorAtEndOfLine() { QString text = "FirstLine SecondLine"; @@ -1078,13 +1098,14 @@ void tst_QTextLayout::xToCursorAtEndOfLine() line = layout.lineAt(1); QCOMPARE(line.xToCursor(100000), 20); } +#endif void tst_QTextLayout::boundingRectTopLeft() { QString text = "FirstLine\nSecondLine"; text.replace('\n', QChar::LineSeparator); - QTextLayout layout(text, testFont); + QTextLayout layout(text); layout.setCacheEnabled(true); layout.beginLayout(); @@ -1106,7 +1127,7 @@ void tst_QTextLayout::graphemeBoundaryForSurrogatePairs() txt.append(0xd87e); txt.append(0xdc25); txt.append("b"); - QTextLayout layout(txt, testFont); + QTextLayout layout(txt); QTextEngine *engine = layout.engine(); const QCharAttributes *attrs = engine->attributes(); QVERIFY(attrs); @@ -1119,13 +1140,13 @@ void tst_QTextLayout::graphemeBoundaryForSurrogatePairs() void tst_QTextLayout::tabStops() { QString txt("Hello there\tworld"); - QTextLayout layout(txt, testFont); + QTextLayout layout(txt); layout.beginLayout(); QTextLine line = layout.createLine(); QVERIFY(line.isValid()); line.setNumColumns(11); - QCOMPARE(line.textLength(), TESTFONT_SIZE); + QCOMPARE(line.textLength(), 12); line = layout.createLine(); QVERIFY(line.isValid()); @@ -1142,7 +1163,7 @@ void tst_QTextLayout::integerOverflow() for (int i = 0; i < 8; ++i) txt += txt; - QTextLayout layout(txt, testFont); + QTextLayout layout(txt); layout.beginLayout(); QTextLine line = layout.createLine(); @@ -1155,6 +1176,7 @@ void tst_QTextLayout::integerOverflow() layout.endLayout(); } +#ifdef QT_BUILD_INTERNAL void tst_QTextLayout::setNumColumnsWrapAtWordBoundaryOrAnywhere() { QString txt("This is a small test text"); @@ -1695,22 +1717,23 @@ void tst_QTextLayout::testTabDPIScale() QCOMPARE(line.cursorToX(12), tabs.at(1).position * scale - TESTFONT_SIZE * 5); QCOMPARE(line.cursorToX(18), tabs.at(2).position * scale - TESTFONT_SIZE * 3 / 2.0); } +#endif void tst_QTextLayout::tabHeight() { - QTextLayout layout("\t", testFont); + QTextLayout layout("\t"); layout.setCacheEnabled(true); layout.beginLayout(); QTextLine line = layout.createLine(); layout.endLayout(); - QCOMPARE(qRound(line.ascent()), QFontMetrics(testFont).ascent()); - QCOMPARE(qRound(line.descent()), QFontMetrics(testFont).descent()); + QCOMPARE(qRound(line.ascent()), QFontMetrics(layout.font()).ascent()); + QCOMPARE(qRound(line.descent()), QFontMetrics(layout.font()).descent()); } void tst_QTextLayout::capitalization_allUpperCase() { - QFont font(testFont); + QFont font; font.setCapitalization(QFont::AllUppercase); QTextLayout layout("Test", font); layout.setCacheEnabled(true); @@ -1726,7 +1749,7 @@ void tst_QTextLayout::capitalization_allUpperCase() void tst_QTextLayout::capitalization_allUpperCase_newline() { - QFont font(testFont); + QFont font; font.setCapitalization(QFont::AllUppercase); QString tmp = "hello\nworld!"; @@ -1748,7 +1771,7 @@ void tst_QTextLayout::capitalization_allUpperCase_newline() void tst_QTextLayout::capitalization_allLowerCase() { - QFont font(testFont); + QFont font; font.setCapitalization(QFont::AllLowercase); QTextLayout layout("Test", font); layout.setCacheEnabled(true); @@ -1764,7 +1787,7 @@ void tst_QTextLayout::capitalization_allLowerCase() void tst_QTextLayout::capitalization_smallCaps() { - QFont font(testFont); + QFont font; font.setCapitalization(QFont::SmallCaps); QTextLayout layout("Test", font); layout.setCacheEnabled(true); @@ -1781,7 +1804,7 @@ void tst_QTextLayout::capitalization_smallCaps() void tst_QTextLayout::capitalization_capitalize() { - QFont font(testFont); + QFont font; font.setCapitalization(QFont::Capitalize); QTextLayout layout("hello\tworld", font); layout.setCacheEnabled(true); @@ -1804,7 +1827,7 @@ void tst_QTextLayout::longText() QString longText(128000, 'a'); { - QTextLayout layout(longText, testFont); + QTextLayout layout(longText); layout.setCacheEnabled(true); layout.beginLayout(); QTextLine line = layout.createLine(); @@ -1814,7 +1837,7 @@ void tst_QTextLayout::longText() } for (int cap = QFont::MixedCase; cap < QFont::Capitalize + 1; ++cap) { - QFont f(testFont); + QFont f; f.setCapitalization(QFont::Capitalization(cap)); QTextLayout layout(longText, f); layout.setCacheEnabled(true); @@ -1826,7 +1849,7 @@ void tst_QTextLayout::longText() } { - QTextLayout layout(longText, testFont); + QTextLayout layout(longText); layout.setCacheEnabled(true); layout.setFlags(Qt::TextForceLeftToRight); layout.beginLayout(); @@ -1837,7 +1860,7 @@ void tst_QTextLayout::longText() } { - QTextLayout layout(longText, testFont); + QTextLayout layout(longText); layout.setCacheEnabled(true); layout.setFlags(Qt::TextForceRightToLeft); layout.beginLayout(); @@ -1850,7 +1873,8 @@ void tst_QTextLayout::longText() void tst_QTextLayout::widthOfTabs() { - QTextEngine engine("ddd\t\t", testFont); + QTextEngine engine; + engine.text = "ddd\t\t"; engine.ignoreBidi = true; engine.itemize(); QCOMPARE(qRound(engine.width(0, 5)), qRound(engine.boundingBox(0, 5).width)); @@ -2078,7 +2102,7 @@ void tst_QTextLayout::cursorInNonStopChars() void tst_QTextLayout::justifyTrailingSpaces() { - QTextLayout layout(QStringLiteral(" t"), testFont); + QTextLayout layout(QStringLiteral(" t")); layout.setTextOption(QTextOption(Qt::AlignJustify)); layout.beginLayout(); diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index 399f82fdca..35a6a8e4e0 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -1907,9 +1907,12 @@ void tst_QTextEdit::setText() QCOMPARE(browser.toPlainText(), QLatin1String("with space")); } +#ifdef QT_BUILD_INTERNAL QT_BEGIN_NAMESPACE -extern void qt_setQtEnableTestFont(bool value); +// qfontdatabase.cpp +Q_AUTOTEST_EXPORT void qt_setQtEnableTestFont(bool value); QT_END_NAMESPACE +#endif #ifdef QT_BUILD_INTERNAL void tst_QTextEdit::fullWidthSelection_data() -- cgit v1.2.3 From d57c6611157cdcb9b27aa99cd757d05e058ac50f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 31 Jul 2015 16:24:21 +0200 Subject: MSVC2015: Disable warning C4577 ('noexcept' used with no exception handling mode specified). Fix the flood of warnings: src/corelib/global/qflags.h(52): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc now occurring since we don't have exception handling enabled. Change-Id: I05d12ee6303b4f9fceb48507fadfd7d1a5604ea4 Reviewed-by: Joerg Bornemann --- mkspecs/common/msvc-desktop.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/common/msvc-desktop.conf b/mkspecs/common/msvc-desktop.conf index e638af6b6a..2775933042 100644 --- a/mkspecs/common/msvc-desktop.conf +++ b/mkspecs/common/msvc-desktop.conf @@ -141,7 +141,7 @@ greaterThan(MSC_VER, 1899) { QMAKE_CFLAGS_WARN_ON += -w44456 -w44457 -w44458 QMAKE_CFLAGS_AVX2 = -arch:AVX2 QMAKE_CXXFLAGS += -Zc:strictStrings - QMAKE_CXXFLAGS_WARN_ON += -w44456 -w44457 -w44458 + QMAKE_CXXFLAGS_WARN_ON += -w44456 -w44457 -w44458 -wd4577 } unset(MSC_VER) -- cgit v1.2.3 From 561ccd7ca3db39f74ee0dc3966d3c6a9234186b4 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 24 Jul 2015 12:33:29 +0200 Subject: Disable #pragma diagnostic [push|pop] for gcc 4.5 Fix warnings like qalgorithms.h:40:16: warning: expected [error|warning|ignored] after `#pragma GCC diagnostic` As the comment below also indicates, #pragma GCC diagnostic [push|pop] is only supported from gcc 4.6 upwards. See also the GCC 4.6 changelog: https://gcc.gnu.org/gcc-4.6/changes.html [ChangeLog][Compiler specific Changes] GCC: Fixed a regression introduced Qt 5.5.0 that generated lots of compiler warnings in Qt public headers when using the (deprecated) version 4.5 of GCC. Change-Id: I425388b61cd5fbf464a0f7dd46ce403d35c532a4 Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 7ef2741746..4828d8596a 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1143,7 +1143,7 @@ # define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) // GCC directives work in Clang too # define QT_WARNING_DISABLE_INTEL(number) # define QT_WARNING_DISABLE_MSVC(number) -#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 405) +#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) # define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push) # define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop) # define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) -- cgit v1.2.3 From 563df0572357ea96afc0b280fb0b4331f9903508 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 10 Jul 2015 15:47:16 +0200 Subject: QSslSocket: Update error string in setSocketDescriptor() Change-Id: I03cd3886c0e2dbb07ef8d37e75df36308ee5fea5 Reviewed-by: Alex Trotsenko Reviewed-by: Richard J. Moore --- src/network/ssl/qsslsocket.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index b9b49ac26e..c15045b180 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -500,6 +500,7 @@ bool QSslSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState state bool retVal = d->plainSocket->setSocketDescriptor(socketDescriptor, state, openMode); d->cachedSocketDescriptor = d->plainSocket->socketDescriptor(); setSocketError(d->plainSocket->error()); + setErrorString(d->plainSocket->errorString()); setSocketState(state); setOpenMode(openMode); setLocalPort(d->plainSocket->localPort()); -- cgit v1.2.3 From fd10b40da27eb897ba2cbae1aa039b72da1abd78 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 31 Jul 2015 11:45:24 +0200 Subject: do not warn about "untested" Windows versions Remove the qWarning that was printed when running a Qt application on desktop Windows versions that Qt doesn't know about. This warning isn't helpful, it's only visible for command line applications and it can only be turned off by rebuilding the application with a newer Qt version. Removing the warning is also consistent with all other platforms - even non-Desktop Windows. Change-Id: If1cac92ce99974335319d0b9a74f1006069abd7a Reviewed-by: Friedemann Kleint Reviewed-by: Jake Petroules --- src/corelib/global/qglobal.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 2c57999ed0..b5bdcedaa1 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2045,8 +2045,6 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() } else if (osver.dwMajorVersion == 10 && osver.dwMinorVersion == 0) { winver = QSysInfo::WV_WINDOWS10; } else { - qWarning("Qt: Untested Windows version %d.%d detected!", - int(osver.dwMajorVersion), int(osver.dwMinorVersion)); winver = QSysInfo::WV_NT_based; } } -- cgit v1.2.3 From 5ba3309703bccc745c1c56ab8fe28529285aaca4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 24 Jul 2015 13:18:29 +0200 Subject: fix build with no built-in image handlers the handlers' .pri files added $$PWD to INCLUDEPATH to make the files self-contained when used externally, but this polluted the include path of the gui module itself, thus hiding incorrect use of QPA includes. Task-number: QTBUG-47400 Change-Id: I576469a71e8ded0b409d62687999c0fa884613f9 Reviewed-by: Joerg Bornemann --- src/gui/image/qgifhandler.pri | 1 - src/gui/image/qjpeghandler.pri | 1 - src/gui/image/qpnghandler.pri | 1 - src/gui/painting/qbrush.cpp | 2 +- src/plugins/imageformats/gif/gif.pro | 1 + src/plugins/imageformats/jpeg/jpeg.pro | 1 + 6 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/image/qgifhandler.pri b/src/gui/image/qgifhandler.pri index 6eb0751372..ec33101451 100644 --- a/src/gui/image/qgifhandler.pri +++ b/src/gui/image/qgifhandler.pri @@ -1,4 +1,3 @@ # common to plugin and built-in forms -INCLUDEPATH *= $$PWD HEADERS += $$PWD/qgifhandler_p.h SOURCES += $$PWD/qgifhandler.cpp diff --git a/src/gui/image/qjpeghandler.pri b/src/gui/image/qjpeghandler.pri index c8de33d8b4..de40c6742e 100644 --- a/src/gui/image/qjpeghandler.pri +++ b/src/gui/image/qjpeghandler.pri @@ -1,5 +1,4 @@ # common to plugin and built-in forms -INCLUDEPATH *= $$PWD HEADERS += $$PWD/qjpeghandler_p.h SOURCES += $$PWD/qjpeghandler.cpp contains(QT_CONFIG, system-jpeg) { diff --git a/src/gui/image/qpnghandler.pri b/src/gui/image/qpnghandler.pri index aca7e2c568..9ab175d628 100644 --- a/src/gui/image/qpnghandler.pri +++ b/src/gui/image/qpnghandler.pri @@ -1,4 +1,3 @@ -INCLUDEPATH *= $$PWD HEADERS += $$PWD/qpnghandler_p.h SOURCES += $$PWD/qpnghandler.cpp contains(QT_CONFIG, system-png) { diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 670717c5f1..c3a0f5c615 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -35,7 +35,7 @@ #include "qpixmap.h" #include "qbitmap.h" #include "qpixmapcache.h" -#include "qplatformpixmap.h" +#include #include "qdatastream.h" #include "qvariant.h" #include "qline.h" diff --git a/src/plugins/imageformats/gif/gif.pro b/src/plugins/imageformats/gif/gif.pro index 898f06e7c7..2a5048bb1c 100644 --- a/src/plugins/imageformats/gif/gif.pro +++ b/src/plugins/imageformats/gif/gif.pro @@ -5,6 +5,7 @@ PLUGIN_CLASS_NAME = QGifPlugin load(qt_plugin) include(../../../gui/image/qgifhandler.pri) +INCLUDEPATH += ../../../gui/image SOURCES += $$PWD/main.cpp HEADERS += $$PWD/main.h OTHER_FILES += gif.json diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro index 45bf7bbd43..e33fde1cdb 100644 --- a/src/plugins/imageformats/jpeg/jpeg.pro +++ b/src/plugins/imageformats/jpeg/jpeg.pro @@ -9,6 +9,7 @@ QT += core-private QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-jpeg)" include(../../../gui/image/qjpeghandler.pri) +INCLUDEPATH += ../../../gui/image SOURCES += main.cpp HEADERS += main.h OTHER_FILES += jpeg.json -- cgit v1.2.3 From 8fdd1e3867019fc62ee2bba3c8a892d8e701f8ed Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Mon, 3 Aug 2015 10:37:19 +0100 Subject: QLoggingCategory: fix default severity in Q_LOGGING_CATEGORY macro [ChangeLog][QtCore][QLoggingCategory] Fixed behavior of default severity passed to constructor or Q_LOGGING_CATEGORY with regards to QtInfoMsg, which was previously treated as being more severe than QtFatalMsg. This is because the code was using the numeric value of QtMsgType as a proxy for severity (via the <= operator), but the value of QtInfoMsg is greater than QtFatalMsg. Instead, the severity ordering must be dealt with explicitly. Change-Id: I5f178afc735221b00cb67c2cea4fa964bd9079ce Reviewed-by: Kai Koehne --- src/corelib/io/qloggingregistry.cpp | 8 +++++--- .../auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp | 11 +++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 11fe32529f..880e567562 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -398,10 +398,12 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat) Q_ASSERT(reg->categories.contains(cat)); QtMsgType enableForLevel = reg->categories.value(cat); + // NB: note that the numeric values of the Qt*Msg constants are + // not in severity order. bool debug = (enableForLevel == QtDebugMsg); - bool info = (enableForLevel <= QtInfoMsg); - bool warning = (enableForLevel <= QtWarningMsg); - bool critical = (enableForLevel <= QtCriticalMsg); + bool info = debug || (enableForLevel == QtInfoMsg); + bool warning = info || (enableForLevel == QtWarningMsg); + bool critical = warning || (enableForLevel == QtCriticalMsg); // hard-wired implementation of // qt.*.debug=false diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp index deef9eecbf..0f2cfd406d 100644 --- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp +++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp @@ -376,6 +376,7 @@ private slots: #ifdef Q_COMPILER_VARIADIC_MACROS Q_LOGGING_CATEGORY(TST_MACRO_2, "tst.macro.2", QtDebugMsg) Q_LOGGING_CATEGORY(TST_MACRO_3, "tst.macro.3", QtFatalMsg) + Q_LOGGING_CATEGORY(TST_MACRO_4, "tst.macro.4", QtInfoMsg) #endif void QLoggingCategoryMacro() @@ -383,6 +384,7 @@ private slots: const QLoggingCategory &cat1 = TST_MACRO_1(); QCOMPARE(cat1.categoryName(), "tst.macro.1"); QCOMPARE(cat1.isDebugEnabled(), true); + QCOMPARE(cat1.isInfoEnabled(), true); QCOMPARE(cat1.isWarningEnabled(), true); QCOMPARE(cat1.isCriticalEnabled(), true); @@ -390,14 +392,23 @@ private slots: const QLoggingCategory &cat2 = TST_MACRO_2(); QCOMPARE(cat2.categoryName(), "tst.macro.2"); QCOMPARE(cat2.isDebugEnabled(), true); + QCOMPARE(cat2.isInfoEnabled(), true); QCOMPARE(cat2.isWarningEnabled(), true); QCOMPARE(cat2.isCriticalEnabled(), true); const QLoggingCategory &cat3 = TST_MACRO_3(); QCOMPARE(cat3.categoryName(), "tst.macro.3"); QCOMPARE(cat3.isDebugEnabled(), false); + QCOMPARE(cat3.isInfoEnabled(), false); QCOMPARE(cat3.isWarningEnabled(), false); QCOMPARE(cat3.isCriticalEnabled(), false); + + const QLoggingCategory &cat4 = TST_MACRO_4(); + QCOMPARE(cat4.categoryName(), "tst.macro.4"); + QCOMPARE(cat4.isDebugEnabled(), false); + QCOMPARE(cat4.isInfoEnabled(), true); + QCOMPARE(cat4.isWarningEnabled(), true); + QCOMPARE(cat4.isCriticalEnabled(), true); #endif } -- cgit v1.2.3 From a416647e385e3d9bd394e960d108bc11d3209d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Wed, 13 May 2015 18:35:36 +0200 Subject: Android: Manually detach the thread after calling quitApp. On Android 5.0 ART will complain when we don't detach the thread before the application is about to quit (non-fatal). This is because we re-attach to call quitApp and then leave it attached. Change-Id: I4571ef5f38d92afcaf91cb920ebe121a7be7835a Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/androidjnimain.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index cf81f92e47..a04bf1eccb 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -443,6 +443,11 @@ static void *startMainMethod(void */*data*/) if (m_applicationClass) QJNIObjectPrivate::callStaticMethod(m_applicationClass, "quitApp", "()V"); + // All attached threads should be detached before returning from this function. + JavaVM *vm = QtAndroidPrivate::javaVM(); + if (vm != 0) + vm->DetachCurrentThread(); + return 0; } -- cgit v1.2.3 From 771235285c5306dd385fbd0be64ab4120a916e1c Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 31 Jul 2015 11:22:06 +0200 Subject: Allow sharing contexts in QOpenGLTexture::destroy() Checking for the exact same context is too strict. The texture is valid in sharing contexts too. Task-number: QTBUG-47521 Change-Id: Ifdf329ef5361b48abcb7c69e08acd7e35d624a08 Reviewed-by: Giuseppe D'Angelo --- src/gui/opengl/qopengltexture.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 5edaddcd6a..5271826015 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -179,8 +179,9 @@ void QOpenGLTexturePrivate::destroy() // not created or already destroyed return; } - if (QOpenGLContext::currentContext() != context) { - qWarning("Requires a valid current OpenGL context.\n" + QOpenGLContext *currentContext = QOpenGLContext::currentContext(); + if (!currentContext || !QOpenGLContext::areSharing(currentContext, context)) { + qWarning("Texture is not valid in the current context.\n" "Texture has not been destroyed"); return; } -- cgit v1.2.3 From 4067bbc24cf7a6d3058387225d9e67ad093991cd Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 14 Jul 2015 18:31:03 +0200 Subject: Fix shortcut handling with modifiers Since d7ca800a87a2291c94c6580f0cfe068bb2280caf the shortcut events were only sent once. The one sent by QGuiApplication did not create a QKeyEvent with the full native modifier state - basically the extended key event expected everywhere. That means that shortcuts on some keyboard layouts - like ctrl-shift-7 on the German keyboard (resulting in ctrl+/) - would not work when the shortcut override was tested from QGuiApplication, but then the same shortcut was sent from QApplication with the full information, so it worked the second time. Shortcuts of this type in Qt Quick were broken before. Task-number: QTBUG-47062 Change-Id: I8390b9a96d0d998a2a538ac65503702e0d299cc7 Reviewed-by: Andy Shaw Reviewed-by: Gatis Paeglis --- src/gui/kernel/qguiapplication.cpp | 10 ++++++++-- src/gui/kernel/qwindowsysteminterface.cpp | 16 ++++++++++++++++ src/gui/kernel/qwindowsysteminterface.h | 2 ++ src/plugins/platforms/cocoa/qnsview.mm | 8 ++++++-- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 8ebddf33a6..654567e7df 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1884,8 +1884,14 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE #if !defined(Q_OS_OSX) // On OS X the shortcut override is checked earlier, see: QWindowSystemInterface::handleKeyEvent() const bool checkShortcut = e->keyType == QEvent::KeyPress && window != 0; - if (checkShortcut && QWindowSystemInterface::tryHandleShortcutEvent(window, e->timestamp, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount)) - return; + if (checkShortcut) { + QKeyEvent override(QEvent::ShortcutOverride, e->key, e->modifiers, + e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers, + e->unicode, e->repeat, e->repeatCount); + override.setTimestamp(e->timestamp); + if (QWindowSystemInterface::tryHandleShortcutOverrideEvent(window, &override)) + return; + } #endif // Q_OS_OSX QKeyEvent ev(e->keyType, e->key, e->modifiers, diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index b17978cb7d..9a9eab2fe7 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -225,6 +225,22 @@ bool QWindowSystemInterface::tryHandleShortcutEvent(QWindow *w, ulong timestamp, #endif } +bool QWindowSystemInterface::tryHandleShortcutOverrideEvent(QWindow *w, QKeyEvent *ev) +{ +#ifndef QT_NO_SHORTCUT + Q_ASSERT(ev->type() == QKeyEvent::ShortcutOverride); + + QObject *focus = w->focusObject(); + if (!focus) + focus = w; + return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(focus, ev); +#else + Q_UNUSED(w) + Q_UNUSED(ev) + return false; +#endif +} + // used by QTestLib to directly send shortcuts to objects bool QWindowSystemInterface::tryHandleShortcutEventToObject(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text, bool autorep, ushort count) diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index c004fc6ef2..448c5d0893 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -78,6 +78,8 @@ public: Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); + static bool tryHandleShortcutOverrideEvent(QWindow *w, QKeyEvent *ev); + static bool tryHandleShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); static bool tryHandleShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 456c9d8c68..d802a36676 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1430,8 +1430,12 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) if (eventType == QEvent::KeyPress) { - if (m_composingText.isEmpty()) - m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutEvent(focusWindow, timestamp, keyCode, modifiers, text, [nsevent isARepeat], 1); + if (m_composingText.isEmpty()) { + QKeyEvent override(QEvent::ShortcutOverride, keyCode, modifiers, + nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1); + override.setTimestamp(timestamp); + m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutOverrideEvent(focusWindow, &override); + } QObject *fo = QGuiApplication::focusObject(); if (m_sendKeyEvent && fo) { -- cgit v1.2.3 From 5f1a0cb42a5aa509e0660fc892f2291593fb08ef Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 5 Aug 2015 08:49:16 -0700 Subject: Seed the random number generator before using QTemporaryDir Otherwise, on some systems (Windows), we'll always create the same dirs. Change-Id: Id3d5c7bf4d4c45069621ffff13f79ba91e0f974b Reviewed-by: Christopher Adams --- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 8 +++++++- tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 2b01cfd7a9..96ad78a666 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -144,12 +144,18 @@ inline bool qIsLikelyToBeNfs(int /* handle */) #endif #endif +static QString seedAndTemplate() +{ + qsrand(QDateTime::currentDateTimeUtc().toTime_t()); + return QDir::tempPath() + "/tst_qfileinfo-XXXXXX"; +} class tst_QFileInfo : public QObject { Q_OBJECT public: - tst_QFileInfo() : m_currentDir(QDir::currentPath()) {} + tst_QFileInfo() : m_currentDir(QDir::currentPath()), m_dir(seedAndTemplate()) + {} private slots: void initTestCase(); diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index 1c9add86f7..99ebf77a3d 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -103,7 +103,14 @@ static bool copyResourceFile(const QString &sourceFileName, const QString &targe // Set LANG before QCoreApplication is created Q_CONSTRUCTOR_FUNCTION(initializeLang) +static QString seedAndTemplate() +{ + qsrand(QDateTime::currentDateTimeUtc().toTime_t()); + return QDir::tempPath() + "/tst_qmimedatabase-XXXXXX"; +} + tst_QMimeDatabase::tst_QMimeDatabase() + : m_temporaryDir(seedAndTemplate()) { } -- cgit v1.2.3 From 84e1bb49513b9001950ea2b9bd24607a33a4d402 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 4 Aug 2015 12:27:40 -0700 Subject: Fix warnings about unused variables Found by ICC qglengineshadermanager.cpp(427): warning #177: variable "none" was declared but never referenced Change-Id: Id3d5c7bf4d4c45069621ffff13f758ffaf1744d7 Reviewed-by: Jake Petroules --- src/opengl/gl2paintengineex/qglengineshadermanager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 8e5d93dce2..903f34f939 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -424,11 +424,10 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS if (!inCache) shaderCache.store(newProg->program, QGLContext::currentContext()); } else { - QLatin1String none("none"); - QLatin1String br("\n"); QString error; error = QLatin1String("Shader program failed to link,"); #if defined(QT_DEBUG) + QLatin1String br("\n"); error += QLatin1String("\n Shaders Used:\n"); for (int i = 0; i < newProg->program->shaders().count(); ++i) { QGLShader *shader = newProg->program->shaders().at(i); -- cgit v1.2.3 From 007ad9e859711f36fb9c6d3b1d32acb5a3825691 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 10 Jul 2015 23:48:16 -0700 Subject: FreeBSD has pipe2, so enable it in forkfd.c Change-Id: Ib056b47dde3341ef9a52ffff13efd1a15748e44d Reviewed-by: Rafael Roquetto --- src/3rdparty/forkfd/forkfd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c index a95d486d9f..a61198a954 100644 --- a/src/3rdparty/forkfd/forkfd.c +++ b/src/3rdparty/forkfd/forkfd.c @@ -59,6 +59,10 @@ # define HAVE_WAITID 1 #endif +#if defined(__FreeBSD__) +# define HAVE_PIPE2 1 +#endif + #if defined(__APPLE__) /* Up until OS X 10.7, waitid(P_ALL, ...) will return success, but will not * fill in the details of the dead child. That means waitid is not useful to us. -- cgit v1.2.3 From 644ac04af0c3ef7d20ddc6077f85547fcba8caf5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 31 Jul 2015 17:26:07 -0700 Subject: Change how QDebug escapes QStrings in the output [ChangeLog][Important Behavior Changes] QDebug output for QStrings changed compared to Qt 5.5.0 to more closely match the output of previous Qt versions. Like Qt 5.5.0, QDebug will escape non-printable characters, the backslash and quote characters, but will no longer escape the printable characters. Task-number: QTBUG-47316 Change-Id: I52dd43c12685407bb9a6ffff13f62ef68cbc80c5 Reviewed-by: Kai Koehne --- src/corelib/io/qdebug.cpp | 43 +++++++++++++++------- tests/auto/corelib/io/qdebug/tst_qdebug.cpp | 40 +++++++++++++++++--- .../testlib/selftests/expected_badxml.lightxml | 2 +- tests/auto/testlib/selftests/expected_badxml.xml | 2 +- .../testlib/selftests/expected_badxml.xunitxml | 4 +- 5 files changed, 69 insertions(+), 22 deletions(-) diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 357d63137c..8eeac26d3b 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -174,6 +174,16 @@ void QDebug::putUcs4(uint ucs4) maybeQuote('\''); } +// These two functions return true if the character should be printed by QDebug. +// For QByteArray, this is technically identical to US-ASCII isprint(); +// for QString, we use QChar::isPrint, which requires a full UCS-4 decode. +static inline bool isPrintable(uint ucs4) +{ return QChar::isPrint(ucs4); } +static inline bool isPrintable(ushort uc) +{ return QChar::isPrint(uc); } +static inline bool isPrintable(uchar c) +{ return c >= ' ' && c < 0x7f; } + template static inline void putEscapedString(QTextStreamPrivate *d, const Char *begin, int length, bool isUnicode = true) { @@ -194,22 +204,23 @@ static inline void putEscapedString(QTextStreamPrivate *d, const Char *begin, in } if (sizeof(Char) == sizeof(QChar)) { + // Surrogate characters are category Cs (Other_Surrogate), so isPrintable = false for them int runLength = 0; while (p + runLength != end && - p[runLength] < 0x7f && p[runLength] >= 0x20 && p[runLength] != '\\' && p[runLength] != '"') + isPrintable(p[runLength]) && p[runLength] != '\\' && p[runLength] != '"') ++runLength; if (runLength) { d->write(reinterpret_cast(p), runLength); p += runLength - 1; continue; } - } else if (*p < 0x7f && *p >= 0x20 && *p != '\\' && *p != '"') { + } else if (isPrintable(*p) && *p != '\\' && *p != '"') { QChar c = QLatin1Char(*p); d->write(&c, 1); continue; } - // print as an escape sequence + // print as an escape sequence (maybe, see below for surrogate pairs) int buflen = 2; ushort buf[sizeof "\\U12345678" - 1]; buf[0] = '\\'; @@ -248,17 +259,23 @@ static inline void putEscapedString(QTextStreamPrivate *d, const Char *begin, in if ((p + 1) != end && QChar::isLowSurrogate(p[1])) { // properly-paired surrogates uint ucs4 = QChar::surrogateToUcs4(*p, p[1]); + if (isPrintable(ucs4)) { + buf[0] = *p; + buf[1] = p[1]; + buflen = 2; + } else { + buf[1] = 'U'; + buf[2] = '0'; // toHexUpper(ucs4 >> 32); + buf[3] = '0'; // toHexUpper(ucs4 >> 28); + buf[4] = toHexUpper(ucs4 >> 20); + buf[5] = toHexUpper(ucs4 >> 16); + buf[6] = toHexUpper(ucs4 >> 12); + buf[7] = toHexUpper(ucs4 >> 8); + buf[8] = toHexUpper(ucs4 >> 4); + buf[9] = toHexUpper(ucs4); + buflen = 10; + } ++p; - buf[1] = 'U'; - buf[2] = '0'; // toHexUpper(ucs4 >> 32); - buf[3] = '0'; // toHexUpper(ucs4 >> 28); - buf[4] = toHexUpper(ucs4 >> 20); - buf[5] = toHexUpper(ucs4 >> 16); - buf[6] = toHexUpper(ucs4 >> 12); - buf[7] = toHexUpper(ucs4 >> 8); - buf[8] = toHexUpper(ucs4 >> 4); - buf[9] = toHexUpper(ucs4); - buflen = 10; break; } // improperly-paired surrogates, fall through diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index 4e5cfed019..3e19e816c9 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -379,18 +379,48 @@ void tst_QDebug::qDebugQString() const qDebug().noquote().nospace() << qSetFieldWidth(8) << string; QCOMPARE(s_msg, " " + string); - string = QLatin1String("\nSm\xF8rg\xE5sbord\\"); + string = "Sm\xc3\xb8rg\xc3\xa5sbord " // Latin script + "\xce\x91\xce\xb8\xce\xae\xce\xbd\xce\xb1 " // Greek script + "\xd0\x9c\xd0\xbe\xd1\x81\xd0\xba\xd0\xb2\xd0\xb0"; // Cyrillic script qDebug().noquote().nospace() << string; QCOMPARE(s_msg, string); + // This string only contains printable characters qDebug() << string; - QCOMPARE(s_msg, QString("\"\\nSm\\u00F8rg\\u00E5sbord\\\\\"")); + QCOMPARE(s_msg, '"' + string + '"'); + + string = "\n\t\\\""; + qDebug().noquote().nospace() << string; + QCOMPARE(s_msg, string); + + // This string only contains characters that must be escaped + qDebug() << string; + QCOMPARE(s_msg, QString("\"\\n\\t\\\\\\\"\"")); + + // Unicode escapes, BMP + string = "\1" // U+0001: START OF HEADING (category Cc) + "\x7f" // U+007F: DELETE (category Cc) + "\xc2\xad" // U+00AD: SOFT HYPHEN (category Cf) + "\xef\xbb\xbf"; // U+FEFF: ZERO WIDTH NO-BREAK SPACE / BOM (category Cf) + qDebug() << string; + QCOMPARE(s_msg, QString("\"\\u0001\\u007F\\u00AD\\uFEFF\"")); + + // Unicode printable non-BMP + string = "\xf0\x90\x80\x80"; // U+10000: LINEAR B SYLLABLE B008 A (category Lo) + qDebug() << string; + QCOMPARE(s_msg, '"' + string + '"'); + + // non-BMP and non-printable + string = "\xf3\xa0\x80\x81 " // U+E0001: LANGUAGE TAG (category Cf) + "\xf4\x80\x80\x80"; // U+100000: Plane 16 Private Use (category Co) + qDebug() << string; + QCOMPARE(s_msg, QString("\"\\U000E0001 \\U00100000\"")); - // surrogate pairs (including broken pairings) - ushort utf16[] = { 0xDC00, 0xD800, 0xDC00, 'x', 0xD800, 0xDC00, 0xD800, 0 }; + // broken surrogate pairs + ushort utf16[] = { 0xDC00, 0xD800, 'x', 0xD800, 0 }; string = QString::fromUtf16(utf16); qDebug() << string; - QCOMPARE(s_msg, QString("\"\\uDC00\\U00010000x\\U00010000\\uD800\"")); + QCOMPARE(s_msg, QString("\"\\uDC00\\uD800x\\uD800\"")); } void tst_QDebug::qDebugQStringRef() const diff --git a/tests/auto/testlib/selftests/expected_badxml.lightxml b/tests/auto/testlib/selftests/expected_badxml.lightxml index e0de44f0be..94f479a79a 100644 --- a/tests/auto/testlib/selftests/expected_badxml.lightxml +++ b/tests/auto/testlib/selftests/expected_badxml.lightxml @@ -113,7 +113,7 @@ - + diff --git a/tests/auto/testlib/selftests/expected_badxml.xml b/tests/auto/testlib/selftests/expected_badxml.xml index 8667c2d9cd..c1266bfeed 100644 --- a/tests/auto/testlib/selftests/expected_badxml.xml +++ b/tests/auto/testlib/selftests/expected_badxml.xml @@ -115,7 +115,7 @@ - + diff --git a/tests/auto/testlib/selftests/expected_badxml.xunitxml b/tests/auto/testlib/selftests/expected_badxml.xunitxml index 46f4be4391..49048fdad6 100644 --- a/tests/auto/testlib/selftests/expected_badxml.xunitxml +++ b/tests/auto/testlib/selftests/expected_badxml.xunitxml @@ -30,7 +30,7 @@ - + @@ -46,6 +46,6 @@ open < tags < text]]> " mixed ]]]> up > " in < the ]]]> hopes < of triggering "< ]]]> bugs]]> - + -- cgit v1.2.3 From f549916d18540f3fcf72cc51a09197738bda5c03 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 21 Jul 2015 09:40:07 -0700 Subject: Doc: update QDebug documentation to talk about the escaping Task-number: QTBUG-47316 Change-Id: Ib306f8f647014b399b87ffff13f303badb2a7a63 Reviewed-by: Martin Smith Reviewed-by: Lars Knoll --- src/corelib/io/qdebug.cpp | 103 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 95 insertions(+), 8 deletions(-) diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 8eeac26d3b..30086b2dac 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -425,6 +425,9 @@ QDebug &QDebug::resetFormat() Disables automatic insertion of quotation characters around QChar, QString and QByteArray contents and returns a reference to the stream. + When quoting is disabled, these types are printed without quotation + characters and without escaping of non-printable characters. + \sa quote(), maybeQuote() */ @@ -444,7 +447,11 @@ QDebug &QDebug::resetFormat() \fn QDebug &QDebug::operator<<(QChar t) Writes the character, \a t, to the stream and returns a reference to the - stream. + stream. Normally, QDebug prints control characters and non-US-ASCII + characters as their C escape sequences or their Unicode value (\\u1234). To + print non-printable characters without transformation, enable the noquote() + functionality, but note that some QDebug backends may not be 8-bit clean + and may not be able to represent \c t. */ /*! @@ -535,34 +542,114 @@ QDebug &QDebug::resetFormat() \fn QDebug &QDebug::operator<<(const char *s) Writes the '\\0'-terminated string, \a s, to the stream and returns a - reference to the stream. + reference to the stream. The string is never quoted nor transformed to the + output, but note that some QDebug backends might not be 8-bit clean. */ /*! \fn QDebug &QDebug::operator<<(const QString &s) - Writes the string, \a s, to the stream and returns a reference to the stream. + Writes the string, \a s, to the stream and returns a reference to the + stream. Normally, QDebug prints the string inside quotes and transforms + non-printable characters to their Unicode values (\\u1234). + + To print non-printable characters without transformation, enable the + noquote() functionality. Note that some QDebug backends might not be 8-bit + clean. + + Output examples: + \code + QString s; + + s = "a"; + qDebug().noquote() << s; // prints: a + qDebug() << s; // prints: "a" + + s = "\"a\r\n\""; + qDebug() << s; // prints: "\"a\r\n\"" + + s = "\033"; // escape character + qDebug() << s; // prints: "\u001B" + + s = "\u00AD"; // SOFT HYPHEN + qDebug() << s; // prints: "\u00AD" + + s = "\u00E1"; // LATIN SMALL LETTER A WITH ACUTE + qDebug() << s; // prints: "á" + + s = "a\u0301"; // "a" followed by COMBINING ACUTE ACCENT + qDebug() << s; // prints: "á"; + + s = "\u0430\u0301"; // CYRILLIC SMALL LETTER A followed by COMBINING ACUTE ACCENT + qDebug() << s; // prints: "а́" + \endcode */ /*! \fn QDebug &QDebug::operator<<(const QStringRef &s) - Writes the string reference, \a s, to the stream and returns a reference to - the stream. + Writes the string, \a s, to the stream and returns a reference to the + stream. Normally, QDebug prints the string inside quotes and transforms + non-printable characters to their Unicode values (\\u1234). + + To print non-printable characters without transformation, enable the + noquote() functionality. Note that some QDebug backends might not be 8-bit + clean. + + See the QString overload for examples. */ /*! \fn QDebug &QDebug::operator<<(QLatin1String s) - Writes the Latin1-encoded string, \a s, to the stream and returns a reference - to the stream. + Writes the string, \a s, to the stream and returns a reference to the + stream. Normally, QDebug prints the string inside quotes and transforms + non-printable characters to their Unicode values (\\u1234). + + To print non-printable characters without transformation, enable the + noquote() functionality. Note that some QDebug backends might not be 8-bit + clean. + + See the QString overload for examples. */ /*! \fn QDebug &QDebug::operator<<(const QByteArray &b) Writes the byte array, \a b, to the stream and returns a reference to the - stream. + stream. Normally, QDebug prints the array inside quotes and transforms + control or non-US-ASCII characters to their C escape sequences (\\xAB). This + way, the output is always 7-bit clean and the string can be copied from the + output and pasted back into C++ sources, if necessary. + + To print non-printable characters without transformation, enable the + noquote() functionality. Note that some QDebug backends might not be 8-bit + clean. + + Output examples: + \code + QByteArray ba; + + ba = "a"; + qDebug().noquote() << ba; // prints: a + qDebug() << ba; // prints: "a" + + ba = "\"a\r\n\""; + qDebug() << ba; // prints: "\"a\r\n\"" + + ba = "\033"; // escape character + qDebug() << ba; // prints: "\x1B" + + ba = "\xC3\xA1"; + qDebug() << ba; // prints: "\xC3\xA1" + + ba = QByteArray("a\0b", 3); + qDebug() << ba // prints: "\a\x00""b" + \endcode + + Note how QDebug needed to close and reopen the string in the way C and C++ + languages concatenate string literals so that the letter 'b' is not + interpreted as part of the previous hexadecimal escape sequence. */ /*! -- cgit v1.2.3 From 01f3530650f9f6f4c08520263a3c62281d81e3fc Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 17 Jul 2015 13:27:35 -0700 Subject: Don't check if Pentium's CPUID leaf 1 exists It does. When CPUID was introduced in late 486, it already supported leaf 1. That means all Pentium-class systems (including Intel's new Quark systems) have CPUID and they have at least leaf 1. Change-Id: Ib306f8f647014b399b87ffff13f1d5d2530d9ddd Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/tools/qsimd.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index d12143b11c..4459d89e07 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -258,8 +258,12 @@ static inline uint detectProcessorFeatures() uint features = 0; int cpuidLevel = maxBasicCpuidSupported(); +#if Q_PROCESSOR_X86 < 5 if (cpuidLevel < 1) return 0; +#else + Q_ASSERT(cpuidLevel >= 1); +#endif uint cpuid01ECX = 0, cpuid01EDX = 0; cpuidFeatures01(cpuid01ECX, cpuid01EDX); -- cgit v1.2.3