From 8141d64527c5e7a1723e2caeeebb0cde4e591207 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 12 Mar 2016 11:34:48 +0100 Subject: [PATCH 001/236] qgrayraster: fix UBs involving << with a negative LHS Left-shifts of negative values are undefined in C++. In particular, they don't behave arithmetically. Reported by UBSan: qgrayraster.c:510:19: runtime error: left shift of negative value -1/-42 qgrayraster.c:537:26: runtime error: left shift of negative value -1/-4/-128 qgrayraster.c:538:26: runtime error: left shift of negative value -1/-4/-128 qgrayraster.c:641:28: runtime error: left shift of negative value -1/-42 qgrayraster.c:676:44: runtime error: left shift of negative value -1/-4/-5/-14/-129 qgrayraster.c:807:19: runtime error: left shift of negative value -1/-42 qgrayraster.c:1101:9: runtime error: left shift of negative value -32/-46/-224/-8160 qgrayraster.c:1102:9: runtime error: left shift of negative value -32/-2626 qgrayraster.c:1454:36: runtime error: left shift of negative value -32/-96/-224/-466/-2626/-8160 qgrayraster.c:1535:30: runtime error: left shift of negative value -32/-46/-224/-2626/-8160 Fix by using ordinary multiplication instead, because negative left-hand-side values don't look like they are an error. Change-Id: I2e96de51adb4a030de8a49869ddd98a31dab31b3 Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qgrayraster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index b536028fe37..5ce18955418 100644 --- a/src/gui/painting/qgrayraster.c +++ b/src/gui/painting/qgrayraster.c @@ -202,13 +202,13 @@ #define ONE_PIXEL ( 1L << PIXEL_BITS ) #define PIXEL_MASK ( -1L << PIXEL_BITS ) #define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) ) -#define SUBPIXELS( x ) ( (TPos)(x) << PIXEL_BITS ) +#define SUBPIXELS( x ) ( (TPos)(x) * ( 1 << PIXEL_BITS ) ) #define FLOOR( x ) ( (x) & -ONE_PIXEL ) #define CEILING( x ) ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL ) #define ROUND( x ) ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL ) #if PIXEL_BITS >= 6 -#define UPSCALE( x ) ( (x) << ( PIXEL_BITS - 6 ) ) +#define UPSCALE( x ) ( (x) * ( 1 << ( PIXEL_BITS - 6 ) ) ) #define DOWNSCALE( x ) ( (x) >> ( PIXEL_BITS - 6 ) ) #else #define UPSCALE( x ) ( (x) >> ( 6 - PIXEL_BITS ) ) From 8a33077853e851e2795476cd502444c2d8535f9a Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 28 Jul 2016 12:25:59 +0200 Subject: [PATCH 002/236] QUrl: fix resolved() for data URLs They look relative because the path doesn't start with a '/' but they have a scheme so they shouldn't be combined as if it was one absolute and one relative URL. [ChangeLog][QtCore][QUrl] QUrl::resolved() no longer treats a URL with a scheme as a relative URL if it matches this URL's scheme. This special casing was incompatible with RFC 3986 and broke resolving data: URLs, for instance. Change-Id: I3758d3a2141cea7c6d13514243eb8dee5d510dd0 Reviewed-by: Thiago Macieira --- src/corelib/io/qurl.cpp | 3 +-- tests/auto/corelib/io/qurl/tst_qurl.cpp | 16 +++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 2672de24f2c..1fe529d48d0 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3167,8 +3167,7 @@ QUrl QUrl::resolved(const QUrl &relative) const if (!relative.d) return *this; QUrl t; - // be non strict and allow scheme in relative url - if (!relative.d->scheme.isEmpty() && relative.d->scheme != d->scheme) { + if (!relative.d->scheme.isEmpty()) { t = relative; t.detach(); } else { diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index eb29646053a..8f99047df34 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -903,13 +903,11 @@ void tst_QUrl::resolving_data() // Some parsers allow the scheme name to be present in a relative URI // reference if it is the same as the base URI scheme. This is - // considered to be a loophole in prior specifications of partial URI - // [RFC1630]. Its use should be avoided, but is allowed for backward - // compatibility. - // For strict parsers : -// QTest::newRow("http:g [for strict parsers]") << QString::fromLatin1("http://a/b/c/d;p?q") << QString::fromLatin1("http:g") << QString::fromLatin1("http:g"); - // For backward compatibility : - QTest::newRow("http:g [for backward compatibility]") << QString::fromLatin1("http://a/b/c/d;p?q") << QString::fromLatin1("http:g") << QString::fromLatin1("http://a/b/c/g"); + // considered to be a loophole in prior specifications of partial URI [RFC1630], + //QTest::newRow("http:g [for backward compatibility]") << QString::fromLatin1("http://a/b/c/d;p?q") << QString::fromLatin1("http:g") << QString::fromLatin1("http://a/b/c/g"); + // However we don't do that anymore, as per RFC3986, in order for the data:subpage testcase below to work. + QTest::newRow("http:g") << QString::fromLatin1("http://a/b/c/d;p?q") << QString::fromLatin1("http:g") << QString::fromLatin1("http:g"); + QTest::newRow("data:subpage") << QString::fromLatin1("data:text/plain, main page") << QString::fromLatin1("data:text/plain, subpage") << QString::fromLatin1("data:text/plain, subpage"); // Resolve relative with relative QTest::newRow("../a (1)") << QString::fromLatin1("b") << QString::fromLatin1("../a") << QString::fromLatin1("a"); @@ -921,6 +919,10 @@ void tst_QUrl::resolving_data() QTest::newRow("../a (6)") << QString::fromLatin1("/b/a") << QString::fromLatin1("../a") << QString::fromLatin1("/a"); QTest::newRow("../a (7)") << QString::fromLatin1("/b/c/a") << QString::fromLatin1("../a") << QString::fromLatin1("/b/a"); QTest::newRow("../a (8)") << QString::fromLatin1("/b") << QString::fromLatin1("/a") << QString::fromLatin1("/a"); + + // More tests from KDE + QTest::newRow("brackets") << QString::fromLatin1("http://www.calorieking.com/personal/diary/") << QString::fromLatin1("/personal/diary/rpc.php?C=jsrs1&F=getDiaryDay&P0=[2006-3-8]&U=1141858921458") << QString::fromLatin1("http://www.calorieking.com/personal/diary/rpc.php?C=jsrs1&F=getDiaryDay&P0=[2006-3-8]&U=1141858921458"); + QTest::newRow("javascript")<< QString::fromLatin1("http://www.youtube.com/?v=JvOSnRD5aNk") << QString::fromLatin1("javascript:window.location+\"__flashplugin_unique__\"") << QString::fromLatin1("javascript:window.location+%22__flashplugin_unique__%22"); } void tst_QUrl::resolving() From f0685992a3412b059a0952ac591f40856ffffb6f Mon Sep 17 00:00:00 2001 From: Konstantin Shegunov Date: Sun, 24 Jul 2016 22:14:49 +0300 Subject: [PATCH 003/236] Docs changed to reflect that valueName is required with value parsing When the option expects a value the valueName parameter of the constructor isn't optional; it must be set. This requirement is made explicit in the documentation. Task-number: QTBUG-54855 Change-Id: I190884aff2fa8e96bc5c5e82cdfed85be761d6e3 Reviewed-by: Thiago Macieira Reviewed-by: David Faure --- src/corelib/tools/qcommandlineoption.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp index 8c0ba8cb2be..93d20577c34 100644 --- a/src/corelib/tools/qcommandlineoption.cpp +++ b/src/corelib/tools/qcommandlineoption.cpp @@ -144,7 +144,7 @@ QCommandLineOption::QCommandLineOption(const QStringList &names) The description is set to \a description. It is customary to add a "." at the end of the description. - In addition, the \a valueName can be set if the option expects a value. + In addition, the \a valueName needs to be set if the option expects a value. The default value for the option is set to \a defaultValue. In Qt versions before 5.4, this constructor was \c explicit. In Qt 5.4 @@ -180,7 +180,7 @@ QCommandLineOption::QCommandLineOption(const QString &name, const QString &descr The description is set to \a description. It is customary to add a "." at the end of the description. - In addition, the \a valueName can be set if the option expects a value. + In addition, the \a valueName needs to be set if the option expects a value. The default value for the option is set to \a defaultValue. In Qt versions before 5.4, this constructor was \c explicit. In Qt 5.4 From 068ce0b10c700df35ce10dee71e76d24a23694f5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 12 Mar 2016 11:34:48 +0100 Subject: [PATCH 004/236] QRasterizer: fix UBs involving << with a negative LHS Left-shifts of negative values are undefined in C++. In particular, they don't behave arithmetically. Reported by UBSan: qrasterizer.cpp:609:48: runtime error: left shift of negative value -640/-2240 qrasterizer.cpp:982:38: runtime error: left shift of negative value -2 Fix by using ordinary multiplication instead, because negative left-hand-side values don't look like they are an error. No errors were actually reported for a.y << 10, but I changed it nonetheless, since all a missing error means is that the test data didn't excercise this code path with negative Y values. Change-Id: I1fa9deca263f12206a3f7eab6ad875fc3242269d Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qrasterizer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 34d72bf4930..9411a200004 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE typedef int Q16Dot16; #define Q16Dot16ToFloat(i) ((i)/65536.) #define FloatToQ16Dot16(i) (int)((i) * 65536.) -#define IntToQ16Dot16(i) ((i) << 16) +#define IntToQ16Dot16(i) ((i) * (1 << 16)) #define Q16Dot16ToInt(i) ((i) >> 16) #define Q16Dot16Factor 65536 @@ -606,7 +606,7 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b) int iBottom = qMin(m_bottom, int((b.y - 32 - rounding) >> 6)); if (iTop <= iBottom) { - Q16Dot16 aFP = Q16Dot16Factor/2 + (a.x << 10) - rounding; + Q16Dot16 aFP = Q16Dot16Factor/2 + (a.x * (1 << 10)) - rounding; if (b.x == a.x) { Line line = { qBound(m_leftFP, aFP, m_rightFP), 0, iTop, iBottom, winding }; @@ -618,7 +618,7 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b) Q16Dot16 xFP = aFP + Q16Dot16Multiply(slopeFP, IntToQ16Dot16(iTop) - + Q16Dot16Factor/2 - (a.y << 10)); + + Q16Dot16Factor/2 - (a.y * (1 << 10))); if (clip(xFP, iTop, iBottom, slopeFP, m_leftFP, winding)) return; From 8740a87841689c97dc92f7600b33c260e4bf7f2c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 30 Jul 2016 22:20:26 +0300 Subject: [PATCH 005/236] QAbstractItemView: Fix UB (invalid downcast) Just use QWidgetPrivate::get() instead. Fixes UBSan error: qabstractitemview.cpp:3814:61: runtime error: downcast of address 0x2b859001aa70 which does not point to an object of type 'QAbstractItemView' 0x2b859001aa70: note: object is of type 'QWidget' Change-Id: I0460fd8a0681e122d440755ebf07018d273b93f8 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/itemviews/qabstractitemview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index f31f2f5256e..cb40eae9a2f 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -3821,7 +3821,7 @@ void QAbstractItemView::doAutoScroll() int horizontalValue = horizontalScroll->value(); QPoint pos = d->viewport->mapFromGlobal(QCursor::pos()); - QRect area = static_cast(d->viewport)->d_func()->clipRect(); // access QWidget private by bending C++ rules + QRect area = QWidgetPrivate::get(d->viewport)->clipRect(); // do the scrolling if we are in the scroll margins if (pos.y() - area.top() < margin) From b37539442f58fc7c0ba54380f07b132a15a037e8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 30 Jul 2016 09:27:37 +0300 Subject: [PATCH 006/236] QColor: Fix UB (left shift of negative number) If hex2int(const char*) is called with invalid input, it is expected to return a negative value. However, it didn't check the return value of h2i() before attempting a left-shift on it, leading to UB when the first digit was already invalid. UBSan agrees: qcolor_p.cpp:55:23: runtime error: left shift of negative value -1 This is particularly worrisome as the function can be called with unsanitized input. Fix by checking each value for non-negativity, returning -1 early when errors are detected. Also port to QtMiscUtils::fromHex() and add some docs. Change-Id: I33dbc157ffb4fbfba27113a0a008eef35c1055f7 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/painting/qcolor_p.cpp | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/gui/painting/qcolor_p.cpp b/src/gui/painting/qcolor_p.cpp index 4ebe74ce4f6..b63c34aab7e 100644 --- a/src/gui/painting/qcolor_p.cpp +++ b/src/gui/painting/qcolor_p.cpp @@ -34,31 +34,37 @@ #include "qglobal.h" #include "qrgb.h" #include "qstringlist.h" +#include "private/qtools_p.h" #include QT_BEGIN_NAMESPACE -static inline int h2i(char hex) -{ - if (hex >= '0' && hex <= '9') - return hex - '0'; - if (hex >= 'a' && hex <= 'f') - return hex - 'a' + 10; - if (hex >= 'A' && hex <= 'F') - return hex - 'A' + 10; - return -1; -} - +/*! + \internal + If s[0..1] is a valid hex number, returns its integer value, + otherwise returns -1. + */ static inline int hex2int(const char *s) { - return (h2i(s[0]) << 4) | h2i(s[1]); + const int hi = QtMiscUtils::fromHex(s[0]); + if (hi < 0) + return -1; + const int lo = QtMiscUtils::fromHex(s[1]); + if (lo < 0) + return -1; + return (hi << 4) | lo; } +/*! + \internal + If s is a valid hex digit, returns its integer value, + multiplied by 0x11, otherwise returns -1. + */ static inline int hex2int(char s) { - int h = h2i(s); - return (h << 4) | h; + const int h = QtMiscUtils::fromHex(s); + return h < 0 ? h : (h << 4) | h; } bool qt_get_hex_rgb(const char *name, QRgb *rgb) From 4ac28eda8edaff06ee7cb310108bfb9d9f1984ff Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 31 Jul 2016 07:40:41 +0300 Subject: [PATCH 007/236] QTreeWidget: Fix UB (member call) Before actually deleting QTreeWidgetItems from QTree{Model,Widget{,Item}} dtors, their 'view' members need to be set to nullptr, lest they attempt to delist themselves from the list of top-level items. For the QTreeModel::headerItem, this was forgottten. Found by UBSan: qtreewidget.cpp:1488:70: runtime error: member call on address 0x7ffd843dd470 which does not point to an object of type 'QAbstractItemView' 0x7ffd843dd470: note: object is of type 'QWidget' #0 0x2b83d5b48323 in QTreeWidgetItem::~QTreeWidgetItem() src/widgets/itemviews/qtreewidget.cpp:1488 #1 0x2b83d5b48860 in QTreeWidgetItem::~QTreeWidgetItem() src/widgets/itemviews/qtreewidget.cpp:1535 #2 0x2b83d5b41659 in QTreeModel::~QTreeModel() src/widgets/itemviews/qtreewidget.cpp:143 #3 0x2b83d5b41bc0 in QTreeModel::~QTreeModel() src/widgets/itemviews/qtreewidget.cpp:146 #4 0x2b83df220747 in QObjectPrivate::deleteChildren() src/corelib/kernel/qobject.cpp:2010 #5 0x2b83d4603dd0 in QWidget::~QWidget() src/widgets/kernel/qwidget.cpp:1675 #6 0x2b83d4d76066 in QFrame::~QFrame() src/widgets/widgets/qframe.cpp:256 #7 0x2b83d5270442 in QAbstractScrollArea::~QAbstractScrollArea() src/widgets/widgets/qabstractscrollarea.cpp:575 #8 0x2b83d5733eb9 in QAbstractItemView::~QAbstractItemView() src/widgets/itemviews/qabstractitemview.cpp:617 #9 0x2b83d598b216 in QTreeView::~QTreeView() src/widgets/itemviews/qtreeview.cpp:206 #10 0x2b83d5b218b6 in QTreeWidget::~QTreeWidget() src/widgets/itemviews/qtreewidget.cpp:2549 #11 0x4eef42 in tst_QTreeWidgetItemIterator::updateIfModifiedFromWidget() tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp:1089 Change-Id: I57c277adee8c99eb07b274d6d8ea1f6fbf3575be Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/itemviews/qtreewidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index f33dd6af17c..e0f6a3d5d1f 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -140,6 +140,7 @@ QTreeModel::QTreeModel(QTreeModelPrivate &dd, QTreeWidget *parent) QTreeModel::~QTreeModel() { clear(); + headerItem->view = Q_NULLPTR; delete headerItem; rootItem->view = 0; delete rootItem; From b55221cf50dde1c71d0a63380f63475f90c79a0b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 31 Jul 2016 09:04:07 +0300 Subject: [PATCH 008/236] Fix UB (invalid enum value) in tst_QTreeView As reported by UBSan: tst_qtreeview.cpp:663:5: runtime error: load of value 4294967295, which is not a valid value for type 'DragDropMode' Instead of abusing -1 to indicate to not set the dragDropMode, use a separate boolean field in tha data. Change-Id: I13e7539c858f3b2462d57d660062ef3cb7aec61b Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../itemviews/qtreeview/tst_qtreeview.cpp | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index ea85c8e0574..bd6939b9776 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -669,33 +669,34 @@ void tst_QTreeView::dragDropModeFromDragEnabledAndAcceptDrops_data() QTest::addColumn("dragEnabled"); QTest::addColumn("acceptDrops"); QTest::addColumn("dragDropMode"); - QTest::addColumn("setBehavior"); + QTest::addColumn("setBehavior"); + QTest::addColumn("behavior"); - QTest::newRow("NoDragDrop -1") << false << false << QAbstractItemView::NoDragDrop << QAbstractItemView::DragDropMode(-1); - QTest::newRow("NoDragDrop 0") << false << false << QAbstractItemView::NoDragDrop << QAbstractItemView::NoDragDrop; - QTest::newRow("NoDragDrop 1") << false << false << QAbstractItemView::NoDragDrop << QAbstractItemView::DragOnly; - QTest::newRow("NoDragDrop 2") << false << false << QAbstractItemView::NoDragDrop << QAbstractItemView::DropOnly; - QTest::newRow("NoDragDrop 3") << false << false << QAbstractItemView::NoDragDrop << QAbstractItemView::DragDrop; - QTest::newRow("NoDragDrop 4") << false << false << QAbstractItemView::NoDragDrop << QAbstractItemView::InternalMove; - QTest::newRow("DragOnly -1") << true << false << QAbstractItemView::DragOnly << QAbstractItemView::DragDropMode(-1); - QTest::newRow("DragOnly 0") << true << false << QAbstractItemView::DragOnly << QAbstractItemView::NoDragDrop; - QTest::newRow("DragOnly 1") << true << false << QAbstractItemView::DragOnly << QAbstractItemView::DragOnly; - QTest::newRow("DragOnly 2") << true << false << QAbstractItemView::DragOnly << QAbstractItemView::DropOnly; - QTest::newRow("DragOnly 3") << true << false << QAbstractItemView::DragOnly << QAbstractItemView::DragDrop; - QTest::newRow("DragOnly 4") << true << false << QAbstractItemView::DragOnly << QAbstractItemView::InternalMove; - QTest::newRow("DropOnly -1") << false << true << QAbstractItemView::DropOnly << QAbstractItemView::DragDropMode(-1); - QTest::newRow("DropOnly 0") << false << true << QAbstractItemView::DropOnly << QAbstractItemView::NoDragDrop; - QTest::newRow("DropOnly 1") << false << true << QAbstractItemView::DropOnly << QAbstractItemView::DragOnly; - QTest::newRow("DropOnly 2") << false << true << QAbstractItemView::DropOnly << QAbstractItemView::DropOnly; - QTest::newRow("DropOnly 3") << false << true << QAbstractItemView::DropOnly << QAbstractItemView::DragDrop; - QTest::newRow("DropOnly 4") << false << true << QAbstractItemView::DropOnly << QAbstractItemView::InternalMove; - QTest::newRow("DragDrop -1") << true << true << QAbstractItemView::DragDrop << QAbstractItemView::DragDropMode(-1); - QTest::newRow("DragDrop 0") << true << true << QAbstractItemView::DragDrop << QAbstractItemView::DragDropMode(-1); - QTest::newRow("DragDrop 1") << true << true << QAbstractItemView::DragDrop << QAbstractItemView::NoDragDrop; - QTest::newRow("DragDrop 2") << true << true << QAbstractItemView::DragDrop << QAbstractItemView::DragOnly; - QTest::newRow("DragDrop 3") << true << true << QAbstractItemView::DragDrop << QAbstractItemView::DropOnly; - QTest::newRow("DragDrop 4") << true << true << QAbstractItemView::DragDrop << QAbstractItemView::DragDrop; - QTest::newRow("DragDrop 5") << true << true << QAbstractItemView::InternalMove << QAbstractItemView::InternalMove; + QTest::newRow("NoDragDrop -1") << false << false << QAbstractItemView::NoDragDrop << false << QAbstractItemView::DragDropMode(); + QTest::newRow("NoDragDrop 0") << false << false << QAbstractItemView::NoDragDrop << true << QAbstractItemView::NoDragDrop; + QTest::newRow("NoDragDrop 1") << false << false << QAbstractItemView::NoDragDrop << true << QAbstractItemView::DragOnly; + QTest::newRow("NoDragDrop 2") << false << false << QAbstractItemView::NoDragDrop << true << QAbstractItemView::DropOnly; + QTest::newRow("NoDragDrop 3") << false << false << QAbstractItemView::NoDragDrop << true << QAbstractItemView::DragDrop; + QTest::newRow("NoDragDrop 4") << false << false << QAbstractItemView::NoDragDrop << true << QAbstractItemView::InternalMove; + QTest::newRow("DragOnly -1") << true << false << QAbstractItemView::DragOnly << false << QAbstractItemView::DragDropMode(); + QTest::newRow("DragOnly 0") << true << false << QAbstractItemView::DragOnly << true << QAbstractItemView::NoDragDrop; + QTest::newRow("DragOnly 1") << true << false << QAbstractItemView::DragOnly << true << QAbstractItemView::DragOnly; + QTest::newRow("DragOnly 2") << true << false << QAbstractItemView::DragOnly << true << QAbstractItemView::DropOnly; + QTest::newRow("DragOnly 3") << true << false << QAbstractItemView::DragOnly << true << QAbstractItemView::DragDrop; + QTest::newRow("DragOnly 4") << true << false << QAbstractItemView::DragOnly << true << QAbstractItemView::InternalMove; + QTest::newRow("DropOnly -1") << false << true << QAbstractItemView::DropOnly << false << QAbstractItemView::DragDropMode(); + QTest::newRow("DropOnly 0") << false << true << QAbstractItemView::DropOnly << true << QAbstractItemView::NoDragDrop; + QTest::newRow("DropOnly 1") << false << true << QAbstractItemView::DropOnly << true << QAbstractItemView::DragOnly; + QTest::newRow("DropOnly 2") << false << true << QAbstractItemView::DropOnly << true << QAbstractItemView::DropOnly; + QTest::newRow("DropOnly 3") << false << true << QAbstractItemView::DropOnly << true << QAbstractItemView::DragDrop; + QTest::newRow("DropOnly 4") << false << true << QAbstractItemView::DropOnly << true << QAbstractItemView::InternalMove; + QTest::newRow("DragDrop -1") << true << true << QAbstractItemView::DragDrop << false << QAbstractItemView::DragDropMode(); + QTest::newRow("DragDrop 0") << true << true << QAbstractItemView::DragDrop << false << QAbstractItemView::DragDropMode(); + QTest::newRow("DragDrop 1") << true << true << QAbstractItemView::DragDrop << true << QAbstractItemView::NoDragDrop; + QTest::newRow("DragDrop 2") << true << true << QAbstractItemView::DragDrop << true << QAbstractItemView::DragOnly; + QTest::newRow("DragDrop 3") << true << true << QAbstractItemView::DragDrop << true << QAbstractItemView::DropOnly; + QTest::newRow("DragDrop 4") << true << true << QAbstractItemView::DragDrop << true << QAbstractItemView::DragDrop; + QTest::newRow("DragDrop 5") << true << true << QAbstractItemView::InternalMove << true << QAbstractItemView::InternalMove; } void tst_QTreeView::dragDropModeFromDragEnabledAndAcceptDrops() @@ -703,13 +704,14 @@ void tst_QTreeView::dragDropModeFromDragEnabledAndAcceptDrops() QFETCH(bool, acceptDrops); QFETCH(bool, dragEnabled); QFETCH(QAbstractItemView::DragDropMode, dragDropMode); - QFETCH(QAbstractItemView::DragDropMode, setBehavior); + QFETCH(bool, setBehavior); + QFETCH(QAbstractItemView::DragDropMode, behavior); QTreeView view; QCOMPARE(view.dragDropMode(), QAbstractItemView::NoDragDrop); - if (setBehavior != QAbstractItemView::DragDropMode(-1)) - view.setDragDropMode(setBehavior); + if (setBehavior) + view.setDragDropMode(behavior); view.setAcceptDrops(acceptDrops); view.setDragEnabled(dragEnabled); From 3f1048cca783749c7da9a9f8b3a61959ed35a0de Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 28 Jul 2016 13:41:43 +0200 Subject: [PATCH 009/236] Android: Fix CJK text with Android 7.0 In Android 7, some fonts are packed in .ttc files. We fix this simply by including them when populating the font database. Freetype supports this and in fact, QBasicFontDatabase::populateFontDatabase() also adds *.ttc. [ChangeLog][Android] Fixed CJK font resolution on Android 7. Task-number: QTBUG-53511 Change-Id: Iebe51b0e6ba2d6987693306cd9a12013ce886b58 Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/qandroidplatformfontdatabase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp index 5725f5793e5..86d50f487bf 100644 --- a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp +++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp @@ -54,7 +54,8 @@ void QAndroidPlatformFontDatabase::populateFontDatabase() QStringList nameFilters; nameFilters << QLatin1String("*.ttf") - << QLatin1String("*.otf"); + << QLatin1String("*.otf") + << QLatin1String("*.ttc"); foreach (const QFileInfo &fi, dir.entryInfoList(nameFilters, QDir::Files)) { const QByteArray file = QFile::encodeName(fi.absoluteFilePath()); From 6f423555eba55ccdf7287071e10576bc1b687fd2 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 1 Aug 2016 13:39:53 +0200 Subject: [PATCH 010/236] REG: Fix unwanted cache flush in Freetype engine The Freetype cache was almost completely disabled by 134c6db8587a8ce156d4fa31ffa62605821851b2 because after that change, the lockedAlphaMapForGlyph() function would no longer cut off early for empty glyphs like spaces, but rather go through all alpha map functions before it realized that there was nothing to render. This would in turn invalidate the cache for every empty glyph, causing all glyphs to be rerendered for every isolated word. This change adds back a cut off. This is only needed in the lockedAlphaMapForGlyph() function, since the superclass implementation of the other alpha map functions already contains a cut off for width/height == 0. [ChangeLog][Qt Gui][Text] Fixed a performance regression in Freetype engine that was introduced in Qt 5.5. Change-Id: I381285939909e99cc5fb5f3497fecf9fa871f29a Task-number: QTBUG-49452 Reviewed-by: Simon Hausmann --- src/gui/text/qfontengine_ft.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 4de41dfa99f..7c878da27f5 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1716,7 +1716,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEngine::GlyphFormat glyphFormat) { - if (glyph == Q_NULLPTR) + if (glyph == Q_NULLPTR || glyph->height == 0 || glyph->width == 0) return QImage(); QImage::Format format = QImage::Format_Invalid; @@ -1764,11 +1764,15 @@ QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixe currentlyLockedAlphaMap = alphaMapFromGlyphData(glyph, neededFormat); + const bool glyphHasGeometry = glyph != Q_NULLPTR && glyph->height != 0 && glyph->width != 0; if (!cacheEnabled && glyph != &emptyGlyph) { currentlyLockedAlphaMap = currentlyLockedAlphaMap.copy(); delete glyph; } + if (!glyphHasGeometry) + return Q_NULLPTR; + if (currentlyLockedAlphaMap.isNull()) return QFontEngine::lockedAlphaMapForGlyph(glyphIndex, subPixelPosition, neededFormat, t, offset); From 49c892328223dfa2502b462d8e5e8e181f4f6cd5 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 25 Jul 2016 13:24:59 +0200 Subject: [PATCH 011/236] QSortFilterProxyModel: Don't forward the hint from source's layoutChanged signal We can't forward a VerticalSortHint or HorizontalSortHint hint, because we might be filtering extra items. The documentation of QAbstractItemModel::LayoutChangeHint states: Note that VerticalSortHint and HorizontalSortHint carry the meaning that items are being moved within the same parent, not moved to a different parent in the model, and not filtered out or in. And some of the views rely on this assumption (QQmlDelegateModel for example) What happens in the test is the following: - 'model' emit the dataChanged signal when its data is changed. - 'proxi1' QSortFilterProxyModelPrivate::_q_sourceDataChanged does not forward the dataChanged signal imediatly, it will instead first re-sort the model and call layoutAboutToBeChanged / layouChanged with the VerticalSortHint - 'proxy2' would forward the layoutAboutToBeChanged with the hint, but in QSortFilterProxyModelPrivate::_q_sourceLayoutChanged, it will redo the mapping which will cause the changed data to be filtered. So proxy2 can't forward the VerticalSortHint as it removed rows in the process. Change-Id: I20b6983e9d18bf7509fe6144c74f37d24e4a18c2 Reviewed-by: Tobias Koenig Reviewed-by: David Faure --- .../itemmodels/qsortfilterproxymodel.cpp | 6 ++- .../tst_qsortfilterproxymodel.cpp | 52 +++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index 0771fd0e301..f264ad015d3 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -1322,6 +1322,7 @@ void QSortFilterProxyModelPrivate::_q_sourceReset() void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList &sourceParents, QAbstractItemModel::LayoutChangeHint hint) { Q_Q(QSortFilterProxyModel); + Q_UNUSED(hint); // We can't forward Hint because we might filter additional rows or columns saved_persistent_indexes.clear(); QList parents; @@ -1340,7 +1341,7 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QListlayoutAboutToBeChanged(parents, hint); + emit q->layoutAboutToBeChanged(parents); if (persistent.indexes.isEmpty()) return; @@ -1350,6 +1351,7 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList &sourceParents, QAbstractItemModel::LayoutChangeHint hint) { Q_Q(QSortFilterProxyModel); + Q_UNUSED(hint); // We can't forward Hint because we might filter additional rows or columns // Optimize: We only actually have to clear the mapping related to the contents of // sourceParents, not everything. @@ -1379,7 +1381,7 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QListlayoutChanged(parents, hint); + emit q->layoutChanged(parents); } void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeInserted( diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 0302ae5cbf5..5928ee8688a 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -148,6 +148,7 @@ private slots: void noMapAfterSourceDelete(); void forwardDropApi(); void canDropMimeData(); + void filterHint(); protected: void buildHierarchy(const QStringList &data, QAbstractItemModel *model); @@ -3804,6 +3805,12 @@ void tst_QSortFilterProxyModel::moveSourceRows() QCOMPARE(filterBeforeParents.size(), 1); QCOMPARE(filterAfterParents.size(), 1); + QCOMPARE( + filterBeforeParentLayoutSpy.first().at(1).value(), + QAbstractItemModel::NoLayoutChangeHint); + QCOMPARE(filterAfterParentLayoutSpy.first().at(1).value(), + QAbstractItemModel::NoLayoutChangeHint); + QCOMPARE(filterBothBeforeParentLayoutSpy.size(), 0); QCOMPARE(filterBothAfterParentLayoutSpy.size(), 0); } @@ -4124,5 +4131,50 @@ void tst_QSortFilterProxyModel::resortingDoesNotBreakTreeModels() QCOMPARE(proxy.rowCount(pi1), 1); } +void tst_QSortFilterProxyModel::filterHint() +{ + // test that a filtering model does not emit layoutChanged with a hint + QStringListModel model(QStringList() << "one" + << "two" + << "three" + << "four" + << "five" + << "six"); + QSortFilterProxyModel proxy1; + proxy1.setSourceModel(&model); + proxy1.setSortRole(Qt::DisplayRole); + proxy1.setDynamicSortFilter(true); + proxy1.sort(0); + + QSortFilterProxyModel proxy2; + proxy2.setSourceModel(&proxy1); + proxy2.setFilterRole(Qt::DisplayRole); + proxy2.setFilterRegExp("^[^ ]*$"); + proxy2.setDynamicSortFilter(true); + + QSignalSpy proxy1BeforeSpy(&proxy1, &QSortFilterProxyModel::layoutAboutToBeChanged); + QSignalSpy proxy1AfterSpy(&proxy1, &QSortFilterProxyModel::layoutChanged); + QSignalSpy proxy2BeforeSpy(&proxy2, &QSortFilterProxyModel::layoutAboutToBeChanged); + QSignalSpy proxy2AfterSpy(&proxy2, &QSortFilterProxyModel::layoutChanged); + + model.setData(model.index(2), QStringLiteral("modified three"), Qt::DisplayRole); + + // The first proxy was re-sorted as one item as changed. + QCOMPARE(proxy1BeforeSpy.size(), 1); + QCOMPARE(proxy1BeforeSpy.first().at(1).value(), + QAbstractItemModel::VerticalSortHint); + QCOMPARE(proxy1AfterSpy.size(), 1); + QCOMPARE(proxy1AfterSpy.first().at(1).value(), + QAbstractItemModel::VerticalSortHint); + + // But the second proxy must not have the VerticalSortHint since an item was filtered + QCOMPARE(proxy2BeforeSpy.size(), 1); + QCOMPARE(proxy2BeforeSpy.first().at(1).value(), + QAbstractItemModel::NoLayoutChangeHint); + QCOMPARE(proxy2AfterSpy.size(), 1); + QCOMPARE(proxy2AfterSpy.first().at(1).value(), + QAbstractItemModel::NoLayoutChangeHint); +} + QTEST_MAIN(tst_QSortFilterProxyModel) #include "tst_qsortfilterproxymodel.moc" From d38f86e50b01c6dd60f5a97355031e08d6a47d18 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 30 Jul 2016 09:36:04 +0300 Subject: [PATCH 012/236] QColor: remove 158 avoidable relocations Instead of storing a pointer to a string, store the string in the RGBData struct. It's not as efficient as in other such cases, because one string is particularly long, but it's still more than acceptable. Text size increases slightly, but data size decreases a lot (can't say by how much, exactly, as I'm on a UBSan build). Change-Id: I1df2985fd1ebfccd84b48315d8d319dd9e25c8e7 Reviewed-by: Gunnar Sletta --- src/gui/painting/qcolor_p.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qcolor_p.cpp b/src/gui/painting/qcolor_p.cpp index b63c34aab7e..2b9ef6030ea 100644 --- a/src/gui/painting/qcolor_p.cpp +++ b/src/gui/painting/qcolor_p.cpp @@ -130,7 +130,7 @@ bool qt_get_hex_rgb(const QChar *str, int len, QRgb *rgb) #define rgb(r,g,b) (0xff000000 | (r << 16) | (g << 8) | b) static const struct RGBData { - const char *name; + const char name[21]; uint value; } rgbTbl[] = { { "aliceblue", rgb(240, 248, 255) }, From a81be85b63f8caf817bb7c4a840ff3a3aaf49a83 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 1 Aug 2016 10:05:28 +0300 Subject: [PATCH 013/236] QDataWidgetMapper: Fix UB (member call) As found by UBSan: qdatawidgetmapper.cpp:212:59: runtime error: member call on address 0x2b6cc8095be0 which does not point to an object of type 'QFocusHelper' 0x2b6cc8095be0: note: object is of type 'QLineEdit' Just make QDataWidgetMapperPrivate a friend of QWidget. Change-Id: I33d8d430c3a03b7173358d0f96dc7f850d11697c Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Friedemann Kleint --- src/widgets/itemviews/qdatawidgetmapper.cpp | 18 ++---------------- src/widgets/kernel/qwidget.h | 1 + 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp index ee7b3613a2f..058a5704371 100644 --- a/src/widgets/itemviews/qdatawidgetmapper.cpp +++ b/src/widgets/itemviews/qdatawidgetmapper.cpp @@ -199,20 +199,6 @@ void QDataWidgetMapperPrivate::_q_commitData(QWidget *w) commit(widgetMap.at(idx)); } -class QFocusHelper: public QWidget -{ -public: - bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE - { - return QWidget::focusNextPrevChild(next); - } - - static inline void focusNextPrevChild(QWidget *w, bool next) - { - static_cast(w)->focusNextPrevChild(next); - } -}; - void QDataWidgetMapperPrivate::_q_closeEditor(QWidget *w, QAbstractItemDelegate::EndEditHint hint) { int idx = findWidget(w); @@ -224,10 +210,10 @@ void QDataWidgetMapperPrivate::_q_closeEditor(QWidget *w, QAbstractItemDelegate: populate(widgetMap[idx]); break; } case QAbstractItemDelegate::EditNextItem: - QFocusHelper::focusNextPrevChild(w, true); + w->focusNextChild(); break; case QAbstractItemDelegate::EditPreviousItem: - QFocusHelper::focusNextPrevChild(w, false); + w->focusPreviousChild(); break; case QAbstractItemDelegate::SubmitModelCache: case QAbstractItemDelegate::NoHint: diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 2af1550ad17..c8e08a5bc4b 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -668,6 +668,7 @@ protected: void destroy(bool destroyWindow = true, bool destroySubWindows = true); + friend class QDataWidgetMapperPrivate; // for access to focusNextPrevChild virtual bool focusNextPrevChild(bool next); inline bool focusNextChild() { return focusNextPrevChild(true); } inline bool focusPreviousChild() { return focusNextPrevChild(false); } From 08f38d22149f062006316997a04fee57c33bc577 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 28 Jul 2016 19:51:53 +0300 Subject: [PATCH 014/236] tst_QAbstractItemView: Fix UB (invalid downcast, member call) As reported by UBSan: tst_qabstractitemview.cpp:336:23: runtime error: member call on address 0x7ffe6fe96e10 which does not point to an object of type 'TestView' 0x7ffe6fe96e10: note: object is of type 'QListView' tst_qabstractitemview.cpp:337:5: runtime error: member call on address 0x7ffe6fe96e10 which does not point to an object of type 'TestView' 0x7ffe6fe96e10: note: object is of type 'QListView' tst_qabstractitemview.cpp:338:23: runtime error: member call on address 0x7ffe6fe96e10 which does not point to an object of type 'TestView' 0x7ffe6fe96e10: note: object is of type 'QListView' [etc ...] Fix by making the test a friend of QAbstractItemView instead. Change-Id: I1a08977042296eb34e9dbdb5c0595662dbd2e5ef Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/itemviews/qabstractitemview.h | 3 + .../tst_qabstractitemview.cpp | 248 ++++++------------ 2 files changed, 76 insertions(+), 175 deletions(-) diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h index ff1848b1497..82bc7cb9aeb 100644 --- a/src/widgets/itemviews/qabstractitemview.h +++ b/src/widgets/itemviews/qabstractitemview.h @@ -39,6 +39,8 @@ #include #include +class tst_QAbstractItemView; + QT_BEGIN_NAMESPACE @@ -359,6 +361,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_scrollerStateChanged()) #endif + friend class ::tst_QAbstractItemView; friend class QTreeViewPrivate; // needed to compile with MSVC friend class QListModeViewBase; friend class QListViewPrivate; diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 6cbf51efd94..a62147b7079 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -81,108 +81,6 @@ static inline void moveCursorAway(const QWidget *topLevel) #endif } -class TestView : public QAbstractItemView -{ - Q_OBJECT -public: - inline void tst_dataChanged(const QModelIndex &tl, const QModelIndex &br) - { dataChanged(tl, br); } - inline void tst_setHorizontalStepsPerItem(int steps) - { setHorizontalStepsPerItem(steps); } - inline int tst_horizontalStepsPerItem() const - { return horizontalStepsPerItem(); } - inline void tst_setVerticalStepsPerItem(int steps) - { setVerticalStepsPerItem(steps); } - inline int tst_verticalStepsPerItem() const - { return verticalStepsPerItem(); } - - inline void tst_rowsInserted(const QModelIndex &parent, int start, int end) - { rowsInserted(parent, start, end); } - inline void tst_rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) - { rowsAboutToBeRemoved(parent, start, end); } - inline void tst_selectionChanged(const QItemSelection &selected, - const QItemSelection &deselected) - { selectionChanged(selected, deselected); } - inline void tst_currentChanged(const QModelIndex ¤t, const QModelIndex &previous) - { currentChanged(current, previous); } - inline void tst_updateEditorData() - { updateEditorData(); } - inline void tst_updateEditorGeometries() - { updateEditorGeometries(); } - inline void tst_updateGeometries() - { updateGeometries(); } - inline void tst_verticalScrollbarAction(int action) - { verticalScrollbarAction(action); } - inline void tst_horizontalScrollbarAction(int action) - { horizontalScrollbarAction(action); } - inline void tst_verticalScrollbarValueChanged(int value) - { verticalScrollbarValueChanged(value); } - inline void tst_horizontalScrollbarValueChanged(int value) - { horizontalScrollbarValueChanged(value); } - inline void tst_closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint) - { closeEditor(editor, hint); } - inline void tst_commitData(QWidget *editor) - { commitData(editor); } - inline void tst_editorDestroyed(QObject *editor) - { editorDestroyed(editor); } - enum tst_CursorAction { - MoveUp = QAbstractItemView::MoveUp, - MoveDown = QAbstractItemView::MoveDown, - MoveLeft = QAbstractItemView::MoveLeft, - MoveRight = QAbstractItemView::MoveRight, - MoveHome = QAbstractItemView::MoveHome, - MoveEnd = QAbstractItemView::MoveEnd, - MovePageUp = QAbstractItemView::MovePageUp, - MovePageDown = QAbstractItemView::MovePageDown, - MoveNext = QAbstractItemView::MoveNext, - MovePrevious = QAbstractItemView::MovePrevious - }; - inline QModelIndex tst_moveCursor(tst_CursorAction cursorAction, - Qt::KeyboardModifiers modifiers) - { return moveCursor(QAbstractItemView::CursorAction(cursorAction), modifiers); } - inline int tst_horizontalOffset() const - { return horizontalOffset(); } - inline int tst_verticalOffset() const - { return verticalOffset(); } - inline bool tst_isIndexHidden(const QModelIndex &index) const - { return isIndexHidden(index); } - inline void tst_setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) - { setSelection(rect, command); } - inline QRegion tst_visualRegionForSelection(const QItemSelection &selection) const - { return visualRegionForSelection(selection); } - inline QModelIndexList tst_selectedIndexes() const - { return selectedIndexes(); } - inline bool tst_edit(const QModelIndex &index, EditTrigger trigger, QEvent *event) - { return edit(index, trigger, event); } - inline QItemSelectionModel::SelectionFlags tst_selectionCommand(const QModelIndex &index, - const QEvent *event = 0) const - { return selectionCommand(index, event); } -#ifndef QT_NO_DRAGANDDROP - inline void tst_startDrag(Qt::DropActions supportedActions) - { startDrag(supportedActions); } -#endif - inline QStyleOptionViewItem tst_viewOptions() const - { return viewOptions(); } - enum tst_State { - NoState = QAbstractItemView::NoState, - DraggingState = QAbstractItemView::DraggingState, - DragSelectingState = QAbstractItemView::DragSelectingState, - EditingState = QAbstractItemView::EditingState, - ExpandingState = QAbstractItemView::ExpandingState, - CollapsingState = QAbstractItemView::CollapsingState - }; - inline tst_State tst_state() const - { return (tst_State)state(); } - inline void tst_setState(tst_State state) - { setState(QAbstractItemView::State(state)); } - inline void tst_startAutoScroll() - { startAutoScroll(); } - inline void tst_stopAutoScroll() - { stopAutoScroll(); } - inline void tst_doAutoScroll() - { doAutoScroll(); } -}; - class GeometriesTestView : public QTableView { Q_OBJECT @@ -198,7 +96,7 @@ class tst_QAbstractItemView : public QObject Q_OBJECT public: - void basic_tests(TestView *view); + void basic_tests(QAbstractItemView *view); private slots: void initTestCase(); @@ -282,7 +180,7 @@ public: void tst_QAbstractItemView::getSetCheck() { QListView view; - TestView *obj1 = reinterpret_cast(&view); + QAbstractItemView *obj1 = &view; // QAbstractItemDelegate * QAbstractItemView::itemDelegate() // void QAbstractItemView::setItemDelegate(QAbstractItemDelegate *) MyAbstractItemDelegate *var1 = new MyAbstractItemDelegate; @@ -333,18 +231,18 @@ void tst_QAbstractItemView::getSetCheck() // State QAbstractItemView::state() // void QAbstractItemView::setState(State) - obj1->tst_setState(TestView::tst_State(TestView::NoState)); - QCOMPARE(TestView::tst_State(TestView::NoState), obj1->tst_state()); - obj1->tst_setState(TestView::tst_State(TestView::DraggingState)); - QCOMPARE(TestView::tst_State(TestView::DraggingState), obj1->tst_state()); - obj1->tst_setState(TestView::tst_State(TestView::DragSelectingState)); - QCOMPARE(TestView::tst_State(TestView::DragSelectingState), obj1->tst_state()); - obj1->tst_setState(TestView::tst_State(TestView::EditingState)); - QCOMPARE(TestView::tst_State(TestView::EditingState), obj1->tst_state()); - obj1->tst_setState(TestView::tst_State(TestView::ExpandingState)); - QCOMPARE(TestView::tst_State(TestView::ExpandingState), obj1->tst_state()); - obj1->tst_setState(TestView::tst_State(TestView::CollapsingState)); - QCOMPARE(TestView::tst_State(TestView::CollapsingState), obj1->tst_state()); + obj1->setState(QAbstractItemView::NoState); + QCOMPARE(QAbstractItemView::NoState, obj1->state()); + obj1->setState(QAbstractItemView::DraggingState); + QCOMPARE(QAbstractItemView::DraggingState, obj1->state()); + obj1->setState(QAbstractItemView::DragSelectingState); + QCOMPARE(QAbstractItemView::DragSelectingState, obj1->state()); + obj1->setState(QAbstractItemView::EditingState); + QCOMPARE(QAbstractItemView::EditingState, obj1->state()); + obj1->setState(QAbstractItemView::ExpandingState); + QCOMPARE(QAbstractItemView::ExpandingState, obj1->state()); + obj1->setState(QAbstractItemView::CollapsingState); + QCOMPARE(QAbstractItemView::CollapsingState, obj1->state()); // QWidget QAbstractScrollArea::viewport() // void setViewport(QWidget*) @@ -405,7 +303,7 @@ void tst_QAbstractItemView::emptyModels() QVERIFY(!view->selectionModel()); //QVERIFY(view->itemDelegate() != 0); - basic_tests(reinterpret_cast(view.data())); + basic_tests(view.data()); } void tst_QAbstractItemView::setModel_data() @@ -442,10 +340,10 @@ void tst_QAbstractItemView::setModel() QStandardItemModel model(20,20); view->setModel(0); view->setModel(&model); - basic_tests(reinterpret_cast(view.data())); + basic_tests(view.data()); } -void tst_QAbstractItemView::basic_tests(TestView *view) +void tst_QAbstractItemView::basic_tests(QAbstractItemView *view) { // setSelectionModel // Will assert as it should @@ -570,73 +468,73 @@ void tst_QAbstractItemView::basic_tests(TestView *view) view->setCurrentIndex(QModelIndex()); // protected methods - view->tst_dataChanged(QModelIndex(), QModelIndex()); - view->tst_rowsInserted(QModelIndex(), -1, -1); - view->tst_rowsAboutToBeRemoved(QModelIndex(), -1, -1); - view->tst_selectionChanged(QItemSelection(), QItemSelection()); + view->dataChanged(QModelIndex(), QModelIndex()); + view->rowsInserted(QModelIndex(), -1, -1); + view->rowsAboutToBeRemoved(QModelIndex(), -1, -1); + view->selectionChanged(QItemSelection(), QItemSelection()); if (view->model()){ - view->tst_currentChanged(QModelIndex(), QModelIndex()); - view->tst_currentChanged(QModelIndex(), view->model()->index(0,0)); + view->currentChanged(QModelIndex(), QModelIndex()); + view->currentChanged(QModelIndex(), view->model()->index(0,0)); } - view->tst_updateEditorData(); - view->tst_updateEditorGeometries(); - view->tst_updateGeometries(); - view->tst_verticalScrollbarAction(QAbstractSlider::SliderSingleStepAdd); - view->tst_horizontalScrollbarAction(QAbstractSlider::SliderSingleStepAdd); - view->tst_verticalScrollbarValueChanged(10); - view->tst_horizontalScrollbarValueChanged(10); - view->tst_closeEditor(0, QAbstractItemDelegate::NoHint); - view->tst_commitData(0); - view->tst_editorDestroyed(0); + view->updateEditorData(); + view->updateEditorGeometries(); + view->updateGeometries(); + view->verticalScrollbarAction(QAbstractSlider::SliderSingleStepAdd); + view->horizontalScrollbarAction(QAbstractSlider::SliderSingleStepAdd); + view->verticalScrollbarValueChanged(10); + view->horizontalScrollbarValueChanged(10); + view->closeEditor(0, QAbstractItemDelegate::NoHint); + view->commitData(0); + view->editorDestroyed(0); - view->tst_setHorizontalStepsPerItem(2); - view->tst_horizontalStepsPerItem(); - view->tst_setVerticalStepsPerItem(2); - view->tst_verticalStepsPerItem(); + view->setHorizontalStepsPerItem(2); + view->horizontalStepsPerItem(); + view->setVerticalStepsPerItem(2); + view->verticalStepsPerItem(); // Will assert as it should // view->setIndexWidget(QModelIndex(), 0); - view->tst_moveCursor(TestView::MoveUp, Qt::NoModifier); - view->tst_horizontalOffset(); - view->tst_verticalOffset(); + view->moveCursor(QAbstractItemView::MoveUp, Qt::NoModifier); + view->horizontalOffset(); + view->verticalOffset(); -// view->tst_isIndexHidden(QModelIndex()); // will (correctly) assert +// view->isIndexHidden(QModelIndex()); // will (correctly) assert if(view->model()) - view->tst_isIndexHidden(view->model()->index(0,0)); + view->isIndexHidden(view->model()->index(0,0)); - view->tst_setSelection(QRect(0, 0, 10, 10), QItemSelectionModel::ClearAndSelect); - view->tst_setSelection(QRect(-1, -1, -1, -1), QItemSelectionModel::ClearAndSelect); - view->tst_visualRegionForSelection(QItemSelection()); - view->tst_selectedIndexes(); + view->setSelection(QRect(0, 0, 10, 10), QItemSelectionModel::ClearAndSelect); + view->setSelection(QRect(-1, -1, -1, -1), QItemSelectionModel::ClearAndSelect); + view->visualRegionForSelection(QItemSelection()); + view->selectedIndexes(); - view->tst_edit(QModelIndex(), QAbstractItemView::NoEditTriggers, 0); + view->edit(QModelIndex(), QAbstractItemView::NoEditTriggers, 0); - view->tst_selectionCommand(QModelIndex(), 0); + view->selectionCommand(QModelIndex(), 0); #ifndef QT_NO_DRAGANDDROP if (!view->model()) - view->tst_startDrag(Qt::CopyAction); + view->startDrag(Qt::CopyAction); - view->tst_viewOptions(); + view->viewOptions(); - view->tst_setState(TestView::NoState); - QVERIFY(view->tst_state()==TestView::NoState); - view->tst_setState(TestView::DraggingState); - QVERIFY(view->tst_state()==TestView::DraggingState); - view->tst_setState(TestView::DragSelectingState); - QVERIFY(view->tst_state()==TestView::DragSelectingState); - view->tst_setState(TestView::EditingState); - QVERIFY(view->tst_state()==TestView::EditingState); - view->tst_setState(TestView::ExpandingState); - QVERIFY(view->tst_state()==TestView::ExpandingState); - view->tst_setState(TestView::CollapsingState); - QVERIFY(view->tst_state()==TestView::CollapsingState); + view->setState(QAbstractItemView::NoState); + QVERIFY(view->state()==QAbstractItemView::NoState); + view->setState(QAbstractItemView::DraggingState); + QVERIFY(view->state()==QAbstractItemView::DraggingState); + view->setState(QAbstractItemView::DragSelectingState); + QVERIFY(view->state()==QAbstractItemView::DragSelectingState); + view->setState(QAbstractItemView::EditingState); + QVERIFY(view->state()==QAbstractItemView::EditingState); + view->setState(QAbstractItemView::ExpandingState); + QVERIFY(view->state()==QAbstractItemView::ExpandingState); + view->setState(QAbstractItemView::CollapsingState); + QVERIFY(view->state()==QAbstractItemView::CollapsingState); #endif - view->tst_startAutoScroll(); - view->tst_stopAutoScroll(); - view->tst_doAutoScroll(); + view->startAutoScroll(); + view->stopAutoScroll(); + view->doAutoScroll(); // testing mouseFoo and key functions // QTest::mousePress(view, Qt::LeftButton, Qt::NoModifier, QPoint(0,0)); @@ -771,11 +669,11 @@ void tst_QAbstractItemView::selectAll() QTableView view; view.setModel(&model); - TestView *tst_view = (TestView*)&view; + QAbstractItemView *tst_view = &view; - QCOMPARE(tst_view->tst_selectedIndexes().count(), 0); + QCOMPARE(tst_view->selectedIndexes().count(), 0); view.selectAll(); - QCOMPARE(tst_view->tst_selectedIndexes().count(), 4*4); + QCOMPARE(tst_view->selectedIndexes().count(), 4*4); } void tst_QAbstractItemView::ctrlA() @@ -784,11 +682,11 @@ void tst_QAbstractItemView::ctrlA() QTableView view; view.setModel(&model); - TestView *tst_view = (TestView*)&view; + QAbstractItemView *tst_view = &view; - QCOMPARE(tst_view->tst_selectedIndexes().count(), 0); + QCOMPARE(tst_view->selectedIndexes().count(), 0); QTest::keyClick(&view, Qt::Key_A, Qt::ControlModifier); - QCOMPARE(tst_view->tst_selectedIndexes().count(), 4*4); + QCOMPARE(tst_view->selectedIndexes().count(), 4*4); } void tst_QAbstractItemView::persistentEditorFocus() @@ -1604,9 +1502,9 @@ void tst_QAbstractItemView::testDelegateDestroyEditor() MyAbstractItemDelegate delegate; table.setItemDelegate(&delegate); table.edit(table.model()->index(1, 1)); - TestView *tv = reinterpret_cast(&table); + QAbstractItemView *tv = &table; QVERIFY(!delegate.calledVirtualDtor); - tv->tst_closeEditor(delegate.openedEditor, QAbstractItemDelegate::NoHint); + tv->closeEditor(delegate.openedEditor, QAbstractItemDelegate::NoHint); QVERIFY(delegate.calledVirtualDtor); } From 5dc83974f7e6f72d715c4c940ca57741a550aa1c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 28 Jul 2016 19:51:53 +0300 Subject: [PATCH 015/236] tst_QTreeView: Fix UB (invalid downcast, member call) As reported by UBSan: tst_qtreeview.cpp:2187:36: runtime error: downcast of address 0x7ffc15749f20 which does not point to an object of type 'PublicView' 0x7ffc15749f20: note: object is of type 'QTreeView' Fix by making the test a friend of QTreeView (and, for Clang, of QAbstractItemView) instead. Change-Id: I5b748696ab441a91058f4d45a18bd5ed75a6e560 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/itemviews/qabstractitemview.h | 2 + src/widgets/itemviews/qtreeview.h | 3 + .../itemviews/qtreeview/tst_qtreeview.cpp | 97 ++++++------------- 3 files changed, 32 insertions(+), 70 deletions(-) diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h index 82bc7cb9aeb..8d712280d3d 100644 --- a/src/widgets/itemviews/qabstractitemview.h +++ b/src/widgets/itemviews/qabstractitemview.h @@ -40,6 +40,7 @@ #include class tst_QAbstractItemView; +class tst_QTreeView; QT_BEGIN_NAMESPACE @@ -362,6 +363,7 @@ private: #endif friend class ::tst_QAbstractItemView; + friend class ::tst_QTreeView; friend class QTreeViewPrivate; // needed to compile with MSVC friend class QListModeViewBase; friend class QListViewPrivate; diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h index 546cc488cb8..9257bb66fa6 100644 --- a/src/widgets/itemviews/qtreeview.h +++ b/src/widgets/itemviews/qtreeview.h @@ -36,6 +36,8 @@ #include +class tst_QTreeView; + QT_BEGIN_NAMESPACE @@ -213,6 +215,7 @@ protected: void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) Q_DECL_OVERRIDE; private: + friend class ::tst_QTreeView; friend class QAccessibleTable; friend class QAccessibleTree; friend class QAccessibleTableCell; diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index bd6939b9776..0f497500cd4 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #ifndef QT_NO_DRAGANDDROP Q_DECLARE_METATYPE(QAbstractItemView::DragDropMode) @@ -62,49 +62,6 @@ static void initStandardTreeModel(QStandardItemModel *model) model->insertRow(2, item); } -class tst_QTreeView; -struct PublicView : public QTreeView -{ - friend class tst_QTreeView; - inline void executeDelayedItemsLayout() - { QTreeView::executeDelayedItemsLayout(); } - - enum PublicCursorAction { - MoveUp = QAbstractItemView::MoveUp, - MoveDown = QAbstractItemView::MoveDown, - MoveLeft = QAbstractItemView::MoveLeft, - MoveRight = QAbstractItemView::MoveRight, - MoveHome = QAbstractItemView::MoveHome, - MoveEnd = QAbstractItemView::MoveEnd, - MovePageUp = QAbstractItemView::MovePageUp, - MovePageDown = QAbstractItemView::MovePageDown, - MoveNext = QAbstractItemView::MoveNext, - MovePrevious = QAbstractItemView::MovePrevious - }; - - // enum PublicCursorAction and moveCursor() are protected in QTreeView. - inline QModelIndex doMoveCursor(PublicCursorAction ca, Qt::KeyboardModifiers kbm) - { return QTreeView::moveCursor((CursorAction)ca, kbm); } - - inline void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) - { - QTreeView::setSelection(rect, command); - } - inline int state() - { - return QTreeView::state(); - } - - inline int rowHeight(QModelIndex idx) { return QTreeView::rowHeight(idx); } - inline int indexRowSizeHint(const QModelIndex &index) const { return QTreeView::indexRowSizeHint(index); } - - inline QModelIndexList selectedIndexes() const { return QTreeView::selectedIndexes(); } - - inline QStyleOptionViewItem viewOptions() const { return QTreeView::viewOptions(); } - inline int sizeHintForColumn(int column) const { return QTreeView::sizeHintForColumn(column); } - QAbstractItemViewPrivate* aiv_priv() { return static_cast(d_ptr.data()); } -}; - // Make a widget frameless to prevent size constraints of title bars // from interfering (Windows). static inline void setFrameless(QWidget *w) @@ -1783,7 +1740,7 @@ void tst_QTreeView::moveCursor() QFETCH(bool, scrollPerPixel); QtTestModel model(8, 6); - PublicView view; + QTreeView view; view.setUniformRowHeights(uniformRowHeights); view.setModel(&model); view.setRowHidden(0, QModelIndex(), true); @@ -1802,7 +1759,7 @@ void tst_QTreeView::moveCursor() QCOMPARE(view.currentIndex(), expected); //then pressing down should go to the next line - QModelIndex actual = view.doMoveCursor(PublicView::MoveDown, Qt::NoModifier); + QModelIndex actual = view.moveCursor(QTreeView::MoveDown, Qt::NoModifier); expected = model.index(2, 1, QModelIndex()); QCOMPARE(actual, expected); @@ -1811,7 +1768,7 @@ void tst_QTreeView::moveCursor() // PageUp was broken with uniform row heights turned on view.setCurrentIndex(model.index(1, 0)); - actual = view.doMoveCursor(PublicView::MovePageUp, Qt::NoModifier); + actual = view.moveCursor(QTreeView::MovePageUp, Qt::NoModifier); expected = model.index(0, 0, QModelIndex()); QCOMPARE(actual, expected); @@ -1910,7 +1867,7 @@ void tst_QTreeView::setSelection() QtTestModel model(10, 5); model.levels = 1; model.setDecorationsEnabled(true); - PublicView view; + QTreeView view; view.resize(400, 300); view.show(); view.setRootIsDecorated(false); @@ -2097,7 +2054,7 @@ void tst_QTreeView::rowsAboutToBeRemoved() } } - PublicView view; + QTreeView view; view.setModel(&model); view.show(); QModelIndex index = model.index(0,0, QModelIndex()); @@ -2111,7 +2068,7 @@ void tst_QTreeView::rowsAboutToBeRemoved() QSignalSpy spy1(&model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int))); model.removeRows(1,1); - QCOMPARE(view.state(), 0); + QCOMPARE(int(view.state()), 0); // Should not be 5 (or any other number for that sake :) QCOMPARE(spy1.count(), 1); @@ -2214,7 +2171,7 @@ void tst_QTreeView::rowsAboutToBeRemoved_move() view.resize(600,800); view.show(); view.doItemsLayout(); - static_cast(&view)->executeDelayedItemsLayout(); + static_cast(&view)->executeDelayedItemsLayout(); parent = indexThatWantsToLiveButWillDieDieITellYou.parent(); QCOMPARE(view.isExpanded(indexThatWantsToLiveButWillDieDieITellYou), true); QCOMPARE(parent.isValid(), true); @@ -2320,7 +2277,7 @@ void tst_QTreeView::spanningItems() { QtTestModel model; model.rows = model.cols = 10; - PublicView view; + QTreeView view; view.setModel(&model); view.show(); @@ -2459,7 +2416,7 @@ void tst_QTreeView::selectionWithHiddenItems() void tst_QTreeView::selectAll() { QStandardItemModel model(4,4); - PublicView view2; + QTreeView view2; view2.setModel(&model); view2.setSelectionMode(QAbstractItemView::ExtendedSelection); view2.selectAll(); // Should work with an empty model @@ -2468,13 +2425,13 @@ void tst_QTreeView::selectAll() for (int i = 0; i < model.rowCount(); ++i) model.setData(model.index(i,0), QString("row %1").arg(i)); - PublicView view; + QTreeView view; view.setModel(&model); int selectedCount = view.selectedIndexes().count(); view.selectAll(); QCOMPARE(view.selectedIndexes().count(), selectedCount); - PublicView view3; + QTreeView view3; view3.setModel(&model); view3.setSelectionMode(QAbstractItemView::NoSelection); view3.selectAll(); @@ -2836,7 +2793,7 @@ void tst_QTreeView::evilModel() { QFETCH(bool, visible); // init - PublicView view; + QTreeView view; EvilModel model; view.setModel(&model); view.setVisible(visible); @@ -2894,7 +2851,7 @@ void tst_QTreeView::evilModel() view.setSelection(rect, QItemSelectionModel::Select); model.change(); - view.doMoveCursor(PublicView::MoveDown, Qt::NoModifier); + view.moveCursor(QTreeView::MoveDown, Qt::NoModifier); model.change(); view.resizeColumnToContents(1); @@ -3005,7 +2962,7 @@ void tst_QTreeView::evilModel() void tst_QTreeView::indexRowSizeHint() { QStandardItemModel model(10, 1); - PublicView view; + QTreeView view; view.setModel(&model); @@ -3051,7 +3008,7 @@ void tst_QTreeView::renderToPixmap_data() void tst_QTreeView::renderToPixmap() { QFETCH(int, row); - PublicView view; + QTreeView view; QStandardItemModel model; model.appendRow(new QStandardItem("Spanning")); @@ -3067,7 +3024,7 @@ void tst_QTreeView::renderToPixmap() // We select the index at row=1 for coverage. QItemSelection sel(model.index(row,0), model.index(row,1)); QRect rect; - view.aiv_priv()->renderToPixmap(sel.indexes(), &rect); + view.d_func()->renderToPixmap(sel.indexes(), &rect); } #endif } @@ -3129,7 +3086,7 @@ void tst_QTreeView::styleOptionViewItem() bool allCollapsed; }; - PublicView view; + QTreeView view; QStandardItemModel model; view.setModel(&model); MyDelegate delegate; @@ -3185,7 +3142,7 @@ void tst_QTreeView::styleOptionViewItem() delegate.count = 0; QItemSelection sel(model.index(0,0), model.index(0,modelColumns-1)); QRect rect; - view.aiv_priv()->renderToPixmap(sel.indexes(), &rect); + view.d_func()->renderToPixmap(sel.indexes(), &rect); if (delegate.count != visibleColumns) { qDebug() << rect << view.rect() << view.isVisible(); } @@ -3213,7 +3170,7 @@ void tst_QTreeView::styleOptionViewItem() delegate.count = 0; QItemSelection sel(model.index(0,0), model.index(0,modelColumns-1)); QRect rect; - view.aiv_priv()->renderToPixmap(sel.indexes(), &rect); + view.d_func()->renderToPixmap(sel.indexes(), &rect); if (delegate.count != visibleColumns) { qDebug() << rect << view.rect() << view.isVisible(); } @@ -4168,7 +4125,7 @@ void tst_QTreeView::taskQTBUG_13567_removeLastItemRegression() // Note: define QT_BUILD_INTERNAL to run this test void tst_QTreeView::taskQTBUG_25333_adjustViewOptionsForIndex() { - PublicView view; + QTreeView view; QStandardItemModel model; QStandardItem *item1 = new QStandardItem("Item1"); QStandardItem *item2 = new QStandardItem("Item2"); @@ -4194,9 +4151,9 @@ void tst_QTreeView::taskQTBUG_25333_adjustViewOptionsForIndex() { QStyleOptionViewItem option; - view.aiv_priv()->adjustViewOptionsForIndex(&option, model.indexFromItem(item1)); + view.d_func()->adjustViewOptionsForIndex(&option, model.indexFromItem(item1)); - view.aiv_priv()->adjustViewOptionsForIndex(&option, model.indexFromItem(item3)); + view.d_func()->adjustViewOptionsForIndex(&option, model.indexFromItem(item3)); } #endif @@ -4302,7 +4259,7 @@ void tst_QTreeView::quickExpandCollapse() //this unit tests makes sure the state after the animation is restored correctly //after starting a 2nd animation while the first one was still on-going //this tests that the stateBeforeAnimation is not set to AnimatingState - PublicView tree; + QTreeView tree; tree.setAnimated(true); QStandardItemModel model; QStandardItem *root = new QStandardItem("root"); @@ -4316,13 +4273,13 @@ void tst_QTreeView::quickExpandCollapse() tree.show(); QTest::qWaitForWindowExposed(&tree); - int initialState = tree.state(); + const QAbstractItemView::State initialState = tree.state(); tree.expand(rootIndex); - QCOMPARE(tree.state(), (int)PublicView::AnimatingState); + QCOMPARE(tree.state(), QTreeView::AnimatingState); tree.collapse(rootIndex); - QCOMPARE(tree.state(), (int)PublicView::AnimatingState); + QCOMPARE(tree.state(), QTreeView::AnimatingState); QTest::qWait(500); //the animation lasts for 250ms max so 500 should be enough From 100970687fc17dd9fa9692e6f746a93baae752a2 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 16 Jun 2016 09:27:57 +0200 Subject: [PATCH 016/236] Doc: Fix broken external link to livecoding vfx video Change-Id: Idf4ea5f175b3ad41292e5ba8e4538311b00c6d2f Reviewed-by: Leena Miettinen --- doc/global/externalsites/qt-webpages.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/global/externalsites/qt-webpages.qdoc b/doc/global/externalsites/qt-webpages.qdoc index 706fcc3a971..5eea92c6016 100644 --- a/doc/global/externalsites/qt-webpages.qdoc +++ b/doc/global/externalsites/qt-webpages.qdoc @@ -70,7 +70,7 @@ \title Qt Quarterly: Another Look at Events */ /*! - \externalpage http://qt-project.org/videos/watch/livecoding-video-effects-with-qt5 + \externalpage https://www.youtube.com/watch?v=P4kv-AoAJ-Q \title Livecoding video effects with Qt5 */ /*! From b92a63f7073b35a31f66af280bd50ddff1d15b50 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 27 Jul 2016 08:34:54 +0200 Subject: [PATCH 017/236] Fix typo in QMessageBox documentation Change-Id: I879817bf0209db331a9b1ef206bad7aa5b8a678f Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qmessagebox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index dbbf6cdc717..f32f7b0417a 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -697,7 +697,7 @@ void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button If the \l{QMessageBox::StandardButtons} {standard buttons} are not flexible enough for your message box, you can use the addButton() - overload that takes a text and a ButtonRoleto to add custom + overload that takes a text and a ButtonRole to add custom buttons. The ButtonRole is used by QMessageBox to determine the ordering of the buttons on screen (which varies according to the platform). You can test the value of clickedButton() after calling From 879fd5bb5ce94d9d98b966448029c030832eb582 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 14 Jun 2016 12:34:53 +0200 Subject: [PATCH 018/236] QTzTimeZonePrivate: skip redundant check, tidy up Various transition functions checked on m_tranTimes.size() > 0 inside a block which was conditioned on this already; simplify the code by knowing this is true already. Tidied up an initializer at the same time. Change-Id: I3e933a69e1b71b94bfd4451e4d761844da669d33 Reviewed-by: Thiago Macieira --- src/corelib/tools/qtimezoneprivate_tz.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp index 29544a5c374..c13c9a52235 100644 --- a/src/corelib/tools/qtimezoneprivate_tz.cpp +++ b/src/corelib/tools/qtimezoneprivate_tz.cpp @@ -896,13 +896,12 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < forMSecsSinceEpoch && !m_posixRule.isEmpty() && forMSecsSinceEpoch >= 0) { const int year = QDateTime::fromMSecsSinceEpoch(forMSecsSinceEpoch, Qt::UTC).date().year(); - const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0; - QVector posixTrans = calculatePosixTransitions(m_posixRule, year - 1, - year + 1, lastMSecs); + QVector posixTrans = + calculatePosixTransitions(m_posixRule, year - 1, year + 1, + m_tranTimes.last().atMSecsSinceEpoch); for (int i = posixTrans.size() - 1; i >= 0; --i) { if (posixTrans.at(i).atMSecsSinceEpoch <= forMSecsSinceEpoch) { - QTimeZonePrivate::Data data; - data = posixTrans.at(i); + QTimeZonePrivate::Data data = posixTrans.at(i); data.atMSecsSinceEpoch = forMSecsSinceEpoch; return data; } @@ -940,9 +939,9 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::nextTransition(qint64 afterMSecsSince if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < afterMSecsSinceEpoch && !m_posixRule.isEmpty() && afterMSecsSinceEpoch >= 0) { const int year = QDateTime::fromMSecsSinceEpoch(afterMSecsSinceEpoch, Qt::UTC).date().year(); - const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0; - QVector posixTrans = calculatePosixTransitions(m_posixRule, year - 1, - year + 1, lastMSecs); + QVector posixTrans = + calculatePosixTransitions(m_posixRule, year - 1, year + 1, + m_tranTimes.last().atMSecsSinceEpoch); for (int i = 0; i < posixTrans.size(); ++i) { if (posixTrans.at(i).atMSecsSinceEpoch > afterMSecsSinceEpoch) return posixTrans.at(i); @@ -966,9 +965,9 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::previousTransition(qint64 beforeMSecs if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < beforeMSecsSinceEpoch && !m_posixRule.isEmpty() && beforeMSecsSinceEpoch > 0) { const int year = QDateTime::fromMSecsSinceEpoch(beforeMSecsSinceEpoch, Qt::UTC).date().year(); - const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0; - QVector posixTrans = calculatePosixTransitions(m_posixRule, year - 1, - year + 1, lastMSecs); + QVector posixTrans = + calculatePosixTransitions(m_posixRule, year - 1, year + 1, + m_tranTimes.last().atMSecsSinceEpoch); for (int i = posixTrans.size() - 1; i >= 0; --i) { if (posixTrans.at(i).atMSecsSinceEpoch < beforeMSecsSinceEpoch) return posixTrans.at(i); From f38a957789598241d919d14ff776d956df850d08 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 18 May 2016 11:24:52 +0200 Subject: [PATCH 019/236] Register sub-families as separate fonts If A is B, but not all B is A, we should not register A as an alias for B. It is better to register it as a separate font-family so when explicitly requested only faces from the sub-family are considered. Task-number: QTBUG-53459 Change-Id: Ie9f5db3ba3fa69a0edb5b1965cce25e4885a00fc Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../fontconfig/qfontconfigdatabase.cpp | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 652a9f4add1..c779c70d4d2 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -365,6 +365,7 @@ static const char *getFcFamilyForStyleHint(const QFont::StyleHint style) static void populateFromPattern(FcPattern *pattern) { QString familyName; + QString familyNameLang; FcChar8 *value = 0; int weight_value; int slant_value; @@ -382,6 +383,9 @@ static void populateFromPattern(FcPattern *pattern) familyName = QString::fromUtf8((const char *)value); + if (FcPatternGetString(pattern, FC_FAMILYLANG, 0, &value) == FcResultMatch) + familyNameLang = QString::fromUtf8((const char *)value); + slant_value = FC_SLANT_ROMAN; weight_value = FC_WEIGHT_REGULAR; spacing_value = FC_PROPORTIONAL; @@ -471,8 +475,31 @@ static void populateFromPattern(FcPattern *pattern) QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile); // qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size; - for (int k = 1; FcPatternGetString(pattern, FC_FAMILY, k, &value) == FcResultMatch; ++k) - QPlatformFontDatabase::registerAliasToFontFamily(familyName, QString::fromUtf8((const char *)value)); + for (int k = 1; FcPatternGetString(pattern, FC_FAMILY, k, &value) == FcResultMatch; ++k) { + const QString altFamilyName = QString::fromUtf8((const char *)value); + // Extra family names can be aliases or subfamilies. + // If it is a subfamily, register it as a separate font, so only members of the subfamily are + // matched when the subfamily is requested. + QString altStyleName; + if (FcPatternGetString(pattern, FC_STYLE, k, &value) == FcResultMatch) + altStyleName = QString::fromUtf8((const char *)value); + else + altStyleName = styleName; + + QString altFamilyNameLang; + if (FcPatternGetString(pattern, FC_FAMILYLANG, k, &value) == FcResultMatch) + altFamilyNameLang = QString::fromUtf8((const char *)value); + else + altFamilyNameLang = familyNameLang; + + if (familyNameLang == altFamilyNameLang && altStyleName != styleName) { + const QString altStyleName = QString::fromUtf8((const char *)value); + FontFile *altFontFile = new FontFile(*fontFile); + QPlatformFontDatabase::registerFont(altFamilyName, altStyleName, QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,altFontFile); + } else { + QPlatformFontDatabase::registerAliasToFontFamily(familyName, altFamilyName); + } + } } @@ -488,7 +515,7 @@ void QFontconfigDatabase::populateFontDatabase() FC_FAMILY, FC_STYLE, FC_WEIGHT, FC_SLANT, FC_SPACING, FC_FILE, FC_INDEX, FC_LANG, FC_CHARSET, FC_FOUNDRY, FC_SCALABLE, FC_PIXEL_SIZE, - FC_WIDTH, + FC_WIDTH, FC_FAMILYLANG, #if FC_VERSION >= 20297 FC_CAPABILITY, #endif From 9b1db44c2a94a8d4d56c85e97c391c5bdf762a95 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 22 Jul 2016 09:21:42 +0200 Subject: [PATCH 020/236] Polish charactermap example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use Qt 5 connection syntax. - Introduce helper function to calculate the square size, remove the existing 24 pixel limitation since that makes it impossible to render 20pt fonts. - Add filter chooser for font filters. - Add menu and info dialog showing DPI and default fonts. - Streamline code Change-Id: I0cd4d0475b5a7ed3c475de7a413abebbe688dfe2 Reviewed-by: Topi Reiniö --- .../widgets/charactermap/characterwidget.cpp | 17 ++- .../widgets/charactermap/characterwidget.h | 2 + .../widgets/charactermap/mainwindow.cpp | 121 +++++++++++++++--- .../widgets/widgets/charactermap/mainwindow.h | 6 +- 4 files changed, 117 insertions(+), 29 deletions(-) diff --git a/examples/widgets/widgets/charactermap/characterwidget.cpp b/examples/widgets/widgets/charactermap/characterwidget.cpp index 1b8cb226f75..47aff4f5be1 100644 --- a/examples/widgets/widgets/charactermap/characterwidget.cpp +++ b/examples/widgets/widgets/charactermap/characterwidget.cpp @@ -44,11 +44,9 @@ //! [0] CharacterWidget::CharacterWidget(QWidget *parent) - : QWidget(parent) + : QWidget(parent), columns(16), lastKey(-1) { - squareSize = 24; - columns = 16; - lastKey = -1; + calculateSquareSize(); setMouseTracking(true); } //! [0] @@ -57,7 +55,7 @@ CharacterWidget::CharacterWidget(QWidget *parent) void CharacterWidget::updateFont(const QFont &font) { displayFont.setFamily(font.family()); - squareSize = qMax(24, QFontMetrics(displayFont).xHeight() * 3); + calculateSquareSize(); adjustSize(); update(); } @@ -67,7 +65,7 @@ void CharacterWidget::updateFont(const QFont &font) void CharacterWidget::updateSize(const QString &fontSize) { displayFont.setPointSize(fontSize.toInt()); - squareSize = qMax(24, QFontMetrics(displayFont).xHeight() * 3); + calculateSquareSize(); adjustSize(); update(); } @@ -79,7 +77,7 @@ void CharacterWidget::updateStyle(const QString &fontStyle) const QFont::StyleStrategy oldStrategy = displayFont.styleStrategy(); displayFont = fontDatabase.font(displayFont.family(), fontStyle, displayFont.pointSize()); displayFont.setStyleStrategy(oldStrategy); - squareSize = qMax(24, QFontMetrics(displayFont).xHeight() * 3); + calculateSquareSize(); adjustSize(); update(); } @@ -94,6 +92,11 @@ void CharacterWidget::updateFontMerging(bool enable) update(); } +void CharacterWidget::calculateSquareSize() +{ + squareSize = qMax(16, 4 + QFontMetrics(displayFont, this).height()); +} + //! [3] QSize CharacterWidget::sizeHint() const { diff --git a/examples/widgets/widgets/charactermap/characterwidget.h b/examples/widgets/widgets/charactermap/characterwidget.h index d1c0f28bc47..e195c177d0c 100644 --- a/examples/widgets/widgets/charactermap/characterwidget.h +++ b/examples/widgets/widgets/charactermap/characterwidget.h @@ -76,6 +76,8 @@ protected: void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; private: + void calculateSquareSize(); + QFont displayFont; int columns; int lastKey; diff --git a/examples/widgets/widgets/charactermap/mainwindow.cpp b/examples/widgets/widgets/charactermap/mainwindow.cpp index 14784e7d65b..a49e74769e0 100644 --- a/examples/widgets/widgets/charactermap/mainwindow.cpp +++ b/examples/widgets/widgets/charactermap/mainwindow.cpp @@ -44,10 +44,30 @@ #include "mainwindow.h" //! [0] + +Q_DECLARE_METATYPE(QFontComboBox::FontFilter) + MainWindow::MainWindow() { + QMenu *fileMenu = menuBar()->addMenu(tr("File")); + fileMenu->addAction(tr("Quit"), this, &QWidget::close); + QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); + helpMenu->addAction(tr("Show Font Info"), this, &MainWindow::showInfo); + helpMenu->addAction(tr("About &Qt"), qApp, &QApplication::aboutQt); + QWidget *centralWidget = new QWidget; + QLabel *filterLabel = new QLabel(tr("Filter:")); + filterCombo = new QComboBox; + filterCombo->addItem(tr("All"), QVariant::fromValue(QFontComboBox::AllFonts)); + filterCombo->addItem(tr("Scalable"), QVariant::fromValue(QFontComboBox::ScalableFonts)); + filterCombo->addItem(tr("Monospaced"), QVariant::fromValue(QFontComboBox::MonospacedFonts)); + filterCombo->addItem(tr("Proportional"), QVariant::fromValue(QFontComboBox::ProportionalFonts)); + filterCombo->setCurrentIndex(0); + typedef void (QComboBox::*QComboBoxIntSignal)(int); + connect(filterCombo, static_cast(&QComboBox::currentIndexChanged), + this, &MainWindow::filterChanged); + QLabel *fontLabel = new QLabel(tr("Font:")); fontCombo = new QFontComboBox; QLabel *sizeLabel = new QLabel(tr("Size:")); @@ -70,38 +90,39 @@ MainWindow::MainWindow() //! [2] lineEdit = new QLineEdit; + lineEdit->setClearButtonEnabled(true); #ifndef QT_NO_CLIPBOARD QPushButton *clipboardButton = new QPushButton(tr("&To clipboard")); //! [2] -//! [3] - clipboard = QApplication::clipboard(); -//! [3] #endif //! [4] - connect(fontCombo, SIGNAL(currentFontChanged(QFont)), - this, SLOT(findStyles(QFont))); - connect(fontCombo, SIGNAL(currentFontChanged(QFont)), - this, SLOT(findSizes(QFont))); - connect(fontCombo, SIGNAL(currentFontChanged(QFont)), - characterWidget, SLOT(updateFont(QFont))); - connect(sizeCombo, SIGNAL(currentIndexChanged(QString)), - characterWidget, SLOT(updateSize(QString))); - connect(styleCombo, SIGNAL(currentIndexChanged(QString)), - characterWidget, SLOT(updateStyle(QString))); + connect(fontCombo, &QFontComboBox::currentFontChanged, + this, &MainWindow::findStyles); + connect(fontCombo, &QFontComboBox::currentFontChanged, + this, &MainWindow::findSizes); + connect(fontCombo, &QFontComboBox::currentFontChanged, + characterWidget, &CharacterWidget::updateFont); + typedef void (QComboBox::*QComboBoxStringSignal)(const QString &); + connect(sizeCombo, static_cast(&QComboBox::currentIndexChanged), + characterWidget, &CharacterWidget::updateSize); + connect(styleCombo, static_cast(&QComboBox::currentIndexChanged), + characterWidget, &CharacterWidget::updateStyle); //! [4] //! [5] - connect(characterWidget, SIGNAL(characterSelected(QString)), - this, SLOT(insertCharacter(QString))); + connect(characterWidget, &CharacterWidget::characterSelected, + this, &MainWindow::insertCharacter); #ifndef QT_NO_CLIPBOARD - connect(clipboardButton, SIGNAL(clicked()), this, SLOT(updateClipboard())); + connect(clipboardButton, &QAbstractButton::clicked, this, &MainWindow::updateClipboard); #endif //! [5] - connect(fontMerging, SIGNAL(toggled(bool)), characterWidget, SLOT(updateFontMerging(bool))); + connect(fontMerging, &QAbstractButton::toggled, characterWidget, &CharacterWidget::updateFontMerging); //! [6] QHBoxLayout *controlsLayout = new QHBoxLayout; + controlsLayout->addWidget(filterLabel); + controlsLayout->addWidget(filterCombo, 1); controlsLayout->addWidget(fontLabel); controlsLayout->addWidget(fontCombo, 1); controlsLayout->addWidget(sizeLabel); @@ -153,6 +174,14 @@ void MainWindow::findStyles(const QFont &font) } //! [8] +void MainWindow::filterChanged(int f) +{ + const QFontComboBox::FontFilter filter = + filterCombo->itemData(f).value(); + fontCombo->setFontFilters(filter); + statusBar()->showMessage(tr("%n font(s) found", 0, fontCombo->count())); +} + void MainWindow::findSizes(const QFont &font) { QFontDatabase fontDatabase; @@ -198,9 +227,63 @@ void MainWindow::insertCharacter(const QString &character) void MainWindow::updateClipboard() { //! [11] - clipboard->setText(lineEdit->text(), QClipboard::Clipboard); + QGuiApplication::clipboard()->setText(lineEdit->text(), QClipboard::Clipboard); //! [11] - clipboard->setText(lineEdit->text(), QClipboard::Selection); + QGuiApplication::clipboard()->setText(lineEdit->text(), QClipboard::Selection); } #endif + +class FontInfoDialog : public QDialog +{ +public: + explicit FontInfoDialog(QWidget *parent = Q_NULLPTR); + +private: + QString text() const; +}; + +FontInfoDialog::FontInfoDialog(QWidget *parent) : QDialog(parent) +{ + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + QVBoxLayout *mainLayout = new QVBoxLayout(this); + QPlainTextEdit *textEdit = new QPlainTextEdit(text(), this); + textEdit->setReadOnly(true); + textEdit->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); + mainLayout->addWidget(textEdit); + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); + mainLayout->addWidget(buttonBox); +} + +QString FontInfoDialog::text() const +{ + QString text; + QTextStream str(&text); + const QFont defaultFont = QFontDatabase::systemFont(QFontDatabase::GeneralFont); + const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); + const QFont titleFont = QFontDatabase::systemFont(QFontDatabase::TitleFont); + const QFont smallestReadableFont = QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont); + + str << "Qt " << QT_VERSION_STR << " on " << QGuiApplication::platformName() + << ", " << logicalDpiX() << "DPI"; + if (!qFuzzyCompare(devicePixelRatioF(), qreal(1))) + str << ", device pixel ratio: " << devicePixelRatioF(); + str << "\n\nDefault font : " << defaultFont.family() << ", " << defaultFont.pointSizeF() << "pt\n" + << "Fixed font : " << fixedFont.family() << ", " << fixedFont.pointSizeF() << "pt\n" + << "Title font : " << titleFont.family() << ", " << titleFont.pointSizeF() << "pt\n" + << "Smallest font: " << smallestReadableFont.family() << ", " << smallestReadableFont.pointSizeF() << "pt\n"; + + return text; +} + +void MainWindow::showInfo() +{ + const QRect screenGeometry = QApplication::desktop()->screenGeometry(this); + FontInfoDialog *dialog = new FontInfoDialog(this); + dialog->setWindowTitle(tr("Fonts")); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->resize(screenGeometry.width() / 4, screenGeometry.height() / 4); + dialog->show(); +} + //! [10] diff --git a/examples/widgets/widgets/charactermap/mainwindow.h b/examples/widgets/widgets/charactermap/mainwindow.h index 75e7e78fedc..b24816418ba 100644 --- a/examples/widgets/widgets/charactermap/mainwindow.h +++ b/examples/widgets/widgets/charactermap/mainwindow.h @@ -63,18 +63,18 @@ public: MainWindow(); public slots: + void filterChanged(int); void findStyles(const QFont &font); void findSizes(const QFont &font); void insertCharacter(const QString &character); #ifndef QT_NO_CLIPBOARD void updateClipboard(); #endif + void showInfo(); private: CharacterWidget *characterWidget; -#ifndef QT_NO_CLIPBOARD - QClipboard *clipboard; -#endif + QComboBox *filterCombo; QComboBox *styleCombo; QComboBox *sizeCombo; QFontComboBox *fontCombo; From dbb5c95f4d80644c6273b3adbe0148cdf30710d2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 1 Aug 2016 16:15:13 +0200 Subject: [PATCH 021/236] Windows QPA: Handle key event sequences of surrogates Emoji characters as input by the virtual keyboard are received as a sequence of surrogates. Store state internally when a high surrogate is received and send off the sequence when the matching low surrogate is received via input method. Task-number: QTBUG-50617 Change-Id: I91e763ec3e0747d6852f7c5c2057a67b0c24e0f5 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/windows/qwindowskeymapper.cpp | 16 ++++++++++++++++ .../platforms/windows/qwindowskeymapper.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 403ac6ecfbc..1e58b9b3d42 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -37,6 +37,7 @@ #include "qwindowswindow.h" #include "qwindowsinputcontext.h" +#include #include #include #include @@ -1072,6 +1073,21 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms if (PeekMessage(&wm_char, 0, charType, charType, PM_REMOVE)) { // Found a ?_CHAR uch = QChar(ushort(wm_char.wParam)); + if (uch.isHighSurrogate()) { + m_lastHighSurrogate = uch; + return true; + } else if (uch.isLowSurrogate() && !m_lastHighSurrogate.isNull()) { + if (QObject *focusObject = QGuiApplication::focusObject()) { + const QChar chars[2] = {m_lastHighSurrogate, uch}; + QInputMethodEvent event; + event.setCommitString(QString(chars, 2)); + QCoreApplication::sendEvent(focusObject, &event); + } + m_lastHighSurrogate = QChar(); + return true; + } else { + m_lastHighSurrogate = QChar(); + } if (msgType == WM_SYSKEYDOWN && uch.isLetter() && (msg.lParam & KF_ALTDOWN)) uch = uch.toLower(); // (See doc of WM_SYSCHAR) Alt-letter if (!code && !uch.row()) diff --git a/src/plugins/platforms/windows/qwindowskeymapper.h b/src/plugins/platforms/windows/qwindowskeymapper.h index 3a3170e4ae9..81ae1a32978 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.h +++ b/src/plugins/platforms/windows/qwindowskeymapper.h @@ -97,6 +97,7 @@ private: void deleteLayouts(); QWindow *m_keyGrabber; + QChar m_lastHighSurrogate; static const size_t NumKeyboardLayoutItems = 256; KeyboardLayoutItem keyLayout[NumKeyboardLayoutItems]; }; From 0cec01190f64d19d7d58d7764595d6d6fab8a9d4 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 2 Aug 2016 16:29:56 +0200 Subject: [PATCH 022/236] Fix registered style name of sub-families An old line redefined the altStyleName variable causing sub-families to be registered with their language-name as their style-name. Change-Id: I8c21ad556f53ffd62f8ef9b326fb9431eea1d857 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../fontdatabases/fontconfig/qfontconfigdatabase.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index c779c70d4d2..02b7e1bd636 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -493,7 +493,6 @@ static void populateFromPattern(FcPattern *pattern) altFamilyNameLang = familyNameLang; if (familyNameLang == altFamilyNameLang && altStyleName != styleName) { - const QString altStyleName = QString::fromUtf8((const char *)value); FontFile *altFontFile = new FontFile(*fontFile); QPlatformFontDatabase::registerFont(altFamilyName, altStyleName, QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,altFontFile); } else { From 2a24c3c268d443fb260d731d9f65b57726a40354 Mon Sep 17 00:00:00 2001 From: Clemens Sielaff Date: Sun, 24 Jul 2016 11:21:34 +1200 Subject: [PATCH 023/236] Fixed Bug in QVariant comparison when containing QStringLists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As it were, QStringLists were not handled explicitly when comparing QVariants. If both QStringLists contained only a single entry, they were treated as QStrings - if both QStringLists were empty, there were equal (correctly so) - but if one of the QStringLists had more than one entry, the compare function fell through to returning always 1. As discussed here: https://stackoverflow.com/a/38492467/3444217 Added rich comparison tests for all non-numerical, non-recursive QVariants that support them (except QModelIndex and QPersistentModelIndex) Task-number: QTBUG-54893 Change-Id: Icc5480d9ba056ee5efe83da566c5829caa1509d7 Reviewed-by: JÄ™drzej Nowacki --- src/corelib/kernel/qvariant.cpp | 2 + .../corelib/kernel/qvariant/tst_qvariant.cpp | 55 +++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 75966998432..4f256cccda7 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -3560,6 +3560,8 @@ int QVariant::compare(const QVariant &v) const return v1.toTime() < v2.toTime() ? -1 : 1; case QVariant::DateTime: return v1.toDateTime() < v2.toDateTime() ? -1 : 1; + case QVariant::StringList: + return v1.toStringList() < v2.toStringList() ? -1 : 1; } int r = v1.toString().compare(v2.toString(), Qt::CaseInsensitive); if (r == 0) { diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 76230ccec86..509eed231db 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -279,6 +279,7 @@ private slots: void metaEnums(); void compareSanity_data(); void compareSanity(); + void compareRich(); void accessSequentialContainerKey(); @@ -4745,6 +4746,60 @@ void tst_QVariant::compareSanity() } } +static void richComparison(const QVariant& less, const QVariant& more) +{ + QVERIFY(less.type() == more.type()); + + QVERIFY(less < more); + QVERIFY(!(more < less)); + + QVERIFY(more > less); + QVERIFY(!(less > more)); + + QVERIFY(less <= more); + QVERIFY(!(more <= less)); + QVERIFY(less <= less); + + QVERIFY(more >= less); + QVERIFY(!(less >= more)); + QVERIFY(more >= more); +} + +void tst_QVariant::compareRich() +{ + richComparison(QUuid("{49d8ad2a-2ee8-4c3d-949f-1b5a3765ddf0}"), + QUuid("{f6d56824-16e9-4543-a375-add2877c2d05}")); + richComparison(QByteArray::fromRawData("a", 1), + QByteArray::fromRawData("b", 1)); + richComparison(QStringLiteral("a"), QStringLiteral("b")); + richComparison(QLatin1String("a"), QLatin1String("b")); + richComparison(QChar('a'), QChar('b')); + richComparison(QDate(2016, 7, 23), QDate(2016, 7, 24)); + richComparison(QTime(0, 0), QTime(0, 1)); + richComparison(QDateTime(QDate(2016, 7, 23), QTime(0, 0)), + QDateTime(QDate(2016, 7, 23), QTime(0, 1))); + + richComparison(QStringList(), QStringList() << QStringLiteral("a")); + richComparison(QStringList(), QStringList() << QStringLiteral("a") + << QStringLiteral("b")); + richComparison(QStringList() << QStringLiteral("a"), + QStringList() << QStringLiteral("b")); + richComparison(QStringList() << QStringLiteral("a"), + QStringList() << QStringLiteral("b") + << QStringLiteral("c")); + richComparison(QStringList() << QStringLiteral("a") + << QStringLiteral("c"), + QStringList() << QStringLiteral("b")); + richComparison(QStringList() << QStringLiteral("a") + << QStringLiteral("c"), + QStringList() << QStringLiteral("b") + << QStringLiteral("d")); + richComparison(QStringList() << QStringLiteral("a") + << QStringLiteral("c"), + QStringList() << QStringLiteral("a") + << QStringLiteral("d")); +} + void tst_QVariant::accessSequentialContainerKey() { QString nameResult; From dbfd7f304c4d91096e104ec2383d92a37502d836 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 3 Aug 2016 10:02:07 +0200 Subject: [PATCH 024/236] Windows QPA: Add missing parameter to qWarning() The warning printed when wrapping foreign windows is missing a parameter. Amends change f2ef587906062706e576e376e4c6481ab192f50d. Task-number: QTBUG-41186 Change-Id: Iefbd174c1acc42e87fd1a764d96452b1745aa4c0 Reviewed-by: Simon Hausmann --- 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 debe6dd131d..f033e4235c8 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -313,7 +313,7 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons if (window->type() == Qt::ForeignWindow) { const HWND hwnd = reinterpret_cast(window->winId()); if (!IsWindow(hwnd)) { - qWarning("Windows QPA: Invalid foreign window ID %p."); + qWarning("Windows QPA: Invalid foreign window ID %p.", hwnd); return nullptr; } QWindowsForeignWindow *result = new QWindowsForeignWindow(window, hwnd); From d5be0d30588f6ccd971f73a3c030f9c10d8a6b4e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 7 Jul 2016 15:30:00 +0200 Subject: [PATCH 025/236] Polish the codecs example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Port to Qt 5 connection syntax. - Remove unneeded member variables. - Adapt to screen size. - Add a tab widget with a hex dump view to the preview dialog. - Handle conversion errors in preview dialog, add status label displaying errors and warnings about failures and invalid characters encountered. - Fix translated messages. Change-Id: I916100c903e73d0d2326523753ed7398b1c34df0 Reviewed-by: Topi Reiniö --- examples/widgets/tools/codecs/mainwindow.cpp | 137 ++++++-------- examples/widgets/tools/codecs/mainwindow.h | 16 +- examples/widgets/tools/codecs/previewform.cpp | 176 +++++++++++++++--- examples/widgets/tools/codecs/previewform.h | 16 +- 4 files changed, 227 insertions(+), 118 deletions(-) diff --git a/examples/widgets/tools/codecs/mainwindow.cpp b/examples/widgets/tools/codecs/mainwindow.cpp index f25be7304ee..3c8ec588815 100644 --- a/examples/widgets/tools/codecs/mainwindow.cpp +++ b/examples/widgets/tools/codecs/mainwindow.cpp @@ -45,8 +45,8 @@ MainWindow::MainWindow() { - textEdit = new QTextEdit; - textEdit->setLineWrapMode(QTextEdit::NoWrap); + textEdit = new QPlainTextEdit; + textEdit->setLineWrapMode(QPlainTextEdit::NoWrap); setCentralWidget(textEdit); findCodecs(); @@ -54,54 +54,57 @@ MainWindow::MainWindow() previewForm = new PreviewForm(this); previewForm->setCodecList(codecs); - createActions(); createMenus(); setWindowTitle(tr("Codecs")); - resize(500, 400); + + const QRect screenGeometry = QApplication::desktop()->screenGeometry(this); + resize(screenGeometry.width() / 2, screenGeometry.height() * 2 / 3); } void MainWindow::open() { - QString fileName = QFileDialog::getOpenFileName(this); - if (!fileName.isEmpty()) { - QFile file(fileName); - if (!file.open(QFile::ReadOnly)) { - QMessageBox::warning(this, tr("Codecs"), - tr("Cannot read file %1:\n%2") - .arg(fileName) - .arg(file.errorString())); - return; - } - - QByteArray data = file.readAll(); - - previewForm->setEncodedData(data); - if (previewForm->exec()) - textEdit->setPlainText(previewForm->decodedString()); + const QString fileName = QFileDialog::getOpenFileName(this); + if (fileName.isEmpty()) + return; + QFile file(fileName); + if (!file.open(QFile::ReadOnly)) { + QMessageBox::warning(this, tr("Codecs"), + tr("Cannot read file %1:\n%2") + .arg(QDir::toNativeSeparators(fileName), + file.errorString())); + return; } + + const QByteArray data = file.readAll(); + + previewForm->setWindowTitle(tr("Choose Encoding for %1").arg(QFileInfo(fileName).fileName())); + previewForm->setEncodedData(data); + if (previewForm->exec()) + textEdit->setPlainText(previewForm->decodedString()); } void MainWindow::save() { - QString fileName = QFileDialog::getSaveFileName(this); - if (!fileName.isEmpty()) { - QFile file(fileName); - if (!file.open(QFile::WriteOnly | QFile::Text)) { - QMessageBox::warning(this, tr("Codecs"), - tr("Cannot write file %1:\n%2") - .arg(fileName) - .arg(file.errorString())); - return; - } + const QAction *action = qobject_cast(sender()); + const QByteArray codecName = action->data().toByteArray(); + const QString title = tr("Save As (%1)").arg(QLatin1String(codecName)); - QAction *action = qobject_cast(sender()); - QByteArray codecName = action->data().toByteArray(); - - QTextStream out(&file); - out.setCodec(codecName.constData()); - out << textEdit->toPlainText(); + QString fileName = QFileDialog::getSaveFileName(this, title); + if (fileName.isEmpty()) + return; + QFile file(fileName); + if (!file.open(QFile::WriteOnly | QFile::Text)) { + QMessageBox::warning(this, tr("Codecs"), + tr("Cannot write file %1:\n%2") + .arg(QDir::toNativeSeparators(fileName), + file.errorString())); + return; } + + QTextStream out(&file); + out.setCodec(codecName.constData()); + out << textEdit->toPlainText(); } void MainWindow::about() @@ -133,9 +136,9 @@ void MainWindow::findCodecs() QString sortKey = codec->name().toUpper(); int rank; - if (sortKey.startsWith("UTF-8")) { + if (sortKey.startsWith(QLatin1String("UTF-8"))) { rank = 1; - } else if (sortKey.startsWith("UTF-16")) { + } else if (sortKey.startsWith(QLatin1String("UTF-16"))) { rank = 2; } else if (iso8859RegExp.exactMatch(sortKey)) { if (iso8859RegExp.cap(1).size() == 1) @@ -145,58 +148,38 @@ void MainWindow::findCodecs() } else { rank = 5; } - sortKey.prepend(QChar('0' + rank)); + sortKey.prepend(QLatin1Char('0' + rank)); codecMap.insert(sortKey, codec); } codecs = codecMap.values(); } -void MainWindow::createActions() +void MainWindow::createMenus() { - openAct = new QAction(tr("&Open..."), this); + QMenu *fileMenu = menuBar()->addMenu(tr("&File")); + QAction *openAct = + fileMenu->addAction(tr("&Open..."), this, &MainWindow::open); openAct->setShortcuts(QKeySequence::Open); - connect(openAct, SIGNAL(triggered()), this, SLOT(open())); - foreach (QTextCodec *codec, codecs) { - QString text = tr("%1...").arg(QString(codec->name())); - - QAction *action = new QAction(text, this); - action->setData(codec->name()); - connect(action, SIGNAL(triggered()), this, SLOT(save())); + QMenu *saveAsMenu = fileMenu->addMenu(tr("&Save As")); + connect(saveAsMenu, &QMenu::aboutToShow, + this, &MainWindow::aboutToShowSaveAsMenu); + foreach (const QTextCodec *codec, codecs) { + const QByteArray name = codec->name(); + QAction *action = saveAsMenu->addAction(tr("%1...").arg(QLatin1String(name))); + action->setData(QVariant(name)); + connect(action, &QAction::triggered, this, &MainWindow::save); saveAsActs.append(action); } - exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcuts(QKeySequence::Quit); - connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); - - aboutAct = new QAction(tr("&About"), this); - connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); - - aboutQtAct = new QAction(tr("About &Qt"), this); - connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); -} - -void MainWindow::createMenus() -{ - saveAsMenu = new QMenu(tr("&Save As"), this); - foreach (QAction *action, saveAsActs) - saveAsMenu->addAction(action); - connect(saveAsMenu, SIGNAL(aboutToShow()), - this, SLOT(aboutToShowSaveAsMenu())); - - fileMenu = new QMenu(tr("&File"), this); - fileMenu->addAction(openAct); - fileMenu->addMenu(saveAsMenu); fileMenu->addSeparator(); - fileMenu->addAction(exitAct); + QAction *exitAct = fileMenu->addAction(tr("E&xit"), this, &QWidget::close); + exitAct->setShortcuts(QKeySequence::Quit); - helpMenu = new QMenu(tr("&Help"), this); - helpMenu->addAction(aboutAct); - helpMenu->addAction(aboutQtAct); - - menuBar()->addMenu(fileMenu); menuBar()->addSeparator(); - menuBar()->addMenu(helpMenu); + + QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); + helpMenu->addAction(tr("&About"), this, &MainWindow::about); + helpMenu->addAction(tr("About &Qt"), qApp, &QApplication::aboutQt); } diff --git a/examples/widgets/tools/codecs/mainwindow.h b/examples/widgets/tools/codecs/mainwindow.h index 7f1d62627ea..5455daeb847 100644 --- a/examples/widgets/tools/codecs/mainwindow.h +++ b/examples/widgets/tools/codecs/mainwindow.h @@ -46,9 +46,8 @@ QT_BEGIN_NAMESPACE class QAction; -class QMenu; class QTextCodec; -class QTextEdit; +class QPlainTextEdit; QT_END_NAMESPACE class PreviewForm; @@ -67,21 +66,12 @@ private slots: private: void findCodecs(); - void createActions(); void createMenus(); - QTextEdit *textEdit; + QList saveAsActs; + QPlainTextEdit *textEdit; PreviewForm *previewForm; QList codecs; - - QMenu *fileMenu; - QMenu *helpMenu; - QMenu *saveAsMenu; - QAction *openAct; - QList saveAsActs; - QAction *exitAct; - QAction *aboutAct; - QAction *aboutQtAct; }; #endif diff --git a/examples/widgets/tools/codecs/previewform.cpp b/examples/widgets/tools/codecs/previewform.cpp index f6199a9b35c..fdfb90f56c4 100644 --- a/examples/widgets/tools/codecs/previewform.cpp +++ b/examples/widgets/tools/codecs/previewform.cpp @@ -42,47 +42,159 @@ #include "previewform.h" +// Helpers for creating hex dumps +static void indent(QTextStream &str, int indent) +{ + for (int i = 0; i < indent; ++i) + str << ' '; +} + +static void formatHex(QTextStream &str, const QByteArray &data) +{ + const int fieldWidth = str.fieldWidth(); + const QTextStream::FieldAlignment alignment = str.fieldAlignment(); + const int base = str.integerBase(); + const QChar padChar = str.padChar(); + str.setIntegerBase(16); + str.setPadChar(QLatin1Char('0')); + str.setFieldAlignment(QTextStream::AlignRight); + + const unsigned char *p = reinterpret_cast(data.constBegin()); + for (const unsigned char *end = p + data.size(); p < end; ++p) { + str << ' '; + str.setFieldWidth(2); + str << unsigned(*p); + str.setFieldWidth(fieldWidth); + } + str.setFieldAlignment(alignment); + str.setPadChar(padChar); + str.setIntegerBase(base); +} + +static void formatPrintableCharacters(QTextStream &str, const QByteArray &data) +{ + for (int i = 0, size = data.size(); i < size; ++i) { + const char c = data.at(i); + switch (c) { + case '\0': + str << "\\0"; + break; + case '\t': + str << "\\t"; + break; + case '\r': + str << "\\r"; + break; + case '\n': + str << "\\n"; + break; + default: + if (c >= 32 && uchar(c) < 127) + str << ' ' << c; + else + str << ".."; + break; + } + } +} + +static QString formatHexDump(const QByteArray &data) +{ + enum { lineWidth = 16 }; + QString result; + QTextStream str(&result); + str.setIntegerBase(16); + str.setPadChar(QLatin1Char('0')); + const int fieldWidth = str.fieldWidth(); + const QTextStream::FieldAlignment alignment = str.fieldAlignment(); + for (int a = 0, size = data.size(); a < size; a += lineWidth) { + str.setFieldAlignment(QTextStream::AlignRight); + str.setFieldWidth(8); + str << a; + str.setFieldWidth(fieldWidth); + str.setFieldAlignment(alignment); + + const int end = qMin(a + lineWidth, size); + const QByteArray line = data.mid(a, end - a); + + formatHex(str, line); + indent(str, 3 * (lineWidth - line.size())); + + str << ' '; + formatPrintableCharacters(str, line); + indent(str, 2 * (lineWidth - line.size())); + str << '\n'; + } + return result; +} + PreviewForm::PreviewForm(QWidget *parent) : QDialog(parent) { + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); encodingComboBox = new QComboBox; - encodingLabel = new QLabel(tr("&Encoding:")); + QLabel *encodingLabel = new QLabel(tr("&Encoding:")); encodingLabel->setBuddy(encodingComboBox); - textEdit = new QTextEdit; - textEdit->setLineWrapMode(QTextEdit::NoWrap); + textEdit = new QPlainTextEdit; + textEdit->setLineWrapMode(QPlainTextEdit::NoWrap); textEdit->setReadOnly(true); + hexDumpEdit = new QPlainTextEdit; + hexDumpEdit->setLineWrapMode(QPlainTextEdit::NoWrap); + hexDumpEdit->setReadOnly(true); + hexDumpEdit->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); - buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok - | QDialogButtonBox::Cancel); + QDialogButtonBox *buttonBox = + new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + okButton = buttonBox->button(QDialogButtonBox::Ok); - connect(encodingComboBox, SIGNAL(activated(int)), - this, SLOT(updateTextEdit())); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + typedef void(QComboBox::*ComboBoxIntSignal)(int); + connect(encodingComboBox, static_cast(&QComboBox::activated), + this, &PreviewForm::updateTextEdit); + connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); - QGridLayout *mainLayout = new QGridLayout; + QGridLayout *mainLayout = new QGridLayout(this); mainLayout->addWidget(encodingLabel, 0, 0); mainLayout->addWidget(encodingComboBox, 0, 1); - mainLayout->addWidget(textEdit, 1, 0, 1, 2); - mainLayout->addWidget(buttonBox, 2, 0, 1, 2); - setLayout(mainLayout); + tabWidget = new QTabWidget; + tabWidget->addTab(textEdit, tr("Preview")); + tabWidget->addTab(hexDumpEdit, tr("Hex Dump")); + mainLayout->addWidget(tabWidget, 1, 0, 1, 2); + statusLabel = new QLabel; + mainLayout->addWidget(statusLabel, 2, 0, 1, 2); + mainLayout->addWidget(buttonBox, 3, 0, 1, 2); - setWindowTitle(tr("Choose Encoding")); - resize(400, 300); + const QRect screenGeometry = QApplication::desktop()->screenGeometry(this); + resize(screenGeometry.width() * 2 / 5, screenGeometry.height() / 2); } void PreviewForm::setCodecList(const QList &list) { encodingComboBox->clear(); - foreach (QTextCodec *codec, list) - encodingComboBox->addItem(codec->name(), codec->mibEnum()); + foreach (const QTextCodec *codec, list) { + encodingComboBox->addItem(QLatin1String(codec->name()), + QVariant(codec->mibEnum())); + } +} + +void PreviewForm::reset() +{ + decodedStr.clear(); + textEdit->clear(); + hexDumpEdit->clear(); + statusLabel->clear(); + statusLabel->setStyleSheet(QString()); + okButton->setEnabled(false); + tabWidget->setCurrentIndex(0); } void PreviewForm::setEncodedData(const QByteArray &data) { + reset(); encodedData = data; + hexDumpEdit->setPlainText(formatHexDump(data)); updateTextEdit(); } @@ -90,12 +202,30 @@ void PreviewForm::updateTextEdit() { int mib = encodingComboBox->itemData( encodingComboBox->currentIndex()).toInt(); - QTextCodec *codec = QTextCodec::codecForMib(mib); + const QTextCodec *codec = QTextCodec::codecForMib(mib); + const QString name = QLatin1String(codec->name()); - QTextStream in(&encodedData); - in.setAutoDetectUnicode(false); - in.setCodec(codec); - decodedStr = in.readAll(); + QTextCodec::ConverterState state; + decodedStr = codec->toUnicode(encodedData.constData(), encodedData.size(), &state); - textEdit->setPlainText(decodedStr); + bool success = true; + if (state.remainingChars) { + success = false; + const QString message = + tr("%1: conversion error at character %2") + .arg(name).arg(encodedData.size() - state.remainingChars + 1); + statusLabel->setText(message); + statusLabel->setStyleSheet(QStringLiteral("background-color: \"red\";")); + } else if (state.invalidChars) { + statusLabel->setText(tr("%1: %n invalid characters", 0, state.invalidChars).arg(name)); + statusLabel->setStyleSheet(QStringLiteral("background-color: \"yellow\";")); + } else { + statusLabel->setText(tr("%1: %n bytes converted", 0, encodedData.size()).arg(name)); + statusLabel->setStyleSheet(QString()); + } + if (success) + textEdit->setPlainText(decodedStr); + else + textEdit->clear(); + okButton->setEnabled(success); } diff --git a/examples/widgets/tools/codecs/previewform.h b/examples/widgets/tools/codecs/previewform.h index 93bfed32753..1047a50d807 100644 --- a/examples/widgets/tools/codecs/previewform.h +++ b/examples/widgets/tools/codecs/previewform.h @@ -48,8 +48,10 @@ QT_BEGIN_NAMESPACE class QComboBox; class QDialogButtonBox; class QLabel; +class QPlainTextEdit; +class QPushButton; +class QTabWidget; class QTextCodec; -class QTextEdit; QT_END_NAMESPACE class PreviewForm : public QDialog @@ -57,7 +59,7 @@ class PreviewForm : public QDialog Q_OBJECT public: - PreviewForm(QWidget *parent = 0); + explicit PreviewForm(QWidget *parent = Q_NULLPTR); void setCodecList(const QList &list); void setEncodedData(const QByteArray &data); @@ -67,13 +69,17 @@ private slots: void updateTextEdit(); private: + void reset(); + QByteArray encodedData; QString decodedStr; + QPushButton *okButton; + QTabWidget *tabWidget; QComboBox *encodingComboBox; - QLabel *encodingLabel; - QTextEdit *textEdit; - QDialogButtonBox *buttonBox; + QPlainTextEdit *textEdit; + QPlainTextEdit *hexDumpEdit; + QLabel *statusLabel; }; #endif From d1a30be5abcc2d5e5340866434b2691275a135a6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 5 Jul 2016 13:26:53 +0200 Subject: [PATCH 026/236] Polish the findfiles example to be actually useful MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Simplify the code, remove unused members - Fix the translations of plurals to use %n - Add tooltip displaying full paths in list - Add context menu allowing to copy the name and open - Display the correct slashes on Windows - Connect the returnPressed() signals of the line edits - Make the search recursive - Do not search binary files by checking the mime type Change-Id: I3663799c88931db1f58c03ea35211e7ab03737ec Reviewed-by: Topi Reiniö --- examples/widgets/dialogs/findfiles/window.cpp | 139 +++++++++++++----- examples/widgets/dialogs/findfiles/window.h | 6 +- examples/widgets/doc/src/findfiles.qdoc | 38 +++-- 3 files changed, 135 insertions(+), 48 deletions(-) diff --git a/examples/widgets/dialogs/findfiles/window.cpp b/examples/widgets/dialogs/findfiles/window.cpp index 780c398ad59..ce53dd8c839 100644 --- a/examples/widgets/dialogs/findfiles/window.cpp +++ b/examples/widgets/dialogs/findfiles/window.cpp @@ -42,51 +42,72 @@ #include "window.h" +//! [17] +enum { absoluteFileNameRole = Qt::UserRole + 1 }; +//! [17] + +//! [18] +static inline QString fileNameOfItem(const QTableWidgetItem *item) +{ + return item->data(absoluteFileNameRole).toString(); +} +//! [18] + +//! [14] +static inline void openFile(const QString &fileName) +{ + QDesktopServices::openUrl(QUrl::fromLocalFile(fileName)); +} +//! [14] + //! [0] Window::Window(QWidget *parent) : QWidget(parent) { - browseButton = new QPushButton(tr("&Browse..."), this); + QPushButton *browseButton = new QPushButton(tr("&Browse..."), this); connect(browseButton, &QAbstractButton::clicked, this, &Window::browse); findButton = new QPushButton(tr("&Find"), this); connect(findButton, &QAbstractButton::clicked, this, &Window::find); fileComboBox = createComboBox(tr("*")); + connect(fileComboBox->lineEdit(), &QLineEdit::returnPressed, + this, &Window::animateFindClick); textComboBox = createComboBox(); - directoryComboBox = createComboBox(QDir::currentPath()); + connect(textComboBox->lineEdit(), &QLineEdit::returnPressed, + this, &Window::animateFindClick); + directoryComboBox = createComboBox(QDir::toNativeSeparators(QDir::currentPath())); + connect(directoryComboBox->lineEdit(), &QLineEdit::returnPressed, + this, &Window::animateFindClick); - fileLabel = new QLabel(tr("Named:")); - textLabel = new QLabel(tr("Containing text:")); - directoryLabel = new QLabel(tr("In directory:")); filesFoundLabel = new QLabel; createFilesTable(); //! [0] //! [1] - QGridLayout *mainLayout = new QGridLayout; - mainLayout->addWidget(fileLabel, 0, 0); + QGridLayout *mainLayout = new QGridLayout(this); + mainLayout->addWidget(new QLabel(tr("Named:")), 0, 0); mainLayout->addWidget(fileComboBox, 0, 1, 1, 2); - mainLayout->addWidget(textLabel, 1, 0); + mainLayout->addWidget(new QLabel(tr("Containing text:")), 1, 0); mainLayout->addWidget(textComboBox, 1, 1, 1, 2); - mainLayout->addWidget(directoryLabel, 2, 0); + mainLayout->addWidget(new QLabel(tr("In directory:")), 2, 0); mainLayout->addWidget(directoryComboBox, 2, 1); mainLayout->addWidget(browseButton, 2, 2); mainLayout->addWidget(filesTable, 3, 0, 1, 3); mainLayout->addWidget(filesFoundLabel, 4, 0, 1, 2); mainLayout->addWidget(findButton, 4, 2); - setLayout(mainLayout); setWindowTitle(tr("Find Files")); - resize(700, 300); + const QRect screenGeometry = QApplication::desktop()->screenGeometry(this); + resize(screenGeometry.width() / 2, screenGeometry.height() / 3); } //! [1] //! [2] void Window::browse() { - QString directory = QFileDialog::getExistingDirectory(this, - tr("Find Files"), QDir::currentPath()); + QString directory = + QDir::toNativeSeparators(QFileDialog::getExistingDirectory(this, tr("Find Files"), QDir::currentPath())); if (!directory.isEmpty()) { if (directoryComboBox->findText(directory) == -1) @@ -102,14 +123,28 @@ static void updateComboBox(QComboBox *comboBox) comboBox->addItem(comboBox->currentText()); } +//! [13] + +static void findRecursion(const QString &path, const QString &pattern, QStringList *result) +{ + QDir currentDir(path); + const QString prefix = path + QLatin1Char('/'); + foreach (const QString &match, currentDir.entryList(QStringList(pattern), QDir::Files | QDir::NoSymLinks)) + result->append(prefix + match); + foreach (const QString &dir, currentDir.entryList(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot)) + findRecursion(prefix + dir, pattern, result); +} + +//! [13] //! [3] + void Window::find() { filesTable->setRowCount(0); QString fileName = fileComboBox->currentText(); QString text = textComboBox->currentText(); - QString path = directoryComboBox->currentText(); + QString path = QDir::cleanPath(directoryComboBox->currentText()); //! [3] updateComboBox(fileComboBox); @@ -117,19 +152,21 @@ void Window::find() updateComboBox(directoryComboBox); //! [4] + currentDir = QDir(path); QStringList files; - if (fileName.isEmpty()) - fileName = "*"; - files = currentDir.entryList(QStringList(fileName), - QDir::Files | QDir::NoSymLinks); - + findRecursion(path, fileName.isEmpty() ? QStringLiteral("*") : fileName, &files); if (!text.isEmpty()) files = findFiles(files, text); showFiles(files); } //! [4] +void Window::animateFindClick() +{ + findButton->animateClick(); +} + //! [5] QStringList Window::findFiles(const QStringList &files, const QString &text) { @@ -139,21 +176,26 @@ QStringList Window::findFiles(const QStringList &files, const QString &text) progressDialog.setWindowTitle(tr("Find Files")); //! [5] //! [6] + QMimeDatabase mimeDatabase; QStringList foundFiles; for (int i = 0; i < files.size(); ++i) { progressDialog.setValue(i); - progressDialog.setLabelText(tr("Searching file number %1 of %2...") - .arg(i).arg(files.size())); - qApp->processEvents(); + progressDialog.setLabelText(tr("Searching file number %1 of %n...", 0, files.size()).arg(i)); + QCoreApplication::processEvents(); //! [6] if (progressDialog.wasCanceled()) break; //! [7] - QFile file(currentDir.absoluteFilePath(files[i])); - + const QString fileName = files.at(i); + const QMimeType mimeType = mimeDatabase.mimeTypeForFile(fileName); + if (mimeType.isValid() && !mimeType.inherits(QStringLiteral("text/plain"))) { + qWarning() << "Not searching binary file " << QDir::toNativeSeparators(fileName); + continue; + } + QFile file(fileName); if (file.open(QIODevice::ReadOnly)) { QString line; QTextStream in(&file); @@ -161,7 +203,7 @@ QStringList Window::findFiles(const QStringList &files, const QString &text) if (progressDialog.wasCanceled()) break; line = in.readLine(); - if (line.contains(text)) { + if (line.contains(text, Qt::CaseInsensitive)) { foundFiles << files[i]; break; } @@ -176,13 +218,18 @@ QStringList Window::findFiles(const QStringList &files, const QString &text) void Window::showFiles(const QStringList &files) { for (int i = 0; i < files.size(); ++i) { - QFile file(currentDir.absoluteFilePath(files[i])); - qint64 size = QFileInfo(file).size(); - - QTableWidgetItem *fileNameItem = new QTableWidgetItem(files[i]); + const QString &fileName = files.at(i); + const QString toolTip = QDir::toNativeSeparators(fileName); + const QString relativePath = QDir::toNativeSeparators(currentDir.relativeFilePath(fileName)); + const qint64 size = QFileInfo(fileName).size(); + QTableWidgetItem *fileNameItem = new QTableWidgetItem(relativePath); + fileNameItem->setData(absoluteFileNameRole, QVariant(fileName)); + fileNameItem->setToolTip(toolTip); fileNameItem->setFlags(fileNameItem->flags() ^ Qt::ItemIsEditable); QTableWidgetItem *sizeItem = new QTableWidgetItem(tr("%1 KB") .arg(int((size + 1023) / 1024))); + sizeItem->setData(absoluteFileNameRole, QVariant(fileName)); + sizeItem->setToolTip(toolTip); sizeItem->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); sizeItem->setFlags(sizeItem->flags() ^ Qt::ItemIsEditable); @@ -191,8 +238,7 @@ void Window::showFiles(const QStringList &files) filesTable->setItem(row, 0, fileNameItem); filesTable->setItem(row, 1, sizeItem); } - filesFoundLabel->setText(tr("%1 file(s) found").arg(files.size()) + - (" (Double click on a file to open it)")); + filesFoundLabel->setText(tr("%n file(s) found (Double click on a file to open it)", 0, files.size())); filesFoundLabel->setWordWrap(true); } //! [8] @@ -220,20 +266,43 @@ void Window::createFilesTable() filesTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); filesTable->verticalHeader()->hide(); filesTable->setShowGrid(false); - +//! [15] + filesTable->setContextMenuPolicy(Qt::CustomContextMenu); + connect(filesTable, &QTableWidget::customContextMenuRequested, + this, &Window::contextMenu); connect(filesTable, &QTableWidget::cellActivated, this, &Window::openFileOfItem); +//! [15] } //! [11] + //! [12] void Window::openFileOfItem(int row, int /* column */) { - QTableWidgetItem *item = filesTable->item(row, 0); - - QDesktopServices::openUrl(QUrl::fromLocalFile(currentDir.absoluteFilePath(item->text()))); + const QTableWidgetItem *item = filesTable->item(row, 0); + openFile(fileNameOfItem(item)); } //! [12] +//! [16] +void Window::contextMenu(const QPoint &pos) +{ + const QTableWidgetItem *item = filesTable->itemAt(pos); + if (!item) + return; + QMenu menu; + QAction *copyAction = menu.addAction("Copy Name"); + QAction *openAction = menu.addAction("Open"); + QAction *action = menu.exec(filesTable->mapToGlobal(pos)); + if (!action) + return; + const QString fileName = fileNameOfItem(item); + if (action == copyAction) + QGuiApplication::clipboard()->setText(QDir::toNativeSeparators(fileName)); + else if (action == openAction) + openFile(fileName); +} +//! [16] diff --git a/examples/widgets/dialogs/findfiles/window.h b/examples/widgets/dialogs/findfiles/window.h index 89dd87b83b0..119c0fa1008 100644 --- a/examples/widgets/dialogs/findfiles/window.h +++ b/examples/widgets/dialogs/findfiles/window.h @@ -63,7 +63,9 @@ public: private slots: void browse(); void find(); + void animateFindClick(); void openFileOfItem(int row, int column); + void contextMenu(const QPoint &pos); private: QStringList findFiles(const QStringList &files, const QString &text); @@ -74,11 +76,7 @@ private: QComboBox *fileComboBox; QComboBox *textComboBox; QComboBox *directoryComboBox; - QLabel *fileLabel; - QLabel *textLabel; - QLabel *directoryLabel; QLabel *filesFoundLabel; - QPushButton *browseButton; QPushButton *findButton; QTableWidget *filesTable; diff --git a/examples/widgets/doc/src/findfiles.qdoc b/examples/widgets/doc/src/findfiles.qdoc index dd06ed8bb4b..df2ef40768d 100644 --- a/examples/widgets/doc/src/findfiles.qdoc +++ b/examples/widgets/doc/src/findfiles.qdoc @@ -120,10 +120,12 @@ \snippet dialogs/findfiles/window.cpp 4 We use the directory's path to create a QDir; the QDir class - provides access to directory structures and their contents. We - create a list of the files (contained in the newly created QDir) - that match the specified file name. If the file name is empty - the list will contain all the files in the directory. + provides access to directory structures and their contents. + + \snippet dialogs/findfiles/window.cpp 13 + + We recursively create a list of the files (contained in the newl + created QDir) that match the specified file name. Then we search through all the files in the list, using the private \c findFiles() function, eliminating the ones that don't contain @@ -173,9 +175,7 @@ \snippet dialogs/findfiles/window.cpp 7 - After updating the QProgressDialog, we create a QFile using the - QDir::absoluteFilePath() function which returns the absolute path - name of a file in the directory. We open the file in read-only + After updating the QProgressDialog, we open the file in read-only mode, and read one line at a time using QTextStream. The QTextStream class provides a convenient interface for reading @@ -194,9 +194,18 @@ Both the \c findFiles() and \c showFiles() functions are called from the \c find() slot. In the \c showFiles() function we run through - the provided list of file names, adding each file name to the + the provided list of file names, adding each relative file name to the first column in the table widget and retrieving the file's size using - QFile and QFileInfo for the second column. + QFileInfo for the second column. For later use, we set + the absolute path as a data on the QTableWidget using the + the role absoluteFileNameRole defined to be Qt::UserRole + 1. + + \snippet dialogs/findfiles/window.cpp 17 + + This allows for retrieving the name of an item using a + convenience function: + + \snippet dialogs/findfiles/window.cpp 18 We also update the total number of files found. @@ -236,8 +245,19 @@ \snippet dialogs/findfiles/window.cpp 12 + \snippet dialogs/findfiles/window.cpp 14 + The \c openFileOfItem() slot is invoked when the user double clicks on a cell in the table. The QDesktopServices::openUrl() knows how to open a file given the file name. + + \snippet dialogs/findfiles/window.cpp 15 + \snippet dialogs/findfiles/window.cpp 16 + + We set the context menu policy to of the table view to Qt::CustomContextMenu + and connect a slot contextMenu() to its signal + customContextMenuRequested(). We retrieve the absolute file name + from the data of the QTableWidgetItem and populate the context menu + with actions offering to copy the file name and to open the file. */ From ed38f516bf1a9185ed331c2e5a38648e64a3982a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 2 Aug 2016 20:29:55 +0300 Subject: [PATCH 027/236] QStringListModel: begin/endResetModel() are no signals ... so don't use emit on them. Just confuses readers. Change-Id: I24365fc533b5b35f8942d6014dbc68387aa23e22 Reviewed-by: Friedemann Kleint --- src/corelib/itemmodels/qstringlistmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp index b0919c5d78e..c6a1fac9c89 100644 --- a/src/corelib/itemmodels/qstringlistmodel.cpp +++ b/src/corelib/itemmodels/qstringlistmodel.cpp @@ -301,9 +301,9 @@ QStringList QStringListModel::stringList() const */ void QStringListModel::setStringList(const QStringList &strings) { - emit beginResetModel(); + beginResetModel(); lst = strings; - emit endResetModel(); + endResetModel(); } /*! From f200d5e824761d583ecdcf5cf952b14ec5693049 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 13 Jul 2016 10:41:09 +0200 Subject: [PATCH 028/236] Doc: Fix references to Control, Meta key enums MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also make use of qdoc's \note command. Change-Id: I276300cfcfde06e82b04793dbf25df8ec73e9838 Reviewed-by: Leena Miettinen Reviewed-by: Topi Reiniö --- src/gui/kernel/qkeysequence.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index a0818b8d20e..f3ebf002247 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -219,9 +219,9 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni code point of the character; for example, 'A' gives the same key sequence as Qt::Key_A. - \b{Note:} On OS X, references to "Ctrl", Qt::CTRL, Qt::Control + \note On OS X, references to "Ctrl", Qt::CTRL, Qt::Key_Control and Qt::ControlModifier correspond to the \uicontrol Command keys on the - Macintosh keyboard, and references to "Meta", Qt::META, Qt::Meta and + Macintosh keyboard, and references to "Meta", Qt::META, Qt::Key_Meta and Qt::MetaModifier correspond to the \uicontrol Control keys. Developers on OS X can use the same shortcut descriptions across all platforms, and their applications will automatically work as expected on OS X. From bc4ce55fff78610c15d6c8a0cb97526889cb5de3 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 4 Aug 2016 11:43:44 +0300 Subject: [PATCH 029/236] Don't call virtual functions with data from an old model Change-Id: I4f1ec56ce722110042f72761bbc2976e580b7149 Reviewed-by: David Faure Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/itemviews/qabstractitemview.cpp | 6 ++- .../tst_qabstractitemview.cpp | 43 ++++++++++++++++++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index cb40eae9a2f..d36431c7162 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -769,8 +769,10 @@ void QAbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel) QModelIndex oldCurrentIndex; if (d->selectionModel) { - oldSelection = d->selectionModel->selection(); - oldCurrentIndex = d->selectionModel->currentIndex(); + if (d->selectionModel->model() == selectionModel->model()) { + oldSelection = d->selectionModel->selection(); + oldCurrentIndex = d->selectionModel->currentIndex(); + } disconnect(d->selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selectionChanged(QItemSelection,QItemSelection))); diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index a62147b7079..27c9e07037f 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -1939,11 +1939,18 @@ void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model() { public: ListView() - : m_paintEventsCount(0) + : m_paintEventsCount(0), m_deselectedMustBeEmpty(false), m_selectionChangedOk(true) { } + void setSelectionModel(QItemSelectionModel *model) Q_DECL_OVERRIDE + { + m_deselectedMustBeEmpty = !selectionModel() || !model || selectionModel()->model() != model->model(); + QListView::setSelectionModel(model); + m_deselectedMustBeEmpty = false; + } int m_paintEventsCount; + bool selectionChangedOk() const { return m_selectionChangedOk; } protected: bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE @@ -1952,6 +1959,24 @@ void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model() ++m_paintEventsCount; return QListView::viewportEvent(event); } + + void selectionChanged(const QItemSelection &selected, + const QItemSelection &deselected) Q_DECL_OVERRIDE + { + if (m_deselectedMustBeEmpty && !deselected.isEmpty()) + m_selectionChangedOk = false; + + // Make sure both selections belong to the same model + foreach (const QModelIndex &nmi, selected.indexes()) { + foreach (const QModelIndex &omi, deselected.indexes()) { + m_selectionChangedOk = m_selectionChangedOk && (nmi.model() == omi.model()); + } + } + QListView::selectionChanged(selected, deselected); + } + private: + bool m_deselectedMustBeEmpty; + bool m_selectionChangedOk; }; // keep the current/selected row in the "low range", i.e. be sure it's visible, otherwise we @@ -1962,7 +1987,7 @@ void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model() view.selectionModel()->setCurrentIndex(model.index(1, 0), QItemSelectionModel::SelectCurrent); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - + QVERIFY(view.selectionChangedOk()); QItemSelectionModel selectionModel(&model); selectionModel.setCurrentIndex(model.index(2, 0), QItemSelectionModel::Current); @@ -1970,6 +1995,7 @@ void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model() int oldPaintEventsCount = view.m_paintEventsCount; view.setSelectionModel(&selectionModel); QTRY_VERIFY(view.m_paintEventsCount > oldPaintEventsCount); + QVERIFY(view.selectionChangedOk()); QItemSelectionModel selectionModel2(&model); @@ -1979,6 +2005,19 @@ void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model() oldPaintEventsCount = view.m_paintEventsCount; view.setSelectionModel(&selectionModel2); QTRY_VERIFY(view.m_paintEventsCount > oldPaintEventsCount); + QVERIFY(view.selectionChangedOk()); + + // Tests QAbstractItemView::selectionChanged + QStandardItemModel model1; + for (int i = 0; i < 10; ++i) + model1.appendRow(new QStandardItem(QString::number(i))); + view.setModel(&model1); + + QItemSelectionModel selectionModel1(&model1); + selectionModel1.select(model1.index(0, 0), QItemSelectionModel::ClearAndSelect); + selectionModel1.setCurrentIndex(model1.index(1, 0), QItemSelectionModel::Current); + view.setSelectionModel(&selectionModel1); + QVERIFY(view.selectionChangedOk()); } void tst_QAbstractItemView::testSelectionModelInSyncWithView() From b643d6f347a72ebe97f63dce1d63414d8ced6405 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 3 Aug 2016 14:20:54 +0200 Subject: [PATCH 030/236] Fix 64-bit bilinear scaled image sampling A constraint ensuring we do not sample beyond the current scan-line was missing in the SSE2 optimized sampling. Discovered with lancelot. Change-Id: Ib0ece8f8bfaa034733873dc5b8baaaad5d4c0380 Reviewed-by: Erik Verbruggen --- src/gui/painting/qdrawhelper.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index f0e5810b541..a0f7155c677 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -2815,10 +2815,16 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co sbuf2[i * 2 + 1] = ((const uint*)s2)[x2]; fx += fdx; } + int fastLen; + if (fdx > 0) + fastLen = qMin(len, int((image_x2 - (fx >> 16)) / data->m11)); + else + fastLen = qMin(len, int((image_x1 - (fx >> 16)) / data->m11)); + fastLen -= 3; const __m128i v_fdx = _mm_set1_epi32(fdx*4); __m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx); - for (; i < len-3; i+=4) { + for (; i < fastLen; i += 4) { int offset = _mm_extract_epi16(v_fx, 1); sbuf1[i * 2 + 0] = ((const uint*)s1)[offset]; sbuf1[i * 2 + 1] = ((const uint*)s1)[offset + 1]; From 457d91bb07a8ad0d1a582016566ba5119bb1ac95 Mon Sep 17 00:00:00 2001 From: charlycha Date: Tue, 9 Feb 2016 06:36:07 +0100 Subject: [PATCH 031/236] raspberry pi: manage eglfs display id with env var Specify the display to use by setting environment variable QT_QPA_EGLFS_DISPMANX_ID Possible values are : 0: MAIN LCD 1: AUX LCD 2: HDMI 3: SDTV 4: FORCE LCD 5: FORCE TV 6: FORCE OTHER Change-Id: I146db9a7f423bd4c6c1716c64d3df4d2388e85f9 Reviewed-by: Andy Nichols --- .../eglfs_brcm/qeglfsbrcmintegration.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp index 4813d9be040..544ac318779 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp @@ -87,9 +87,23 @@ void QEglFSBrcmIntegration::platformInit() bcm_host_init(); } +static int getDisplayId() +{ + // As defined in vc_dispmanx_types.h + // DISPMANX_ID_MAIN_LCD 0 + // DISPMANX_ID_AUX_LCD 1 + // DISPMANX_ID_HDMI 2 + // DISPMANX_ID_SDTV 3 + // DISPMANX_ID_FORCE_LCD 4 + // DISPMANX_ID_FORCE_TV 5 + // DISPMANX_ID_FORCE_OTHER 6 /* non-default display */ + static const int dispmanxId = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DISPMANX_ID"); + return (dispmanxId >= 0 && dispmanxId <= 6) ? dispmanxId : 0; +} + EGLNativeDisplayType QEglFSBrcmIntegration::platformDisplay() const { - dispman_display = vc_dispmanx_display_open(0/* LCD */); + dispman_display = vc_dispmanx_display_open(getDisplayId()); return EGL_DEFAULT_DISPLAY; } @@ -101,7 +115,7 @@ void QEglFSBrcmIntegration::platformDestroy() QSize QEglFSBrcmIntegration::screenSize() const { uint32_t width, height; - graphics_get_display_size(0 /* LCD */, &width, &height); + graphics_get_display_size(getDisplayId(), &width, &height); return QSize(width, height); } From 595c6abf9d2cb666f2502bbf89ab3a7052717027 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Thu, 28 Jul 2016 17:28:27 +0300 Subject: [PATCH 032/236] QLocalSocket/Tcp: open device before making a connection According to QLocalSocket's documentation, connectToServer() must initiate a connection attempt after opening the device. Otherwise, if a connection succeeds immediately, connected() signal will be emitted on closed device. So, this patch ensures that TCP-based implementation behaves correctly. Change-Id: I4cc9474815e091a1491a429a6dc17f9cf0154f58 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/network/socket/qlocalsocket_tcp.cpp | 2 +- tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp index c0140e574ed..461ece837fe 100644 --- a/src/network/socket/qlocalsocket_tcp.cpp +++ b/src/network/socket/qlocalsocket_tcp.cpp @@ -239,8 +239,8 @@ void QLocalSocket::connectToServer(OpenMode openMode) QLatin1String("QLocalSocket::connectToServer")); return; } - d->tcpSocket->connectToHost(QHostAddress::LocalHost, port, openMode); QIODevice::open(openMode); + d->tcpSocket->connectToHost(QHostAddress::LocalHost, port, openMode); } bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor, diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 6e55b15a18c..33aceb91597 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -190,6 +190,7 @@ private slots: void slotConnected() { QCOMPARE(state(), QLocalSocket::ConnectedState); + QVERIFY(isOpen()); } void slotDisconnected() { From 35117590c8f4634ddfdbe75966dd43adeca69369 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Fri, 3 Jun 2016 07:33:55 +0200 Subject: [PATCH 033/236] Remove unneeded ';' after some macros The unneeded ';' triggered warnings in pedantic compilation mode. Change-Id: Id2324823e138560bb25234306601253d7bbd713e Reviewed-by: Richard J. Moore Reviewed-by: Friedemann Kleint Reviewed-by: Allan Sandfeld Jensen --- src/gui/image/qpixmap_blitter_p.h | 2 +- src/gui/opengl/qopengltextureblitter_p.h | 4 ++-- src/gui/painting/qblittable_p.h | 2 +- src/gui/painting/qdatabuffer_p.h | 2 +- src/gui/painting/qpaintengine_blitter_p.h | 2 +- src/network/ssl/qsslsocket_mac_p.h | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 6dbcbd91beb..e1444f6279f 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QBlittablePlatformPixmap : public QPlatformPixmap { -// Q_DECLARE_PRIVATE(QBlittablePlatformPixmap); +// Q_DECLARE_PRIVATE(QBlittablePlatformPixmap) public: QBlittablePlatformPixmap(); ~QBlittablePlatformPixmap(); diff --git a/src/gui/opengl/qopengltextureblitter_p.h b/src/gui/opengl/qopengltextureblitter_p.h index ebf3a4bfbbd..65149d2cb09 100644 --- a/src/gui/opengl/qopengltextureblitter_p.h +++ b/src/gui/opengl/qopengltextureblitter_p.h @@ -83,8 +83,8 @@ public: static QMatrix3x3 sourceTransform(const QRectF &subTexture, const QSize &textureSize, Origin origin); private: - Q_DISABLE_COPY(QOpenGLTextureBlitter); - Q_DECLARE_PRIVATE(QOpenGLTextureBlitter); + Q_DISABLE_COPY(QOpenGLTextureBlitter) + Q_DECLARE_PRIVATE(QOpenGLTextureBlitter) QScopedPointer d_ptr; }; diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h index 47218f2f35c..1a5c5073481 100644 --- a/src/gui/painting/qblittable_p.h +++ b/src/gui/painting/qblittable_p.h @@ -57,7 +57,7 @@ class QBlittablePrivate; class Q_GUI_EXPORT QBlittable { - Q_DECLARE_PRIVATE(QBlittable); + Q_DECLARE_PRIVATE(QBlittable) public: enum Capability { diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h index 3fe39efddec..2a6b1bde4c2 100644 --- a/src/gui/painting/qdatabuffer_p.h +++ b/src/gui/painting/qdatabuffer_p.h @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE template class QDataBuffer { - Q_DISABLE_COPY(QDataBuffer); + Q_DISABLE_COPY(QDataBuffer) public: QDataBuffer(int res) { diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index ab44851ec70..e960fbcfa86 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -56,7 +56,7 @@ class QBlittable; class Q_GUI_EXPORT QBlitterPaintEngine : public QRasterPaintEngine { - Q_DECLARE_PRIVATE(QBlitterPaintEngine); + Q_DECLARE_PRIVATE(QBlitterPaintEngine) public: QBlitterPaintEngine(QBlittablePlatformPixmap *p); diff --git a/src/network/ssl/qsslsocket_mac_p.h b/src/network/ssl/qsslsocket_mac_p.h index 7a622db185d..e8d9d346934 100644 --- a/src/network/ssl/qsslsocket_mac_p.h +++ b/src/network/ssl/qsslsocket_mac_p.h @@ -68,7 +68,7 @@ public: private: SSLContextRef context; - Q_DISABLE_COPY(QSecureTransportContext); + Q_DISABLE_COPY(QSecureTransportContext) }; class QSslSocketBackendPrivate : public QSslSocketPrivate @@ -115,7 +115,7 @@ private: QSecureTransportContext context; - Q_DISABLE_COPY(QSslSocketBackendPrivate); + Q_DISABLE_COPY(QSslSocketBackendPrivate) }; QT_END_NAMESPACE From 9c8a8e90a6514c23bcbeb14073a9d6bdd926d68b Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Mon, 11 Jul 2016 17:23:21 +0300 Subject: [PATCH 034/236] QString: fix append(const QStringRef &str) Use QStringRef::isNull instead of QStringRef::string() for validation. Non-NULL str.string() may yet leave us with a useless str.unicode(), which is the actual problem here; whereas !str.isNull() does really confirm that str.unicode() is sensible. Such test prevents situation like: const QString a; QString b; b.append(a); // b.isNull() == true b.append(QStringRef(&a)); // b.isNull() == false Auto test updated: create QStringRef from QString directly, without any condition. Change-Id: I082cd58ef656d8a53e3c1223aca01feea82fffb9 Reviewed-by: Thiago Macieira Reviewed-by: Marc Mutz --- src/corelib/tools/qstring.cpp | 2 +- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index b5119444b7b..9aeec77632f 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -9375,7 +9375,7 @@ QString &QString::append(const QStringRef &str) { if (str.string() == this) { str.appendTo(this); - } else if (str.string()) { + } else if (!str.isNull()) { int oldSize = size(); resize(oldSize + str.size()); memcpy(data() + oldSize, str.unicode(), str.size() * sizeof(QChar)); diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index da6cdddd4f6..db4c33afde5 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -131,7 +131,7 @@ template <> class Arg : ArgBase { QStringRef ref() const - { return this->pinned.isNull() ? QStringRef() : this->pinned.midRef(0) ; } + { return QStringRef(&pinned); } public: explicit Arg(const char *str) : ArgBase(str) {} From 47511046a404d223021b72aadd660e18faa2b90c Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Tue, 5 Jul 2016 11:52:59 -0700 Subject: [PATCH 035/236] Fix rasterwindow example At least with the eglfs platform plugin, the QBackingStore constructor results in a null pointer access if done before creation. Change-Id: I2e78e70700fa48499a35c55797e1b962b6e6285a Reviewed-by: Rebecca Worledge Reviewed-by: Andy Nichols --- examples/gui/rasterwindow/rasterwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gui/rasterwindow/rasterwindow.cpp b/examples/gui/rasterwindow/rasterwindow.cpp index 96fe5297c84..f343ab6c303 100644 --- a/examples/gui/rasterwindow/rasterwindow.cpp +++ b/examples/gui/rasterwindow/rasterwindow.cpp @@ -45,8 +45,8 @@ RasterWindow::RasterWindow(QWindow *parent) : QWindow(parent) , m_update_pending(false) { - m_backingStore = new QBackingStore(this); create(); + m_backingStore = new QBackingStore(this); setGeometry(100, 100, 300, 200); From 91a2c8630b2204831566ab8e523c747f9d8ec927 Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 2 Aug 2016 14:07:37 +0200 Subject: [PATCH 036/236] QUrl::resolved: keep treating file:name.txt as relative for now 8a33077 made QUrl::resolved() follow its documentation ("If relative is not a relative URL, this function will return relative directly.", where relative means scheme is empty). However there is much code out there (e.g. qtdeclarative) which relies on QUrl::fromLocalFile("fileName.txt") to be treated as relative, so for now, we still allow this (in Qt 5.6.x). For Qt 5.8, this commit will be reverted. [ChangeLog][QtCore][QUrl] [EDITORIAL: replaces 8a33077] QUrl::resolved() no longer treats a URL with a scheme as a relative URL if it matches this URL's scheme. For now it still treats "file:name.txt" as relative for compatibility, but be warned that in Qt 5.8 it will no longer consider those to be relative. Both isRelative() and RFC 3986 say that such URLs are not relative, so starting from Qt 5.8, resolved() will return them as is. Change-Id: Iff01e5b470319f6c46526086d765187e2259bdf5 Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qurl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 1fe529d48d0..a5643d123dc 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3167,7 +3167,8 @@ QUrl QUrl::resolved(const QUrl &relative) const if (!relative.d) return *this; QUrl t; - if (!relative.d->scheme.isEmpty()) { + // Compatibility hack (mostly for qtdeclarative) : treat "file:relative.txt" as relative even though QUrl::isRelative() says false + if (!relative.d->scheme.isEmpty() && (!relative.isLocalFile() || QDir::isAbsolutePath(relative.d->path))) { t = relative; t.detach(); } else { From 9b3a7ece479997fc093ae913255b37c937291795 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 4 Aug 2016 15:21:47 +0200 Subject: [PATCH 037/236] Re-add the space character as a document terminator With change 208496091d994c2ffe44ea41368fb659978c1581 the space character was replaced with a visual document terminator character. However this meant that if the whitespace was visualized without the document terminator character visualized then clicking after the text would cause it to be positioned off by one. By bringing back the space character when the terminator is not being visualized then it will correctly place the cursor at the end of the text. Change-Id: I335c1773a37a654f3196bd350562e8f92ffd5369 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextengine.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 28fb9d27690..7378b129a9f 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1569,12 +1569,13 @@ void QTextEngine::validate() const layoutData = new LayoutData(); if (block.docHandle()) { layoutData->string = block.text(); - if (block.next().isValid()) { - if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) - layoutData->string += QChar(0xb6); - } else if (option.flags() & QTextOption::ShowDocumentTerminator) { + const bool nextBlockValid = block.next().isValid(); + if (!nextBlockValid && option.flags() & QTextOption::ShowDocumentTerminator) { layoutData->string += QChar(0xA7); + } else if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) { + layoutData->string += QLatin1Char(nextBlockValid ? 0xb6 : 0x20); } + } else { layoutData->string = text; } From eb4bcdd8cec77c558cc75d31730cff89852dd684 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Thu, 4 Aug 2016 18:43:42 +0300 Subject: [PATCH 038/236] QNativeSocketEngine::option(): return a correct value on invalid call Instead of 'true', it should be '-1'. Change-Id: I5e8f99153da68d34b37477ef4cedbc447fba347f Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne --- src/network/socket/qnativesocketengine_unix.cpp | 2 +- .../socket/platformsocketengine/tst_platformsocketengine.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 5dfc6480da1..1ce12edef13 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -307,7 +307,7 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co // handle non-getsockopt cases first if (opt == QNativeSocketEngine::BindExclusively || opt == QNativeSocketEngine::NonBlockingSocketOption || opt == QNativeSocketEngine::BroadcastSocketOption) - return true; + return -1; int n, level; int v = -1; diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp index 71125f463ac..ba7659a8a71 100644 --- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp +++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp @@ -139,6 +139,7 @@ void tst_PlatformSocketEngine::construction() QCOMPARE(socketDevice.peerAddress(), QHostAddress()); QCOMPARE(socketDevice.peerPort(), quint16(0)); QCOMPARE(socketDevice.error(), QAbstractSocket::UnknownSocketError); + QCOMPARE(socketDevice.option(QNativeSocketEngine::NonBlockingSocketOption), -1); QTest::ignoreMessage(QtWarningMsg, PLATFORMSOCKETENGINESTRING "::bytesAvailable() was called in QAbstractSocket::UnconnectedState"); QCOMPARE(socketDevice.bytesAvailable(), -1); From 434c52269564c84e3ea57242b7aaa2fd7cad3f54 Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 4 Aug 2016 10:01:21 +0200 Subject: [PATCH 039/236] Improve performance of QColor::name, now more than 4 times faster Before: HexRgb: 0.00230 ms per iteration, HexArgb: 0.00290 ms per iteration After: HexRgb: 0.00051 ms per iteration, HexArgb: 0.00061 ms per iteration This showed up as a relevant optimization when profiling KIconLoader which uses QColor::name() as part of the key -- thanks to Mark Gaiser for the investigation and first suggestion of a solution. I have also seen customer code writing a replacement for QColor::name() because it was too slow to be used as a hash key. Change-Id: I009ccdd712ea0d869d466e2c9894e0cea58f0e68 Reviewed-by: Marc Mutz --- src/gui/painting/qcolor.cpp | 5 +- tests/auto/gui/painting/qcolor/tst_qcolor.cpp | 2 + tests/benchmarks/gui/painting/painting.pro | 1 + .../benchmarks/gui/painting/qcolor/qcolor.pro | 7 ++ .../gui/painting/qcolor/tst_qcolor.cpp | 67 +++++++++++++++++++ 5 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 tests/benchmarks/gui/painting/qcolor/qcolor.pro create mode 100644 tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 3f30c061dc1..d0a60f37041 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -521,9 +521,10 @@ QString QColor::name(NameFormat format) const { switch (format) { case HexRgb: - return QString::asprintf("#%02x%02x%02x", red(), green(), blue()); + return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6); case HexArgb: - return QString::asprintf("#%02x%02x%02x%02x", alpha(), red(), green(), blue()); + // it's called rgba() but it does return AARRGGBB + return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8); } return QString(); } diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index b81a4e2c4cc..289b06fc62f 100644 --- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp +++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp @@ -284,6 +284,8 @@ void tst_QColor::name_data() QTest::newRow("global color darkMagenta") << QColor(Qt::darkMagenta) << "#800080" << QColor::HexRgb; QTest::newRow("global color darkYellow") << QColor(Qt::darkYellow) << "#808000" << QColor::HexRgb; QTest::newRow("transparent red") << QColor(255, 0, 0, 102) << "#66ff0000" << QColor::HexArgb; + QTest::newRow("fully_transparent_green_rgb") << QColor(0, 0, 255, 0) << "#0000ff" << QColor::HexRgb; + QTest::newRow("fully_transparent_green_argb") << QColor(0, 0, 255, 0) << "#000000ff" << QColor::HexArgb; } void tst_QColor::name() diff --git a/tests/benchmarks/gui/painting/painting.pro b/tests/benchmarks/gui/painting/painting.pro index 0eb7fa92a72..cdcfc9b3188 100644 --- a/tests/benchmarks/gui/painting/painting.pro +++ b/tests/benchmarks/gui/painting/painting.pro @@ -1,5 +1,6 @@ TEMPLATE = subdirs SUBDIRS = \ + qcolor \ qpainter \ qregion \ qtransform \ diff --git a/tests/benchmarks/gui/painting/qcolor/qcolor.pro b/tests/benchmarks/gui/painting/qcolor/qcolor.pro new file mode 100644 index 00000000000..5ceb7023234 --- /dev/null +++ b/tests/benchmarks/gui/painting/qcolor/qcolor.pro @@ -0,0 +1,7 @@ +QT += testlib +QT += gui-private + +TEMPLATE = app +TARGET = tst_bench_qcolor + +SOURCES += tst_qcolor.cpp diff --git a/tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp b/tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp new file mode 100644 index 00000000000..b67fa450d79 --- /dev/null +++ b/tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + + +class tst_QColor : public QObject +{ + Q_OBJECT + +private slots: + void nameRgb(); + void nameArgb(); +}; + +void tst_QColor::nameRgb() +{ + QColor color(128, 255, 10); + QCOMPARE(color.name(), QStringLiteral("#80ff0a")); + QBENCHMARK { + color.name(); + } +} + +void tst_QColor::nameArgb() +{ + QColor color(128, 255, 0, 102); + QCOMPARE(color.name(QColor::HexArgb), QStringLiteral("#6680ff00")); + QBENCHMARK { + color.name(QColor::HexArgb); + } +} + +QTEST_MAIN(tst_QColor) + +#include "tst_qcolor.moc" From ebde32ae3d743ad1d3f70295317dcea9c0377314 Mon Sep 17 00:00:00 2001 From: Andreas Wilhelm Date: Fri, 15 Jul 2016 14:40:00 +0200 Subject: [PATCH 040/236] qdbusxml2cpp: Ported to QCommandLineParser Change-Id: I8a91a376ba60b110fff9eb84e1b02e3c6e8c5e30 Reviewed-by: Rolf Eike Beer Reviewed-by: Thiago Macieira --- src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp | 203 +++++++++--------------- 1 file changed, 74 insertions(+), 129 deletions(-) diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index 8fc54794bca..e58f194b729 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -27,6 +27,8 @@ ****************************************************************************/ #include +#include +#include #include #include #include @@ -59,30 +61,6 @@ static QString commandLine; static QStringList includes; static QStringList wantedInterfaces; -static const char help[] = - "Usage: " PROGRAMNAME " [options...] [xml-or-xml-file] [interfaces...]\n" - "Produces the C++ code to implement the interfaces defined in the input file.\n" - "\n" - "Options:\n" - " -a Write the adaptor code to \n" - " -c Use as the class name for the generated classes\n" - " -h Show this information\n" - " -i Add #include to the output\n" - " -l When generating an adaptor, use as the parent class\n" - " -m Generate #include \"filename.moc\" statements in the .cpp files\n" - " -N Don't use namespaces\n" - " -p Write the proxy code to \n" - " -v Be verbose.\n" - " -V Show the program version and quit.\n" - "\n" - "If the file name given to the options -a and -p does not end in .cpp or .h, the\n" - "program will automatically append the suffixes and produce both files.\n" - "You can also use a colon (:) to separate the header name from the source file\n" - "name, as in '-a filename_p.h:filename.cpp'.\n" - "\n" - "If you pass a dash (-) as the argument to either -p or -a, the output is written\n" - "to the standard output\n"; - static const char includeList[] = "#include \n" "#include \n" @@ -101,105 +79,6 @@ static const char forwardDeclarations[] = "class QVariant;\n" "QT_END_NAMESPACE\n"; -static void showHelp() -{ - printf("%s", help); - exit(0); -} - -static void showVersion() -{ - printf("%s version %s\n", PROGRAMNAME, PROGRAMVERSION); - printf("D-Bus binding tool for Qt\n"); - exit(0); -} - -static QString nextArg(QStringList &args, int i, char opt) -{ - QString arg = args.value(i); - if (arg.isEmpty()) { - printf("-%c needs at least one argument\n", opt); - exit(1); - } - return args.takeAt(i); -} - -static void parseCmdLine(QStringList args) -{ - args.takeFirst(); - - commandLine = QLatin1String(PROGRAMNAME " "); - commandLine += args.join(QLatin1Char(' ')); - - int i = 0; - while (i < args.count()) { - - if (!args.at(i).startsWith(QLatin1Char('-'))) { - ++i; - continue; - } - QString arg = args.takeAt(i); - - char c = '\0'; - if (arg.length() == 2) - c = arg.at(1).toLatin1(); - else if (arg == QLatin1String("--help")) - c = 'h'; - - switch (c) { - case 'a': - adaptorFile = nextArg(args, i, 'a'); - break; - - case 'c': - globalClassName = nextArg(args, i, 'c'); - break; - - case 'v': - verbose = true; - break; - - case 'i': - includes << nextArg(args, i, 'i'); - break; - - case 'l': - parentClassName = nextArg(args, i, 'l'); - break; - - case 'm': - includeMocs = true; - break; - - case 'N': - skipNamespaces = true; - break; - - case '?': - case 'h': - showHelp(); - break; - - case 'V': - showVersion(); - break; - - case 'p': - proxyFile = nextArg(args, i, 'p'); - break; - - default: - printf("unknown option: '%s'\n", qPrintable(arg)); - exit(1); - } - } - - if (!args.isEmpty()) - inputFile = args.takeFirst(); - - wantedInterfaces << args; -} - static QDBusIntrospection::Interfaces readInput() { QFile input(inputFile); @@ -1139,13 +1018,79 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte int main(int argc, char **argv) { - QStringList arguments; - arguments.reserve(argc); - for (int i = 0; i < argc; ++i) { - arguments.append(QString::fromLocal8Bit(argv[i])); - } + QCoreApplication app(argc, argv); + QCoreApplication::setApplicationName(QStringLiteral(PROGRAMNAME)); + QCoreApplication::setApplicationVersion(QStringLiteral(PROGRAMVERSION)); - parseCmdLine(arguments); + QCommandLineParser parser; + parser.setApplicationDescription(QLatin1String( + "Produces the C++ code to implement the interfaces defined in the input file.\n\n" + "If the file name given to the options -a and -p does not end in .cpp or .h, the\n" + "program will automatically append the suffixes and produce both files.\n" + "You can also use a colon (:) to separate the header name from the source file\n" + "name, as in '-a filename_p.h:filename.cpp'.\n\n" + "If you pass a dash (-) as the argument to either -p or -a, the output is written\n" + "to the standard output.")); + + parser.addHelpOption(); + parser.addVersionOption(); + parser.addPositionalArgument(QStringLiteral("xml-or-xml-file"), QStringLiteral("XML file to use.")); + parser.addPositionalArgument(QStringLiteral("interfaces"), QStringLiteral("List of interfaces to use."), + QStringLiteral("[interfaces ...]")); + + QCommandLineOption adapterCodeOption(QStringList() << QStringLiteral("a") << QStringLiteral("adaptor"), + QStringLiteral("Write the adaptor code to "), QStringLiteral("filename")); + parser.addOption(adapterCodeOption); + + QCommandLineOption classNameOption(QStringList() << QStringLiteral("c") << QStringLiteral("classname"), + QStringLiteral("Use as the class name for the generated classes"), QStringLiteral("classname")); + parser.addOption(classNameOption); + + QCommandLineOption addIncludeOption(QStringList() << QStringLiteral("i") << QStringLiteral("include"), + QStringLiteral("Add #include to the output"), QStringLiteral("filename")); + parser.addOption(addIncludeOption); + + QCommandLineOption adapterParentOption(QStringLiteral("l"), + QStringLiteral("When generating an adaptor, use as the parent class"), QStringLiteral("classname")); + parser.addOption(adapterParentOption); + + QCommandLineOption mocIncludeOption(QStringList() << QStringLiteral("m") << QStringLiteral("moc"), + QStringLiteral("Generate #include \"filename.moc\" statements in the .cpp files")); + parser.addOption(mocIncludeOption); + + QCommandLineOption noNamespaceOption(QStringList() << QStringLiteral("N") << QStringLiteral("no-namespaces"), + QStringLiteral("Don't use namespaces")); + parser.addOption(noNamespaceOption); + + QCommandLineOption proxyCodeOption(QStringList() << QStringLiteral("p") << QStringLiteral("proxy"), + QStringLiteral("Write the proxy code to "), QStringLiteral("filename")); + parser.addOption(proxyCodeOption); + + QCommandLineOption verboseOption(QStringList() << QStringLiteral("V") << QStringLiteral("verbose"), + QStringLiteral("Be verbose.")); + parser.addOption(verboseOption); + + parser.process(app); + + adaptorFile = parser.value(adapterCodeOption); + globalClassName = parser.value(classNameOption); + includes = parser.values(addIncludeOption); + parentClassName = parser.value(adapterParentOption); + includeMocs = parser.isSet(mocIncludeOption); + skipNamespaces = parser.isSet(noNamespaceOption); + proxyFile = parser.value(proxyCodeOption); + verbose = parser.isSet(verboseOption); + + wantedInterfaces = parser.positionalArguments(); + if (!wantedInterfaces.isEmpty()) { + inputFile = wantedInterfaces.takeFirst(); + + QFileInfo inputInfo(inputFile); + if (!inputInfo.exists() || !inputInfo.isFile() || !inputInfo.isReadable()) { + qCritical("Error: Input %s is not a file or cannot be accessed\n", qPrintable(inputFile)); + return 1; + } + } QDBusIntrospection::Interfaces interfaces = readInput(); cleanInterfaces(interfaces); From 4cb44c744c7d15658df79b801296b98fdc956336 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Thu, 4 Aug 2016 17:01:37 +0200 Subject: [PATCH 041/236] Added pointer check in QFontDatabase::load CID 11131 (#1 of 1): Dereference after null check (FORWARD_NULL)46. var_deref_op: Dereferencing null pointer fe. Change-Id: Ifc0cd0b208db511516db93c3d0e0367299df6d80 Reviewed-by: Timur Pocheptsov Reviewed-by: Konstantin Ritt --- src/gui/text/qfontdatabase.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 7b88a73c61c..074d9707f16 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -2799,6 +2799,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script) req.fallBackFamilies.clear(); } + Q_ASSERT(fe); if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) { for (int i = 0; i < QChar::ScriptCount; ++i) { if (!d->engineData->engines[i]) { From 1ceee31ae0f552d128fa77be79c9be135f9c6972 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Wed, 3 Aug 2016 20:20:54 +0300 Subject: [PATCH 042/236] Fix tst_QProcess::closeWriteChannel() under Windows Sometimes, this test fails in CI due to notifications arriving asynchronously from the OS. This happens inside closeWriteChannel() call, where we are flushing the write buffer and I/O completion on the read pipe could occur there as well. So, take this into account before waiting for the new incoming data. Also, improve the checks on successful reading and writing. Change-Id: Iabe875fc346eb4420c72d03208d22ea861a570c6 Reviewed-by: Edward Welbourne --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 7e1d5487ba5..3c4bc79cdee 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -764,6 +764,7 @@ void tst_QProcess::restartProcess() // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::closeWriteChannel() { + QByteArray testData("Data to read"); QProcess more; more.start("testProcessEOF/testProcessEOF"); @@ -771,19 +772,21 @@ void tst_QProcess::closeWriteChannel() QVERIFY(!more.waitForReadyRead(250)); QCOMPARE(more.error(), QProcess::Timedout); - QVERIFY(more.write("Data to read") != -1); + QCOMPARE(more.write(testData), qint64(testData.size())); QVERIFY(!more.waitForReadyRead(250)); QCOMPARE(more.error(), QProcess::Timedout); more.closeWriteChannel(); - - QVERIFY(more.waitForReadyRead(5000)); - QVERIFY(more.readAll().startsWith("Data to read")); + // During closeWriteChannel() call, we might also get an I/O completion + // on the read pipe. So, take this into account before waiting for + // the new incoming data. + while (more.bytesAvailable() < testData.size()) + QVERIFY(more.waitForReadyRead(5000)); + QCOMPARE(more.readAll(), testData); if (more.state() == QProcess::Running) - more.write("q"); - QVERIFY(more.waitForFinished(5000)); + QVERIFY(more.waitForFinished(5000)); QCOMPARE(more.exitStatus(), QProcess::NormalExit); QCOMPARE(more.exitCode(), 0); } From b92f5a0f3bba5d75ae59db2dbc203e577382fac3 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 3 Aug 2016 16:20:50 +0200 Subject: [PATCH 043/236] Remove hiding of .main div in offline pages The section got introduced in commit 93d35c07d06fcc, but is ignored by browsers so far due to a non-blank space (0xc2 0xa0). Task-number: QTBUG-55115 Change-Id: Ie0668b89c7151c934f40e033100a544011a583d8 Reviewed-by: Allan Sandfeld Jensen --- doc/global/template/style/offline.css | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/global/template/style/offline.css b/doc/global/template/style/offline.css index 1c5a2dfa615..612c1087d58 100644 --- a/doc/global/template/style/offline.css +++ b/doc/global/template/style/offline.css @@ -47,9 +47,6 @@ tt { text-align: left } -.main { - display: none; -} /* ----------- links From ceabcc01425664651df08bfa9f148e541287f753 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 12 Apr 2016 15:47:55 +0200 Subject: [PATCH 044/236] tst_QString: unit test for broken toLocal8bit() error-handling We can't (at present) actually exercise the failure in QWindowsLocalCodec::convertFromUnicode() that prompted us to consider the possible failure here, but we should at least test for it. Change-Id: I5066c88d7b4caeb48aebc6b79c355fa49e1c581c Reviewed-by: Frederic Marchal Reviewed-by: Thiago Macieira --- .../corelib/tools/qstring/tst_qstring.cpp | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index db4c33afde5..bfcb20231b0 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -503,6 +503,8 @@ private slots: void fromLocal8Bit(); void local8Bit_data(); void local8Bit(); + void invalidToLocal8Bit_data(); + void invalidToLocal8Bit(); void nullFromLocal8Bit(); void fromLatin1Roundtrip_data(); void fromLatin1Roundtrip(); @@ -4277,6 +4279,66 @@ void tst_QString::local8Bit() QCOMPARE(local8Bit.toLocal8Bit(), QByteArray(result)); } +void tst_QString::invalidToLocal8Bit_data() +{ + QTest::addColumn("unicode"); + QTest::addColumn("expect"); // Initial validly-converted prefix + + { + const QChar malformed[] = { 'A', 0xd800, 'B', 0 }; + const char expected[] = "A"; + QTest::newRow("LoneHighSurrogate") + << QString(malformed, sizeof(malformed) / sizeof(QChar)) + // Don't include the terminating '\0' of expected: + << QByteArray(expected, sizeof(expected) / sizeof(char) - 1); + } + { + const QChar malformed[] = { 'A', 0xdc00, 'B', 0 }; + const char expected[] = "A"; + QTest::newRow("LoneLowSurrogate") + << QString(malformed, sizeof(malformed) / sizeof(QChar)) + << QByteArray(expected, sizeof(expected) / sizeof(char) - 1); + } + { + const QChar malformed[] = { 'A', 0xd800, 0xd801, 'B', 0 }; + const char expected[] = "A"; + QTest::newRow("DoubleHighSurrogate") + << QString(malformed, sizeof(malformed) / sizeof(QChar)) + << QByteArray(expected, sizeof(expected) / sizeof(char) - 1); + } + { + const QChar malformed[] = { 'A', 0xdc00, 0xdc01, 'B', 0 }; + const char expected[] = "A"; + QTest::newRow("DoubleLowSurrogate") + << QString(malformed, sizeof(malformed) / sizeof(QChar)) + << QByteArray(expected, sizeof(expected) / sizeof(char) - 1); + } + { + const QChar malformed[] = { 'A', 0xdc00, 0xd800, 'B', 0 }; + const char expected[] = "A"; + QTest::newRow("ReversedSurrogates") // low before high + << QString(malformed, sizeof(malformed) / sizeof(QChar)) + << QByteArray(expected, sizeof(expected) / sizeof(char) - 1); + } +} + +void tst_QString::invalidToLocal8Bit() +{ + QFETCH(QString, unicode); + QFETCH(QByteArray, expect); + QByteArray local = unicode.toLocal8Bit(); + /* + The main concern of this test is to check that any error-reporting that + toLocal8Bit() prompts on failure isn't dependent on outputting the data + it's converting via toLocal8Bit(), which would be apt to recurse. So the + real purpose of this QVERIFY(), for all that we should indeed check we get + the borked output that matches what we can reliably expect (despite + variation in how codecs respond to errors), is to verify that we got here + - i.e. we didn't crash in such a recursive stack over-flow. + */ + QVERIFY(local.startsWith(expect)); +} + void tst_QString::nullFromLocal8Bit() { QString a; From 4e6440acf8e09abbb2b2aa208f0241416154e090 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 4 May 2016 15:21:17 +0200 Subject: [PATCH 045/236] Improve reliability of callgrind benchmark results When running under callgrind, do not bother with the use of the watchdog. The constructor waits for the thread to start, which adds an overall run-time cost that depends on the OS scheduling. Change-Id: I162e2e311c43a6892ebc67dea39899e40babb61d Reviewed-by: Robin Burchell --- src/testlib/qtestcase.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index d674b0af7ab..fe680e19aa0 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -2548,8 +2548,13 @@ static void qInvokeTestMethods(QObject *testObject) invokeMethod(testObject, "initTestCase_data()"); QScopedPointer watchDog; - if (!debuggerPresent()) + if (!debuggerPresent() +#ifdef QTESTLIB_USE_VALGRIND + && QBenchmarkGlobalData::current->mode() != QBenchmarkGlobalData::CallgrindChildProcess +#endif + ) { watchDog.reset(new WatchDog); + } if (!QTestResult::skipCurrentTest() && !QTest::currentTestFailed()) { invokeMethod(testObject, "initTestCase()"); From 131b7c8f6467abe07143099aa8b85e594bb9111b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 28 Jul 2016 08:41:05 +0200 Subject: [PATCH 046/236] Fix permissions on lock files on Unix We should create the files with 0666 and let the umask take care of adjusting to the final permissions in the file system. [ChangeLog][QtCore][QLockFile] Fixed permissions on lock files on Unix to allow for adjustments via umask. Change-Id: Iee6a6ac3920d0ffd4465f54ac6e955f7fe087173 Reviewed-by: Denis Shienkov Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira Reviewed-by: David Faure --- src/corelib/io/qlockfile_unix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index 57c689ac819..7bef253e591 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -176,7 +176,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys() % localHostName() % '\n'; const QByteArray lockFileName = QFile::encodeName(fileName); - const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0644); + const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0666); if (fd < 0) { switch (errno) { case EEXIST: @@ -217,7 +217,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys() bool QLockFilePrivate::removeStaleLock() { const QByteArray lockFileName = QFile::encodeName(fileName); - const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY, 0644); + const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY, 0666); if (fd < 0) // gone already? return false; bool success = setNativeLocks(fileName, fd) && (::unlink(lockFileName) == 0); From 7f66289f9d36458b0ab52d02d35ca4aa3ae722c4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 3 Aug 2016 09:16:03 +0200 Subject: [PATCH 047/236] Windows QPA: Introduce command line options for DirectWrite Add option "nodirectwrite" to turn off DirectWrite fonts and "nocolorfonts" to turn off DirectWrite for colored fonts. Task-number: QTBUG-55096 Task-number: QTBUG-55097 Change-Id: If12133fbd20dc7657b3616eff833a8e8c116e070 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../windows/qwindowsfontdatabase.cpp | 32 ++++++++++++------- .../platforms/windows/qwindowsintegration.cpp | 4 +++ .../platforms/windows/qwindowsintegration.h | 4 ++- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 68a8fc5390c..08769a3b39a 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -40,6 +40,7 @@ #include "qwindowsfontdatabase.h" #include "qwindowsfontdatabase_ft.h" // for default font #include "qwindowscontext.h" +#include "qwindowsintegration.h" #include "qwindowsfontengine.h" #include "qwindowsfontenginedirectwrite.h" #include "qtwindows_additional.h" @@ -112,6 +113,18 @@ static void createDirectWriteFactory(IDWriteFactory **factory) *factory = static_cast(result); } + +static inline bool useDirectWrite(QFont::HintingPreference hintingPreference, bool isColorFont = false) +{ + const unsigned options = QWindowsIntegration::instance()->options(); + if (Q_UNLIKELY(options & QWindowsIntegration::DontUseDirectWriteFonts)) + return false; + if (isColorFont) + return (options & QWindowsIntegration::DontUseColorFonts) == 0; + return hintingPreference == QFont::PreferNoHinting + || hintingPreference == QFont::PreferVerticalHinting + || (QHighDpiScaling::isActive() && hintingPreference == QFont::PreferDefaultHinting); +} #endif // !QT_NO_DIRECTWRITE // Helper classes for creating font engines directly from font data @@ -1163,11 +1176,7 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal QFontEngine *fontEngine = 0; #if !defined(QT_NO_DIRECTWRITE) - bool useDirectWrite = (hintingPreference == QFont::PreferNoHinting) - || (hintingPreference == QFont::PreferVerticalHinting) - || (QHighDpiScaling::isActive() && hintingPreference == QFont::PreferDefaultHinting); - - if (!useDirectWrite) + if (!useDirectWrite(hintingPreference)) #endif { GUID guid; @@ -1804,12 +1813,13 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, isColorFont = true; } #endif - - bool useDirectWrite = (request.hintingPreference == QFont::PreferNoHinting) - || (request.hintingPreference == QFont::PreferVerticalHinting) - || (QHighDpiScaling::isActive() && request.hintingPreference == QFont::PreferDefaultHinting) - || isColorFont; - if (useDirectWrite) { + const QFont::HintingPreference hintingPreference = + static_cast(request.hintingPreference); + const bool useDw = useDirectWrite(hintingPreference, isColorFont); + qCDebug(lcQpaFonts) << __FUNCTION__ << request.family << request.pointSize + << "pt" << "hintingPreference=" << hintingPreference << "color=" << isColorFont + << dpi << "dpi" << "useDirectWrite=" << useDw; + if (useDw) { QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace, request.pixelSize, data); diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index f033e4235c8..b6d2c16f890 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -199,6 +199,10 @@ static inline unsigned parseOptions(const QStringList ¶mList, } } else if (param == QLatin1String("gl=gdi")) { options |= QWindowsIntegration::DisableArb; + } else if (param == QLatin1String("nodirectwrite")) { + options |= QWindowsIntegration::DontUseDirectWriteFonts; + } else if (param == QLatin1String("nocolorfonts")) { + options |= QWindowsIntegration::DontUseColorFonts; } else if (param == QLatin1String("nomousefromtouch")) { options |= QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch; } else if (parseIntOption(param, QLatin1String("verbose"), 0, INT_MAX, &QWindowsContext::verbose) diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index 9658ef711d1..0c03274799c 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -60,7 +60,9 @@ public: DisableArb = 0x4, NoNativeDialogs = 0x8, XpNativeDialogs = 0x10, - DontPassOsMouseEventsSynthesizedFromTouch = 0x20 // Do not pass OS-generated mouse events from touch. + DontPassOsMouseEventsSynthesizedFromTouch = 0x20, // Do not pass OS-generated mouse events from touch. + DontUseDirectWriteFonts = 0x40, + DontUseColorFonts = 0x80 }; explicit QWindowsIntegration(const QStringList ¶mList); From 121b7b7a3cb401cb1597b8d56b9372f09aae6b51 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 5 Aug 2016 15:55:30 +0200 Subject: [PATCH 048/236] Windows: Fix Adobe/Mozilla format color fonts after Windows update After the Anniversary update of Windows 10 (update 1607), color fonts using the Adobe/Mozilla format with embedded SVGs are detected as color fonts by DirectWrite, but they do not contain any colored layers. The result of this was that we would no longer draw these fonts using the pen color, but we would also not support the colored glyphs in the fonts. In order to still support using these fonts as regular monochromatic fonts, we check if there is actually a palette in the font file before registering it as a color font. [ChangeLog][QtGui][Windows] Fixed rendering Adobe/Mozilla format color fonts with other colors than black after Windows 10 Anniversary update. Task-number: QTBUG-55097 Change-Id: I8d74787e49530d1167b9f2533ffdf7ab814c3358 Reviewed-by: Friedemann Kleint Reviewed-by: Tim Jenssen --- src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 08769a3b39a..314da702ebd 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1810,7 +1810,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, if (SUCCEEDED(directWriteFontFace->QueryInterface(__uuidof(IDWriteFontFace2), reinterpret_cast(&directWriteFontFace2)))) { if (directWriteFontFace2->IsColorFont()) - isColorFont = true; + isColorFont = directWriteFontFace2->GetPaletteEntryCount() > 0; } #endif const QFont::HintingPreference hintingPreference = From 874852d62504f70c148ddf77c9a6f17c37aeee9c Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 6 Aug 2016 19:24:48 +0200 Subject: [PATCH 049/236] QMap: remove statement about STL support during Qt's own configuration Since STL support is mandatory in Qt 5, the sentence is a tautology and can be removed. Change-Id: I8676368cc917aa00a85b1113ed2a47694427b2ce Reviewed-by: Marc Mutz --- src/corelib/tools/qmap.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 27ae07441e3..ec54b138f29 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -533,9 +533,6 @@ void QMapDataBase::freeData(QMapDataBase *d) Constructs a copy of \a other. - This function is only available if Qt is configured with STL - compatibility enabled. - \sa toStdMap() */ @@ -552,9 +549,6 @@ void QMapDataBase::freeData(QMapDataBase *d) /*! \fn std::map QMap::toStdMap() const Returns an STL map equivalent to this QMap. - - This function is only available if Qt is configured with STL - compatibility enabled. */ /*! \fn QMap::~QMap() From 9e8c1d83144bd17786c185107fcc2784e8a6247f Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Fri, 1 Jul 2016 15:18:05 +0200 Subject: [PATCH 050/236] Doc: Link issue startpage statement qmake-manual.qdoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8ba7df0bf54eea2a43827d538fe5259a6adf4404 Reviewed-by: Venugopal Shivashankar Reviewed-by: Topi Reiniö --- qmake/doc/src/qmake-manual.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 8078c377b2e..9f8c1b29302 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -28,7 +28,7 @@ /*! \page qmake-manual.html \title qmake Manual - \startpage {Qt Reference Documentation} + \startpage index.html \nextpage Overview \ingroup qttools From 385ab06fb1d99322872dc84f0e077886a917b9a7 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 29 Jul 2016 12:28:07 +0200 Subject: [PATCH 051/236] Always generate size hint for spacer items Task-number: QTBUG-55008 Change-Id: I53c86b64aa3c0a3e5f80551baefe775c2d4b1e90 Reviewed-by: Friedemann Kleint --- src/tools/uic/cpp/cppwriteinitialization.cpp | 6 +++++- tests/auto/tools/uic/baseline/imagedialog.ui.h | 4 ++-- tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index e0d4bea5b96..518944d9d79 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -89,10 +89,14 @@ namespace { const QHash properties = propertyMap(node->elementProperty()); output << "new QSpacerItem("; + int w = 0; + int h = 0; if (properties.contains(QLatin1String("sizeHint"))) { const DomSize *sizeHint = properties.value(QLatin1String("sizeHint"))->elementSize(); - output << sizeHint->elementWidth() << ", " << sizeHint->elementHeight() << ", "; + w = sizeHint->elementWidth(); + h = sizeHint->elementHeight(); } + output << w << ", " << h << ", "; // size type QString sizeType = properties.contains(QLatin1String("sizeType")) ? diff --git a/tests/auto/tools/uic/baseline/imagedialog.ui.h b/tests/auto/tools/uic/baseline/imagedialog.ui.h index c02c40c2c1e..99e853b7a82 100644 --- a/tests/auto/tools/uic/baseline/imagedialog.ui.h +++ b/tests/auto/tools/uic/baseline/imagedialog.ui.h @@ -155,7 +155,7 @@ public: vboxLayout->addLayout(gridLayout); - spacerItem = new QSpacerItem(QSizePolicy::Minimum, QSizePolicy::Expanding); + spacerItem = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); vboxLayout->addItem(spacerItem); @@ -166,7 +166,7 @@ public: hboxLayout->setContentsMargins(1, 1, 1, 1); hboxLayout->setObjectName(QStringLiteral("hboxLayout")); hboxLayout->setObjectName(QStringLiteral("")); - spacerItem1 = new QSpacerItem(QSizePolicy::Expanding, QSizePolicy::Minimum); + spacerItem1 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); hboxLayout->addItem(spacerItem1); diff --git a/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h b/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h index ca7bd253a86..3c4e0ba09eb 100644 --- a/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h +++ b/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h @@ -91,7 +91,7 @@ public: verticalLayout->addLayout(formLayout); - spacerItem = new QSpacerItem(QSizePolicy::Minimum, QSizePolicy::Expanding); + spacerItem = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); verticalLayout->addItem(spacerItem); From ae190c24a0395e9d784b5b9c6c194d1fb89fbc82 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 3 Aug 2016 14:47:25 +0200 Subject: [PATCH 052/236] fix enable/disable of -xkb-common-x11 Change-Id: I2d0b7a8ed2f30422cb1af2cac8dca0e718509021 Reviewed-by: Lars Knoll --- configure.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.json b/configure.json index 81aea1733fc..2fbd0f3491a 100644 --- a/configure.json +++ b/configure.json @@ -1895,8 +1895,9 @@ "xkbcommon-system": { "description": "Using system-provided xkbcommon", "emitIf": "features.xcb", + "enable": "input.xkbcommon == 'system'", + "disable": "input.xkbcommon == 'qt' || input.xkbcommon == 'no'", "condition": "tests.xkbcommon-x11", - "disable": "input.xkbcommon == 'qt'", "output": [ { "type": "publicQtConfig", "negative": true, "name": "xkbcommon-qt" }, { "type": "library", "name": "xkbcommon", "test": "xkbcommon-x11" } From 6aa3ba0a0b91bc38eb7ff282ef2511964dd99080 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 5 Jul 2016 14:46:14 +0200 Subject: [PATCH 053/236] winrt: add vcruntime.lib to standard libs to link This is required for projects compiled with CONFIG-=qt, which is not supported so far, but is required for the new configure system. Change-Id: I85d7de9105ff68c73e8a433a3c757864a619cce8 Reviewed-by: Lars Knoll --- mkspecs/features/winrt/default_pre.prf | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mkspecs/features/winrt/default_pre.prf b/mkspecs/features/winrt/default_pre.prf index 8299950d8bc..f397ef3d618 100644 --- a/mkspecs/features/winrt/default_pre.prf +++ b/mkspecs/features/winrt/default_pre.prf @@ -1,12 +1,14 @@ *msvc2015 { - # Note that the order is important, ucrt(d) has to be first - # Otherwise the linker might use malloc from a different library - # but free_dbg() from the runtime, causing assert when deleting - # items from different heaps + # Note that the order is important - ucrt(d) has to be first. + # Otherwise, the linker might use malloc from a different library, + # but free_dbg() from the runtime, causing an assertion failure + # due to deleting an item from a different heap. + # vcruntime(d) is necessary when we don't link to any libraries + # which would pull it in transitively. CONFIG(debug, debug|release): \ - QMAKE_LIBS = ucrtd.lib $$QMAKE_LIBS + QMAKE_LIBS = ucrtd.lib vcruntimed.lib $$QMAKE_LIBS else: \ - QMAKE_LIBS = ucrt.lib $$QMAKE_LIBS + QMAKE_LIBS = ucrt.lib vcruntime.lib $$QMAKE_LIBS } equals(TEMPLATE, "vcapp"): CONFIG += windeployqt From 22d1351ddea193f5c00d4ae12229358dea826c62 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 14 Jul 2016 16:48:25 +0200 Subject: [PATCH 054/236] print no message at all when no argument is supplied to error() this is useful when an adequate message has already been emitted by other means, like various built-ins do. Change-Id: I092771f55969fad8b214204d666327664727c572 Reviewed-by: Lars Knoll --- qmake/library/qmakebuiltins.cpp | 2 +- tests/auto/tools/qmakelib/evaltest.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 628210b55b2..ac3a866848c 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -1587,7 +1587,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( #ifdef PROEVALUATOR_FULL fputs(msg.toLatin1().constData(), stderr); #endif - } else { + } else if (!msg.isEmpty() || func_t != T_ERROR) { m_handler->fileMessage( (func_t == T_ERROR ? QMakeHandler::ErrorMessage : func_t == T_WARNING ? QMakeHandler::WarningMessage : diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index 21c1759b082..ffdf9294b8f 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -2346,12 +2346,18 @@ void tst_qmakelib::addTestFunctions(const QString &qindir) << "Project WARNING: World, be warned!" << true; - QTest::newRow("error()") + QTest::newRow("error(message)") << "error('World, you FAIL!'): OK = 1\nOKE = 1" << "OK = UNDEF\nOKE = UNDEF" << "Project ERROR: World, you FAIL!" << false; + QTest::newRow("error(empty)") + << "error(): OK = 1\nOKE = 1" + << "OK = UNDEF\nOKE = UNDEF" + << "" + << false; + QTest::newRow("if(error())") << "if(error(\\'World, you FAIL!\\')): OK = 1\nOKE = 1" << "OK = UNDEF\nOKE = UNDEF" From 815a41f714df007eeee8726ada650a0aeb81ffc7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 14 Jul 2016 16:50:02 +0200 Subject: [PATCH 055/236] make use of silent error() emission get rid of the entirely superfluous stock "Aborting." messages - the event triggering the exit has already reported the problem. Change-Id: Ib9dfb9e4212f60eceb2ea432cdf56c5a8afe9d65 Reviewed-by: Lars Knoll --- .../features/android/android_deployment_settings.prf | 2 +- mkspecs/features/configure.prf | 2 +- mkspecs/features/java.prf | 2 +- mkspecs/features/moc.prf | 2 +- mkspecs/features/qt.prf | 6 +++--- mkspecs/features/qt_android_deps.prf | 2 +- mkspecs/features/qt_configure.prf | 10 +++++----- mkspecs/features/qt_functions.prf | 2 +- mkspecs/features/qt_module.prf | 2 +- mkspecs/features/qt_module_headers.prf | 6 +++--- mkspecs/features/qt_module_pris.prf | 6 +++--- mkspecs/features/qt_plugin.prf | 4 ++-- mkspecs/features/qt_tool.prf | 2 +- mkspecs/features/resources.prf | 2 +- qtbase.pro | 10 +++++----- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/mkspecs/features/android/android_deployment_settings.prf b/mkspecs/features/android/android_deployment_settings.prf index ce5696a33c7..848de485f86 100644 --- a/mkspecs/features/android/android_deployment_settings.prf +++ b/mkspecs/features/android/android_deployment_settings.prf @@ -65,6 +65,6 @@ contains(TEMPLATE, ".*app"):!build_pass: { isEmpty(ANDROID_DEPLOYMENT_SETTINGS_FILE): ANDROID_DEPLOYMENT_SETTINGS_FILE = $$OUT_PWD/android-$$TARGET-deployment-settings.json - write_file($$ANDROID_DEPLOYMENT_SETTINGS_FILE, FILE_CONTENT) | error("Aborting.") + write_file($$ANDROID_DEPLOYMENT_SETTINGS_FILE, FILE_CONTENT)|error() } diff --git a/mkspecs/features/configure.prf b/mkspecs/features/configure.prf index e1040d250ea..bd53e31a046 100644 --- a/mkspecs/features/configure.prf +++ b/mkspecs/features/configure.prf @@ -37,7 +37,7 @@ defineTest(qtCompileTest) { # Clean up after previous run exists($$test_out_dir/Makefile):qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE distclean") - mkpath($$test_out_dir)|error("Aborting.") + mkpath($$test_out_dir)|error() !isEmpty (QMAKE_QTCONF): qtconfarg = -qtconf $$QMAKE_QTCONF diff --git a/mkspecs/features/java.prf b/mkspecs/features/java.prf index 0f0b991f0a6..852954e5ca5 100644 --- a/mkspecs/features/java.prf +++ b/mkspecs/features/java.prf @@ -28,7 +28,7 @@ javac.commands = javac -source 6 -target 6 -Xlint:unchecked -bootclasspath $$AND javac.depends = FORCE QMAKE_EXTRA_COMPILERS += javac -mkpath($$absolute_path($$CLASS_DIR, $$OUT_PWD)) | error("Aborting.") +mkpath($$absolute_path($$CLASS_DIR, $$OUT_PWD))|error() # Disable all linker flags since we are overriding the regular linker QMAKE_LFLAGS = diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index 6368c8e394b..73fbc8c29b9 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -21,7 +21,7 @@ win32:count(MOC_INCLUDEPATH, 40, >) { WIN_INCLUDETEMP_CONT = for (inc, MOC_INCLUDEPATH): \ WIN_INCLUDETEMP_CONT += -I$$inc - write_file($$absolute_path($$WIN_INCLUDETEMP, $$OUT_PWD), WIN_INCLUDETEMP_CONT)|error("Aborting.") + write_file($$absolute_path($$WIN_INCLUDETEMP, $$OUT_PWD), WIN_INCLUDETEMP_CONT)|error() } # QNX's compiler sets "gcc" config, but does not support the -dM option; diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 8d96d18d06e..3146d95ef46 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -238,7 +238,7 @@ contains(qt_module_deps, qml): \ } } QML_IMPORT_CPP = $$OUT_PWD/$$lower($$basename(TARGET))_qml_plugin_import.cpp - write_file($$QML_IMPORT_CPP, IMPORT_FILE_CONT)|error("Aborting.") + write_file($$QML_IMPORT_CPP, IMPORT_FILE_CONT)|error() GENERATED_SOURCES += $$QML_IMPORT_CPP QMAKE_DISTCLEAN += $$QML_IMPORT_CPP @@ -261,7 +261,7 @@ contains(qt_module_deps, qml): \ "[Paths]" \ "Imports = $$QMAKE_QML_BUNDLE_PATH" \ "Qml2Imports = $$QMAKE_QML_BUNDLE_PATH" - write_file("$$OUT_PWD/qt.conf", QT_CONF_CONTENTS)|error("Aborting.") + write_file("$$OUT_PWD/qt.conf", QT_CONF_CONTENTS)|error() # write qt.conf and copy each qml import dir into the bundle. # But strip away archives and other files that are not needed: @@ -334,7 +334,7 @@ contains(QT_CONFIG, static) { warning("Plugin class name could not be determined for $$IMPORT_PLUG plugin.") } IMPORT_CPP = $$OUT_PWD/$$lower($$basename(TARGET))_plugin_import.cpp - write_file($$IMPORT_CPP, IMPORT_FILE_CONT)|error("Aborting.") + write_file($$IMPORT_CPP, IMPORT_FILE_CONT)|error() GENERATED_SOURCES += $$IMPORT_CPP QMAKE_DISTCLEAN += $$IMPORT_CPP } diff --git a/mkspecs/features/qt_android_deps.prf b/mkspecs/features/qt_android_deps.prf index 7ec7bad0476..c172ca8c4ed 100644 --- a/mkspecs/features/qt_android_deps.prf +++ b/mkspecs/features/qt_android_deps.prf @@ -79,7 +79,7 @@ DEPENDENCY_FILE = $$ANDROID_DEPENDS_DIR$$TARGET-android-dependencies.xml !isEmpty(FILE_CONTENT) { FILE_CONTENT = "" $$FILE_CONTENT "" - write_file($$DEPENDENCY_FILE, FILE_CONTENT) | error("Aborting.") + write_file($$DEPENDENCY_FILE, FILE_CONTENT)|error() } } diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index bae050ae182..dc1c1ef524b 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -260,7 +260,7 @@ defineTest(qtConfTest_shell) { test_out_dir = $$shadowed($$test_dir) test_cmd_base = "cd $$system_quote($$system_path($$test_out_dir)) &&" - mkpath($$test_out_dir)|error("Aborting.") + mkpath($$test_out_dir)|error() qtRunLoggedCommand("$$test_cmd_base $$test_dir/$${test} $${args}"): \ return(false) @@ -272,7 +272,7 @@ defineReplace(qtConfToolchainSupportsFlag) { test_cmd_base = "cd $$system_quote($$system_path($$test_out_dir)) &&" conftest = "int main() { return 0; }" - write_file("$$test_out_dir/conftest.cpp", conftest)|error("Aborting.") + write_file("$$test_out_dir/conftest.cpp", conftest)|error() qtRunLoggedCommand("$$test_cmd_base $$QMAKE_CXX $${1} -o conftest-out conftest.cpp"): \ return(true) @@ -436,7 +436,7 @@ defineTest(qtConfTest_compile) { # Clean up after previous run exists($$test_out_dir/Makefile): qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE distclean") - mkpath($$test_out_dir)|error("Aborting.") + mkpath($$test_out_dir)|error() !isEmpty(QMAKE_QTCONF): qtconfarg = -qtconf $$QMAKE_QTCONF @@ -912,7 +912,7 @@ defineTest(qtConfPrintReport) { } !equals(config.input.continue, yes): \ - error("Aborting.") + error() } } @@ -1156,7 +1156,7 @@ defineTest(qtConfProcessOutput) { defined(qtConfOutputPostProcess_$${type}, test): \ qtConfOutputPostProcess_$${type}() - write_file($$file, config.output.$${type})|error("Aborting.") + write_file($$file, config.output.$${type})|error() } } diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 6dd4a36b5ee..f03472d9404 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -171,7 +171,7 @@ defineTest(qtAddToolEnv) { "EndLocal" $$1 = call } - !build_pass:!write_file($$OUT_PWD/$$batch_name, batch_cont, exe): error("Aborting.") + !build_pass:!write_file($$OUT_PWD/$$batch_name, batch_cont, exe): error() isEmpty(3): \ $$1 += $$shell_quote($$shell_path($$OUT_PWD/$$batch_name)) else: \ diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index 923ac73200f..bce8b896430 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -235,7 +235,7 @@ android: CONFIG += qt_android_deps no_linker_version_script verscript = $$verscript_in } - write_file($$OUT_PWD/$$verscript, verscript_content)|error("Aborting.") + write_file($$OUT_PWD/$$verscript, verscript_content)|error() unset(current) unset(previous) unset(verscript) diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf index 05d0706a332..d29e02ef3c8 100644 --- a/mkspecs/features/qt_module_headers.prf +++ b/mkspecs/features/qt_module_headers.prf @@ -109,13 +109,13 @@ for (injection, SYNCQT.INJECTIONS) { fwd_hdr = $$member(injects, 1) MAIN_FWD = $$INC_PATH/include/$$MODULE_INCNAME/$$fwd_hdr MAIN_FWD_CONT = '$${LITERAL_HASH}include "$$member(injects, 0)"' - write_file($$MAIN_FWD, MAIN_FWD_CONT)|error("Aborting.") + write_file($$MAIN_FWD, MAIN_FWD_CONT)|error() !git_build: QMAKE_DISTCLEAN += $$MAIN_FWD injects = $$member(injects, 2, -1) for (inject, injects) { CLASS_FWD = $$INC_PATH/include/$$MODULE_INCNAME/$$inject CLASS_FWD_CONT = '$${LITERAL_HASH}include "$$fwd_hdr"' - write_file($$CLASS_FWD, CLASS_FWD_CONT)|error("Aborting.") + write_file($$CLASS_FWD, CLASS_FWD_CONT)|error() !git_build: QMAKE_DISTCLEAN += $$CLASS_FWD } } @@ -135,7 +135,7 @@ MODULE_MASTER_DEPS_HEADER = $$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME/$${MOD MODULE_MASTER_DEPS_HEADER_CONT += "$${LITERAL_HASH}include <$$depname/$$depname>" } MODULE_MASTER_DEPS_HEADER_CONT += "$${LITERAL_HASH}endif" - write_file($$MODULE_MASTER_DEPS_HEADER, MODULE_MASTER_DEPS_HEADER_CONT)|error("Aborting.") + write_file($$MODULE_MASTER_DEPS_HEADER, MODULE_MASTER_DEPS_HEADER_CONT)|error() !git_build: QMAKE_DISTCLEAN += $$MODULE_MASTER_DEPS_HEADER } SYNCQT.HEADER_FILES += $$MODULE_MASTER_DEPS_HEADER diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf index 4dd9e25f9f3..b67a56c7d5c 100644 --- a/mkspecs/features/qt_module_pris.prf +++ b/mkspecs/features/qt_module_pris.prf @@ -107,7 +107,7 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri winrt: MODULE_PRI_CONT += \ "QT.$${MODULE_ID}.winrt_capabilities =$$join(MODULE_WINRT_CAPABILITIES, " ", " ")" \ "QT.$${MODULE_ID}.winrt_capabilities_device =$$join(MODULE_WINRT_CAPABILITIES_DEVICE, " ", " ")" - write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.") + write_file($$MODULE_PRI, MODULE_PRI_CONT)|error() !internal_module:!no_private_module { module_build_type += internal_module private_deps = $$QT @@ -127,7 +127,7 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri "QT.$${MODULE}_private.frameworks =" \ "QT.$${MODULE}_private.depends = $$private_deps" \ "QT.$${MODULE}_private.module_config =$$join(module_build_type, " ", " ")" - write_file($$MODULE_PRIVATE_PRI, MODULE_PRIVATE_PRI_CONT)|error("Aborting.") + write_file($$MODULE_PRIVATE_PRI, MODULE_PRIVATE_PRI_CONT)|error() } MODULE_PRI_FILES = $$MODULE_PRI $$MODULE_PRIVATE_PRI @@ -162,7 +162,7 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri MODULE_FWD_PRI_CONT += \ "QT.$${MODULE}_private.includes $$pls= $$MODULE_FWD_PRIVATE_INCLUDES" } - write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.") + write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error() touch($$MODULE_FWD_PRI, $$MODULE_PRI) MODULE_PRI_FILES += $$MODULE_FWD_PRI diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index e11b543cb4e..c4fea60e0f8 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -50,7 +50,7 @@ CONFIG(static, static|shared)|prefix_build { "QT_PLUGIN.$${MODULE}.EXTENDS =$$join(PLUGIN_EXTENDS, " ", " ")" \ "QT_PLUGIN.$${MODULE}.CLASS_NAME = $$PLUGIN_CLASS_NAME" \ "QT_PLUGINS += $$MODULE" - write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.") + write_file($$MODULE_PRI, MODULE_PRI_CONT)|error() MODULE_PRI_FILES = $$MODULE_PRI force_independent { @@ -59,7 +59,7 @@ CONFIG(static, static|shared)|prefix_build { MODULE_FWD_PRI_CONT = \ "QT_PLUGIN.$${MODULE}.PATH = $$MODULE_BASE_OUTDIR/plugins" \ "include($$MODULE_PRI)" - write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.") + write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error() touch($$MODULE_FWD_PRI, $$MODULE_PRI) MODULE_PRI_FILES += $$MODULE_FWD_PRI diff --git a/mkspecs/features/qt_tool.prf b/mkspecs/features/qt_tool.prf index bdeb59c83db..93c952617d5 100644 --- a/mkspecs/features/qt_tool.prf +++ b/mkspecs/features/qt_tool.prf @@ -60,7 +60,7 @@ DEFINES *= QT_USE_QSTRINGBUILDER "QT_TOOL.$${MODULE}.binary = $$val_escape(bin)" \ "QT_TOOL.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")" \ $$module_envvars - write_file($$TOOL_PRI, TOOL_PRI_CONT)|error("Aborting.") + write_file($$TOOL_PRI, TOOL_PRI_CONT)|error() # Then, inject the new tool into the current cache state !contains(QMAKE_INTERNAL_INCLUDED_FILES, $$TOOL_PRI) { # before the actual include()! diff --git a/mkspecs/features/resources.prf b/mkspecs/features/resources.prf index 21147e4a42a..adc8e9a8ac9 100644 --- a/mkspecs/features/resources.prf +++ b/mkspecs/features/resources.prf @@ -65,7 +65,7 @@ for(resource, RESOURCES) { "" !write_file($$OUT_PWD/$$resource_file, resource_file_content): \ - error("Aborting.") + error() } RESOURCES -= $$resource diff --git a/qtbase.pro b/qtbase.pro index 34f67047524..93a2f6264f7 100644 --- a/qtbase.pro +++ b/qtbase.pro @@ -114,11 +114,11 @@ for (ft, features) { " QT_DISABLED_FEATURES += $$lower($$replace(ft, _, -))" } } -write_file($$OUT_PWD/src/corelib/global/qfeatures.h, FEATURES_H)|error("Aborting.") +write_file($$OUT_PWD/src/corelib/global/qfeatures.h, FEATURES_H)|error() # Create forwarding header FWD_FEATURES_H = \ '$${LITERAL_HASH}include "../../src/corelib/global/qfeatures.h"' -write_file($$OUT_PWD/include/QtCore/qfeatures.h, FWD_FEATURES_H)|error("Aborting.") +write_file($$OUT_PWD/include/QtCore/qfeatures.h, FWD_FEATURES_H)|error() no_features = lines = $$cat($$OUT_PWD/src/corelib/global/qconfig.h, lines) @@ -146,15 +146,15 @@ FEATURES_PRI = \ "$$escape_expand(\\n)$${LITERAL_HASH} Dependencies derived from /src/corelib/global/qfeatures.txt:" \ $$FEATURES_PRI \ "QT_DISABLED_FEATURES = \$\$unique(QT_DISABLED_FEATURES)" -write_file($$OUT_PWD/mkspecs/qfeatures.pri, FEATURES_PRI)|error("Aborting.") +write_file($$OUT_PWD/mkspecs/qfeatures.pri, FEATURES_PRI)|error() # Create forwarding headers for qconfig.h FWD_QCONFIG_H = \ '$${LITERAL_HASH}include "../../src/corelib/global/qconfig.h"' -write_file($$OUT_PWD/include/QtCore/qconfig.h, FWD_QCONFIG_H)|error("Aborting.") +write_file($$OUT_PWD/include/QtCore/qconfig.h, FWD_QCONFIG_H)|error() FWD_QTCONFIG = \ '$${LITERAL_HASH}include "qconfig.h"' -write_file($$OUT_PWD/include/QtCore/QtConfig, FWD_QTCONFIG)|error("Aborting.") +write_file($$OUT_PWD/include/QtCore/QtConfig, FWD_QTCONFIG)|error() # Files created by us QMAKE_DISTCLEAN += \ From 4da9972e89ea793f327a5899ea1740290a8a6745 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 5 Aug 2016 13:22:06 +0200 Subject: [PATCH 056/236] Add -opengl es2 to the DRIVE CX configure example To make sure it does not end up picking the desktop OpenGL implementation from Mesa that may be present in the sysroot. Change-Id: I815eb7d2664f9e62d620acf8260cae40f83dfaf8 Reviewed-by: Andy Nichols --- mkspecs/devices/linux-drive-cx-g++/qmake.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkspecs/devices/linux-drive-cx-g++/qmake.conf b/mkspecs/devices/linux-drive-cx-g++/qmake.conf index cb43c9e2f62..c8e85e449c2 100644 --- a/mkspecs/devices/linux-drive-cx-g++/qmake.conf +++ b/mkspecs/devices/linux-drive-cx-g++/qmake.conf @@ -7,7 +7,8 @@ # -device-option VIBRANTE_SDK_TOPDIR=/opt/nvidia/vibrante-t186ref-linux # -device-option CROSS_COMPILE=/opt/nvidia/toolchains/tegra-4.9-nv/usr/bin/aarch64-gnu-linux/aarch64-gnu-linux- \ # -sysroot /opt/nvidia/vibrante-t186ref-linux/targetfs \ -# -no-gcc-sysroot +# -no-gcc-sysroot \ +# -opengl es2 include(../common/linux_device_pre.conf) From a8390bb19739c5890e8172cdfe05ece25b33f906 Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Mon, 8 Aug 2016 10:13:10 +0200 Subject: [PATCH 057/236] Doc: Fix saturation graphic for HSV color model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The text is correctly describing the gradient from gray to blue but the picture shows white to blue. Additionally including the SVG sources for creating the pictures. Change-Id: I608a239f4de9c2d3761196c44db024cc31ce441a Reviewed-by: Leena Miettinen Reviewed-by: Topi Reiniö --- src/gui/doc/images/qcolor-saturation.png | Bin 2150 -> 1116 bytes src/gui/doc/images/qcolor-saturation.svg | 78 +++++++++++++++++++++++ src/gui/doc/images/qcolor-value.png | Bin 1241 -> 909 bytes src/gui/doc/images/qcolor-value.svg | 78 +++++++++++++++++++++++ 4 files changed, 156 insertions(+) create mode 100644 src/gui/doc/images/qcolor-saturation.svg create mode 100644 src/gui/doc/images/qcolor-value.svg diff --git a/src/gui/doc/images/qcolor-saturation.png b/src/gui/doc/images/qcolor-saturation.png index f28776aff5e3d6e4ee91d21bba36698a2e0f1743..9c104f73898c321fb9dbcd7dbbdb763fdbe11f1a 100644 GIT binary patch literal 1116 zcmeAS@N?(olHy`uVBq!ia0y~yV5|nR131`#M`+!r+RKvF%cOq3Hu25Axh7k8_v09|@2?i=19#^ zzdh$R3x7_3{%-r`)$gCLv0kWlw=?}!%Up};SAdI9?R30;soE`O)A=sEZN*~J#mKRw)8^>20PiE>T;jS~vrB-*}p2^4WXe(lKFm}5C=7f-kE zIpP0g_Tk_urViXcuNCs8<~~VoGi`hob;G4~uFNy8X`dwgm0W>Z!Z%G_v$)3FUVOs@ z(HLLxtG-XePQ6;*S`)spW0Rf3*7m=Vd(H%|TRwTs&zd7q+cxn2ec!!EL+ZR-+=JX- zC$paL>ZKd|s(dOfVE-w!b=L9kPkzr8te$tI>XWU*BiTh7T}m%qv_wj+>L<7D@{m*)QV%C|PDWwzF_sd(%+zFE0 znw_8)xmToAYx~7xMYC2cPm9_)KYOM}>|Fmv^Ed7CxZ@$>8W^(M-LuAT-_a#P^Npr2 z+BTU>X2I5ZXa9+8s#~V=eu?K4aiCXCH&0XE5)>kyy`%efWs{xWGhwNd| z@Y!4I7^ZCcTCq^@r(f~}M!%#L8eNMr)b3A+I36*}H)(?KitXP$Y&_1IO{i$A(e~V8 z90K%Q30wTcifJ3Kxh0u@HJjS3GA&@UrA%VOvpb*nCE9laU9s%5YUlNtL5mt+$)yWk z^-U0ERtXEbTYBfL%c|%Dd_s47(vO50o`}zRSj)y`{tsy5iq??!>J@qVo$)u%`teQl z*yFYINzU2CsvBsvkx?GLzdKk45i$z5r&Z$MeW)78&qol`;+0IsY3V*mgE literal 2150 zcmV-s2$}bZP)2chmggzodA(VtaCI%^a_)!F&JDs5jt)Qy?6J!M5*)wFh9CTk(3gG zPbu{tCY8ehfI9o6e00^V2S_~Fb*-Civ@&+7*2)u2j;$3Zu!N;WY!^KQ_xbr%Uc3kv z)j>)U)rwY1CC2LDSLJs5qfN)h#W-jwr6Ww*w(Y#xCbgxU*Ro_Am>*rXGCh`TMQ31a z1Zo4t;m3!&UfuhiWuAr0s!H@FaY3O6GaT}AOL`ST>$QN@5cZD zY?uKcH~`>Y7XWy!3jl1G0hqb~z|;i*UW5eTxh??ka0mc+5pog$Hp~DJLj8TIb8eUc zfDJPM8)koE09bXo^5y(hdjC?sfmN3)9{}GR0svlw1YpAq06ZL84ggkN0N~$L0KmVg z0QmX=0Pq7h0Kn7*fQ#$Idx?F$Q6@{>`Mfe-hETqTDW&jTd5ZF5&wH_3nYXlUQqgT{ zvkoQa*1$KDitc>Obt_< zJSKuOJ?(d|ZR-M%v@bhwKmq^&g8=NmDjuJ ztM~18li!`qtk&v{A4@5Hcqjm-A^JQ=SCYq(-`5*G(E#WW>7fpk-s=_l0dK#6x~Y23t|}ws3d|AyfvbY z;H6P;1wlnoe}LF1C@Ms-3IvO!43Z)Q@xHs+-3Pwq?BRG4{Q=)o3}5EWFgCC6mzgn4 zbbEW-)6?U2yGu(;tE;OwHZ}-ee8h;lva(WER#sVAiAqsXQ9%nlKR=I@Up3O(Y5qaW zmQJVh`uf`E^VQVU`2GI-`}?7xp^J-)t*tEkw{BR%k%SdcXxMrc{!fK zO;=Y}o12>iAq&#!^uxo$z`%gR;lNoe$z(FMwY5kes{cHjH6fAP+S*!ISNHPrBIe%N z*W)b-Cb&l*|D)PW^gYxmM$tP8Xg`tJO$J&XMBBqwN=G> z#%OJrA0HptU}k298s8&4Jv}iqH8o{~buJV|5#x}SO-)T=8B&lUl}h2G>FH@|BGjl+ zQZh0!vb3~>p9>2M^S8~4qCGP{ zqCIYJZc@7qKJd!Qbr;-7K?RsbQ~NU5TPEA2Ne@CPE1VP+}tcKE^cpcA08gk8y_7V zp<-ZL_4xSM>`liX6PE2ous;6CjiM-GE!tX+g&F($`e=0V8+}&!bipf$+fjL9$ip~GbxNtn0kGE{k=+Ueb}5eA(umJ z+}74cEsLe|o}HbgmhH1SP!vV3ZMm1>eFXJi_RSu*K_H02cK)ErUAO=Rls*V@kup-6 z2&f_y(IFp$5>Z)5k=I!Aw1 z=4Lku^H2MBi~;}*!cesLKXbGlgpxsU7XI6!vj~FGsaupJj}E{%J2JoMUj*%xjopeT c7XsMZ52eR{EO69~r~m)}07*qoM6N<$f`=3OWdHyG diff --git a/src/gui/doc/images/qcolor-saturation.svg b/src/gui/doc/images/qcolor-saturation.svg new file mode 100644 index 00000000000..608c2555e86 --- /dev/null +++ b/src/gui/doc/images/qcolor-saturation.svg @@ -0,0 +1,78 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + + 0 + 255 + + diff --git a/src/gui/doc/images/qcolor-value.png b/src/gui/doc/images/qcolor-value.png index 0e069123a9f2e4f148f59cc32f2ad9426a78e25d..add9b7f83d0389c591dbcaf5b6b86e8eff54ca5c 100644 GIT binary patch literal 909 zcmeAS@N?(olHy`uVBq!ia0y~yV5|nR12|ZKWRSM(K?Vlq5KkA!kP5~(cMQ1>8}PJU zjF+6W_{%@_5_R!Qh6~hoyyuTp=I`KM(f1&^ zP43@%Aj%QCf5(3^at9f*_xY+dpKZ4{_fQILc#wYlZQ* zqIvHg9k={ncDeO`_xdG7XOne4LDQd0{jv)@_izI)aAz3*%q;`BYQ z@-SN@bYGF~%P`7uy<6z6%X$9frlK9*9H-A&WV>3dmp`!9X_h5}O!kYi%%Z)l-E9ZV zj9=wVPE9p=fl>h05s7GU^sm}T8Z`>hKOr}Z$-_%=JQ_SjVKX5>zT6ns2uHEmQ*pL)W! zpSz!N0aF9tea`nHW&K?Bucs7kHc1=48EfuIFqL(B5%9z|aX(w|AwGuim8*A#Oq=Sw-S`mW>eqs=qC|hXR0K6UAL3}R zJ(L(3#ur;B7`M%8o`9d$rh{t?RyeL#HDz9KeT#v{=~D|XpFgzwntCR)&3iG2?!8%u zNP?pwJfYa`>UPpxKnrklC-pqS|6dtWxh btNvrOTrOg4(L8wvC;@u9`njxgN@xNAR*JCH literal 1241 zcmV;~1Sb25P)#%8MkF|JowN!&IM&1Y#u z!cGV)@JlNZ6-g$BKSWF*hI_`(M8@f>Q|Cs+P}bVC`bGI#VS-Cm5nZ*8l z06?N4V;C`v08$<_l|j=%Q&DT}AIJ2$g*sae@~YVeIF)P@v4y76;WZT%b6UHb!3;3V z+Br&hU-NN5u|WS7xl>T^>9Z3cEqxmxDisJaat1`P0isrcoqz5lifh4hAGzM<<>n=d z$A;%V-uI~(H}7r3^f7&WXd~Ei-$!iAjSEqTZg^-TkS&{+*sX6~zHuR3eO!H9eSG7x z3Ln}CH!m+8Tz$NB5MDZ1q`{ZBjTcd)5^*G9OaMkKky@kQssDfK zmGiILc2%7rYwQ_@)p2UjIMY-|SQh)+yyRb91;5S<^3_$=FViP@eR~V*5FmF4g_ThO{eJBGf^%>+lj+qs|6Dvme~;NO{DpGn9=6pCQa(nA9+ zo}?gRDMYL%E!q-1CIn0{LLj91V<@c@X_`Q>PzwbuiY@e*=p{-XNx*<7L8P=tDIPSW zFL{4OzJ*=cxqvY|<(%T~J-oMTPs;u8e$w`S zWak2E?v?PbBhYHEgcp$nTJ3^xzfXbLwk0TPfocU3gep>T;X-36iBP-^{Gi|9bQ|yiGH-(j)89{ z_6xi~m3q%WMJPi7c-C_-I{Rf;k(?$VA_>P(V?GK2t+m37c*#e=vB67GdxZ-=Ez=4$ zG75qeQ3#-5oQj@*{L8%~SjOnn={vvH=TY(LAq3D&0Z<^b4a@}s9qUiK=I?)IG5F^w zrGD({>?f6O_QCT~pP#3mp3)Sw9Azq#-}_6@I7wgd^k zK^syru90(n`wbdvOp8LKv(M}O+ZOon~hMV${G@#Cqiwz-{&a* zE}&^jtDz!^5Uxd>%{DK{JF%&BNV@WdisS^ca{>PWmQ;W6uM(ad00000NkvXXu0mjf Ds8~!z diff --git a/src/gui/doc/images/qcolor-value.svg b/src/gui/doc/images/qcolor-value.svg new file mode 100644 index 00000000000..51c2de03385 --- /dev/null +++ b/src/gui/doc/images/qcolor-value.svg @@ -0,0 +1,78 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + + 0 + 255 + + From 30eecdf6d8e593027542df8e809dc2b5f33cc60e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 8 Aug 2016 14:21:14 +0200 Subject: [PATCH 058/236] Fix QGtk3Menu::removeMenuItem() The if-condition was broken, so items weren't removed from the container as appropriate. Accessing such dangling items caused a crash later on exit. Task-number: QTBUG-54432 Task-number: QTBUG-54462 Change-Id: I98fd9f29a93d72e3e4a8f0fb6bac40ad4728ba6f Reviewed-by: Heikki Halmet Reviewed-by: Mitch Curtis --- src/plugins/platformthemes/gtk3/qgtk3menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp index 288978ae844..52757587b48 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp @@ -371,7 +371,7 @@ void QGtk3Menu::insertMenuItem(QPlatformMenuItem *item, QPlatformMenuItem *befor void QGtk3Menu::removeMenuItem(QPlatformMenuItem *item) { QGtk3MenuItem *gitem = static_cast(item); - if (!gitem && !m_items.removeOne(gitem)) + if (!gitem || !m_items.removeOne(gitem)) return; GtkWidget *handle = gitem->handle(); From e24f89f266cee6e2473af6f66bd78f2df3a51c83 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 18 Jul 2016 13:48:06 -0700 Subject: [PATCH 059/236] Fix build with clang-cl and the Intel compiler on Windows Neither clang-cl nor the Intel compiler are able to parse the MSVC code in a constexpr environment. For Clang, we can just use the __builtin functions, which it does make available on Windows. For the Intel compiler, there's no alternative, so we just don't use the _BitScanXxx functions. It will produce slower code, though. qalgorithms.h(587,19) : error: variables defined in a constexpr function must be initialized qalgorithms.h(635,12) : note: non-constexpr function '__popcnt' cannot be used in a constant expression etc. Change-Id: I149e0540c00745fe8119fffd14627ded43807000 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/tools/qalgorithms.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h index 6e68bc7eb1c..6e472e8b222 100644 --- a/src/corelib/tools/qalgorithms.h +++ b/src/corelib/tools/qalgorithms.h @@ -516,14 +516,19 @@ QT_DEPRECATED_X("Use std::binary_search") Q_OUTOFLINE_TEMPLATE RandomAccessItera #endif // QT_DEPRECATED_SINCE(5, 2) +#ifdef Q_CC_CLANG // Clang had a bug where __builtin_ctz/clz/popcount were not marked as constexpr. -#if !defined Q_CC_CLANG || (defined __apple_build_version__ && __clang_major__ >= 7) \ - || (Q_CC_CLANG >= 307) +# if (defined __apple_build_version__ && __clang_major__ >= 7) || (Q_CC_CLANG >= 307) +# define QT_HAS_CONSTEXPR_BUILTINS +# endif +#elif defined(Q_CC_MSVC) && !defined(Q_CC_INTEL) && !defined(Q_OS_WINCE) && !defined(Q_PROCESSOR_ARM) +# define QT_HAS_CONSTEXPR_BUILTINS +#elif defined(Q_CC_GNU) # define QT_HAS_CONSTEXPR_BUILTINS #endif #if defined QT_HAS_CONSTEXPR_BUILTINS -#if defined(Q_CC_GNU) +#if defined(Q_CC_GNU) || defined(Q_CC_CLANG) # define QT_HAS_BUILTIN_CTZS Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW { From 6f275a4beb9a42b9d5ac99682ce9939a66239778 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 31 May 2016 11:57:53 -0300 Subject: [PATCH 060/236] Make sure QDBusConnection::connect() returns false if already connected QDBusConnection::connect() behaves like QObject::connect with a connection type of Qt::UniqueConnection | Qt::QueuedConnection. So return false if it's already connected. [ChangeLog][QtDBus][QDBusConnection] Fixed a bug that would cause QDBusConnection::connect() to return true if a slot was already connected to the same D-Bus signal. QtDBus does not support multiple connections. Change-Id: I87e17314d8b24ae983b1fffd1453aef5a7c9ad0b Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/dbus/qdbusconnection_p.h | 4 ++-- src/dbus/qdbusintegrator.cpp | 13 +++++-------- .../qdbusconnection/tst_qdbusconnection.cpp | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index bd100639d1f..0b7c731810e 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -280,7 +280,7 @@ public slots: void socketWrite(int); void objectDestroyed(QObject *o); void relaySignal(QObject *obj, const QMetaObject *, int signalId, const QVariantList &args); - void addSignalHook(const QString &key, const SignalHook &hook); + bool addSignalHook(const QString &key, const SignalHook &hook); bool removeSignalHook(const QString &key, const SignalHook &hook); private slots: @@ -293,7 +293,7 @@ signals: void dispatchStatusChanged(); void spyHooksFinished(const QDBusMessage &msg); void messageNeedsSending(QDBusPendingCallPrivate *pcall, void *msg, int timeout = -1); - void signalNeedsConnecting(const QString &key, const QDBusConnectionPrivate::SignalHook &hook); + bool signalNeedsConnecting(const QString &key, const QDBusConnectionPrivate::SignalHook &hook); bool signalNeedsDisconnecting(const QString &key, const QDBusConnectionPrivate::SignalHook &hook); void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner); void callWithCallbackFailed(const QDBusError &error, const QDBusMessage &message); diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 54418c213ad..21bc3c8ac29 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -2187,20 +2187,16 @@ bool QDBusConnectionPrivate::connectSignal(const QString &service, // check the slot QDBusConnectionPrivate::SignalHook hook; QString key; - QString name2 = name; - if (name2.isNull()) - name2.detach(); hook.signature = signature; if (!prepareHook(hook, key, service, path, interface, name, argumentMatch, receiver, slot, 0, false)) return false; // don't connect Q_ASSERT(thread() != QThread::currentThread()); - emit signalNeedsConnecting(key, hook); - return true; + return emit signalNeedsConnecting(key, hook); } -void QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook &hook) +bool QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook &hook) { QDBusWriteLocker locker(ConnectAction, this); @@ -2216,7 +2212,7 @@ void QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook entry.midx == hook.midx && entry.argumentMatch == hook.argumentMatch) { // no need to compare the parameters if it's the same slot - return; // already there + return false; // already there } } @@ -2228,7 +2224,7 @@ void QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook if (mit != matchRefCounts.end()) { // Match already present mit.value() = mit.value() + 1; - return; + return true; } matchRefCounts.insert(hook.matchRule, 1); @@ -2255,6 +2251,7 @@ void QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook } } } + return true; } bool QDBusConnectionPrivate::disconnectSignal(const QString &service, diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp index 602de58b2c4..95daa256b5f 100644 --- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp +++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp @@ -1087,6 +1087,16 @@ void tst_QDBusConnection::connectSignal() QTest::qWait(100); QCOMPARE(recv.argumentReceived, signal.arguments().at(0).toString()); QCOMPARE(recv.signalsReceived, 1); + + // confirm that we are, indeed, a unique connection + recv.argumentReceived.clear(); + recv.signalsReceived = 0; + QVERIFY(!con.connect(con.baseService(), signal.path(), signal.interface(), + signal.member(), "s", &recv, SLOT(oneSlot(QString)))); + QVERIFY(con.send(signal)); + QTest::qWait(100); + QCOMPARE(recv.argumentReceived, signal.arguments().at(0).toString()); + QCOMPARE(recv.signalsReceived, 1); } void tst_QDBusConnection::slotsWithLessParameters() @@ -1118,6 +1128,15 @@ void tst_QDBusConnection::slotsWithLessParameters() QTest::qWait(100); QCOMPARE(recv.argumentReceived, QString()); QCOMPARE(recv.signalsReceived, 1); + + // confirm that we are, indeed, a unique connection + recv.signalsReceived = 0; + QVERIFY(!con.connect(con.baseService(), signal.path(), signal.interface(), + signal.member(), "s", &recv, SLOT(oneSlot()))); + QVERIFY(con.send(signal)); + QTest::qWait(100); + QCOMPARE(recv.argumentReceived, QString()); + QCOMPARE(recv.signalsReceived, 1); } void SignalReceiver::secondCallWithCallback() From db79b89899e6537d540e290beaed263c46e3a885 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 5 Jul 2016 09:34:13 +0200 Subject: [PATCH 061/236] winrt: support fullscreen mode Enable switching application to fullscreen mode. This is mostly required for desktop targets of WinRT. Task-number: QTBUG-54517 Change-Id: I67e4020bc2ec8da86d94815e5765959f4ae2b63f Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrtwindow.cpp | 51 +++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/winrt/qwinrtwindow.cpp b/src/plugins/platforms/winrt/qwinrtwindow.cpp index 75b43205b7b..3bd0cd3ad73 100644 --- a/src/plugins/platforms/winrt/qwinrtwindow.cpp +++ b/src/plugins/platforms/winrt/qwinrtwindow.cpp @@ -320,10 +320,59 @@ void QWinRTWindow::setWindowState(Qt::WindowState state) if (d->state == state) return; +#if _MSC_VER >= 1900 + if (state == Qt::WindowFullScreen) { + HRESULT hr; + boolean success; + hr = QEventDispatcherWinRT::runOnXamlThread([&hr, &success]() { + ComPtr applicationViewStatics; + hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(), + IID_PPV_ARGS(&applicationViewStatics)); + RETURN_HR_IF_FAILED("Could not access application view statics."); + ComPtr view; + hr = applicationViewStatics->GetForCurrentView(&view); + RETURN_HR_IF_FAILED("Could not access application view."); + ComPtr view3; + hr = view.As(&view3); + Q_ASSERT_SUCCEEDED(hr); + hr = view3->TryEnterFullScreenMode(&success); + return hr; + }); + if (FAILED(hr) || !success) { + qCDebug(lcQpaWindows) << "Failed to enter full screen mode."; + return; + } + d->state = state; + return; + } + + if (d->state == Qt::WindowFullScreen) { + HRESULT hr; + hr = QEventDispatcherWinRT::runOnXamlThread([&hr]() { + ComPtr applicationViewStatics; + hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(), + IID_PPV_ARGS(&applicationViewStatics)); + RETURN_HR_IF_FAILED("Could not access application view statics."); + ComPtr view; + hr = applicationViewStatics->GetForCurrentView(&view); + RETURN_HR_IF_FAILED("Could not access application view."); + ComPtr view3; + hr = view.As(&view3); + Q_ASSERT_SUCCEEDED(hr); + hr = view3->ExitFullScreenMode(); + return hr; + }); + if (FAILED(hr)) { + qCDebug(lcQpaWindows) << "Failed to exit full screen mode."; + return; + } + } +#endif // _MSC_VER >= 1900 + if (state == Qt::WindowMinimized) setUIElementVisibility(d->uiElement.Get(), false); - if (d->state == Qt::WindowMinimized) + if (d->state == Qt::WindowMinimized || state == Qt::WindowNoState || state == Qt::WindowActive) setUIElementVisibility(d->uiElement.Get(), true); d->state = state; From 4101ecdb0edb43540afaab8b3310a876b528da17 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 7 Aug 2016 16:05:24 +0300 Subject: [PATCH 062/236] QColor: mark as movable (except for QList) Unbelievable that this has survived for so long... Change-Id: Icff6ecc56de773fa6054d5b96e421299a48bdbde Reviewed-by: Lars Knoll Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/painting/qcolor.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index faeccf7b911..6cf3a8e262d 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -264,6 +264,7 @@ private: friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QColor &); #endif }; +Q_DECLARE_TYPEINFO(QColor, QT_VERSION >= QT_VERSION_CHECK(6,0,0) ? Q_MOVABLE_TYPE : Q_RELOCATABLE_TYPE); inline QColor::QColor() Q_DECL_NOTHROW { invalidate(); } From ccfd699b854321d26be844e916cd26bb1a01ebca Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 6 Aug 2016 15:06:53 +0300 Subject: [PATCH 063/236] QNetworkManagerEngine: fix const-correctness Change-Id: I058617315e7cf2c6fa49f1ed0d16cb5e2a78dd72 Reviewed-by: Lars Knoll --- .../bearer/networkmanager/qnetworkmanagerengine.cpp | 8 ++++---- src/plugins/bearer/networkmanager/qnetworkmanagerengine.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index b0bc8a265ee..8e6ab025cde 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -553,7 +553,7 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, emit configurationAdded(ptr); } -bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath) +bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath) const { QHashIterator i(activeConnectionsList); while (i.hasNext()) { @@ -863,7 +863,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri return cpPriv; } -bool QNetworkManagerEngine::isActiveContext(const QString &contextPath) +bool QNetworkManagerEngine::isActiveContext(const QString &contextPath) const { if (ofonoManager && ofonoManager->isValid()) { const QString contextPart = contextPath.section('/', -1); @@ -1024,7 +1024,7 @@ QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration( return QNetworkConfigurationPrivatePointer(); } -QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id) +QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id) const { QString contextPart = id.section('/', -1); QHashIterator i(ofonoContextManagers); @@ -1055,7 +1055,7 @@ QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const return QNetworkConfiguration::BearerUnknown; } -QString QNetworkManagerEngine::contextName(const QString &path) +QString QNetworkManagerEngine::contextName(const QString &path) const { QString contextPart = path.section('/', -1); QHashIterator i(ofonoContextManagers); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index e8c40a881d2..2296d6b2b69 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -140,14 +140,14 @@ private: QOfonoManagerInterface *ofonoManager; QHash ofonoContextManagers; - QNetworkConfiguration::BearerType currentBearerType(const QString &id); - QString contextName(const QString &path); + QNetworkConfiguration::BearerType currentBearerType(const QString &id) const; + QString contextName(const QString &path) const; - bool isConnectionActive(const QString &settingsPath); + bool isConnectionActive(const QString &settingsPath) const; QDBusServiceWatcher *ofonoWatcher; QDBusServiceWatcher *nmWatcher; - bool isActiveContext(const QString &contextPath); + bool isActiveContext(const QString &contextPath) const; bool nmAvailable; void setupConfigurations(); }; From 3400e7ee7fc9f8747de28aa4eba9a28a8a79f819 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 6 Aug 2016 15:08:34 +0300 Subject: [PATCH 064/236] QNetworkManagerEngine: add override keywords Change-Id: Ie926119ee58d330e415634f93eb334c6befeede1 Reviewed-by: Lars Knoll --- .../networkmanager/qnetworkmanagerengine.h | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 2296d6b2b69..2f425ddc020 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -74,26 +74,26 @@ public: bool networkManagerAvailable() const; - QString getInterfaceFromId(const QString &id); - bool hasIdentifier(const QString &id); + QString getInterfaceFromId(const QString &id) override; + bool hasIdentifier(const QString &id) override; - void connectToId(const QString &id); - void disconnectFromId(const QString &id); + void connectToId(const QString &id) override; + void disconnectFromId(const QString &id) override; Q_INVOKABLE void initialize(); Q_INVOKABLE void requestUpdate(); - QNetworkSession::State sessionStateForId(const QString &id); + QNetworkSession::State sessionStateForId(const QString &id) override; - quint64 bytesWritten(const QString &id); - quint64 bytesReceived(const QString &id); - quint64 startTime(const QString &id); + quint64 bytesWritten(const QString &id) override; + quint64 bytesReceived(const QString &id) override; + quint64 startTime(const QString &id) override; - QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkConfigurationManager::Capabilities capabilities() const override; - QNetworkSessionPrivate *createSessionBackend(); + QNetworkSessionPrivate *createSessionBackend() override; - QNetworkConfigurationPrivatePointer defaultConfiguration(); + QNetworkConfigurationPrivatePointer defaultConfiguration() override; private Q_SLOTS: void interfacePropertiesChanged(const QMap &properties); From 7305b3e82863f077c4f677d0a860e314ce6f806c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 6 Aug 2016 15:11:44 +0300 Subject: [PATCH 065/236] QNetworkManagerEngine: port away from Java-style iterators They are slower, more annoying, and not safer than their STL counterparts. Port to C++11 range-for, or to "auto it, end" for loops in cases where the key was also accessed. Change-Id: Ib27608ddbe9c0775092a1c6495731ad324727d3e Reviewed-by: Lars Knoll --- .../networkmanager/qnetworkmanagerengine.cpp | 36 +++++++------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 8e6ab025cde..3cd92904206 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -555,12 +555,11 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath) const { - QHashIterator i(activeConnectionsList); - while (i.hasNext()) { - i.next(); - if (i.value()->connection().path() == settingsPath) { - if (i.value()->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATING - || i.value()->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { + for (QNetworkManagerConnectionActive *activeConnection : activeConnectionsList) { + if (activeConnection->connection().path() == settingsPath) { + const auto state = activeConnection->state(); + if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATING + || state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { return true; } else { break; @@ -848,9 +847,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri if (ofonoManager && ofonoManager->isValid()) { const QString contextPart = connectionPath.section('/', -1); - QHashIterator i(ofonoContextManagers); - while (i.hasNext()) { - i.next(); + for (auto i = ofonoContextManagers.cbegin(), end = ofonoContextManagers.cend(); i != end; ++i) { const QString path = i.key() + QLatin1Char('/') +contextPart; if (isActiveContext(path)) { cpPriv->state |= QNetworkConfiguration::Active; @@ -867,10 +864,8 @@ bool QNetworkManagerEngine::isActiveContext(const QString &contextPath) const { if (ofonoManager && ofonoManager->isValid()) { const QString contextPart = contextPath.section('/', -1); - QHashIterator i(ofonoContextManagers); - while (i.hasNext()) { - i.next(); - PathPropertiesList list = i.value()->contextsWithProperties(); + for (QOfonoDataConnectionManagerInterface *iface : ofonoContextManagers) { + const PathPropertiesList list = iface->contextsWithProperties(); for (int i = 0; i < list.size(); ++i) { if (list.at(i).path.path().contains(contextPart)) { return list.at(i).properties.value(QStringLiteral("Active")).toBool(); @@ -1012,10 +1007,7 @@ QNetworkSessionPrivate *QNetworkManagerEngine::createSessionBackend() QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration() { - QHashIterator i(activeConnectionsList); - while (i.hasNext()) { - i.next(); - QNetworkManagerConnectionActive *activeConnection = i.value(); + for (QNetworkManagerConnectionActive *activeConnection : qAsConst(activeConnectionsList)) { if ((activeConnection->defaultRoute() || activeConnection->default6Route())) { return accessPointConfigurations.value(activeConnection->connection().path()); } @@ -1027,9 +1019,7 @@ QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration( QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id) const { QString contextPart = id.section('/', -1); - QHashIterator i(ofonoContextManagers); - while (i.hasNext()) { - i.next(); + for (auto i = ofonoContextManagers.begin(), end = ofonoContextManagers.end(); i != end; ++i) { QString contextPath = i.key() + QLatin1Char('/') +contextPart; if (i.value()->contexts().contains(contextPath)) { @@ -1058,10 +1048,8 @@ QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString QNetworkManagerEngine::contextName(const QString &path) const { QString contextPart = path.section('/', -1); - QHashIterator i(ofonoContextManagers); - while (i.hasNext()) { - i.next(); - PathPropertiesList list = i.value()->contextsWithProperties(); + for (QOfonoDataConnectionManagerInterface *iface : ofonoContextManagers) { + const PathPropertiesList list = iface->contextsWithProperties(); for (int i = 0; i < list.size(); ++i) { if (list.at(i).path.path().contains(contextPart)) { return list.at(i).properties.value(QStringLiteral("Name")).toString(); From fa95eb055401f5264cbc6aca761cb9b5feb4affc Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 8 Aug 2016 17:23:18 +0200 Subject: [PATCH 066/236] QHeaderView: Reset lastSectionLogicalIdx on clear() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise we can fail to stretch the last section when adding new sections. Task-number: QTBUG-52446 Change-Id: I7eb5267ac500bf4246e57c3e3a43268bb65ef1f7 Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/itemviews/qheaderview.cpp | 1 + tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 7b393463a61..1a0b417034d 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3465,6 +3465,7 @@ void QHeaderViewPrivate::clear() sectionSelected.clear(); hiddenSectionSize.clear(); sectionItems.clear(); + lastSectionLogicalIdx = -1; invalidateCachedSizeHint(); } } diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 47ec93ce169..ea065a4db4d 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -3014,6 +3014,11 @@ void tst_QHeaderView::stretchAndRestoreLastSection() header.swapSections(1, 11); QCOMPARE(header.sectionSize(1), someOtherSectionSize); + // Clear and re-add. This triggers a different code path than seColumnCount(0) + m.clear(); + m.setColumnCount(3); + QVERIFY(header.sectionSize(2) >= biggerSizeThanAnySection); + // Test import/export of the original (not stretched) sectionSize. m.setColumnCount(0); m.setColumnCount(10); From bd79c4e28c307ba87aca02155b845774c7ffec1f Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 9 Aug 2016 13:46:42 +0200 Subject: [PATCH 067/236] winrt: Make test functional The adoptedThreads test never spawned any thread causing a test error later on. Hence add a winrt version using __beginthreadex which exists for that platform. Change-Id: I04f980218713df20cb41d804d732e0c99b958489 Reviewed-by: Oliver Wolff --- .../thread/qthreadstorage/tst_qthreadstorage.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp index 4e582cc3461..49a3b3e4db2 100644 --- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -200,6 +200,13 @@ void testAdoptedThreadStorageWin(void *p) } QObject::connect(QThread::currentThread(), SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); } +#ifdef Q_OS_WINRT +unsigned __stdcall testAdoptedThreadStorageWinRT(void *p) +{ + testAdoptedThreadStorageWin(p); + return 0; +} +#endif void *testAdoptedThreadStorageUnix(void *pointers) { testAdoptedThreadStorageWin(pointers); @@ -217,7 +224,12 @@ void tst_QThreadStorage::adoptedThreads() const int state = pthread_create(&thread, 0, testAdoptedThreadStorageUnix, &pointers); QCOMPARE(state, 0); pthread_join(thread, 0); -#elif defined Q_OS_WIN && !defined(Q_OS_WINRT) +#elif defined Q_OS_WINRT + HANDLE thread; + thread = (HANDLE) _beginthreadex(NULL, 0, testAdoptedThreadStorageWinRT, &pointers, 0, 0); + QVERIFY(thread); + WaitForSingleObjectEx(thread, INFINITE, FALSE); +#elif defined Q_OS_WIN HANDLE thread; thread = (HANDLE)_beginthread(testAdoptedThreadStorageWin, 0, &pointers); QVERIFY(thread); From 39def876a641e0fff42298c61bbe3d3fafaf47af Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 9 Aug 2016 11:58:31 +0200 Subject: [PATCH 068/236] winrt: update tests Update due to behavior differences between win32 and winrt. Change-Id: I39532de98c25cd67da49cbb20d42dccc803f1805 Reviewed-by: Oliver Wolff --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 4c9986d50ed..68d7a4fe5f6 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -155,10 +155,12 @@ private slots: void copyRemovesTemporaryFile() const; void copyShouldntOverwrite(); void copyFallback(); +#ifndef Q_OS_WINRT void link(); void linkToDir(); void absolutePathLinkToRelativePath(); void readBrokenLink(); +#endif void readTextFile_data(); void readTextFile(); void readTextFile2(); @@ -568,7 +570,7 @@ void tst_QFile::open() QSKIP("Running this test as root doesn't make sense"); #endif -#if defined(Q_OS_WIN32) +#if defined(Q_OS_WIN32) || defined(Q_OS_WINRT) QEXPECT_FAIL("noreadfile", "Windows does not currently support non-readable files.", Abort); #endif if (filename.isEmpty()) @@ -1226,7 +1228,7 @@ void tst_QFile::permissions() QFile::remove(file); } -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) if (qt_ntfs_permission_lookup) QEXPECT_FAIL("readonly", "QTBUG-25630", Abort); #endif @@ -1413,6 +1415,7 @@ static QString getWorkingDirectoryForLink(const QString &linkFileName) } #endif +#ifndef Q_OS_WINRT void tst_QFile::link() { QFile::remove("myLink.lnk"); @@ -1433,7 +1436,7 @@ void tst_QFile::link() QCOMPARE(QFile::symLinkTarget("myLink.lnk"), referenceTarget); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) QString wd = getWorkingDirectoryForLink(info2.absoluteFilePath()); QCOMPARE(QDir::fromNativeSeparators(wd), QDir::cleanPath(info1.absolutePath())); #endif @@ -1487,6 +1490,7 @@ void tst_QFile::readBrokenLink() QVERIFY(QFile::link("ole/..", "myLink2.lnk")); QCOMPARE(QFileInfo("myLink2.lnk").symLinkTarget(), QDir::currentPath()); } +#endif // Q_OS_WINRT void tst_QFile::readTextFile_data() { From 8ebe8ae35ee7556de0749bc27737ced7c61f5153 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 5 Aug 2016 16:12:00 -0700 Subject: [PATCH 069/236] HiDPI Drag and Drop: Properly render the default image on Mac MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is only when the attached MIME data contains text, and we fall back to rendering that text into a pixmap. It requires getting the device pixel ratio from the source which, for now, may be a QWidget or a QWindow. Other cases may exist, but that would bring more dependencies than desired. Similarly, it fixes the draggabletext example. Other examples would require either to get updated pixmaps or change substantially in order to support HiDPI (e.g., the fridgemagnets example). Change-Id: I66198214233e3e06c87505744e2aaa9691fe1bb6 Reviewed-by: Filipe Azevedo Reviewed-by: Timur Pocheptsov Reviewed-by: Morten Johan Sørvig --- .../draganddrop/draggabletext/dragwidget.cpp | 4 +++- src/plugins/platforms/cocoa/qcocoadrag.mm | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/examples/widgets/draganddrop/draggabletext/dragwidget.cpp b/examples/widgets/draganddrop/draggabletext/dragwidget.cpp index 36c4df2e438..77262e5b291 100644 --- a/examples/widgets/draganddrop/draggabletext/dragwidget.cpp +++ b/examples/widgets/draganddrop/draggabletext/dragwidget.cpp @@ -150,7 +150,9 @@ void DragWidget::mousePressEvent(QMouseEvent *event) mimeData->setData(hotSpotMimeDataKey(), QByteArray::number(hotSpot.x()) + ' ' + QByteArray::number(hotSpot.y())); - QPixmap pixmap(child->size()); + qreal dpr = window()->windowHandle()->devicePixelRatio(); + QPixmap pixmap(child->size() * dpr); + pixmap.setDevicePixelRatio(dpr); child->render(&pixmap); QDrag *drag = new QDrag(this); diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index 80006ae9b85..1e9c355788f 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -34,6 +34,9 @@ #include "qcocoadrag.h" #include "qmacclipboard.h" #include "qcocoahelpers.h" +#ifndef QT_NO_WIDGETS +#include +#endif QT_BEGIN_NAMESPACE @@ -181,7 +184,18 @@ QPixmap QCocoaDrag::dragPixmap(QDrag *drag, QPoint &hotSpot) const const int width = fm.width(s); const int height = fm.height(); if (width > 0 && height > 0) { - pm = QPixmap(width, height); + qreal dpr = 1.0; + if (const QWindow *sourceWindow = qobject_cast(drag->source())) { + dpr = sourceWindow->devicePixelRatio(); + } +#ifndef QT_NO_WIDGETS + else if (const QWidget *sourceWidget = qobject_cast(drag->source())) { + if (const QWindow *sourceWindow = sourceWidget->window()->windowHandle()) + dpr = sourceWindow->devicePixelRatio(); + } +#endif + pm = QPixmap(width * dpr, height * dpr); + pm.setDevicePixelRatio(dpr); QPainter p(&pm); p.fillRect(0, 0, pm.width(), pm.height(), Qt::color0); p.setPen(Qt::color1); From 89d7c904e5f7c0cd230e59a4cd8b2ee2a1cbcac1 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 20 May 2016 10:47:37 -0700 Subject: [PATCH 070/236] QTabBar: Cache title text sizes The first part adds QTabBarPrivate::initBasicStyleOption() which is basically QTabBar::initStyleOption() but without the expensive QFontMetrics::elidedText() call. That is because QTabBar::tabSizeHint() would call initStyleOption() and then immediately discard the result of that computation. Then, QTabBar::tabSizeHint() is modified to cache the calls to QFontMetrics::size(), which is also expensive. The cache is invalidated when the style or the font changes, or when the elide mode is set. Change-Id: I591b2e401af3576a2ebabc5b94f19ae157e28cf2 Reviewed-by: Friedemann Kleint Reviewed-by: Wayne Arnold Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/widgets/widgets/qtabbar.cpp | 87 +++++++++++++++++++++------------ src/widgets/widgets/qtabbar_p.h | 3 ++ 2 files changed, 58 insertions(+), 32 deletions(-) diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 87fb3357d6c..fc27654addf 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -134,60 +134,59 @@ void QTabBarPrivate::updateMacBorderMetrics() } /*! - Initialize \a option with the values from the tab at \a tabIndex. This method - is useful for subclasses when they need a QStyleOptionTab, - but don't want to fill in all the information themselves. - - \sa QStyleOption::initFrom(), QTabWidget::initStyleOption() + \internal + This is basically QTabBar::initStyleOption() but + without the expensive QFontMetrics::elidedText() call. */ -void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const + +void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex) const { - Q_D(const QTabBar); - int totalTabs = d->tabList.size(); + Q_Q(const QTabBar); + const int totalTabs = tabList.size(); if (!option || (tabIndex < 0 || tabIndex >= totalTabs)) return; - const QTabBarPrivate::Tab &tab = d->tabList.at(tabIndex); - option->initFrom(this); + const QTabBarPrivate::Tab &tab = tabList.at(tabIndex); + option->initFrom(q); option->state &= ~(QStyle::State_HasFocus | QStyle::State_MouseOver); - option->rect = tabRect(tabIndex); - bool isCurrent = tabIndex == d->currentIndex; + option->rect = q->tabRect(tabIndex); + const bool isCurrent = tabIndex == currentIndex; option->row = 0; - if (tabIndex == d->pressedIndex) + if (tabIndex == pressedIndex) option->state |= QStyle::State_Sunken; if (isCurrent) option->state |= QStyle::State_Selected; - if (isCurrent && hasFocus()) + if (isCurrent && q->hasFocus()) option->state |= QStyle::State_HasFocus; if (!tab.enabled) option->state &= ~QStyle::State_Enabled; - if (isActiveWindow()) + if (q->isActiveWindow()) option->state |= QStyle::State_Active; - if (!d->dragInProgress && option->rect == d->hoverRect) + if (!dragInProgress && option->rect == hoverRect) option->state |= QStyle::State_MouseOver; - option->shape = d->shape; + option->shape = shape; option->text = tab.text; if (tab.textColor.isValid()) - option->palette.setColor(foregroundRole(), tab.textColor); + option->palette.setColor(q->foregroundRole(), tab.textColor); option->icon = tab.icon; - option->iconSize = iconSize(); // Will get the default value then. + option->iconSize = q->iconSize(); // Will get the default value then. option->leftButtonSize = tab.leftWidget ? tab.leftWidget->size() : QSize(); option->rightButtonSize = tab.rightWidget ? tab.rightWidget->size() : QSize(); - option->documentMode = d->documentMode; + option->documentMode = documentMode; - if (tabIndex > 0 && tabIndex - 1 == d->currentIndex) + if (tabIndex > 0 && tabIndex - 1 == currentIndex) option->selectedPosition = QStyleOptionTab::PreviousIsSelected; - else if (tabIndex + 1 < totalTabs && tabIndex + 1 == d->currentIndex) + else if (tabIndex + 1 < totalTabs && tabIndex + 1 == currentIndex) option->selectedPosition = QStyleOptionTab::NextIsSelected; else option->selectedPosition = QStyleOptionTab::NotAdjacent; - bool paintBeginning = (tabIndex == 0) || (d->dragInProgress && tabIndex == d->pressedIndex + 1); - bool paintEnd = (tabIndex == totalTabs - 1) || (d->dragInProgress && tabIndex == d->pressedIndex - 1); + const bool paintBeginning = (tabIndex == 0) || (dragInProgress && tabIndex == pressedIndex + 1); + const bool paintEnd = (tabIndex == totalTabs - 1) || (dragInProgress && tabIndex == pressedIndex - 1); if (paintBeginning) { if (paintEnd) option->position = QStyleOptionTab::OnlyOneTab; @@ -200,7 +199,7 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const } #ifndef QT_NO_TABWIDGET - if (const QTabWidget *tw = qobject_cast(parentWidget())) { + if (const QTabWidget *tw = qobject_cast(q->parentWidget())) { option->features |= QStyleOptionTab::HasFrame; if (tw->cornerWidget(Qt::TopLeftCorner) || tw->cornerWidget(Qt::BottomLeftCorner)) option->cornerWidgets |= QStyleOptionTab::LeftCornerWidget; @@ -208,6 +207,19 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const option->cornerWidgets |= QStyleOptionTab::RightCornerWidget; } #endif +} + +/*! + Initialize \a option with the values from the tab at \a tabIndex. This method + is useful for subclasses when they need a QStyleOptionTab, + but don't want to fill in all the information themselves. + + \sa QStyleOption::initFrom(), QTabWidget::initStyleOption() +*/ +void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const +{ + Q_D(const QTabBar); + d->initBasicStyleOption(option, tabIndex); QRect textRect = style()->subElementRect(QStyle::SE_TabBarTabText, option, this); option->text = fontMetrics().elidedText(option->text, d->elideMode, textRect.width(), @@ -1020,6 +1032,7 @@ void QTabBar::setTabText(int index, const QString &text) { Q_D(QTabBar); if (QTabBarPrivate::Tab *tab = d->at(index)) { + d->textSizes.remove(tab->text); tab->text = text; #ifndef QT_NO_SHORTCUT releaseShortcut(tab->shortcutId); @@ -1379,7 +1392,7 @@ QSize QTabBar::tabSizeHint(int index) const Q_D(const QTabBar); if (const QTabBarPrivate::Tab *tab = d->at(index)) { QStyleOptionTab opt; - initStyleOption(&opt, index); + d->initBasicStyleOption(&opt, index); opt.text = d->tabList.at(index).text; QSize iconSize = tab->icon.isNull() ? QSize(0, 0) : opt.iconSize; int hframe = style()->pixelMetric(QStyle::PM_TabBarTabHSpace, &opt, this); @@ -1405,13 +1418,16 @@ QSize QTabBar::tabSizeHint(int index) const if (!opt.icon.isNull()) padding += 4; + QHash::iterator it = d->textSizes.find(tab->text); + if (it == d->textSizes.end()) + it = d->textSizes.insert(tab->text, fm.size(Qt::TextShowMnemonic, tab->text)); + const int textWidth = it.value().width(); QSize csz; if (verticalTabs(d->shape)) { csz = QSize( qMax(maxWidgetWidth, qMax(fm.height(), iconSize.height())) + vframe, - fm.size(Qt::TextShowMnemonic, tab->text).width() + iconSize.width() + hframe + widgetHeight + padding); + textWidth + iconSize.width() + hframe + widgetHeight + padding); } else { - csz = QSize(fm.size(Qt::TextShowMnemonic, tab->text).width() + iconSize.width() + hframe - + widgetWidth + padding, + csz = QSize(textWidth + iconSize.width() + hframe + widgetWidth + padding, qMax(maxWidgetHeight, qMax(fm.height(), iconSize.height())) + vframe); } @@ -2071,15 +2087,21 @@ void QTabBarPrivate::setCurrentNextEnabledIndex(int offset) void QTabBar::changeEvent(QEvent *event) { Q_D(QTabBar); - if (event->type() == QEvent::StyleChange) { + switch (event->type()) { + case QEvent::StyleChange: if (!d->elideModeSetByUser) d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this)); if (!d->useScrollButtonsSetByUser) d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this); + // fallthrough + case QEvent::FontChange: + d->textSizes.clear(); d->refresh(); - } else if (event->type() == QEvent::FontChange) { - d->refresh(); + break; + default: + break; } + QWidget::changeEvent(event); } @@ -2122,6 +2144,7 @@ void QTabBar::setElideMode(Qt::TextElideMode mode) Q_D(QTabBar); d->elideMode = mode; d->elideModeSetByUser = true; + d->textSizes.clear(); d->refresh(); } diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h index e58fde160c2..d34f45071db 100644 --- a/src/widgets/widgets/qtabbar_p.h +++ b/src/widgets/widgets/qtabbar_p.h @@ -159,6 +159,7 @@ public: #endif //QT_NO_ANIMATION }; QList tabList; + mutable QHash textSizes; int calculateNewPosition(int from, int to, int index) const; void slide(int from, int to); @@ -192,6 +193,8 @@ public: void setupMovableTab(); void autoHideTabs(); + void initBasicStyleOption(QStyleOptionTab *option, int tabIndex) const; + void makeVisible(int index); QSize iconSize; Qt::TextElideMode elideMode; From c8afc67875a3db232f98735602af054bdf2ef531 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 1 Jul 2016 16:14:31 +0200 Subject: [PATCH 071/236] Automatically generate code attribution documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let the qtattributionsscanner tool generate a .qdoc file in the build directory that contains code attributions for this qdoc module. Task-number: QTBUG-55139 Change-Id: Ic7532c9a7c092f552c36e21ee6cbebdd0107689b Reviewed-by: Oswald Buddenhagen Reviewed-by: Topi Reiniö --- doc/global/config.qdocconf | 2 +- mkspecs/features/qt_docs.prf | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/global/config.qdocconf b/doc/global/config.qdocconf index 97357345c9a..ac9e7ac2746 100644 --- a/doc/global/config.qdocconf +++ b/doc/global/config.qdocconf @@ -10,6 +10,6 @@ dita.metadata.default.audience = programmer #Set the main Qt index.html navigation.homepage = "Qt $QT_VER" -sourcedirs += includes +sourcedirs += includes $$BUILDDIR url = http://doc.qt.io/qt-5 diff --git a/mkspecs/features/qt_docs.prf b/mkspecs/features/qt_docs.prf index 183d0c9502d..72dde61a409 100644 --- a/mkspecs/features/qt_docs.prf +++ b/mkspecs/features/qt_docs.prf @@ -21,12 +21,16 @@ qtvertag.name = QT_VERSION_TAG qtvertag.value = $$replace(qtver.value, \.,) qtdocs.name = QT_INSTALL_DOCS qtdocs.value = $$[QT_INSTALL_DOCS/src] -QT_TOOL_ENV = qtver qtmver qtvertag qtdocs +builddir.name = BUILDDIR +builddir.value = $$OUT_PWD +QT_TOOL_ENV = qtver qtmver qtvertag qtdocs builddir qtPrepareTool(QDOC, qdoc) QT_TOOL_ENV = !build_online_docs: qtPrepareTool(QHELPGENERATOR, qhelpgenerator) +qtPrepareTool(QTATTRIBUTIONSSCANNER, qtattributionsscanner) + # qtPrepareTool() must be called outside a build pass, as it protects # against concurrent wrapper creation by omitting it during build passes. # However, creating the actual targets is reserved to the build passes. @@ -63,12 +67,21 @@ DOC_INDEXES = PREP_DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get]) DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get]) } + +qtattributionsscanner.target = qtattributionsscanner +qtattributionsscanner.commands = $$QTATTRIBUTIONSSCANNER $$shell_quote($$MODULE_BASE_INDIR) \ + --filter "QDocModule=$$QMAKE_DOCS_TARGET" -o $$shell_quote($$OUT_PWD/codeattributions.qdoc) +qtattributionsscanner.CONFIG += phony +QMAKE_EXTRA_TARGETS += qtattributionsscanner + doc_command = $$QDOC $$QMAKE_DOCS prepare_docs { prepare_docs.commands += $$doc_command -prepare $$PREP_DOC_INDEXES -no-link-errors generate_docs.commands += $$doc_command -generate $$DOC_INDEXES + prepare_docs.depends += qtattributionsscanner } else { html_docs.commands += $$doc_command $$DOC_INDEXES + html_docs.depends += qtattributionsscanner } !build_online_docs { From c35fef9d3b8bb77a7f303e3cd62c86cd00e57f5b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 22 Jul 2016 19:56:41 -0700 Subject: [PATCH 072/236] Fix qnumeric_p.h with ICC's supplied math.h ICC supplies a math.h header that defines things like: #define isnan( __x__ ) __IMFC99MACRO1ARG_ALL( __x__, isnan, __, f, __, , __, l) So use the already-existing workaround for it. Since Qt 5.7 requires C++11, we can remove the check for that. Change-Id: I149e0540c00745fe8119fffd1463cc5caf341337 Reviewed-by: Simon Hausmann --- src/corelib/global/qnumeric_p.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 5705bc29c8e..3451b2158d4 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -66,8 +66,9 @@ #include #endif -#if !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || !defined(__cplusplus) || __cplusplus < 201103L) -#include +#if !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || defined(Q_CC_INTEL) || !defined(__cplusplus)) +# include +# define QT_MATH_H_DEFINES_MACROS QT_BEGIN_NAMESPACE namespace qnumeric_std_wrapper { // the 'using namespace std' below is cases where the stdlib already put the math.h functions in the std namespace and undefined the macros. @@ -96,7 +97,8 @@ static inline bool isfinite(double d) { return !!_finite(d); } static inline bool isnan(float f) { return !!_isnan(f); } static inline bool isinf(float f) { return !_finite(f) && !_isnan(f); } static inline bool isfinite(float f) { return !!_finite(f); } -#elif !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || !defined(__cplusplus) || __cplusplus < 201103L) +#elif defined(QT_MATH_H_DEFINES_MACROS) +# undef QT_MATH_H_DEFINES_MACROS static inline bool isnan(double d) { return math_h_isnan(d); } static inline bool isinf(double d) { return math_h_isinf(d); } static inline bool isfinite(double d) { return math_h_isfinite(d); } From af7b4e3f5564f8a47c4ca14c543d74c5684238ee Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 8 Aug 2016 10:42:28 +0200 Subject: [PATCH 073/236] eglfs: Enable virtual desktop with EGLDevice as well Not clear why separateScreen was overridden to true. The GBM-based backend goes with the default of false, leading to setting up the screens as virtual siblings and reporting the correct virtual desktop geometry. The difference currently lies in the OpenGL mouse cursor, which, unlike the GBM hardware cursor, does not yet support virtual desktops. Its behavior is not affected of the flag however. Task-number: QTBUG-54151 Task-number: QTBUG-55161 Task-number: QTBUG-55188 Change-Id: I888ffc43ed4add66065a2f7c606c9b3a2d56a9ab Reviewed-by: Andy Nichols Reviewed-by: Dominik Holland --- .../eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp | 5 ----- .../eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h | 2 -- .../deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp | 1 + .../deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp | 2 +- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index 28967d71ffe..cbf7cfe7d0a 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -222,11 +222,6 @@ QEglFSWindow *QEglFSKmsEglDeviceIntegration::createWindow(QWindow *window) const return eglWindow; } -bool QEglFSKmsEglDeviceIntegration::separateScreens() const -{ - return true; -} - QEglFSKmsDevice *QEglFSKmsEglDeviceIntegration::createDevice(const QString &devicePath) { Q_UNUSED(devicePath) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h index f04c42267a9..af6b3f81ced 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h @@ -61,8 +61,6 @@ public: bool supportsPBuffers() const Q_DECL_OVERRIDE; QEglFSWindow *createWindow(QWindow *window) const Q_DECL_OVERRIDE; - virtual bool separateScreens() const Q_DECL_OVERRIDE; - EGLDeviceEXT eglDevice() const { return m_egl_device; } protected: diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index f4ffee569de..934f7802ac2 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -376,6 +376,7 @@ void QEglFSKmsDevice::createScreens() drmModeFreeResources(resources); if (!m_integration->separateScreens()) { + // set up a virtual desktop Q_FOREACH (QPlatformScreen *screen, siblings) static_cast(screen)->setVirtualSiblings(siblings); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp index e6b256f6b2e..addcb366ebc 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp @@ -81,7 +81,7 @@ QEglFSKmsScreen::QEglFSKmsScreen(QEglFSKmsIntegration *integration, , m_powerState(PowerStateOn) , m_interruptHandler(new QEglFSKmsInterruptHandler(this)) { - m_siblings << this; + m_siblings << this; // gets overridden by QEglFSKmsDevice later if !separateScreens } QEglFSKmsScreen::~QEglFSKmsScreen() From e93042522817003f35402adea83b8a537dba7c87 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 8 Aug 2016 12:06:40 +0200 Subject: [PATCH 074/236] eglfs: Fix QT_QPA_EGLFS_ROTATION with the KMS/DRM screeen It overrides geometry(). Change-Id: I93c607567d7cb688221d200dcd47c1a6ba23b26b Reviewed-by: Andy Nichols --- .../eglfs_kms_support/qeglfskmsscreen.cpp | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp index addcb366ebc..fb8233a8758 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp @@ -101,9 +101,29 @@ QEglFSKmsScreen::~QEglFSKmsScreen() QRect QEglFSKmsScreen::geometry() const { const int mode = m_output.mode; - return QRect(m_pos.x(), m_pos.y(), - m_output.modes[mode].hdisplay, - m_output.modes[mode].vdisplay); + QRect r(m_pos.x(), m_pos.y(), + m_output.modes[mode].hdisplay, + m_output.modes[mode].vdisplay); + + static int rotation = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION"); + switch (rotation) { + case 0: + case 180: + case -180: + break; + case 90: + case -90: { + int h = r.height(); + r.setHeight(r.width()); + r.setWidth(h); + break; + } + default: + qWarning("Invalid rotation %d specified in QT_QPA_EGLFS_ROTATION", rotation); + break; + } + + return r; } int QEglFSKmsScreen::depth() const From b305702d1e38d72765325dd7b1f2a7fde14e5529 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 8 Aug 2016 11:37:43 +0200 Subject: [PATCH 075/236] eglfs: Support virtual desktops in the OpenGL cursor The GBM-based hardware cursor already has this. Let's implement it in the commonly used OpenGL cursor too. The main user will be the EGLDevice backend which does not currently have a hardware cursor but supports multiple screens. This also means QEglFSCursor must be capable of operating on different contexts (and what's more, non-sharing contexts). Task-number: QTBUG-55161 Change-Id: Ie23bba1e6aab34b04d689f26a84c19a2bde518da Reviewed-by: Andy Nichols --- .../platforms/eglfs/api/qeglfscursor.cpp | 163 +++++++++++------- .../platforms/eglfs/api/qeglfscursor_p.h | 27 ++- .../eglfs/api/qeglfsdeviceintegration.cpp | 3 +- .../qeglfskmsegldevice.cpp | 33 +++- .../eglfs_kms_egldevice/qeglfskmsegldevice.h | 12 ++ .../qeglfskmsegldeviceintegration.cpp | 6 + .../qeglfskmsegldeviceintegration.h | 1 + .../qeglfskmsegldevicescreen.cpp | 22 +++ .../qeglfskmsegldevicescreen.h | 7 + 9 files changed, 198 insertions(+), 76 deletions(-) diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp index 7c1f11372a7..0040ecd59d9 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp @@ -59,12 +59,11 @@ QT_BEGIN_NAMESPACE QEglFSCursor::QEglFSCursor(QPlatformScreen *screen) - : m_visible(true), - m_screen(static_cast(screen)), - m_program(0), - m_textureEntry(0), - m_deviceListener(0), - m_updateRequested(false) + : m_visible(true), + m_screen(static_cast(screen)), + m_activeScreen(nullptr), + m_deviceListener(0), + m_updateRequested(false) { QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR"); if (!hideCursorVal.isEmpty()) @@ -116,15 +115,14 @@ void QEglFSCursorDeviceListener::onDeviceListChanged(QInputDeviceManager::Device void QEglFSCursor::resetResources() { - if (QOpenGLContext::currentContext()) { - delete m_program; - glDeleteTextures(1, &m_cursor.customCursorTexture); - glDeleteTextures(1, &m_cursorAtlas.texture); + if (QOpenGLContext *ctx = QOpenGLContext::currentContext()) { + GraphicsContextData &gfx(m_gfx[ctx]); + delete gfx.program; + glDeleteTextures(1, &gfx.customCursorTexture); + glDeleteTextures(1, &gfx.atlasTexture); + gfx = GraphicsContextData(); } - m_program = 0; - m_cursor.customCursorTexture = 0; m_cursor.customCursorPending = !m_cursor.customCursorImage.isNull(); - m_cursorAtlas.texture = 0; } void QEglFSCursor::createShaderPrograms() @@ -146,15 +144,16 @@ void QEglFSCursor::createShaderPrograms() " gl_FragColor = texture2D(texture, textureCoord).bgra;\n" "}\n"; - m_program = new QOpenGLShaderProgram; - m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram); - m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram); - m_program->bindAttributeLocation("vertexCoordEntry", 0); - m_program->bindAttributeLocation("textureCoordEntry", 1); - m_program->link(); + GraphicsContextData &gfx(m_gfx[QOpenGLContext::currentContext()]); + gfx.program = new QOpenGLShaderProgram; + gfx.program->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram); + gfx.program->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram); + gfx.program->bindAttributeLocation("vertexCoordEntry", 0); + gfx.program->bindAttributeLocation("textureCoordEntry", 1); + gfx.program->link(); - m_textureEntry = m_program->uniformLocation("texture"); - m_matEntry = m_program->uniformLocation("mat"); + gfx.textureEntry = gfx.program->uniformLocation("texture"); + gfx.matEntry = gfx.program->uniformLocation("mat"); } void QEglFSCursor::createCursorTexture(uint *texture, const QImage &image) @@ -214,7 +213,7 @@ void QEglFSCursor::changeCursor(QCursor *cursor, QWindow *window) Q_UNUSED(window); const QRect oldCursorRect = cursorRect(); if (setCurrentCursor(cursor)) - update(oldCursorRect | cursorRect()); + update(oldCursorRect | cursorRect(), false); } bool QEglFSCursor::setCurrentCursor(QCursor *cursor) @@ -238,16 +237,17 @@ bool QEglFSCursor::setCurrentCursor(QCursor *cursor) hs * (m_cursor.shape / m_cursorAtlas.cursorsPerRow), ws, hs); m_cursor.hotSpot = m_cursorAtlas.hotSpots[m_cursor.shape]; - m_cursor.texture = m_cursorAtlas.texture; + m_cursor.useCustomCursor = false; m_cursor.size = QSize(m_cursorAtlas.cursorWidth, m_cursorAtlas.cursorHeight); } else { QImage image = cursor->pixmap().toImage(); m_cursor.textureRect = QRectF(0, 0, 1, 1); m_cursor.hotSpot = cursor->hotSpot(); - m_cursor.texture = 0; // will get updated in the next render() + m_cursor.useCustomCursor = false; // will get updated in the next render() m_cursor.size = image.size(); m_cursor.customCursorImage = image; m_cursor.customCursorPending = true; + m_cursor.customCursorKey = m_cursor.customCursorImage.cacheKey(); } return true; @@ -257,17 +257,20 @@ bool QEglFSCursor::setCurrentCursor(QCursor *cursor) class CursorUpdateEvent : public QEvent { public: - CursorUpdateEvent(const QPoint &pos, const QRegion &rgn) + CursorUpdateEvent(const QPoint &pos, const QRect &rect, bool allScreens) : QEvent(QEvent::Type(QEvent::User + 1)), m_pos(pos), - m_region(rgn) + m_rect(rect), + m_allScreens(allScreens) { } QPoint pos() const { return m_pos; } - QRegion region() const { return m_region; } + QRegion rect() const { return m_rect; } + bool allScreens() const { return m_allScreens; } private: QPoint m_pos; - QRegion m_region; + QRect m_rect; + bool m_allScreens; }; bool QEglFSCursor::event(QEvent *e) @@ -275,21 +278,30 @@ bool QEglFSCursor::event(QEvent *e) if (e->type() == QEvent::User + 1) { CursorUpdateEvent *ev = static_cast(e); m_updateRequested = false; - QWindowSystemInterface::handleExposeEvent(m_screen->topLevelAt(ev->pos()), ev->region()); - QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); + if (!ev->allScreens()) { + QWindow *w = m_screen->topLevelAt(ev->pos()); // works for the entire virtual desktop, no need to loop + if (w) { + QWindowSystemInterface::handleExposeEvent(w, ev->rect()); + QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); + } + } else { + for (QWindow *w : qGuiApp->topLevelWindows()) + QWindowSystemInterface::handleExposeEvent(w, w->geometry()); + QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); + } return true; } return QPlatformCursor::event(e); } -void QEglFSCursor::update(const QRegion &rgn) +void QEglFSCursor::update(const QRect &rect, bool allScreens) { if (!m_updateRequested) { // Must not flush the window system events directly from here since we are likely to // be a called directly from QGuiApplication's processMouseEvents. Flushing events // could cause reentering by dispatching more queued mouse events. m_updateRequested = true; - QCoreApplication::postEvent(this, new CursorUpdateEvent(m_cursor.pos, rgn)); + QCoreApplication::postEvent(this, new CursorUpdateEvent(m_cursor.pos, rect, allScreens)); } } @@ -308,8 +320,9 @@ void QEglFSCursor::setPos(const QPoint &pos) QGuiApplicationPrivate::inputDeviceManager()->setCursorPos(pos); const QRect oldCursorRect = cursorRect(); m_cursor.pos = pos; - update(oldCursorRect | cursorRect()); - m_screen->handleCursorMove(m_cursor.pos); + update(oldCursorRect | cursorRect(), false); + for (QPlatformScreen *screen : m_screen->virtualSiblings()) + static_cast(screen)->handleCursorMove(m_cursor.pos); } void QEglFSCursor::pointerEvent(const QMouseEvent &event) @@ -318,8 +331,9 @@ void QEglFSCursor::pointerEvent(const QMouseEvent &event) return; const QRect oldCursorRect = cursorRect(); m_cursor.pos = event.screenPos().toPoint(); - update(oldCursorRect | cursorRect()); - m_screen->handleCursorMove(m_cursor.pos); + update(oldCursorRect | cursorRect(), false); + for (QPlatformScreen *screen : m_screen->virtualSiblings()) + static_cast(screen)->handleCursorMove(m_cursor.pos); } void QEglFSCursor::paintOnScreen() @@ -327,15 +341,35 @@ void QEglFSCursor::paintOnScreen() if (!m_visible) return; - const QRectF cr = cursorRect(); - const QRect screenRect(m_screen->geometry()); - const GLfloat x1 = 2 * (cr.left() / screenRect.width()) - 1; - const GLfloat x2 = 2 * (cr.right() / screenRect.width()) - 1; - const GLfloat y1 = 1 - (cr.top() / screenRect.height()) * 2; - const GLfloat y2 = 1 - (cr.bottom() / screenRect.height()) * 2; - QRectF r(QPointF(x1, y1), QPointF(x2, y2)); + QRect cr = cursorRect(); // hotspot included - draw(r); + // Support virtual desktop too. Backends with multi-screen support (e.g. all + // variants of KMS/DRM) will enable this by default. In this case all + // screens are siblings of each other. When not enabled, the sibling list + // only contains m_screen itself. + for (QPlatformScreen *screen : m_screen->virtualSiblings()) { + if (screen->geometry().contains(cr.topLeft() + m_cursor.hotSpot) + && QOpenGLContext::currentContext()->screen() == screen->screen()) + { + cr.translate(-screen->geometry().topLeft()); + const QSize screenSize = screen->geometry().size(); + const GLfloat x1 = 2 * (cr.left() / GLfloat(screenSize.width())) - 1; + const GLfloat x2 = 2 * (cr.right() / GLfloat(screenSize.width())) - 1; + const GLfloat y1 = 1 - (cr.top() / GLfloat(screenSize.height())) * 2; + const GLfloat y2 = 1 - (cr.bottom() / GLfloat(screenSize.height())) * 2; + QRectF r(QPointF(x1, y1), QPointF(x2, y2)); + + draw(r); + + if (screen != m_activeScreen) { + m_activeScreen = screen; + // Do not want a leftover cursor on the screen the cursor just left. + update(cursorRect(), true); + } + + break; + } + } } // In order to prevent breaking code doing custom OpenGL rendering while @@ -437,30 +471,33 @@ void QEglFSCursor::draw(const QRectF &r) { StateSaver stateSaver; - if (!m_program) { + GraphicsContextData &gfx(m_gfx[QOpenGLContext::currentContext()]); + if (!gfx.program) { // one time initialization initializeOpenGLFunctions(); createShaderPrograms(); - if (!m_cursorAtlas.texture) { - createCursorTexture(&m_cursorAtlas.texture, m_cursorAtlas.image); + if (!gfx.atlasTexture) { + createCursorTexture(&gfx.atlasTexture, m_cursorAtlas.image); if (m_cursor.shape != Qt::BitmapCursor) - m_cursor.texture = m_cursorAtlas.texture; + m_cursor.useCustomCursor = false; } } - if (m_cursor.shape == Qt::BitmapCursor && m_cursor.customCursorPending) { + if (m_cursor.shape == Qt::BitmapCursor && (m_cursor.customCursorPending || m_cursor.customCursorKey != gfx.customCursorKey)) { // upload the custom cursor - createCursorTexture(&m_cursor.customCursorTexture, m_cursor.customCursorImage); - m_cursor.texture = m_cursor.customCursorTexture; + createCursorTexture(&gfx.customCursorTexture, m_cursor.customCursorImage); + m_cursor.useCustomCursor = true; m_cursor.customCursorPending = false; + gfx.customCursorKey = m_cursor.customCursorKey; } - Q_ASSERT(m_cursor.texture); + GLuint cursorTexture = !m_cursor.useCustomCursor ? gfx.atlasTexture : gfx.customCursorTexture; + Q_ASSERT(cursorTexture); - m_program->bind(); + gfx.program->bind(); const GLfloat x1 = r.left(); const GLfloat x2 = r.right(); @@ -485,20 +522,20 @@ void QEglFSCursor::draw(const QRectF &r) }; glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, m_cursor.texture); + glBindTexture(GL_TEXTURE_2D, cursorTexture); if (stateSaver.vaoHelper->isValid()) stateSaver.vaoHelper->glBindVertexArray(0); glBindBuffer(GL_ARRAY_BUFFER, 0); - m_program->enableAttributeArray(0); - m_program->enableAttributeArray(1); - m_program->setAttributeArray(0, cursorCoordinates, 2); - m_program->setAttributeArray(1, textureCoordinates, 2); + gfx.program->enableAttributeArray(0); + gfx.program->enableAttributeArray(1); + gfx.program->setAttributeArray(0, cursorCoordinates, 2); + gfx.program->setAttributeArray(1, textureCoordinates, 2); - m_program->setUniformValue(m_textureEntry, 0); - m_program->setUniformValue(m_matEntry, m_rotationMatrix); + gfx.program->setUniformValue(gfx.textureEntry, 0); + gfx.program->setUniformValue(gfx.matEntry, m_rotationMatrix); glDisable(GL_CULL_FACE); glFrontFace(GL_CCW); @@ -508,9 +545,9 @@ void QEglFSCursor::draw(const QRectF &r) glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - m_program->disableAttributeArray(0); - m_program->disableAttributeArray(1); - m_program->release(); + gfx.program->disableAttributeArray(0); + gfx.program->disableAttributeArray(1); + gfx.program->release(); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h index f72e4c0374f..8ccbe4493c9 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h @@ -105,30 +105,29 @@ private: bool setCurrentCursor(QCursor *cursor); #endif void draw(const QRectF &rect); - void update(const QRegion ®ion); + void update(const QRect &rect, bool allScreens); void createShaderPrograms(); void createCursorTexture(uint *texture, const QImage &image); void initCursorAtlas(); // current cursor information struct Cursor { - Cursor() : texture(0), shape(Qt::BlankCursor), customCursorTexture(0), customCursorPending(false) { } - uint texture; // a texture from 'image' or the atlas + Cursor() : shape(Qt::BlankCursor), customCursorPending(false), customCursorKey(0), useCustomCursor(false) { } Qt::CursorShape shape; QRectF textureRect; // normalized rect inside texture QSize size; // size of the cursor QPoint hotSpot; QImage customCursorImage; QPoint pos; // current cursor position - uint customCursorTexture; bool customCursorPending; + qint64 customCursorKey; + bool useCustomCursor; } m_cursor; // cursor atlas information struct CursorAtlas { - CursorAtlas() : cursorsPerRow(0), texture(0), cursorWidth(0), cursorHeight(0) { } + CursorAtlas() : cursorsPerRow(0), cursorWidth(0), cursorHeight(0) { } int cursorsPerRow; - uint texture; int width, height; // width and height of the atlas int cursorWidth, cursorHeight; // width and height of cursors inside the atlas QList hotSpots; @@ -137,12 +136,22 @@ private: bool m_visible; QEglFSScreen *m_screen; - QOpenGLShaderProgram *m_program; - int m_textureEntry; - int m_matEntry; + QPlatformScreen *m_activeScreen; QEglFSCursorDeviceListener *m_deviceListener; bool m_updateRequested; QMatrix4x4 m_rotationMatrix; + + struct GraphicsContextData { + GraphicsContextData() : program(nullptr), textureEntry(0), matEntry(0), + customCursorTexture(0), atlasTexture(0), customCursorKey(0) { } + QOpenGLShaderProgram *program; + int textureEntry; + int matEntry; + uint customCursorTexture; + uint atlasTexture; + qint64 customCursorKey; + }; + QHash m_gfx; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index 3848e99221f..6f659299138 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp @@ -41,6 +41,7 @@ #include "qeglfsintegration.h" #include "qeglfscursor_p.h" #include "qeglfswindow_p.h" +#include "qeglfsscreen_p.h" #include "qeglfshooks_p.h" #include @@ -311,7 +312,7 @@ bool QEglFSDeviceIntegration::hasCapability(QPlatformIntegration::Capability cap QPlatformCursor *QEglFSDeviceIntegration::createCursor(QPlatformScreen *screen) const { - return new QEglFSCursor(screen); + return new QEglFSCursor(static_cast(screen)); } void QEglFSDeviceIntegration::waitForVSync(QPlatformSurface *surface) const diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp index 743f714cf09..f45b947fa62 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp @@ -40,11 +40,15 @@ #include "qeglfskmsegldevice.h" #include "qeglfskmsegldevicescreen.h" #include "qeglfskmsegldeviceintegration.h" +#include "private/qeglfscursor_p.h" #include +QT_BEGIN_NAMESPACE + QEglFSKmsEglDevice::QEglFSKmsEglDevice(QEglFSKmsIntegration *integration, const QString &path) - : QEglFSKmsDevice(integration, path) + : QEglFSKmsDevice(integration, path), + m_globalCursor(nullptr) { } @@ -52,6 +56,8 @@ bool QEglFSKmsEglDevice::open() { Q_ASSERT(fd() == -1); + qCDebug(qLcEglfsKmsDebug, "Opening DRM device %s", qPrintable(devicePath())); + int fd = drmOpen(devicePath().toLocal8Bit().constData(), Q_NULLPTR); if (Q_UNLIKELY(fd < 0)) qFatal("Could not open DRM device"); @@ -63,6 +69,8 @@ bool QEglFSKmsEglDevice::open() void QEglFSKmsEglDevice::close() { + qCDebug(qLcEglfsKmsDebug, "Closing DRM device"); + if (qt_safe_close(fd()) == -1) qErrnoWarning("Could not close DRM device"); @@ -74,7 +82,26 @@ EGLNativeDisplayType QEglFSKmsEglDevice::nativeDisplay() const return static_cast(m_integration)->eglDevice(); } -QEglFSKmsScreen *QEglFSKmsEglDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position) +QEglFSKmsScreen *QEglFSKmsEglDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, + QEglFSKmsOutput output, QPoint position) { - return new QEglFSKmsEglDeviceScreen(integration, device, output, position); + QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(integration, device, output, position); + + if (!m_globalCursor && !integration->separateScreens()) { + qCDebug(qLcEglfsKmsDebug, "Creating new global mouse cursor"); + m_globalCursor = new QEglFSCursor(screen); + } + + return screen; } + +void QEglFSKmsEglDevice::destroyGlobalCursor() +{ + if (m_globalCursor) { + qCDebug(qLcEglfsKmsDebug, "Destroying global mouse cursor"); + delete m_globalCursor; + m_globalCursor = nullptr; + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h index b1c98f3fe6d..a27112fb4f0 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h @@ -42,6 +42,10 @@ #include +QT_BEGIN_NAMESPACE + +class QPlatformCursor; + class QEglFSKmsEglDevice: public QEglFSKmsDevice { public: @@ -56,6 +60,14 @@ public: QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position) Q_DECL_OVERRIDE; + + QPlatformCursor *globalCursor() { return m_globalCursor; } + void destroyGlobalCursor(); + +private: + QPlatformCursor *m_globalCursor; }; +QT_END_NAMESPACE + #endif // QEGLFSKMSEGLDEVICE_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index cbf7cfe7d0a..0120c0726df 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -41,6 +41,7 @@ #include "qeglfskmsegldeviceintegration.h" #include #include "private/qeglfswindow_p.h" +#include "private/qeglfscursor_p.h" #include "qeglfskmsegldevice.h" #include "qeglfskmsscreen.h" #include @@ -258,4 +259,9 @@ bool QEglFSKmsEglDeviceIntegration::query_egl_device() return true; } +QPlatformCursor *QEglFSKmsEglDeviceIntegration::createCursor(QPlatformScreen *screen) const +{ + return separateScreens() ? new QEglFSCursor(screen) : nullptr; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h index af6b3f81ced..375c388548c 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h @@ -65,6 +65,7 @@ public: protected: QEglFSKmsDevice *createDevice(const QString &devicePath) Q_DECL_OVERRIDE; + QPlatformCursor *createCursor(QPlatformScreen *screen) const Q_DECL_OVERRIDE; private: bool setup_kms(); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp index da1b5778012..b0deabe8344 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp @@ -39,12 +39,32 @@ #include "qeglfskmsegldevicescreen.h" #include "qeglfskmsegldevice.h" +#include + +QT_BEGIN_NAMESPACE QEglFSKmsEglDeviceScreen::QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position) : QEglFSKmsScreen(integration, device, output, position) { } +QEglFSKmsEglDeviceScreen::~QEglFSKmsEglDeviceScreen() +{ + const int remainingScreenCount = qGuiApp->screens().count(); + qCDebug(qLcEglfsKmsDebug, "Screen dtor. Remaining screens: %d", remainingScreenCount); + if (!remainingScreenCount && !m_integration->separateScreens()) + static_cast(device())->destroyGlobalCursor(); +} + +QPlatformCursor *QEglFSKmsEglDeviceScreen::cursor() const +{ + // The base class creates a cursor via integration->createCursor() + // in its ctor. With separateScreens just use that. Otherwise + // there's a virtual desktop and the device has a global cursor + // and the base class has no dedicated cursor at all. + return m_integration->separateScreens() ? QEglFSScreen::cursor() : static_cast(device())->globalCursor(); +} + void QEglFSKmsEglDeviceScreen::waitForFlip() { if (!output().mode_set) { @@ -76,3 +96,5 @@ void QEglFSKmsEglDeviceScreen::waitForFlip() } } + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h index 0cd46e9f9d8..7fceae49786 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h @@ -42,6 +42,8 @@ #include +QT_BEGIN_NAMESPACE + class QEglFSKmsEglDeviceScreen : public QEglFSKmsScreen { public: @@ -49,8 +51,13 @@ public: QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position); + ~QEglFSKmsEglDeviceScreen(); + + QPlatformCursor *cursor() const Q_DECL_OVERRIDE; void waitForFlip() Q_DECL_OVERRIDE; }; +QT_END_NAMESPACE + #endif // QEGLFSKMSEGLDEVICESCREEN_H From 7de7f981dceb86775bdcc1ebb2b39b58ddca6d71 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 8 Aug 2016 16:54:52 +0200 Subject: [PATCH 076/236] eglfs: Add physicalWidth and height overrides to KMS config Task-number: QTBUG-55188 Change-Id: I751b8c3c4b6f7a33b08ec23fd16cd025a5792ba6 Reviewed-by: Dominik Holland Reviewed-by: Andy Nichols --- .../eglfs_kms_support/qeglfskmsdevice.cpp | 28 +++++++++++++------ .../eglfs_kms_support/qeglfskmsdevice.h | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index 934f7802ac2..30cd2f32256 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -159,7 +159,7 @@ static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode) return true; } -QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos) +QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos) { const QByteArray connectorName = nameForConnector(connector); @@ -173,8 +173,11 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr QSize configurationSize; drmModeModeInfo configurationModeline; - const QByteArray mode = m_integration->outputSettings().value(QString::fromUtf8(connectorName)) - .value(QStringLiteral("mode"), QStringLiteral("preferred")).toByteArray().toLower(); + auto userConfig = m_integration->outputSettings(); + auto userConnectorConfig = userConfig.value(QString::fromUtf8(connectorName)); + // default to the preferred mode unless overridden in the config + const QByteArray mode = userConnectorConfig.value(QStringLiteral("mode"), QStringLiteral("preferred")) + .toByteArray().toLower(); if (mode == "off") { configuration = OutputConfigOff; } else if (mode == "preferred") { @@ -287,18 +290,25 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr qCDebug(qLcEglfsKmsDebug) << "Selected mode" << selected_mode << ":" << width << "x" << height << '@' << refresh << "hz for output" << connectorName; } + + // physical size from connector < config values < env vars static const int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_WIDTH"); static const int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_HEIGHT"); - QSizeF size(width, height); - if (size.isEmpty()) { - size.setWidth(connector->mmWidth); - size.setHeight(connector->mmHeight); + QSizeF physSize(width, height); + if (physSize.isEmpty()) { + physSize = QSize(userConnectorConfig.value(QStringLiteral("physicalWidth")).toInt(), + userConnectorConfig.value(QStringLiteral("physicalHeight")).toInt()); + if (physSize.isEmpty()) { + physSize.setWidth(connector->mmWidth); + physSize.setHeight(connector->mmHeight); + } } + QEglFSKmsOutput output = { QString::fromUtf8(connectorName), connector->connector_id, crtc_id, - size, + physSize, selected_mode, false, drmModeGetCrtc(m_dri_fd, crtc_id), @@ -360,7 +370,7 @@ void QEglFSKmsDevice::createScreens() if (!connector) continue; - QEglFSKmsScreen *screen = screenForConnector(resources, connector, pos); + QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, pos); if (screen) { integration->addScreen(screen); pos.rx() += screen->geometry().width(); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h index 041c063695c..65619497800 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h @@ -80,7 +80,7 @@ protected: quint32 m_connector_allocator; int crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr connector); - QEglFSKmsScreen *screenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos); + QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos); drmModePropertyPtr connectorProperty(drmModeConnectorPtr connector, const QByteArray &name); static void pageFlipHandler(int fd, From 9ab5c329bfe17122441000f0c8cdd1f32f09072b Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 9 Aug 2016 09:16:38 +0200 Subject: [PATCH 077/236] eglfs: Add basic support for controlling how the virtual desktop is formed Choose between horizontal (default) and vertical. Task-number: QTBUG-55188 Change-Id: Ibc490b0ad8c60b66db785455c57987eb8afdad0d Reviewed-by: Dominik Holland Reviewed-by: Andy Nichols --- .../eglfs_kms_support/qeglfskmsdevice.cpp | 7 +++++- .../qeglfskmsintegration.cpp | 25 ++++++++++++++++--- .../eglfs_kms_support/qeglfskmsintegration.h | 7 ++++++ 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index 30cd2f32256..74c7667f1f8 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -373,7 +373,12 @@ void QEglFSKmsDevice::createScreens() QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, pos); if (screen) { integration->addScreen(screen); - pos.rx() += screen->geometry().width(); + + if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical) + pos.ry() += screen->geometry().height(); + else + pos.rx() += screen->geometry().width(); + siblings << screen; if (!primaryScreen) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp index 7389050efc2..0f64d5b28e2 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp @@ -65,6 +65,7 @@ QEglFSKmsIntegration::QEglFSKmsIntegration() , m_hwCursor(false) , m_pbuffers(false) , m_separateScreens(false) + , m_virtualDesktopLayout(VirtualDesktopLayoutHorizontal) {} void QEglFSKmsIntegration::platformInit() @@ -149,6 +150,11 @@ bool QEglFSKmsIntegration::separateScreens() const return m_separateScreens; } +QEglFSKmsIntegration::VirtualDesktopLayout QEglFSKmsIntegration::virtualDesktopLayout() const +{ + return m_virtualDesktopLayout; +} + QMap QEglFSKmsIntegration::outputSettings() const { return m_outputSettings; @@ -169,15 +175,15 @@ void QEglFSKmsIntegration::loadConfig() QFile file(QString::fromUtf8(json)); if (!file.open(QFile::ReadOnly)) { - qCDebug(qLcEglfsKmsDebug) << "Could not open config file" - << json << "for reading"; + qCWarning(qLcEglfsKmsDebug) << "Could not open config file" + << json << "for reading"; return; } const QJsonDocument doc = QJsonDocument::fromJson(file.readAll()); if (!doc.isObject()) { - qCDebug(qLcEglfsKmsDebug) << "Invalid config file" << json - << "- no top-level JSON object"; + qCWarning(qLcEglfsKmsDebug) << "Invalid config file" << json + << "- no top-level JSON object"; return; } @@ -188,6 +194,16 @@ void QEglFSKmsIntegration::loadConfig() m_devicePath = object.value(QLatin1String("device")).toString(); m_separateScreens = object.value(QLatin1String("separateScreens")).toBool(m_separateScreens); + const QString vdOriString = object.value(QLatin1String("virtualDesktopLayout")).toString(); + if (!vdOriString.isEmpty()) { + if (vdOriString == QLatin1String("horizontal")) + m_virtualDesktopLayout = VirtualDesktopLayoutHorizontal; + else if (vdOriString == QLatin1String("vertical")) + m_virtualDesktopLayout = VirtualDesktopLayoutVertical; + else + qCWarning(qLcEglfsKmsDebug) << "Unknown virtualDesktop value" << vdOriString; + } + const QJsonArray outputs = object.value(QLatin1String("outputs")).toArray(); for (int i = 0; i < outputs.size(); i++) { const QVariantMap outputSettings = outputs.at(i).toObject().toVariantMap(); @@ -207,6 +223,7 @@ void QEglFSKmsIntegration::loadConfig() << "\thwcursor:" << m_hwCursor << "\n" << "\tpbuffers:" << m_pbuffers << "\n" << "\tseparateScreens:" << m_separateScreens << "\n" + << "\tvirtualDesktopLayout:" << m_virtualDesktopLayout << "\n" << "\toutputs:" << m_outputSettings; } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h index 81386881ffb..ba499457156 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h @@ -56,6 +56,11 @@ Q_EGLFS_EXPORT Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug) class Q_EGLFS_EXPORT QEglFSKmsIntegration : public QEglFSDeviceIntegration { public: + enum VirtualDesktopLayout { + VirtualDesktopLayoutHorizontal, + VirtualDesktopLayoutVertical + }; + QEglFSKmsIntegration(); void platformInit() Q_DECL_OVERRIDE; @@ -70,6 +75,7 @@ public: virtual bool hwCursor() const; virtual bool separateScreens() const; + virtual VirtualDesktopLayout virtualDesktopLayout() const; QMap outputSettings() const; QEglFSKmsDevice *device() const; @@ -83,6 +89,7 @@ protected: bool m_hwCursor; bool m_pbuffers; bool m_separateScreens; + VirtualDesktopLayout m_virtualDesktopLayout; QString m_devicePath; QMap m_outputSettings; }; From e9fe0a15a8ede45020def7059ed4f49a5c20186d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 9 Aug 2016 11:53:01 +0200 Subject: [PATCH 078/236] eglfs: Fix rotation support with the DRM backends The change in QEglFSScreen::geometry() was not reflected in the advanced backends that subclass it. Change-Id: I6494a96f0b9afaea3722c61035d4b46bf2473897 Reviewed-by: Andy Nichols --- src/plugins/platforms/eglfs/api/qeglfsscreen.cpp | 4 ++-- src/plugins/platforms/eglfs/api/qeglfsscreen_p.h | 2 +- src/plugins/platforms/eglfs/api/qeglfswindow.cpp | 4 ++-- .../eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp | 4 ++-- .../eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp | 4 ++-- .../deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp | 4 +++- .../deviceintegration/eglfs_kms_support/qeglfskmsscreen.h | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp index 47ef2f64e74..b0c32e51768 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp @@ -65,7 +65,7 @@ QEglFSScreen::~QEglFSScreen() QRect QEglFSScreen::geometry() const { - QRect r = geometryForSurface(); + QRect r = rawGeometry(); static int rotation = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION"); switch (rotation) { @@ -88,7 +88,7 @@ QRect QEglFSScreen::geometry() const return r; } -QRect QEglFSScreen::geometryForSurface() const +QRect QEglFSScreen::rawGeometry() const { return QRect(QPoint(0, 0), qt_egl_device_integration()->screenSize()); } diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h index 232525fae33..daba9fc5917 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h @@ -68,7 +68,7 @@ public: ~QEglFSScreen(); QRect geometry() const Q_DECL_OVERRIDE; - QRect geometryForSurface() const; + virtual QRect rawGeometry() const; int depth() const Q_DECL_OVERRIDE; QImage::Format format() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index 74723955c6d..5ce88e6bd89 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -142,7 +142,7 @@ void QEglFSWindow::create() context->setScreen(window()->screen()); if (Q_UNLIKELY(!context->create())) qFatal("EGLFS: Failed to create compositing context"); - compositor->setTarget(context, window(), screen->geometryForSurface()); + compositor->setTarget(context, window(), screen->rawGeometry()); compositor->setRotation(qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION")); // If there is a "root" window into which raster and QOpenGLWidget content is // composited, all other contexts must share with its context. @@ -190,7 +190,7 @@ void QEglFSWindow::resetSurface() m_config = QEglFSDeviceIntegration::chooseConfig(display, platformFormat); m_format = q_glFormatFromConfig(display, m_config, platformFormat); - const QSize surfaceSize = screen()->geometryForSurface().size(); + const QSize surfaceSize = screen()->rawGeometry().size(); m_window = qt_egl_device_integration()->createNativeWindow(this, surfaceSize, m_format); m_surface = eglCreateWindowSurface(display, m_config, m_window, NULL); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp index 7a17b60a5e7..9ffffd74718 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp @@ -130,8 +130,8 @@ gbm_surface *QEglFSKmsGbmScreen::createSurface() if (!m_gbm_surface) { qCDebug(qLcEglfsKmsDebug) << "Creating window for screen" << name(); m_gbm_surface = gbm_surface_create(static_cast(device())->gbmDevice(), - geometry().width(), - geometry().height(), + rawGeometry().width(), + rawGeometry().height(), GBM_FORMAT_XRGB8888, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index 0120c0726df..ddb24997516 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -194,8 +194,8 @@ void QEglJetsonTK1Window::resetSurface() m_format = q_glFormatFromConfig(display, m_config); qCDebug(qLcEglfsKmsDebug) << "Stream producer format is" << m_format; - const int w = cur_screen->geometry().width(); - const int h = cur_screen->geometry().height(); + const int w = cur_screen->rawGeometry().width(); + const int h = cur_screen->rawGeometry().height(); qCDebug(qLcEglfsKmsDebug, "Creating stream producer surface of size %dx%d", w, h); const EGLint stream_producer_attribs[] = { diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp index fb8233a8758..55417e4525f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp @@ -98,7 +98,9 @@ QEglFSKmsScreen::~QEglFSKmsScreen() delete m_interruptHandler; } -QRect QEglFSKmsScreen::geometry() const +// Reimplement rawGeometry(), not geometry(). The base class implementation of +// geometry() calls rawGeometry() and may apply additional transforms. +QRect QEglFSKmsScreen::rawGeometry() const { const int mode = m_output.mode; QRect r(m_pos.x(), m_pos.y(), diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h index 9679f702604..7b424b53825 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h @@ -78,7 +78,7 @@ public: QPoint position); ~QEglFSKmsScreen(); - QRect geometry() const Q_DECL_OVERRIDE; + QRect rawGeometry() const Q_DECL_OVERRIDE; int depth() const Q_DECL_OVERRIDE; QImage::Format format() const Q_DECL_OVERRIDE; From 9981f521d96b0369b72ff56bae96175db4148ded Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 9 Aug 2016 12:28:30 +0200 Subject: [PATCH 079/236] libinput: Fix high dpi scaling support Bring it onto the level of evdevtouch. Task-number: QTBUG-55182 Change-Id: Iaba58234fa6289870d60f0fcc351d4b97655f3e2 Reviewed-by: Andy Nichols --- src/platformsupport/input/libinput/qlibinputtouch.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/platformsupport/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp index 0a0e9daccb8..1e82ce5c91d 100644 --- a/src/platformsupport/input/libinput/qlibinputtouch.cpp +++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp @@ -41,6 +41,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -63,7 +64,8 @@ QLibInputTouch::DeviceState *QLibInputTouch::deviceState(libinput_event_touch *e static inline QPointF getPos(libinput_event_touch *e) { - const QSize screenSize = QGuiApplication::primaryScreen()->geometry().size(); + QScreen *screen = QGuiApplication::primaryScreen(); + const QSize screenSize = QHighDpi::toNativePixels(screen->geometry().size(), screen); const double x = libinput_event_touch_get_x_transformed(e, screenSize.width()); const double y = libinput_event_touch_get_y_transformed(e, screenSize.height()); return QPointF(x, y); From 5699530758f05e6f2cd9debc29ff30d318f4db34 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 5 Aug 2016 11:36:02 +0200 Subject: [PATCH 080/236] Add a benchmark for QReadWriteLock Results on current dev branch [955b2bdfc0cb1d707f8914be230e5e00c548b6ab]: thread count: 4 ********* Start testing of tst_QReadWriteLock ********* Config: Using QtTest library 5.8.0, Qt 5.8.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 6.1.1 20160707) PASS : tst_QReadWriteLock::initTestCase() PASS : tst_QReadWriteLock::uncontended(nothing) RESULT : tst_QReadWriteLock::uncontended():"nothing": 1,113,292.1 CPU ticks per iteration (total: 11,132,922, iterations: 10) PASS : tst_QReadWriteLock::uncontended(QMutex) RESULT : tst_QReadWriteLock::uncontended():"QMutex": 35,490,310.7 CPU ticks per iteration (total: 354,903,108, iterations: 10) PASS : tst_QReadWriteLock::uncontended(QReadWriteLock, read) RESULT : tst_QReadWriteLock::uncontended():"QReadWriteLock, read": 40,513,695.0 CPU ticks per iteration (total: 405,136,950, iterations: 10) PASS : tst_QReadWriteLock::uncontended(QReadWriteLock, write) RESULT : tst_QReadWriteLock::uncontended():"QReadWriteLock, write": 43,179,327.2 CPU ticks per iteration (total: 431,793,272, iterations: 10) PASS : tst_QReadWriteLock::uncontended(std::mutex) RESULT : tst_QReadWriteLock::uncontended():"std::mutex": 37,733,243.0 CPU ticks per iteration (total: 377,332,430, iterations: 10) PASS : tst_QReadWriteLock::uncontended(std::shared_timed_mutex, read) RESULT : tst_QReadWriteLock::uncontended():"std::shared_timed_mutex, read": 71,517,438.7 CPU ticks per iteration (total: 715,174,388, iterations: 10) PASS : tst_QReadWriteLock::uncontended(std::shared_timed_mutex, write) RESULT : tst_QReadWriteLock::uncontended():"std::shared_timed_mutex, write": 69,967,867.5 CPU ticks per iteration (total: 699,678,676, iterations: 10) PASS : tst_QReadWriteLock::readOnly(nothing) RESULT : tst_QReadWriteLock::readOnly():"nothing": 479,393,335.3 CPU ticks per iteration (total: 4,793,933,354, iterations: 10) PASS : tst_QReadWriteLock::readOnly(QMutex) RESULT : tst_QReadWriteLock::readOnly():"QMutex": 823,493,383.2 CPU ticks per iteration (total: 8,234,933,832, iterations: 10) PASS : tst_QReadWriteLock::readOnly(QReadWriteLock) RESULT : tst_QReadWriteLock::readOnly():"QReadWriteLock": 559,816,053.6 CPU ticks per iteration (total: 5,598,160,536, iterations: 10) PASS : tst_QReadWriteLock::readOnly(std::mutex) RESULT : tst_QReadWriteLock::readOnly():"std::mutex": 961,903,416.3 CPU ticks per iteration (total: 9,619,034,164, iterations: 10) PASS : tst_QReadWriteLock::readOnly(std::shared_timed_mutex) RESULT : tst_QReadWriteLock::readOnly():"std::shared_timed_mutex": 1,786,254,363.5 CPU ticks per iteration (total: 17,862,543,636, iterations: 10) PASS : tst_QReadWriteLock::cleanupTestCase() Totals: 14 passed, 0 failed, 0 skipped, 0 blacklisted, 44507ms ********* Finished testing of tst_QReadWriteLock ********* Change-Id: I42189f7a356dcb36378e9d54111b7fbe89e62402 Reviewed-by: Thiago Macieira --- .../thread/qreadwritelock/qreadwritelock.pro | 6 + .../qreadwritelock/tst_qreadwritelock.cpp | 183 ++++++++++++++++++ tests/benchmarks/corelib/thread/thread.pro | 1 + 3 files changed, 190 insertions(+) create mode 100644 tests/benchmarks/corelib/thread/qreadwritelock/qreadwritelock.pro create mode 100644 tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp diff --git a/tests/benchmarks/corelib/thread/qreadwritelock/qreadwritelock.pro b/tests/benchmarks/corelib/thread/qreadwritelock/qreadwritelock.pro new file mode 100644 index 00000000000..86102adecdc --- /dev/null +++ b/tests/benchmarks/corelib/thread/qreadwritelock/qreadwritelock.pro @@ -0,0 +1,6 @@ +TEMPLATE = app +TARGET = tst_bench_qreadwritelock +QT = core testlib +SOURCES += tst_qreadwritelock.cpp +CONFIG += c++14 # for std::shared_timed_mutex + diff --git a/tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp b/tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp new file mode 100644 index 00000000000..bdec6c3a0a6 --- /dev/null +++ b/tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp @@ -0,0 +1,183 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Olivier Goffart +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#if QT_HAS_INCLUDE() +#if __cplusplus > 201103L +#include +#endif +#endif + +// Wrapers that take pointers instead of reference to have the same interface as Qt +template +struct LockerWrapper : T +{ + LockerWrapper(typename T::mutex_type *mtx) + : T(*mtx) + { + } +}; + +int threadCount; + +class tst_QReadWriteLock : public QObject +{ + Q_OBJECT +public: + tst_QReadWriteLock() + { + // at least 2 threads, even on single cpu/core machines + threadCount = qMax(2, QThread::idealThreadCount()); + qDebug("thread count: %d", threadCount); + } + +private slots: + void uncontended_data(); + void uncontended(); + void readOnly_data(); + void readOnly(); + // void readWrite(); +}; + +struct FunctionPtrHolder +{ + FunctionPtrHolder(QFunctionPointer value = nullptr) + : value(value) + { + } + QFunctionPointer value; +}; +Q_DECLARE_METATYPE(FunctionPtrHolder) + +struct FakeLock +{ + FakeLock(volatile int *i) { *i = 0; } +}; + +enum { Iterations = 1000000 }; + +template +void testUncontended() +{ + Mutex lock; + QBENCHMARK { + for (int i = 0; i < Iterations; ++i) { + Locker locker(&lock); + } + } +} + +void tst_QReadWriteLock::uncontended_data() +{ + QTest::addColumn("holder"); + + QTest::newRow("nothing") << FunctionPtrHolder(testUncontended); + QTest::newRow("QMutex") << FunctionPtrHolder(testUncontended); + QTest::newRow("QReadWriteLock, read") + << FunctionPtrHolder(testUncontended); + QTest::newRow("QReadWriteLock, write") + << FunctionPtrHolder(testUncontended); + QTest::newRow("std::mutex") << FunctionPtrHolder( + testUncontended>>); +#if defined __cpp_lib_shared_timed_mutex + QTest::newRow("std::shared_timed_mutex, read") << FunctionPtrHolder( + testUncontended>>); + QTest::newRow("std::shared_timed_mutex, write") << FunctionPtrHolder( + testUncontended>>); +#endif +} + +void tst_QReadWriteLock::uncontended() +{ + QFETCH(FunctionPtrHolder, holder); + holder.value(); +} + +static QHash global_hash; + +template +void testReadOnly() +{ + struct Thread : QThread + { + Mutex *lock; + void run() + { + for (int i = 0; i < Iterations; ++i) { + QString s = QString::number(i); // Do something outside the lock + Locker locker(lock); + global_hash.contains(s); + } + } + }; + Mutex lock; + QVector threads; + for (int i = 0; i < threadCount; ++i) { + auto t = new Thread; + t->lock = &lock; + threads.append(t); + } + QBENCHMARK { + for (auto t : threads) { + t->start(); + } + for (auto t : threads) { + t->wait(); + } + } + qDeleteAll(threads); +} + +void tst_QReadWriteLock::readOnly_data() +{ + QTest::addColumn("holder"); + + QTest::newRow("nothing") << FunctionPtrHolder(testReadOnly); + QTest::newRow("QMutex") << FunctionPtrHolder(testReadOnly); + QTest::newRow("QReadWriteLock") << FunctionPtrHolder(testReadOnly); + QTest::newRow("std::mutex") << FunctionPtrHolder( + testReadOnly>>); +#if defined __cpp_lib_shared_timed_mutex + QTest::newRow("std::shared_timed_mutex") << FunctionPtrHolder( + testReadOnly>>); +#endif +} + +void tst_QReadWriteLock::readOnly() +{ + QFETCH(FunctionPtrHolder, holder); + holder.value(); +} + +QTEST_MAIN(tst_QReadWriteLock) +#include "tst_qreadwritelock.moc" diff --git a/tests/benchmarks/corelib/thread/thread.pro b/tests/benchmarks/corelib/thread/thread.pro index 4e602ceb4e4..6b3009bd0cf 100644 --- a/tests/benchmarks/corelib/thread/thread.pro +++ b/tests/benchmarks/corelib/thread/thread.pro @@ -1,6 +1,7 @@ TEMPLATE = subdirs SUBDIRS = \ qmutex \ + qreadwritelock \ qthreadstorage \ qthreadpool \ qwaitcondition \ From c6cfa2270b6d25921373f959b318d89f7098f710 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 9 Aug 2016 13:33:14 +0200 Subject: [PATCH 081/236] evdevtouch: Avoid crashing on exit 26238aca8c442736f380eb523ef48468f892bdb7 causes double deletion of the QTouchDevice in case the post routine already cleaned up the list by the time the touch handler gets to do it. Just check the list of devices to see if the one we hold is still there. If not, the pointer is likely to be a dangling one so do nothing. This will avoid dying with bus error or similar on application exit. Task-number: QTBUG-51562 Change-Id: I50c1edee7405aad308274538219698388c2cc9f9 Reviewed-by: Shawn Rutledge --- src/gui/kernel/qwindowsysteminterface.cpp | 5 +++++ src/gui/kernel/qwindowsysteminterface.h | 1 + .../input/evdevtouch/qevdevtouchhandler.cpp | 8 ++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index cae976098cc..f1c43110e34 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -442,6 +442,11 @@ void QWindowSystemInterface::unregisterTouchDevice(const QTouchDevice *device) QTouchDevicePrivate::unregisterDevice(device); } +bool QWindowSystemInterface::isTouchDeviceRegistered(const QTouchDevice *device) +{ + return QTouchDevicePrivate::isRegistered(device); +} + void QWindowSystemInterface::handleTouchEvent(QWindow *w, QTouchDevice *device, const QList &points, Qt::KeyboardModifiers mods) { diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 69c850ad3e9..b4f6020fe29 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -123,6 +123,7 @@ public: static void registerTouchDevice(const QTouchDevice *device); static void unregisterTouchDevice(const QTouchDevice *device); + static bool isTouchDeviceRegistered(const QTouchDevice *device); static void handleTouchEvent(QWindow *w, QTouchDevice *device, const QList &points, Qt::KeyboardModifiers mods = Qt::NoModifier); static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device, diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index 7cb4813c7b5..f863629ff90 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -393,9 +393,13 @@ void QEvdevTouchScreenHandler::unregisterTouchDevice() if (!m_device) return; - QWindowSystemInterface::unregisterTouchDevice(m_device); + // At app exit the cleanup may have already been done, avoid + // double delete by checking the list first. + if (QWindowSystemInterface::isTouchDeviceRegistered(m_device)) { + QWindowSystemInterface::unregisterTouchDevice(m_device); + delete m_device; + } - delete m_device; m_device = Q_NULLPTR; } From 91be1f1b04a527ea363de1dc09ffaf7b8fc46d81 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Wed, 6 Jul 2016 09:39:27 +0200 Subject: [PATCH 082/236] win: Disable warning about deprecated ATL modules This warning has been introduced by VS2015 Update 3 and is not in our control as the warning happens inside the system headers. To keep the compile output clean, disable this warning. Change-Id: I96253538c6d6774bb91cd5a4ea80dda2910e74b5 Reviewed-by: Joerg Bornemann Reviewed-by: Thiago Macieira --- mkspecs/common/msvc-base.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/common/msvc-base.conf b/mkspecs/common/msvc-base.conf index 5bd144faa0f..37f38560e81 100644 --- a/mkspecs/common/msvc-base.conf +++ b/mkspecs/common/msvc-base.conf @@ -52,5 +52,5 @@ greaterThan(MSC_VER, 1899) { QMAKE_CFLAGS_WARN_ON += -w44456 -w44457 -w44458 QMAKE_CFLAGS_AVX2 = -arch:AVX2 QMAKE_CXXFLAGS += -Zc:strictStrings -Zc:throwingNew - QMAKE_CXXFLAGS_WARN_ON += -w44456 -w44457 -w44458 -wd4577 + QMAKE_CXXFLAGS_WARN_ON += -w44456 -w44457 -w44458 -wd4577 -wd4467 } From 885720aa1ba25f996e5afd83a46794294dc563f4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 5 Aug 2016 14:34:12 +0200 Subject: [PATCH 083/236] Update logo icons in icons example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-55137 Change-Id: I51a16a40112f5f5bbea00540178999382752a6f2 Reviewed-by: Topi Reiniö --- .../widgets/widgets/icons/images/designer.png | Bin 4205 -> 3604 bytes .../icons/images/qt_extended_16x16.png | Bin 524 -> 1263 bytes .../icons/images/qt_extended_32x32.png | Bin 892 -> 15518 bytes .../icons/images/qt_extended_48x48.png | Bin 1294 -> 789 bytes 4 files changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/widgets/widgets/icons/images/designer.png b/examples/widgets/widgets/icons/images/designer.png index 0988fcee3f28eacfbd0cb0722b34093e8eace9a8..9f8578b49e66006f6eea2b36d0bdfaa75d76bce1 100644 GIT binary patch literal 3604 zcma)kmm~ zS2JUYvVAQvn0WfX{J(mh7x(=+=RViD&V9YS((G)_pv(fyAP@*@VSe5IFERf&jF7*Z zVBkIa_r73p{hCAc{8o{Fh|mDfP!OJ-^Sy&qu7ebiU{}SQxJ()jMr;ImrN>_LarHex!`L zNm|Xj6artBxPx)IS8pIoOKm@8kC^Wg6VUy~cDN1AQYhdd4!$=ILPnzL%C}YREKLYk zqOmBOuSd-|84k|V&y@okTjx?>S^l<-e7y4yb#@lSA^}UL?%((}^K4W+W?bEv_>3ke z-E~w1(~y!bn%9J?#deD7*tS#9*yGMi-675cVQQFHtU$;(WZFM`IB~x*UWb-~ z2bgNB;vvHCJ)rT^Fj+jh{g5fT-v8>`-+sNAQH^q@7biWE;P)e-4(a2gxQse?jBqgQ zw&#R5K+#*=(Cw~Iz4G`DhEIU>=2s*sFToM^oi55*PiQyteCn|NQveXruAR$T3IU@( z@6+?XDC)kLH>D^1`-3_ptYc;{O>#5(1Z!$@kf?_L8lMThU(gvA9bYXB*ZcnhYXuT z3e3Q-HA+^UgbX??a|wll_!;Z<>NoRH{DIF!K^LmwKIC3gYnZ}zT5?@_?oHKO1SOe> zSi^CM%a}B-;1@N&{?4w1jUfKVhj4`puuV5>jmP!ta8{mNGNj!&psx)n2s#+W0dE(b$ z_o_B1-Dy2AXlEjz+xs#UTlV0l*Z01ARhVEOwuqw$BOBDAwKM>ESz0upS*-<%`{V)# z!=+ztFXiRVmsAOWYv0>ou1(XJ{$>WADxzeJR1(lu_&)7vn4PGTL`F%~G>EM!R0%#y zl|wWZnDpPgjqH?X#Wr2O#`nh>-|(85D3bh9K-S8dX^3u#J5VMg(9s|CIx%;YR8)gD zwmvRKg1u5^H$B6)FUe;o6Wv)HrTp#e-5Bqh*{|AQcd!%lFc<)HfZ>er{*VWWunvyK>5{QQZM%GjYM zGmvtD5g6bTY`0KJ=(VHI?QHP}ROML?4NV7CW%UZUX<;$5TM<(y$X$ht`85wz%`f}0 z5f?0TLIp=TTT%BHoo#d;(&cD@E+oj1;|=J0_?F$ZuSHtCkfc^8x&wCyL(M0K@4(bc z*X`^l zV?pVvAV=9gRvrxb3AM{TFP5Zc>sFCkvjqOM<%}<>*;G8{y%phRSfG|k7`WH)R3BZe z;!aIa$+nI5<1X#!JAP;lkOeNAsOQZ*p))=4Ei;gm)d zd`%s4^qm7aO=NOhqn>Qg@w^9DGx)2$$b2mD+3CXgQ)LEHeqod;Ju&X!wiqPQ8UyHO zhH}KoXPCTNbjQXSCNj*NPO%2WQZ*`PQRg{BbE_!MA4hOnoc#DbK*Hm1n zXY1#Q+aanQl@^oI-txpxh{OoVZ|OE@2vJ6TxnMy#%rqg%d$4PvS)?6>bm(g$+6QsTu~6~LMmC()nW&bl!sJse0?)VIJ;X1__&qn0B-VTG*`?vWAH_0oYWUhr- zR_WrPBtXGt!Vw|`vbxuWLs zwm3&zoqzLf;ObuR9Yik|kbSE575Z0J;BsgFYOExFn(aa4R@OQRl9WZ-?e}tDQr_{&a!RZtM2?=sJE7u{?4any|t-21?iHT?uNfV?E{4nQjnv<5fk=tc@V` z_syn_py3mjouvNC4XK?km24Kuicg?;?Yi7#qA2*Bjv?->gpZn5>qT8+8pqF+(fID4 zu#;yBre&GqzY?`|z4XeID7@)3-}ebah@MxyLzMBJ%W4!Qzu*h_^TmR<`V`(o8bIfz z1*L`pH(-m?`fDgjooHc(eTQPc3^R)0{wWI%L975V@UuBrT40y&%6MOvA2>B8O}Ihu zRWz`n{5)>0`8?d$f`F9&M*(Xn_2HY%O<;KnRB$J~E25F$cWG7>inE0nRL&t4I~ndP zMsc|E+;`VtgLyzjg(b9gKC#AXF5rDT#qU!xYhRL=`)|78v&>Ytc~9Zfd;Ed6#(pEJ z>owmlwDu~LC-2Bp0(q`ZL|V^Y?Q0daQ>s}2Sph%W5GVH;J)d~^(wc4Elc$g%vVzIUFBZ{R5Fep);hi9e>=#x{EjyKeL_(I$JHn{0j~ku~ii9Qiu@#iA z99nP<vjOyDi`0z%!(3;-yT3$YVFVRr521>!1 zdIg`hS2jx;PlJqxu-Qb=x;=;UGAuh9v8Fh#{-5yeY_W6E-3gWDJM4qQ0zN5 zRVG~YV@9Ge@PYnZ;6ZZn&~g}s_3jWs3*(iTs7=r15(#e{2N_g~oH18B2Jsu}z`lQW zdUy_iwRt(v<=C@3C*r}I;HmU3`I%e!?h$FjAa z-JHKBEDK8;de}D!e}boP8GhoYx+2ge0rp*xS;g0E1^En7i!p8N8;RClvicX^wT6Yv znRZ`G>*rB)`nXYyejyHoPMYa>++7|_!qBK_A<;sp!r!C^wz~Egvs`ic14h-|6cr3W zPcKzbK?Bq{)g}83so}{Xl!X{?qOP#gi9&TFMI9r|fy4ebF`uPMuB;XfB1znyK>63k z3?wCraapVDl7N6fVqpx`GFM5l{_U-FBp7`Og(}4Pw50~foRK}ZOX`0gJD&%a-|7IY k0ft|*|F1}OemaP^IIiS0ELU{<+x9>fCbrk>jl2^713@0>)&Kwi literal 4205 zcmV-z5R&hSP)|4BqaRCwC# zU2Sj_^%;Nm?h+umyqJr|Kmtk71T}2}+G(OA1Q4kcgUNKXwlf_f#c|pXg6R0cRzceF zQ-#VnGE>oD$0|~%h?r>|iX>DCbt(h|M?l~rl#q~w%gZH~d)w}_ce~lU+q?Vk=Js-X z`~S@>xyx;m<9@&A_5a4OEDIFIg^7LyQ~(qPhK2OT%*K*hzu8pFFie@>=gVUmrWU_n zkZ*xScVv|n6l9ha7iY@-sGSAYZf4A#;0HTC-`U*NK|lJ`023<*U|P!aEq?z-j_|d> z5ifl$C&vs+mgK{AP}zHtu15_-mDwSx{G(3z?akL=avW32`suyRG?zgVL2G0hk{y+0I$~M!6qA@|P~npNaSC;Dpglg`u$kIP%*#@>^4k zd_}?th7&ubSD^qbYv#9d&)ei~wAnJCrR8Q_{pUDgU`~N~Mh}-~bWmZ$5CE6(m6^QW z6LK*h(b!lBQL=p9feJ%L0I^(uaq%op05&6h9(?#PF{YD#zrP!k(LXnT*`4+Rz;chX z{u|M5TD7VG7A%-;WKWs4!r%p9UbA2$u>S4QZd$*7E)AA(grV171}^|pQ|UeipxNN= zKjFO$Jv6xj9-yi8MzrLwx;h)`>hdV12^PlAHC>3bB;iD1vVczlT7r&-upc0_l7syA_+cvza8TkTA^D1G} zeQ)qyfdoTCo{;Cueo#;Q0Exiq(@rtwBQV*Em*FQ;1Q-%X%TNJ)*_pu5WLN>9>py;c zG{mYfwyN?XUw84>$%|(c{apS0Mm{9O7r><9tY7mS;MlPdUIYR#<5vnyzFt4F8TK6P zgmdS{MGJlUk@c`)&98`l$J)g&^07NwJ}@@s6H8JdM==UC^8omv3WNz+wNkf=8TTJL zehF76Px330mMsfRT(b9HflY62fpve{L|h%LT=;m*1W*cWL{R}u6H@XKq}D0`t##*@ z&xcqou0$3@fOzN7-{7^6-y-^b*dvIR5K7%YCa2T`BmmgvmAX`=A1ZeCCZOjVlrq1DIg=Hb2s0+9S2gkE4}#pAMxsx$=D z8p!%J6M)qE5lUOV@dkHrjUp~q6+^+l_7eSGY!2m{DtL<*E|>^i@Vd-E@n5qlV7fK+ z*}<>k-h)fk1k1&w5X(c7Ff*5Z0RGti`INWX(+RDM&k%=zIT=>IOPDTg;e-ny+@-1+ z=(#d{KJGn%JYdR8beuj$B!KV?ACo>MaUYvY&)&CFwqiMSaSwET-)`&>AhmwAH8qK4 zg)dbnZ4e2QOcD(gMq!rz)=(x~0O2)tZTX!ECtm<=R3!kz04Zt=mgwoq17K_=h1EJ0 z!LUtCiUxy~dPx<4wDqf|rdHwsY&LZ%%mRZ9^vrk&P!nr$0tP9<7p{`#0cBJG+Ef8j z>z|3H3Q0#$@J!fD!tn}oQzef{RRA?tGg|KRfV(0n786MA*o9aI2=gWhTX z4kaNVycARd6aeNcIA(zfBwi!}nlSajJKsGG!$UssctW?>%gQ!Emepij0Yqfm3M&A_ zbY}IEdH|tp>+L_s{jfrfT?<$ z%dEA8+CBiHs_<^gzSaWJy56Q6SkVwbK?OiT1wfIS0#MSJp_n!rxT`j$1fX;k4}~h= z9?!Vd?_uu3^ByiK5rVEmK=|APB}kKvBwD#^AB1l8TNV^UZPEpxr?M;!CUheC{P8~i zkx_6SJOa+cNBPG=K@f=`p^QnVYEvYKd>=>n=+XazXL1rePAC7^r$7Xnnyiv}dKAjZ z_YRN1@aO*lFGs%5=i@JY%ztlqgh&LM3ZO@Y0C1RAEtD+k(CIdFA>NKia=8j(4kSkQYJ11t2X2)ii>Xgn;lFNTh2JbkqZo zC0~GL(QUvK#TS8lViK+#?BGP;h!8=-1rVMGD6Ir=1utNara zS;5D>7VC0zo}lN`!{8bcMX+7-5TM2jC=r0#MJPIG0uhmq-@D%556+?jaOGri*6xdW zO-{I=hYJTmG$cg;ohlMRTz*aF0n{x*NpS&)FO zyAmz{tJNH`XcL!hYtajcScFO#|5JRc`4IBmBM(9bvlpzE=VFpCz*ABLUKBx;(h$sM zD1SiQGS9AA87SSu2Sb3;YM?YXz5pV2_9ScqrEmohK|ag!@fv2CJ`_a|jePz!mW6BC zvtV>~Mx@neSfH}$L6~E^i7(K&t3^WrWKJs#)D$m`dk>y7pr!)A^9A%oz5reXrsrak zKR9%Q&lzsyTVZStionNTU@^m@rqz&TD-g(E4uNxzwGlx0N#pyEeX6(=jJ3NbCV$fH zXK@#jWc2_@^OHo9A7GgKT>9RFdEVc}BwxVrO}XHlGmE$UyP6+@?7~R$H4^~#0;D3q z{rr@Mf%?+MsITGv!%~p$L5SP8NP7TkOIF-;5*L=@`}p94KG?PEDt!3<7-aW9q#60< zUNtQ5U~lI`Nq1E95qTP#|? zQ~+51k(Pi*FMksAb<)8r+<^MquK}tm09IE7@(A!uo@8d3&af_mF^daA9VPh|9I|zQ2z@jj*w>ma_%3?R-vNk zR?xF}>F3X={%nF9R;nUjeBW$4jP<$U8ay49{Jc2iYZd|oNH=su_lluFX*q~{{$q0p zUGBbp*F~~$(FqhMhUJn7b5kiB%ZjCztQ2UmXt~ma4G)b-7BGC^j^nYKKNwbop=A`+ z@z?&T`tLop|HnxqUyAb5tBs+Iv`?|5wCU!6}S6T7GV?^(f z-y!tE9(dtkv+Q9~$sj+o;SezSHHyhkN(hMNYB7VyBu=YM8OAXCV?Wrd_e6vLeXMA5 z_UeKB84&>AaN#TrkCGGWc{NAJMsxWG&b~S0qkVcIf5rqL?dajz0z$J0Jpon;O2a~` z5U)4#XH)>;arev_r|QtK`^46i*rr`?3m|+ViITx19HVbq^kh;!f!@hanIupOoM0hT z1y~kdcuV;R9p9`89z3DdQSa$Me#&_OL2v?a2wBaz0gfQzWD*UgZ>1IaDJcL91JdPX zFTcM%rQTmUk)M(RK=SMBrzUt}B1n2ZFeN_?1c1PaB+}7CoJca$JC3Cz`6(*^L|t93 z*cZT(kaT#KlAk65z)*l=^q3UlV-&%X4L^acTuzY84Jgx@{FE#MByQ~)yqY#tefe1wHk9*U-_ zC;6{lS1H)&Avf^?6>*VMFxVQ@-utYug<~P!k zd?O3M!2;XOFdPYfQ;!Ll?sY%f>ZmPVhWqWqNZ&>AM%QRi1hzNQj(j5sAcANYxVqb# zPsjxJ;2yk_<1ld}baE+*z~uBnKD#5W$WJE$C?Q%7I3W>F-hkn&XJu~~_pb=t$m~cP z@3v=IH<$d6eDvimMMI1wz*urO^L*$$l( zEr;5m2Y{aMz5%OQ*$-zI&WF6YRbZJVPF>R-`7u3!0f1$1>#0*;!Ig^+D4l@gEG&0Q};a06yN!Ki~lWx?zpKKf`sjJw?M>e~n4^0h&EH_4H0 zD_;zAYgS3E9xeV)+*Qt9Pw0_+BYOZ`Y_PGfuMgI?t`onRH9IrJ6JUJLDXM@uH-#Kx zfkeL+w0ei$KL{gwfPBIF-~H=*q4j;x6PT<;P_*bixP`kUCv+X1T6bv8&W2U19)RZNN1&*vNP7QAL5uH5#}C7Z0^r-e`?%OY#)$yQM&esI z;{3jAFJg2T)jk)8oi3#0-$aN1{?c|g2d$P)DnfH z)bz|eTc!8A_bVx6rr0WloBA5~7C5J7WO`H;r3P2|g(O#HCtIc{+1n}DR9FEG$W1Lt zRH(?!$t$+1uvG$^YXxM3g!Ppaz)DK8ZIvL7itr6kaLzAERWQ{v(@i!sHc~LR)H5`- zG_o+!Q7|$vG}AXQ(KoczH8i#YA`=4zC{P00R+N%v73AUuwF}6zRmvzSDX`MlFE20G zD>v55FG>gMwY1bXFw!?N(gmu}Ew0QfNvzP#D^`Y?;F4OLT$EW*l9`{U05UN#DZjMD zRte}*h!=7T;Kt?^LxTwzVEPq_1^R}11|ToN6#Dw&SDKp(S6y5Zl!|aKR)dQ}DhpEe zgHnt0ON)|$5tpV6vZ}z!xhOTUB)=#mKR*W+iUAq%gju%axu3sx3F+DG&OK`GBk8Gv#@lraI!El zurPIWu{3fsf$4S0PcF?(%`1WFO+n~2!l@UOBytOYHoK%2WtOF;xE1B+DuBIim5IeI z7RDAvmPRgSIL(9VO~LIJ1DtyGfsWA!MKDr?!-RmT2*iXZUmypb0aEjTslEu9ycvRi z%?D(BJu0Z<#|No9>gOHKa*m}JY zDhqDb7Tu~Zx!qWPySesmNAtbDmizs!_a}5cn9}ob`lLs5raYcE{mFt^PZ!UAx@7V5 zHLG84TJv(t+Lv3_zuLCt_3mwN_HKW(cgLIkd*2;C`2P5j4=0a*ICJLH#fzV>UjBUj z>X#eWzTA5F{mIiG&!7Ex@#5#Jmp@;>{`L0VulL{ne*f|J=bwLnfNu6Mb&CPIo~dC8Lqjw-Tlyciwgzu@H+K+y zmuZjabhWmIU)A*$Q*W>tJ4pO|_hhDWw6>Ge9~JY^eKFB4JNr_Op6L3?5XHg$W0T5@ R6rgh$JYD@<);T3K0RR^b+tmO7 delta 499 zcmaFQ*~2nHxt@_Jz$e7@|Ns9D`yJ{IJJlR?sXy#gcgPXQt~&%o&b5b~>Ve!tjqJQRiO{t-+NPdOX+Gk)>}u_Shl}?8e zPe0%Eo(yj~;_>S1!zEX$9)G&_<=6XD&o<4!RQ%}UmFHh>zyI-K*S%SP|NX5$RPWq* zJgDKY>z{wWzpUDQgn@xUt|Z7Wn1SWG=F&>vi#ygf9=81%`t)zXw+oBPyk#yes}4|M z>O3_e1*meir;B4qMV#-sP`<+kA})c`XU@FGz5L9XGd#cVd)+?KS7hIBa!J5xkKg9g zZ@16jIL#bo*M2qaIs;E&fdBE+k`4h992Gg!pIraFIW^#jAMWWPmf-z;7Qne?~mdF=Iw{&S)8pL nEQETG3cF~}^h)1k>GYfFYPXc2hHYyl(47pPu6{1-oD!M<@jw;! diff --git a/examples/widgets/widgets/icons/images/qt_extended_32x32.png b/examples/widgets/widgets/icons/images/qt_extended_32x32.png index 6e7d000c0470e0f45ae714827ba72f69cc25270a..d609c1e1e5b46d571cc46378cf7ae74b250aa82b 100644 GIT binary patch literal 15518 zcmeI3eNDl)3V!MHsK5a=b`HaB8$q1Ch=XAJuqt7h$ z`x-$kHj`3`Um_HnrHSHzk{nxxB$@Lt60KY(vn$mq$#R2SsWqtdnx9Kl3Z;%zXh@|& zrc@ijTceN!Us6i~h)f>3z?f-W85|D$XOKoX)73ypYL+XBKrpKD*4#keLk6m3Zt7kS~sQ3A~U}3Z@i9Gz+7YQpP1j zwW94IA9snz;Rj9INyfoAK?)BjD5K8BUBn3-U&O@#80wCRQD6&Vun>DJyt3kC=Gi3{< z&a`DbY$-#p^l(o9K6g_do)Nc?Svs|ULI*>z82lU1$j+Q<@Oo6SuV+ST_rK#RE2r z*)Y9zs>8v~a$!Qt1CBK#WfzZb3r~T?HIe?KZmKPOQGpC`pnxFCn$E6#XQam-!&}6- zBDXudRRdOjRcsTUD-gVthe<31J7Tt{QNVe6YV0BGMU<XB$4Lnm)=3pIq}x?!BEya0F-@W01Y5J8qQqfVg-vT zI9fzAlqLRT1z==>+cd_a(`waP6B*eYnUTTz7)Oqk1&1mxZWT2c$)6M15jAmLtVF0I zm>4Jp=!VK)DS=jSy9VwQ$K*kss5)mxGxL_K{7~?`Bf&~~COamEX zTu4N)0ONvbAY+URi3k>8Trdq}jBz0m!2*m6rh$wxE+isYfN{YzkTJ%EL<9>kE|>-~ z#<-A(U;)Mj(?G@;7ZMRHz_?%<$Qa{7B7y}N7fb^gV_Zl?umIzNX&_^a3yBC8U|cW_ zWQ=hk5y1kC3#NgLF)kz`Sb%ZCG>|dIg+v4kFfNz|GJYVggz&?cj0-$*=>?Bgem~!O z4m_4Av8QI*2%>xmK~%g*5dWP7-#r9Tq9BMHc?4m6ogjX|?R@^sN`i>fW;~mn0&*rN zClebp;dfGFR`RFW)=$@@i0@xN)ASo#Q*L_G`t*zIe|3>s^EsXSW%2rEM_#kb-m-yi z@h~lXQEN$2YbkrlyW#St(yum`w{3l)?T;1zuH15U`_`*FwzcnixqWwK`=4LA_LrSs z@7>k0Z+FN3*E-+c(^<8rtLlxe1N*uTzS;fWTiw-fcOQPI`|!d49DVotvFhu`4_!Zg zq^IU+PtCC#e>-vWWX;XL*W9cH0foPTg(z@a`uc-#vS}_v|OV z7yjAXc($+cd|y*z|L33ef6+AX$-hla+7hwqP!+`l(EF*-IeHa0OnJ~2KqIRS8; z>K|SWz|9jf)3XR-iLCSH=>-)!fb=J6*2HZ6`Nmyq*M79(i7ji-Em`*1kCv^vRrgd* zM)s|_k8Rv8JvTo2W}fc+i_4F6Hg^2uLfZxJPV*bN7uy&2#aC42y}s$S=T~nsZ(DJH zzqNYdJG)*wQ(3p8Vc}ah_HB2UEaJD$InqMRec`~)mU+hy#m_%gJ*eGXwY6-^pIDtb z@6m%#_AIJsK5EfjsF3Y_zxS0xC-48^g!6l<_HWlNGf9r-CjWTd0vG*WT>4+DK3bId zoa80-g8j<(=f2we#EvWT1|Pq@xMS{UMO@Fr)iv{(9RuHLkgcjrE3Vt@9QhsB)3yGC zW;6NQjmMtb`_qY@0~;RAaEzYJ@ughJUDY~%&RQGq*3SEGU;U!5S9H!FY4|Mu8WF!# rX+L3EYOU*da^tnu%HO+}*T?DBYy#&P)t-s|NsAf!a{$-L4eg&e!@b3!$N+-Lw&+SZMI2$!9jk) zLVm+Se8EJ1!a;t*LVvcj58Vg2YGS@zsCAL)q=e$>y+u!$#-y+`{6f)9Syr-IS8dVC(ha?f2#Q{PmH` zUGVtng2YJC>3_VW)Ow4^Rj$~GvD%Hz=eD`tnfCkg`~CT<*MiUJxvSTM_xtnO?Z}hN zVUNmMtk{Lp>b>gq;E2aj-S5qi%3O)ZQm@&GjL25F-j~?y#pLqXq0@D<+mFKHrTzZ> z$mOr!@X(6LQ}6fZkjq`?^xMwpxTw~Et=NX|_~?koP=Dp~+1u{Q`TX|${`;%fgx>GZ z@%ZYT&~D4-v%uk_gTzUW$yt@nW2jh3VE_OCGIUZ-Qvmyg2K=S0SO-?w*D0jko7Ad; zfK@954SKJAQxf3%F7EYXfgP@cE&bcDS}(GPTrmj*xAnU_ztWO)p?_Kw=}lc#Fh44+P) z5x27qjm<5sWh$tbqm@)wGzHIvj)FQ-3sjvbEdcT9xFGiD$Is67m@n9U48Yrn17^Qy zz;Cd7`ydw<$)JLW4G%>&;7NSd)_{H>A+i9AOMk%fiWek-HIZLnr7fVx3p&Bfiu?mJ z{}iHsz2Gxg&geE_%K_>;jN+au77S>?APkAqFpOwH2Iid+!|#emKwRVv5Y>V%;J-)$ zMnwxIfVBHiGkP#)Lzl=qcrPDdzuODs89aZHGW%+B)C(DT&M^VQPx*3FD|D>G|vG`t0rc@9z5V@B8rY`|&_|Nj5~{}-L5dH?_b19VbOQviQ}ziA@J0004oNkl=UkmL z&--SQIcMT|&k;YW6*H3ZO3EuKucW+^@=D6 zFcB=q5xQ>x&VJqj%*7CPAXw^<(z$aebw&!WfhCic;Zvlr2!C2lz6OOzVHY;SJO^aN z!x>nGOMh4h^DNL8A*2GB4vQDS`$vJ4MQ8$YVNnB&$@j0I;QPLB6Pkh1zqgx^RD`_i zqw9dlut)<#5rXc*_DbpmdZUCqd=2wqD7RFEBd4$erFN5V!hs|m!--QE1-?~|<6QtV zlC%f6wJxEt2&}eAwNoXyYBVFl=Yhcy`?QV&ly?rdiU1!aNwcPLY5N754<1^(Qd8+> zzEWl!SM<%sZzIfy@A+ZtS7Cd(#UV)b+1~!_KHPTM{{dB=ZMCNi-yOVF&=)fq7Tzvo wu7mY%J8u^>m~}kgCCJHpNqH|R{~U4R9@~+G=4e!U<^TWy07*qoM6N<$f?1KS6951J delta 1275 zcmXw%2~d)07{@=!uq^4^tX9j$skN=l(b^8H3Gm2c%{I5wac#}aEp6M##FFnz%SlTy zQzK2+a;z=$$g8w8_`nNA%mYyl5m63B4M7D2_rq%DooC*8p5Oof{NI^31D#@-Y7e4( z{e1)6=jP^OVJr#8nGPMP*jOq)cK#ksKM+gD#=>}{f-n|h94685UrF#gkBkrr3C2U8 z4x3ao95O=gCX9xIVBFP)eIU(bh>(P84+M^4xFT*hzz=TUSAJcL1L@zyra*MuO&UU* zI*1r*@|q8an0`w@GA+hIG#v5cd}m&3NTbO+nR%8bF8J90w46tdV|Zq=LT8P7?d;Upv~+BGcv`Q9#RU=-_gSr~^Gs6H@v^>@5zWB! z&Ks%Bz~bI}cj|rWC58WSpg6`6N?SNYcW;ywz3e7c@*icgE(}d_-w84dM#Io#Z#ge@ zT0co2e3{&Qs<0=%Raz-k^JQvbc6&sd>^-IJqF|g=(woRtHhj^JRDt~Tkty-;BrmNs zxI|=TRoYRu zy!u1`Q-wxUEqo%^^b5z^IHUAIRd<7&vL65dAHr{b#{pNpu|~YF_S}ldzzd1HLIk4w zhSWVr-!H9{|$a!%_dC-zPtK?Y);KjsbMu+q6MewR32FV3%!u2$P z@0FuH#tQDVK}kKSh$wws=NlPzr++D`W))@9;DiQN~t@vcDkiC^qC zdLK@n%3Dm`Rs%^pGl!+X&Y-$7i)6s;Gb#595pdYqXO+5Dw}AcAe$hg%!+LTP+V+%% zNS{1%-EN5}TlQCOr0oo50#9ga-d%x`BnlbVz;aBN+2yw#j97=yw<7@F@rSMtKM?G4 zN(qt;T|u_Ny8*p_f$9~CTVie@$#Ge5pv=sYXmcp71km2G4H?}_7A@B1v%Wk+m0pIO zkHQ&FqpQz(`;!tRD&~&h+@gZleCHp6t#6^sv(HF8bGu|E%%ni*{@g_54)lAq_1Z#$ z`KYDE@5Kp=ocydfk17{A1zENJ7-i>Sb?P(gtP$o71jntw?7E+`w|U)qB`TjdX}vx0ybN6$-P{q{a&m23)j!>e-HQw)RMvK362_y> Q8TpNXm%E=^F)ldnfAj;(>i_@% From 25b72a63fffe800f2005b21d254b0b191d263b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 3 Aug 2016 15:20:09 +0200 Subject: [PATCH 084/236] Fix memory leak in tst_qgraphicsproxywidget QStyle was created but never removed Change-Id: I55011377afd475af28e4ce2cf657e435dd37c96a Reviewed-by: Marc Mutz Reviewed-by: Frederik Gladhorn --- .../qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index ea2599fcf9d..7375513303f 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -415,6 +415,7 @@ void tst_QGraphicsProxyWidget::setWidget() QGraphicsScene scene; QGraphicsView view(&scene); view.show(); + QScopedPointer style(QStyleFactory::create(QLatin1String("Fusion"))); QVERIFY(QTest::qWaitForWindowExposed(&view)); QPointer proxy = new SubQGraphicsProxyWidget; SubQGraphicsProxyWidget parentProxy; @@ -437,7 +438,7 @@ void tst_QGraphicsProxyWidget::setWidget() #endif widget->setPalette(QPalette(Qt::magenta)); widget->setLayoutDirection(Qt::RightToLeft); - widget->setStyle(QStyleFactory::create(QLatin1String("Fusion"))); + widget->setStyle(style.data()); widget->setFont(QFont("Times")); widget->setVisible(true); QApplication::setActiveWindow(widget); From e694ced803589b3504b6bdb2fc8bf97bc891c794 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 4 Aug 2016 12:22:05 +0200 Subject: [PATCH 085/236] Add X11 support for the DRIVE CX The spec, added in 5.7.0, simply defined WIN_INTERFACE_CUSTOM, leading to the generic, non-X11 typedefs for the EGL native types. This is fine for the typical embedded use, but is not what is wanted when targeting xcb, and leads to disabling EGL-on-X support. Therefore, move the define into a comon header and let the individual libs decide by defining or not defining QT_EGL_NO_X11. This sets both MESA_EGL_NO_X11_HEADERS and WIN_INTERFACE_CUSTOM in qt_egl_p.h. This way Qt builds supporting all three of eglfs (DRM+EGLDevice), wayland, and xcb (EGL) can be generated out of the box. [ChangeLog][Platform Specific Changes][Linux] xcb with EGL and OpenGL ES, as well as eglfs with the eglfs_x11 backend, are now supported on DRIVE CX boards when using the linux-drive-cx-g++ device spec. Done-with: Louai Al-Khanji Task-number: QTBUG-55140 Change-Id: I6f186d16612e170995e3bca1214bcabad59af08e Reviewed-by: Andy Nichols --- mkspecs/devices/linux-drive-cx-g++/qmake.conf | 9 +- .../nativecontexts/qeglnativecontext.h | 2 +- .../eglconvenience/eglconvenience.pri | 7 +- .../eglconvenience/qeglconvenience_p.h | 2 +- .../eglconvenience/qeglpbuffer_p.h | 1 - .../eglconvenience/qeglplatformcontext_p.h | 2 +- .../eglconvenience/qeglstreamconvenience_p.h | 3 +- src/platformsupport/eglconvenience/qt_egl_p.h | 117 ++++++++++++++++++ .../platforms/directfb/qdirectfb_egl.cpp | 2 +- .../eglfs_brcm/eglfs_brcm.pro | 4 +- .../deviceintegration/eglfs_kms/eglfs_kms.pro | 4 +- .../eglfs_kms_egldevice.pro | 3 +- .../eglfs_kms_support/eglfs_kms_support.pro | 4 +- .../eglfs_mali/eglfs_mali.pro | 4 +- .../deviceintegration/eglfs_x11/eglfs_x11.pro | 4 +- .../eglfs_x11/qeglfsx11integration.cpp | 4 +- .../platforms/eglfs/eglfs_device_lib.pro | 4 +- src/plugins/platforms/eglfs/qeglfsglobal.h | 2 +- .../platforms/minimalegl/minimalegl.pro | 4 +- .../minimalegl/qminimaleglintegration.cpp | 2 +- .../platforms/minimalegl/qminimaleglscreen.h | 2 +- .../gl_integrations/xcb_egl/qxcbeglinclude.h | 2 +- src/plugins/platforms/xcb/qxcbintegration.cpp | 2 +- 23 files changed, 157 insertions(+), 33 deletions(-) create mode 100644 src/platformsupport/eglconvenience/qt_egl_p.h diff --git a/mkspecs/devices/linux-drive-cx-g++/qmake.conf b/mkspecs/devices/linux-drive-cx-g++/qmake.conf index c8e85e449c2..985f8626add 100644 --- a/mkspecs/devices/linux-drive-cx-g++/qmake.conf +++ b/mkspecs/devices/linux-drive-cx-g++/qmake.conf @@ -10,6 +10,10 @@ # -no-gcc-sysroot \ # -opengl es2 +# Note: This enables eglfs and wayland only. To enable xcb (with EGL +# support) as well, add -qt-xcb and fix the SDK's X11 headers. See +# QTBUG-55140. + include(../common/linux_device_pre.conf) isEmpty(VIBRANTE_SDK_TOPDIR):error("You must pass -device-option VIBRANTE_SDK_TOPDIR=/path/to/sdk") @@ -31,7 +35,10 @@ QMAKE_LFLAGS += \ -Wl,-rpath-link,$$[QT_SYSROOT]/lib/aarch64-linux-gnu DISTRO_OPTS += aarch64 -COMPILER_FLAGS += -mtune=cortex-a57.cortex-a53 -march=armv8-a -DWIN_INTERFACE_CUSTOM + +# Do not define WIN_INTERFACE_CUSTOM here. It is suitable for drm and +# wayland, but not X11. Leave it to qt_egl_p.h instead. +COMPILER_FLAGS += -mtune=cortex-a57.cortex-a53 -march=armv8-a EGLFS_DEVICE_INTEGRATION = eglfs_kms_egldevice diff --git a/src/platformheaders/nativecontexts/qeglnativecontext.h b/src/platformheaders/nativecontexts/qeglnativecontext.h index acc5dd10ab4..67a6d2b808a 100644 --- a/src/platformheaders/nativecontexts/qeglnativecontext.h +++ b/src/platformheaders/nativecontexts/qeglnativecontext.h @@ -41,7 +41,7 @@ #define QEGLNATIVECONTEXT_H #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/eglconvenience/eglconvenience.pri b/src/platformsupport/eglconvenience/eglconvenience.pri index fe6d0eb7484..1cacaf4a4c2 100644 --- a/src/platformsupport/eglconvenience/eglconvenience.pri +++ b/src/platformsupport/eglconvenience/eglconvenience.pri @@ -1,7 +1,8 @@ contains(QT_CONFIG,egl) { HEADERS += \ $$PWD/qeglconvenience_p.h \ - $$PWD/qeglstreamconvenience_p.h + $$PWD/qeglstreamconvenience_p.h \ + $$PWD/qt_egl_p.h SOURCES += \ $$PWD/qeglconvenience.cpp \ @@ -15,8 +16,8 @@ contains(QT_CONFIG,egl) { $$PWD/qeglpbuffer.cpp } - # Avoid X11 header collision - DEFINES += MESA_EGL_NO_X11_HEADERS + # Avoid X11 header collision, use generic EGL native types + DEFINES += QT_EGL_NO_X11 contains(QT_CONFIG,xlib) { HEADERS += \ diff --git a/src/platformsupport/eglconvenience/qeglconvenience_p.h b/src/platformsupport/eglconvenience/qeglconvenience_p.h index ec5c1e403a0..fdd21b8f19a 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience_p.h +++ b/src/platformsupport/eglconvenience/qeglconvenience_p.h @@ -54,7 +54,7 @@ #include #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/eglconvenience/qeglpbuffer_p.h b/src/platformsupport/eglconvenience/qeglpbuffer_p.h index 19a29d5dd8c..4f9ea9d5f3a 100644 --- a/src/platformsupport/eglconvenience/qeglpbuffer_p.h +++ b/src/platformsupport/eglconvenience/qeglpbuffer_p.h @@ -53,7 +53,6 @@ #include #include -#include QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h index e772f5df89b..f6b2b876f7a 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h @@ -55,7 +55,7 @@ #include #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h index c8a80968164..f535afbc55e 100644 --- a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h +++ b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h @@ -52,8 +52,7 @@ // #include -#include -#include +#include // This provides runtime EGLDevice/Output/Stream support even when eglext.h in // the sysroot is not up-to-date. diff --git a/src/platformsupport/eglconvenience/qt_egl_p.h b/src/platformsupport/eglconvenience/qt_egl_p.h new file mode 100644 index 00000000000..615ee4b80a6 --- /dev/null +++ b/src/platformsupport/eglconvenience/qt_egl_p.h @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT_EGL_P_H +#define QT_EGL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifdef QT_EGL_NO_X11 +# define MESA_EGL_NO_X11_HEADERS // MESA +# define WIN_INTERFACE_CUSTOM // NV +#endif // QT_EGL_NO_X11 + +#ifdef QT_EGL_WAYLAND +# define WAYLAND // NV +#endif // QT_EGL_WAYLAND + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QtInternal { + +template +struct QtEglConverter +{ + static inline ToType convert(FromType v) + { return v; } +}; + +template <> +struct QtEglConverter +{ + static inline uintptr_t convert(uint32_t v) + { return v; } +}; + +#if Q_PROCESSOR_WORDSIZE > 4 +template <> +struct QtEglConverter +{ + static inline uint32_t convert(uintptr_t v) + { return uint32_t(v); } +}; +#endif + +template <> +struct QtEglConverter +{ + static inline void *convert(uint32_t v) + { return reinterpret_cast(uintptr_t(v)); } +}; + +template <> +struct QtEglConverter +{ + static inline uint32_t convert(void *v) + { return uintptr_t(v); } +}; + +} // QtInternal + +template +static inline ToType qt_egl_cast(FromType from) +{ return QtInternal::QtEglConverter::convert(from); } + +QT_END_NAMESPACE + +#endif // QT_EGL_P_H diff --git a/src/plugins/platforms/directfb/qdirectfb_egl.cpp b/src/plugins/platforms/directfb/qdirectfb_egl.cpp index 0e706d789a3..2a04c0bba31 100644 --- a/src/plugins/platforms/directfb/qdirectfb_egl.cpp +++ b/src/plugins/platforms/directfb/qdirectfb_egl.cpp @@ -49,7 +49,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro index e2ebf9f7ee5..2b710ac24c5 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro @@ -8,8 +8,8 @@ CONFIG += egl LIBS += -lbcm_host QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF -# Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 SOURCES += $$PWD/qeglfsbrcmmain.cpp \ $$PWD/qeglfsbrcmintegration.cpp diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro index 979bfe3ea9e..b1791240ab0 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro @@ -8,8 +8,8 @@ QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support -# Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 CONFIG += link_pkgconfig !contains(QT_CONFIG, no-pkg-config) { diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro index 3a380b75255..e2263f6cbf8 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro @@ -4,7 +4,8 @@ QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 CONFIG += link_pkgconfig !contains(QT_CONFIG, no-pkg-config) { diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro index 6355fe6abdc..32f15f33fbc 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro @@ -6,8 +6,8 @@ QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. -# Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 CONFIG += link_pkgconfig !contains(QT_CONFIG, no-pkg-config) { diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro index 7fc4568ae3f..3e486bd1bde 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro @@ -2,8 +2,8 @@ TARGET = qeglfs-mali-integration QT += core-private gui-private platformsupport-private eglfs_device_lib-private -# Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 INCLUDEPATH += $$PWD/../.. CONFIG += egl diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro index 83f0c74910b..1948d737503 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro @@ -2,8 +2,8 @@ TARGET = qeglfs-x11-integration QT += core-private gui-private platformsupport-private eglfs_device_lib-private -# Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 INCLUDEPATH += $$PWD/../.. diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp index 74a687b3829..f9924fe5ce7 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp @@ -281,12 +281,12 @@ EGLNativeWindowType QEglFSX11Integration::createNativeWindow(QPlatformWindow *pl xcb_flush(m_connection); - return m_window; + return qt_egl_cast(m_window); } void QEglFSX11Integration::destroyNativeWindow(EGLNativeWindowType window) { - xcb_destroy_window(m_connection, window); + xcb_destroy_window(m_connection, qt_egl_cast(window)); } bool QEglFSX11Integration::hasCapability(QPlatformIntegration::Capability cap) const diff --git a/src/plugins/platforms/eglfs/eglfs_device_lib.pro b/src/plugins/platforms/eglfs/eglfs_device_lib.pro index f784020fb62..974b85b1dd3 100644 --- a/src/plugins/platforms/eglfs/eglfs_device_lib.pro +++ b/src/plugins/platforms/eglfs/eglfs_device_lib.pro @@ -9,8 +9,8 @@ CONFIG += no_module_headers internal_module QT += core-private gui-private platformsupport-private LIBS += $$QMAKE_LIBS_DYNLOAD -# Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 DEFINES += QT_BUILD_EGL_DEVICE_LIB diff --git a/src/plugins/platforms/eglfs/qeglfsglobal.h b/src/plugins/platforms/eglfs/qeglfsglobal.h index d6aba565ce8..309655e86c5 100644 --- a/src/plugins/platforms/eglfs/qeglfsglobal.h +++ b/src/plugins/platforms/eglfs/qeglfsglobal.h @@ -48,7 +48,7 @@ #define Q_EGLFS_EXPORT Q_DECL_IMPORT #endif -#include +#include #undef Status #undef None #undef Bool diff --git a/src/plugins/platforms/minimalegl/minimalegl.pro b/src/plugins/platforms/minimalegl/minimalegl.pro index ac672495914..b8a91729fd0 100644 --- a/src/plugins/platforms/minimalegl/minimalegl.pro +++ b/src/plugins/platforms/minimalegl/minimalegl.pro @@ -6,8 +6,8 @@ QT += core-private gui-private platformsupport-private #DEFINES += Q_OPENKODE -#Avoid X11 header collision -DEFINES += MESA_EGL_NO_X11_HEADERS +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 SOURCES = main.cpp \ qminimaleglintegration.cpp \ diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp index cf31eec75f1..b1d3691a109 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp +++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp @@ -58,7 +58,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/minimalegl/qminimaleglscreen.h b/src/plugins/platforms/minimalegl/qminimaleglscreen.h index 825d5e85412..4b53bbd39ad 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglscreen.h +++ b/src/plugins/platforms/minimalegl/qminimaleglscreen.h @@ -44,7 +44,7 @@ #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h index 9729f610b6c..7c6524c8ee2 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h @@ -46,7 +46,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index cdbf9b295e1..5a89113a4f1 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -65,7 +65,7 @@ #include #ifdef XCB_USE_EGL -#include +# include #endif #ifdef XCB_USE_XLIB From 23ac125bcb750575b86edfaa08448f8358260e4b Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 13 Jun 2016 17:05:43 +0300 Subject: [PATCH 086/236] Android: don't wait if the event loop is stopped QAndroidEventDispatcherStopper is stopped when the application is in background and the user uses the task manager to kill the task. If the application has services the task manager doesn't kills it, but instead it tries to gently terminate the activity. The problem is that the activity is still backgrounded (meaning that the Qt event loop is freezed), therefore terminateQt will hang. Task-number: QTBUG-54012 Change-Id: I6e333cbcaf41e9e298eeb8b2b0bc3adcf446783f Reviewed-by: Christian Stromme --- src/plugins/platforms/android/androidjnimain.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 671dad98b23..fe2401f561a 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -539,8 +539,11 @@ static void quitQtAndroidPlugin(JNIEnv *env, jclass /*clazz*/) static void terminateQt(JNIEnv *env, jclass /*clazz*/) { - sem_wait(&m_terminateSemaphore); - sem_destroy(&m_terminateSemaphore); + // QAndroidEventDispatcherStopper is stopped when the user uses the task manager to kill the application + if (!QAndroidEventDispatcherStopper::instance()->stopped()) { + sem_wait(&m_terminateSemaphore); + sem_destroy(&m_terminateSemaphore); + } env->DeleteGlobalRef(m_applicationClass); env->DeleteGlobalRef(m_classLoaderObject); if (m_resourcesObj) @@ -558,8 +561,11 @@ static void terminateQt(JNIEnv *env, jclass /*clazz*/) m_androidPlatformIntegration = nullptr; delete m_androidAssetsFileEngineHandler; m_androidAssetsFileEngineHandler = nullptr; - sem_post(&m_exitSemaphore); - pthread_join(m_qtAppThread, nullptr); + + if (!QAndroidEventDispatcherStopper::instance()->stopped()) { + sem_post(&m_exitSemaphore); + pthread_join(m_qtAppThread, nullptr); + } } static void setSurface(JNIEnv *env, jobject /*thiz*/, jint id, jobject jSurface, jint w, jint h) From c1ad0c2ebf219397a677e5fb28ca169bf90e083a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 5 Aug 2016 18:37:31 +0200 Subject: [PATCH 087/236] Fix QZip autotest and enable QZip and QTextOdfWriter tests again don't refer to non-existent feature 'OdfWriter', and test these classes if we have a developer build. Change-Id: I59b0d4bbba4958ed3bd76f504cd8b493dbd7f877 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- tests/auto/gui/text/qzip/tst_qzip.cpp | 2 +- tests/auto/gui/text/text.pro | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/auto/gui/text/qzip/tst_qzip.cpp b/tests/auto/gui/text/qzip/tst_qzip.cpp index 50e9a0f0efd..c0bf5fef8ed 100644 --- a/tests/auto/gui/text/qzip/tst_qzip.cpp +++ b/tests/auto/gui/text/qzip/tst_qzip.cpp @@ -50,7 +50,7 @@ void tst_QZip::basicUnpack() QZipReader::FileInfo fi = files.at(0); QVERIFY(fi.isValid()); - QCOMPARE(fi.filePath, QString("test/")); + QCOMPARE(fi.filePath, QString("test")); QCOMPARE(uint(fi.isDir), (uint) 1); QCOMPARE(uint(fi.isFile), (uint) 0); QCOMPARE(uint(fi.isSymLink), (uint) 0); diff --git a/tests/auto/gui/text/text.pro b/tests/auto/gui/text/text.pro index dc67794a98d..9160141c604 100644 --- a/tests/auto/gui/text/text.pro +++ b/tests/auto/gui/text/text.pro @@ -22,8 +22,8 @@ SUBDIRS=\ qtextpiecetable \ qtextscriptengine \ qtexttable \ - -contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter + qzip \ + qtextodfwriter win32:SUBDIRS -= qtextpiecetable @@ -32,3 +32,5 @@ win32:SUBDIRS -= qtextpiecetable qcssparser \ qtextlayout \ qtextpiecetable \ + qzip \ + qtextodfwriter From 865d80fdb536af7eb17094787444f010313594b5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 21 Jul 2016 17:19:21 +0200 Subject: [PATCH 088/236] remove workarounds for spurious function argument inheritance the qmake bug has been fixed recently. Change-Id: I4a4226b3cd77d449980f73e41cd256ed43940a09 Reviewed-by: Lars Knoll --- mkspecs/features/qt_configure.prf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index dc1c1ef524b..c4dda1b5684 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -889,26 +889,26 @@ defineTest(qtConfCreateSummary) { defineTest(qtConfPrintReport) { for (n, QT_CONFIGURE_REPORT): \ logn($$n) - logn(" ") + logn() for (n, QT_CONFIGURE_NOTES) { logn($$n) - logn(" ") + logn() } for (w, QT_CONFIGURE_WARNINGS) { logn($$w) - logn(" ") + logn() } !isEmpty(QT_CONFIGURE_ERRORS) { for (e, QT_CONFIGURE_ERRORS) { logn($$e) - logn(" ") + logn() } mention_config_log:!$$QMAKE_CONFIG_VERBOSE { logn("Check config.log for details.") - logn(" ") + logn() } !equals(config.input.continue, yes): \ @@ -1176,7 +1176,7 @@ defineTest(qtConfigure) { qtConfProcessEarlyChecks() CONFIG += qt_conf_tests_allowed - logn(" ") + logn() logn("Running configuration tests...") # process all features @@ -1188,12 +1188,12 @@ defineTest(qtConfigure) { qtConfCreateSummary() logn("Done running configuration tests.") - logn(" ") + logn() } qtConfigure($$_PRO_FILE_PWD_/configure.json) logn("Configure summary:") -logn(" ") +logn() qtConfPrintReport() From 53e06e68b6c675e3d3d6f49e23a6466e3404d377 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 14 Jul 2016 21:13:11 +0200 Subject: [PATCH 089/236] fix passing arguments with spaces to configure -D/-I/-L/-F Change-Id: Ic03e487e5988fa38246975b52d1494af58ccb22f Reviewed-by: Lars Knoll --- configure.pri | 8 ++++---- mkspecs/features/qt_configure.prf | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/configure.pri b/configure.pri index 7625074c500..cdded4f2d49 100644 --- a/configure.pri +++ b/configure.pri @@ -576,23 +576,23 @@ defineTest(qtConfOutput_compilerFlags) { !isEmpty(config.input.defines) { EXTRA_DEFINES += $$config.input.defines export(EXTRA_DEFINES) - output += "EXTRA_DEFINES += $$config.input.defines" + output += "EXTRA_DEFINES += $$val_escape(config.input.defines)" } !isEmpty(config.input.includes) { EXTRA_INCLUDEPATH += $$config.input.includes export(EXTRA_INCLUDEPATH) - output += "EXTRA_INCLUDEPATH += $$config.input.includes" + output += "EXTRA_INCLUDEPATH += $$val_escape(config.input.includes)" } !isEmpty(config.input.lpaths) { EXTRA_LIBDIR += $$config.input.lpaths export(EXTRA_LIBDIR) - output += "EXTRA_LIBDIR += $$config.input.lpaths" + output += "EXTRA_LIBDIR += $$val_escape(config.input.lpaths)" } darwin:!isEmpty(config.input.fpaths) { EXTRA_FRAMEWORKPATH += $$config.input.fpaths export(EXTRA_FRAMEWORKPATH) - output += "EXTRA_FRAMEWORKPATH += $$config.input.fpaths" + output += "EXTRA_FRAMEWORKPATH += $$val_escape(config.input.fpaths)" } config.output.privatePro += $$output diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index c4dda1b5684..e815baebf11 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -415,13 +415,13 @@ defineTest(qtConfTest_compile) { # add compiler flags, these are set for the target and should not be applied to host tests !isEmpty(EXTRA_DEFINES): \ - qmake_args += "\"DEFINES += $$EXTRA_DEFINES\"" + qmake_args += $$system_quote(DEFINES += $$val_escape(EXTRA_DEFINES)) !isEmpty(EXTRA_LIBDIR) \ - qmake_args += "\"QMAKE_LIBDIR += $$EXTRA_LIBDIR\"" + qmake_args += $$system_quote(QMAKE_LIBDIR += $$val_escape(EXTRA_LIBDIR)) !isEmpty(EXTRA_FRAMEWORKPATH) \ - qmake_args += "\"QMAKE_FRAMEWORKPATH += $$EXTRA_FRAMEWORKPATH\"" + qmake_args += $$system_quote(QMAKE_FRAMEWORKPATH += $$val_escape(EXTRA_FRAMEWORKPATH)) !isEmpty(EXTRA_INCLUDEPATH): \ - qmake_args += "\"INCLUDEPATH += $$EXTRA_INCLUDEPATH\"" + qmake_args += $$system_quote(INCLUDEPATH += $$val_escape(EXTRA_INCLUDEPATH)) qmake_args += $$EXTRA_QMAKE_ARGS } From 62838f07d4e4e8ae578801167b11e02480d34daa Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 20 Jul 2016 20:22:50 +0200 Subject: [PATCH 090/236] fix handling of multi-token fields in config test definitions standardize on the fields in the json structure being single strings in which separate elements are quoted and space-joined (because quoting is unlikely to be necessary in the json file itself, and this format avoids the visual noise of array handling). the quoting itself is expected to be qmake-compatible, which is assumed to be the case for the output of pkg-config (it's actually shell-quoted, but that's the same except in some not-so-relevant corner cases). Change-Id: Icc1d7abc02c449fa759d9714bc5e56e2b8809585 Reviewed-by: Lars Knoll --- configure.pri | 38 +++++++++++++++++++------------ mkspecs/features/qt_configure.prf | 15 ++++++------ 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/configure.pri b/configure.pri index cdded4f2d49..4cc1640d6f8 100644 --- a/configure.pri +++ b/configure.pri @@ -293,15 +293,17 @@ defineTest(qtConfTest_psqlCompile) { isEmpty(pg_config): \ pg_config = $$qtConfFindInPath("pg_config") !win32:!isEmpty(pg_config) { - libdir = $$system("$$pg_config --libdir") + libdir = $$system("$$pg_config --libdir", lines) libdir -= $$QMAKE_DEFAULT_LIBDIRS - !isEmpty(libdir): libs = "-L$$libdir" + libs = + !isEmpty(libdir): libs += "-L$$libdir" libs += "-lpq" - $${1}.libs = $$libs - $${1}.includedir = $$system("$$pg_config --includedir") - $${1}.includedir -= $$QMAKE_DEFAULT_INCDIRS - !isEmpty($${1}.includedir): \ - $${1}.cflags = "-I$$eval($${1}.includedir)" + $${1}.libs = "$$val_escape(libs)" + includedir = $$system("$$pg_config --includedir", lines) + includedir -= $$QMAKE_DEFAULT_INCDIRS + $${1}.includedir = "$$val_escape(includedir)" + !isEmpty(includedir): \ + $${1}.cflags = "-I$$val_escape(includedir)" } # Respect PSQL_LIBS if set @@ -328,15 +330,19 @@ defineTest(qtConfTest_mysqlCompile) { # query is either --libs or --libs_r query = $$eval($${1}.query) - $${1}.libs = $$filterLibraryPath($$system("$$mysql_config $$query")) + libs = $$system("$$mysql_config $$query", lines) + eval(libs = $$libs) + libs = $$filterLibraryPath($$libs) # -rdynamic should not be returned by mysql_config, but is on RHEL 6.6 - $${1}.libs -= -rdynamic - includedir = $$system("$$mysql_config --include") + libs -= -rdynamic + $${1}.libs = "$$val_escape(libs)" + includedir = $$system("$$mysql_config --include", lines) + eval(includedir = $$includedir) includedir ~= s/^-I//g includedir -= $$QMAKE_DEFAULT_INCDIRS - $${1}.includedir = $$includedir - !isEmpty($${1}.includedir): \ - $${1}.cflags = "-I$$eval($${1}.includedir)" + $${1}.includedir = "$$val_escape(includedir)" + !isEmpty(includedir): \ + $${1}.cflags = "-I$$val_escape(includedir)" export($${1}.libs) export($${1}.includedir) export($${1}.cflags) @@ -347,10 +353,12 @@ defineTest(qtConfTest_mysqlCompile) { } defineTest(qtConfTest_tdsCompile) { + libs = sybase = $$getenv(SYBASE) !isEmpty(sybase): \ - $${1}.libs = "-L$${sybase}/lib" - $${1}.libs += $$getenv(SYBASE_LIBS) + libs += "-L$${sybase}/lib" + libs += $$getenv(SYBASE_LIBS) + $${1}.libs = "$$val_escape(libs)" export($${1}.libs) qtConfTest_compile($${1}): return(true) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index e815baebf11..aaed0cb2d1f 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -350,11 +350,12 @@ defineTest(qtConfTest_pkgConfig) { !qtConfPkgConfigPackageExists($$pkg_config, $$args): \ return(false) - $${1}.libs = $$system("$$pkg_config --libs $$args") - $${1}.cflags = $$system("$$pkg_config --cflags $$args") - includes = $$system("$$pkg_config --cflags-only-I $$args") + $${1}.libs = $$system("$$pkg_config --libs $$args", lines) + $${1}.cflags = $$system("$$pkg_config --cflags $$args", lines) + includes = $$system("$$pkg_config --cflags-only-I $$args", lines) + eval(includes = $$includes) includes ~= s/^-I//g - $${1}.includedir = $$includes + $${1}.includedir = "$$val_escape(includes)" version = $$system("$$pkg_config --modversion $$args") $${1}.version = $$first(version) export($${1}.libs) @@ -1089,9 +1090,9 @@ defineTest(qtConfOutput_library) { isEmpty(lookup): \ error("Output type 'library' used in feature '$$eval($${1}.feature)' without a 'test' entry.") - libs = $$eval($${lookup}.libs) - cflags = $$eval($${lookup}.cflags) - includes = $$eval($${lookup}.includedir) + eval(libs = $$eval($${lookup}.libs)) + eval(cflags = $$eval($${lookup}.cflags)) + eval(includes = $$eval($${lookup}.includedir)) version = $$split($${lookup}.version, '.') !isEmpty(libs): qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs) From 0eff800e81f3e7f803dffd77737faaed73002ac8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 Jul 2016 18:09:24 +0200 Subject: [PATCH 091/236] add support for returning the command's exit status to $$system() ... and make use of it in qtRunLoggedCommand(). Change-Id: I242dfde344f555800cef1f55d3cb85418a93277f Reviewed-by: Lars Knoll --- mkspecs/features/configure_base.prf | 9 +++------ qmake/doc/src/qmake-manual.qdoc | 7 ++++++- qmake/library/qmakebuiltins.cpp | 21 ++++++++++++++++----- qmake/library/qmakeevaluator.h | 2 +- tests/auto/tools/qmakelib/evaltest.cpp | 4 ++-- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/mkspecs/features/configure_base.prf b/mkspecs/features/configure_base.prf index fd1730741a2..3397a7703e2 100644 --- a/mkspecs/features/configure_base.prf +++ b/mkspecs/features/configure_base.prf @@ -32,16 +32,13 @@ defineTest(qtLog) { defineTest(qtRunLoggedCommand) { qtLog($$1) - write_file($${QMAKE_CONFIG_LOG}.part, "") - result = false - system("$$1 > \"$${QMAKE_CONFIG_LOG}.part\" 2>&1"): result = true - - output = $$cat($${QMAKE_CONFIG_LOG}.part, blob) + output = $$system("$$1 2>&1", blob, result) write_file($${QMAKE_CONFIG_LOG}, output, append) $$QMAKE_CONFIG_VERBOSE: log($$output) - return($$result) + !equals(result, 0): return(false) + return(true) } isEmpty(QMAKE_CONFIG_TESTS_DIR): QMAKE_CONFIG_TESTS_DIR = $$_PRO_FILE_PWD_/config.tests diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 38e80f7a2d7..68538cabe35 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -3138,7 +3138,7 @@ See also \l{fn_size}{size()}. - \section2 system(command[, mode]) + \section2 system(command[, mode[, stsvar]]) You can use this variant of the \c system function to obtain stdout from the command and assign it to a variable. @@ -3147,6 +3147,11 @@ \snippet code/doc_src_qmake-manual.pro 72 + If you pass \c stsvar, the command's exit status will be stored in that + variable. If the command crashes, the status will be -1, otherwise a + non-negative exit code of the command's choosing. Usually, comparing + the status with zero (success) is sufficient. + See also the test variant of \l{system(command)}{system()}. \section2 system_path(path) diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index ac3a866848c..0cc3b52458a 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -450,12 +450,13 @@ void QMakeEvaluator::runProcess(QProcess *proc, const QString &command) const } #endif -QByteArray QMakeEvaluator::getCommandOutput(const QString &args) const +QByteArray QMakeEvaluator::getCommandOutput(const QString &args, int *exitCode) const { QByteArray out; #ifndef QT_BOOTSTRAPPED QProcess proc; runProcess(&proc, args); + *exitCode = (proc.exitStatus() == QProcess::NormalExit) ? proc.exitCode() : -1; QByteArray errout = proc.readAllStandardError(); # ifdef PROEVALUATOR_FULL // FIXME: Qt really should have the option to set forwarding per channel @@ -483,7 +484,12 @@ QByteArray QMakeEvaluator::getCommandOutput(const QString &args) const break; out += QByteArray(buff, read_in); } - QT_PCLOSE(proc); + int ec = QT_PCLOSE(proc); +# ifdef Q_OS_WIN + *exitCode = ec >= 0 ? ec : -1; +# else + *exitCode = WIFEXITED(ec) ? WEXITSTATUS(ec) : -1; +# endif } # ifdef Q_OS_WIN out.replace("\r\n", "\n"); @@ -871,8 +877,8 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand( break; case E_SYSTEM: if (!m_skipLevel) { - if (args.count() < 1 || args.count() > 2) { - evalError(fL1S("system(execute) requires one or two arguments.")); + if (args.count() < 1 || args.count() > 3) { + evalError(fL1S("system(command, [mode], [stsvar]) requires one to three arguments.")); } else { bool blob = false; bool lines = false; @@ -885,7 +891,12 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand( else if (!args.at(1).compare(QLatin1String("lines"), Qt::CaseInsensitive)) lines = true; } - QByteArray bytes = getCommandOutput(args.at(0).toQString(m_tmp2)); + int exitCode; + QByteArray bytes = getCommandOutput(args.at(0).toQString(m_tmp2), &exitCode); + if (args.count() > 2 && !args.at(2).isEmpty()) { + m_valuemapStack.top()[args.at(2).toKey()] = + ProStringList(ProString(QString::number(exitCode))); + } if (lines) { QTextStream stream(bytes); while (!stream.atEnd()) diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h index eddabe39a09..3f2a22c5672 100644 --- a/qmake/library/qmakeevaluator.h +++ b/qmake/library/qmakeevaluator.h @@ -240,7 +240,7 @@ public: #ifndef QT_BOOTSTRAPPED void runProcess(QProcess *proc, const QString &command) const; #endif - QByteArray getCommandOutput(const QString &args) const; + QByteArray getCommandOutput(const QString &args, int *exitCode) const; QMakeEvaluator *m_caller; #ifdef PROEVALUATOR_CUMULATIVE diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index ffdf9294b8f..1cd5c71531d 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -1326,9 +1326,9 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir) << true; QTest::newRow("$$system(): bad number of arguments") - << "VAR = $$system(1, 2, 3)" + << "VAR = $$system(1, 2, 3, 4)" << "VAR =" - << "##:1: system(execute) requires one or two arguments." + << "##:1: system(command, [mode], [stsvar]) requires one to three arguments." << true; QTest::newRow("$$unique()") From a4e1bc5b13556f21ff64817a0e2d5981aa3284b0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 Jul 2016 18:10:34 +0200 Subject: [PATCH 092/236] fix 'test' field checking in qtConfOutput_library() Change-Id: I7cfcc33e188713f32d31e023999f5059c0bd05b1 Reviewed-by: Lars Knoll --- mkspecs/features/qt_configure.prf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index aaed0cb2d1f..f4d94c02bc3 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -1086,9 +1086,12 @@ defineTest(qtConfOutput_library) { name = $$eval($${1}.feature) NAME = $$upper($$replace(name, [-.], _)) - lookup = "config.tests.$$eval($${1}.test)" - isEmpty(lookup): \ + test = $$eval($${1}.test) + isEmpty(test): \ error("Output type 'library' used in feature '$$eval($${1}.feature)' without a 'test' entry.") + lookup = "config.tests.$$test" + isEmpty($${lookup}._KEYS_): \ + error("Output type 'library' used in feature '$$eval($${1}.feature)' refers to undefined test '$$test'.") eval(libs = $$eval($${lookup}.libs)) eval(cflags = $$eval($${lookup}.cflags)) From 52b3a81865a39a69dce969bd24327ba89180e116 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 Jul 2016 18:21:00 +0200 Subject: [PATCH 093/236] don't distclean before every compile test run in non-clean build dir due to gmake's Makefile auto-rebuild feature, the distclean would typically invoke qmake. overall, the step would almost double the run time of each compile test. instead, just clean between the regular qmake and make steps. this deletes the object file the test executable depends on, so this is sufficient to trigger a full rebuild. Change-Id: If8e254e172dd169e31fd606d9ef31d9a14f670d8 Reviewed-by: Lars Knoll --- mkspecs/features/qt_configure.prf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index f4d94c02bc3..63ee6a48dbd 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -435,7 +435,8 @@ defineTest(qtConfTest_compile) { qmake_args += "\"INCLUDEPATH *= $$includedir\"" # Clean up after previous run - exists($$test_out_dir/Makefile): qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE distclean") + exists($$test_out_dir/Makefile): \ + QMAKE_MAKE = "$$QMAKE_MAKE clean && $$QMAKE_MAKE" mkpath($$test_out_dir)|error() From 9987b1dc692e257964e64e4b0cea702dd8408efb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 Jul 2016 18:23:05 +0200 Subject: [PATCH 094/236] platform-scope the test executables the arch test is looking for this is clearer, and avoids potential false hits if the target OS is changed without cleaning the build dir first. Change-Id: If88f3c555740dc9ff559c172b4b005ed8bfb60ae Reviewed-by: Lars Knoll --- configure.pri | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.pri b/configure.pri index 4cc1640d6f8..96b0d4ea568 100644 --- a/configure.pri +++ b/configure.pri @@ -59,11 +59,11 @@ defineTest(qtConfTest_architecture) { test = $$eval($${1}.test) test_out_dir = $$shadowed($$QMAKE_CONFIG_TESTS_DIR/$$test) - exists($$test_out_dir/arch): \ + unix:exists($$test_out_dir/arch): \ content = $$cat($$test_out_dir/arch, blob) - else: exists($$test_out_dir/arch.exe): \ + else: win32:exists($$test_out_dir/arch.exe): \ content = $$cat($$test_out_dir/arch.exe, blob) - else: exists($$test_out_dir/libarch.so): \ + else: android:exists($$test_out_dir/libarch.so): \ content = $$cat($$test_out_dir/libarch.so, blob) else: \ error("$$eval($${1}.description) detection binary not found.") From 472332559a9839469679131043bf860108da3f44 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 29 Jul 2016 19:58:33 +0200 Subject: [PATCH 095/236] fix use_gold_linker not being used by compile tests Change-Id: Ib43ddb5174fd2d9b45f3c1a3e6d90f2b8f0dddd1 Reviewed-by: Lars Knoll --- mkspecs/features/qt_configure.prf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 63ee6a48dbd..b3a47a77095 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -402,6 +402,9 @@ defineTest(qtConfTest_compile) { else: \ qmake_configs = "static" + use_gold_linker: \ + qmake_configs += "use_gold_linker" + # add console to the CONFIG variable when running the tests, so that they # can work with a regular main() entry point on Windows. qmake_configs += "console" From bcd0653e10f86b5f9280151684e452fd6de1f36a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 Jul 2016 18:26:55 +0200 Subject: [PATCH 096/236] fix exit paths when pkg-config is not found while the previous code actually worked, it's probably more or less coincidence that running "false" produces the correct result. Change-Id: Ib332bd6789ac7188570ba1af4676494b4e2c9d8c Reviewed-by: Lars Knoll --- mkspecs/features/qt_configure.prf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index b3a47a77095..07338ffe9d5 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -316,8 +316,6 @@ defineReplace(qtConfPkgConfig) { $$host { pkg_config = $$qtConfFindInPath("pkg-config") - isEmpty(pkg_config): \ - return(false) } else { pkg_config = "$$qtConfPkgConfigEnv()$$PKG_CONFIG" } @@ -345,6 +343,8 @@ defineReplace(qtConfPrepareArgs) { defineTest(qtConfTest_pkgConfig) { pkg_config = $$qtConfPkgConfig($$eval($${1}.host)) + isEmpty(pkg_config): \ + return(false) args = $$qtConfPrepareArgs($$eval($${1}.pkg-config-args)) !qtConfPkgConfigPackageExists($$pkg_config, $$args): \ @@ -367,6 +367,8 @@ defineTest(qtConfTest_pkgConfig) { defineTest(qtConfTest_getPkgConfigVariable) { pkg_config = $$qtConfPkgConfig($$eval($${1}.host)) + isEmpty(pkg_config): \ + return(false) args = $$qtConfPrepareArgs($$eval($${1}.pkg-config-args)) !qtConfPkgConfigPackageExists($$pkg_config, $$args): \ From 08f6545dcb37b661e63c42c4996fb4ed737070f4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 Jul 2016 20:43:44 +0200 Subject: [PATCH 097/236] fix over-quoting of OPENSSL_LIBS and QT_HOST_CFLAGS_DBUS we pass the pre-quoted value directly to the output function, which adds another layer of quoting. to avoid over-quoting, introduce the 'eval' attribute which sends the value through eval() first, thus removing the extra quoting. Change-Id: Ic63a50cb7eccc61b0f730476e124339aeb95586c Reviewed-by: Lars Knoll --- configure.json | 4 ++-- mkspecs/features/qt_configure.prf | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/configure.json b/configure.json index 2fbd0f3491a..d9faed3b902 100644 --- a/configure.json +++ b/configure.json @@ -1617,7 +1617,7 @@ "condition": "features.openssl && tests.openssl-libs", "output": [ "publicQtConfig", - { "type": "varAssign", "name": "OPENSSL_LIBS", "value": "tests.openssl-libs.libs" }, + { "type": "varAssign", "name": "OPENSSL_LIBS", "value": "tests.openssl-libs.libs", "eval": "true" }, { "type": "define", "name": "QT_LINKED_OPENSSL" } ] }, @@ -1790,7 +1790,7 @@ "description": "Qt D-Bus (Host)", "autoDetect": "!config.android", "condition": "tests.host-dbus", - "output": [ { "type": "varAppend", "name": "QT_HOST_CFLAGS_DBUS", "value": "tests.host-dbus.cflags" } ] + "output": [ { "type": "varAppend", "name": "QT_HOST_CFLAGS_DBUS", "value": "tests.host-dbus.cflags", "eval": "true" } ] }, "skip_modules": { "output": [ { "type": "varAssign", "name": "QT_SKIP_MODULES", "value": "tests.skip_modules.value" } ] diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 07338ffe9d5..84891a83e5b 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -983,6 +983,8 @@ defineTest(qtConfOutputVarHelper) { error("Output type 'var$$title($$1)' used in feature '$$eval($${2}.feature)' without a 'name' entry.") value = $$qtConfEvaluate($$eval($${2}.value)) + !isEmpty($${2}.eval):$$qtConfEvaluate($$eval($${2}.eval)): \ + eval(value = $$value) qtConfOutputVar($$1, $$output, $$name, $$value) } From d520c825f199ec5f292a5aa2e84d129a8bc95633 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 5 Aug 2016 17:51:23 +0200 Subject: [PATCH 098/236] delete orphaned config tests mitshm, xcursor, xfixes, xrandr, xshape, and xsync were dead for a long time (see also 4cb795cbdb). glxfbconfig was also dead (see also d54b77d55). x11/notype and x11/xkb became dead in 4535913c4f. javascriptcore-jit became dead in 24f1025663. stdint was another webkit vestige (see also 1b716724f7). Change-Id: I04f408cb917c767951645c6445f15f24378fa43a Reviewed-by: Lars Knoll --- .../unix/javascriptcore-jit/hwcap_test.cpp | 44 ------------- .../javascriptcore-jit/javascriptcore-jit.pro | 2 - config.tests/unix/stdint/main.cpp | 47 -------------- config.tests/unix/stdint/stdint.pro | 3 - config.tests/x11/glxfbconfig/glxfbconfig.cpp | 49 -------------- config.tests/x11/glxfbconfig/glxfbconfig.pro | 10 --- config.tests/x11/mitshm/mitshm.cpp | 61 ------------------ config.tests/x11/mitshm/mitshm.pro | 5 -- config.tests/x11/notype.test | 49 -------------- config.tests/x11/notype/notypetest.cpp | 50 --------------- config.tests/x11/notype/notypetest.pro | 5 -- config.tests/x11/xcursor/xcursor.cpp | 64 ------------------- config.tests/x11/xcursor/xcursor.pro | 4 -- config.tests/x11/xfixes/xfixes.cpp | 53 --------------- config.tests/x11/xfixes/xfixes.pro | 3 - config.tests/x11/xrandr/xrandr.cpp | 52 --------------- config.tests/x11/xrandr/xrandr.pro | 4 -- config.tests/x11/xshape/xshape.cpp | 49 -------------- config.tests/x11/xshape/xshape.pro | 3 - config.tests/x11/xsync/xsync.cpp | 54 ---------------- config.tests/x11/xsync/xsync.pro | 3 - 21 files changed, 614 deletions(-) delete mode 100644 config.tests/unix/javascriptcore-jit/hwcap_test.cpp delete mode 100644 config.tests/unix/javascriptcore-jit/javascriptcore-jit.pro delete mode 100644 config.tests/unix/stdint/main.cpp delete mode 100644 config.tests/unix/stdint/stdint.pro delete mode 100644 config.tests/x11/glxfbconfig/glxfbconfig.cpp delete mode 100644 config.tests/x11/glxfbconfig/glxfbconfig.pro delete mode 100644 config.tests/x11/mitshm/mitshm.cpp delete mode 100644 config.tests/x11/mitshm/mitshm.pro delete mode 100755 config.tests/x11/notype.test delete mode 100644 config.tests/x11/notype/notypetest.cpp delete mode 100644 config.tests/x11/notype/notypetest.pro delete mode 100644 config.tests/x11/xcursor/xcursor.cpp delete mode 100644 config.tests/x11/xcursor/xcursor.pro delete mode 100644 config.tests/x11/xfixes/xfixes.cpp delete mode 100644 config.tests/x11/xfixes/xfixes.pro delete mode 100644 config.tests/x11/xrandr/xrandr.cpp delete mode 100644 config.tests/x11/xrandr/xrandr.pro delete mode 100644 config.tests/x11/xshape/xshape.cpp delete mode 100644 config.tests/x11/xshape/xshape.pro delete mode 100644 config.tests/x11/xsync/xsync.cpp delete mode 100644 config.tests/x11/xsync/xsync.pro diff --git a/config.tests/unix/javascriptcore-jit/hwcap_test.cpp b/config.tests/unix/javascriptcore-jit/hwcap_test.cpp deleted file mode 100644 index 560476963a2..00000000000 --- a/config.tests/unix/javascriptcore-jit/hwcap_test.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include - -int main (int argc, char **argv) -{ - return 0; -} diff --git a/config.tests/unix/javascriptcore-jit/javascriptcore-jit.pro b/config.tests/unix/javascriptcore-jit/javascriptcore-jit.pro deleted file mode 100644 index 0d5a20d7f3a..00000000000 --- a/config.tests/unix/javascriptcore-jit/javascriptcore-jit.pro +++ /dev/null @@ -1,2 +0,0 @@ -SOURCES = hwcap_test.cpp -CONFIG -= qt dylib diff --git a/config.tests/unix/stdint/main.cpp b/config.tests/unix/stdint/main.cpp deleted file mode 100644 index f232e8bb854..00000000000 --- a/config.tests/unix/stdint/main.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* Check for the presence of stdint.h */ -#include - -int main() -{ - return 0; -} - diff --git a/config.tests/unix/stdint/stdint.pro b/config.tests/unix/stdint/stdint.pro deleted file mode 100644 index 9975484889b..00000000000 --- a/config.tests/unix/stdint/stdint.pro +++ /dev/null @@ -1,3 +0,0 @@ -SOURCES = main.cpp -CONFIG -= x11 qt - diff --git a/config.tests/x11/glxfbconfig/glxfbconfig.cpp b/config.tests/x11/glxfbconfig/glxfbconfig.cpp deleted file mode 100644 index 9a2a0f166c1..00000000000 --- a/config.tests/x11/glxfbconfig/glxfbconfig.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -int main(int, char **) -{ - GLXFBConfig config; - config = 0; - - return 0; -} diff --git a/config.tests/x11/glxfbconfig/glxfbconfig.pro b/config.tests/x11/glxfbconfig/glxfbconfig.pro deleted file mode 100644 index 65f855a5f2d..00000000000 --- a/config.tests/x11/glxfbconfig/glxfbconfig.pro +++ /dev/null @@ -1,10 +0,0 @@ -SOURCES = glxfbconfig.cpp -CONFIG += x11 -INCLUDEPATH += $$QMAKE_INCDIR_OPENGL - -for(p, QMAKE_LIBDIR_OPENGL) { - exists($$p):LIBS += -L$$p -} - -CONFIG -= qt -LIBS += -lGL diff --git a/config.tests/x11/mitshm/mitshm.cpp b/config.tests/x11/mitshm/mitshm.cpp deleted file mode 100644 index fcc25d6eb49..00000000000 --- a/config.tests/x11/mitshm/mitshm.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifdef Q_OS_HPUX -#error "MITSHM not supported on HP-UX." -#else -#include -#include -#include -#include - -int main(int, char **) -{ - Display *dpy = 0; - int minor; - int major; - int pixmaps; - if (dpy && XShmQueryVersion(dpy, &major, &minor, &pixmaps)) { - minor = 0; - major = 0; - pixmaps = 0; - } - return 0; -} -#endif diff --git a/config.tests/x11/mitshm/mitshm.pro b/config.tests/x11/mitshm/mitshm.pro deleted file mode 100644 index 8a40317d978..00000000000 --- a/config.tests/x11/mitshm/mitshm.pro +++ /dev/null @@ -1,5 +0,0 @@ -SOURCES = mitshm.cpp -CONFIG += x11 -CONFIG -= qt -LIBS += -lXext -hpux*:DEFINES+=Q_OS_HPUX diff --git a/config.tests/x11/notype.test b/config.tests/x11/notype.test deleted file mode 100755 index 3a01d8f1d74..00000000000 --- a/config.tests/x11/notype.test +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -QMKSPEC=$1 -XPLATFORM=`basename $1` -VERBOSE=$2 -SRCDIR=$3 -OUTDIR=$4 - -# debuggery -[ "$VERBOSE" = "yes" ] && echo "Detecting broken X11 headers... ($*)" - -# Detect broken X11 headers when using GCC 2.95 or later -# Xsun on Solaris 2.5.1: -# Patches are available for Solaris 2.6, 7, and 8 but -# not for Solaris 2.5.1. -# HP-UX: -# Patches are available for HP-UX 10.20, 11.00, and 11.11. -# AIX 4.3.3 and AIX 5.1: -# Headers are clearly broken on all AIX versions, and we -# don't know of any patches. The strange thing is that we -# did not get any reports about this issue until very -# recently, long after gcc 3.0.x was released. It seems to -# work for us with gcc 2.95.2. -NOTYPE=no - -if [ $XPLATFORM = "solaris-g++" -o $XPLATFORM = "hpux-g++" -o $XPLATFORM = "aix-g++" -o $XPLATFORM = "aix-g++-64" ]; then - NOTYPE=yes - - test -d "$OUTDIR/config.tests/x11/notype" || mkdir -p "$OUTDIR/config.tests/x11/notype" - "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/x11/notype/notypetest.pro" -o "$OUTDIR/config.tests/x11/notype/Makefile" >/dev/null 2>&1 - cd "$OUTDIR/config.tests/x11/notype" - - if [ "$VERBOSE" = "yes" ]; then - $MAKE - else - $MAKE >/dev/null 2>&1 - fi - - [ -x notypetest ] && NOTYPE=no -fi - -# done -if [ "$NOTYPE" = "yes" ]; then - [ "$VERBOSE" = "yes" ] && echo "Broken X11 headers detected." - exit 0 -else - [ "$VERBOSE" = "yes" ] && echo "X11 headers look good." - exit 1 -fi diff --git a/config.tests/x11/notype/notypetest.cpp b/config.tests/x11/notype/notypetest.cpp deleted file mode 100644 index 1faf4db0566..00000000000 --- a/config.tests/x11/notype/notypetest.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* Sample program for configure to test for broken X11 headers that -confuse gcc 2.95 and better on target platforms such as Solaris. -*/ - -#include -#include - -int main() -{ - return 0; -} diff --git a/config.tests/x11/notype/notypetest.pro b/config.tests/x11/notype/notypetest.pro deleted file mode 100644 index 6ce2c626195..00000000000 --- a/config.tests/x11/notype/notypetest.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE=app -TARGET=notypetest -CONFIG-=qt -CONFIG+=x11 -SOURCES=notypetest.cpp diff --git a/config.tests/x11/xcursor/xcursor.cpp b/config.tests/x11/xcursor/xcursor.cpp deleted file mode 100644 index 990534efeaf..00000000000 --- a/config.tests/x11/xcursor/xcursor.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#if !defined(XCURSOR_LIB_MAJOR) -# define XCURSOR_LIB_MAJOR XCURSOR_MAJOR -#endif -#if !defined(XCURSOR_LIB_MINOR) -# define XCURSOR_LIB_MINOR XCURSOR_MINOR -#endif - -#if XCURSOR_LIB_MAJOR == 1 && XCURSOR_LIB_MINOR >= 0 -# define XCURSOR_FOUND -#else -# define -# error "Required Xcursor version 1.0 not found." -#endif - -int main(int, char **) -{ - XcursorImage *image; - image = 0; - XcursorCursors *cursors; - cursors = 0; - return 0; -} diff --git a/config.tests/x11/xcursor/xcursor.pro b/config.tests/x11/xcursor/xcursor.pro deleted file mode 100644 index b1e69be29ae..00000000000 --- a/config.tests/x11/xcursor/xcursor.pro +++ /dev/null @@ -1,4 +0,0 @@ -SOURCES = xcursor.cpp -CONFIG += x11 -CONFIG -= qt -LIBS += -lXcursor diff --git a/config.tests/x11/xfixes/xfixes.cpp b/config.tests/x11/xfixes/xfixes.cpp deleted file mode 100644 index 12e402f1751..00000000000 --- a/config.tests/x11/xfixes/xfixes.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#if XFIXES_MAJOR < 2 -# error "Required Xfixes version 2.0 not found." -#endif - -int main(int, char **) -{ - XFixesSelectionNotifyEvent event; - event.type = 0; - return 0; -} - diff --git a/config.tests/x11/xfixes/xfixes.pro b/config.tests/x11/xfixes/xfixes.pro deleted file mode 100644 index cc94a11bc27..00000000000 --- a/config.tests/x11/xfixes/xfixes.pro +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG += x11 -CONFIG -= qt -SOURCES = xfixes.cpp diff --git a/config.tests/x11/xrandr/xrandr.cpp b/config.tests/x11/xrandr/xrandr.cpp deleted file mode 100644 index 4fb8a1b94c6..00000000000 --- a/config.tests/x11/xrandr/xrandr.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#if RANDR_MAJOR != 1 || RANDR_MINOR < 1 -# error "Requried Xrandr version 1.1 not found." -#endif - -int main(int, char **) -{ - XRRScreenSize *size; - size = 0; - return 0; -} diff --git a/config.tests/x11/xrandr/xrandr.pro b/config.tests/x11/xrandr/xrandr.pro deleted file mode 100644 index 3fb2910b5ef..00000000000 --- a/config.tests/x11/xrandr/xrandr.pro +++ /dev/null @@ -1,4 +0,0 @@ -SOURCES = xrandr.cpp -CONFIG += x11 -CONFIG -= qt -LIBS += -lXrender -lXrandr diff --git a/config.tests/x11/xshape/xshape.cpp b/config.tests/x11/xshape/xshape.cpp deleted file mode 100644 index 804a9d044eb..00000000000 --- a/config.tests/x11/xshape/xshape.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -int main(int, char **) -{ - XShapeEvent shapeevent; - shapeevent.type = 0; - return 0; -} diff --git a/config.tests/x11/xshape/xshape.pro b/config.tests/x11/xshape/xshape.pro deleted file mode 100644 index 611c048e39b..00000000000 --- a/config.tests/x11/xshape/xshape.pro +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG += x11 -CONFIG -= qt -SOURCES = xshape.cpp diff --git a/config.tests/x11/xsync/xsync.cpp b/config.tests/x11/xsync/xsync.cpp deleted file mode 100644 index 48feefdb4a6..00000000000 --- a/config.tests/x11/xsync/xsync.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -extern "C" { -#include -} - -int main(int, char **) -{ - XSyncValue value; - (void*)&XSyncIntToValue; - (void*)&XSyncCreateCounter; - int a, b; - Status ret = XSyncInitialize(NULL, &a, &b); - return ret; -} diff --git a/config.tests/x11/xsync/xsync.pro b/config.tests/x11/xsync/xsync.pro deleted file mode 100644 index 58b82383ea3..00000000000 --- a/config.tests/x11/xsync/xsync.pro +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG += x11 -CONFIG -= qt -SOURCES = xsync.cpp From 9945763cabbe807a30a829499316a769f97f2869 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 5 Aug 2016 10:41:59 +0200 Subject: [PATCH 099/236] remove redundant x11 handling one of the effects of CONFIG+=x11 is LIBS+=$$QMAKE_LIBS_X11, so it's positively pointless for project files to do the same. Change-Id: I4085acd6254401897b34e131c2cb57f1f76a3638 Reviewed-by: Lars Knoll --- tests/auto/opengl/qglthreads/qglthreads.pro | 7 ------- tests/auto/widgets/kernel/qwidget/qwidget.pro | 4 ---- .../auto/widgets/kernel/qwidget_window/qwidget_window.pro | 5 ----- 3 files changed, 16 deletions(-) diff --git a/tests/auto/opengl/qglthreads/qglthreads.pro b/tests/auto/opengl/qglthreads/qglthreads.pro index ab8bda741e7..9aa21fb3a26 100644 --- a/tests/auto/opengl/qglthreads/qglthreads.pro +++ b/tests/auto/opengl/qglthreads/qglthreads.pro @@ -5,10 +5,3 @@ QT += opengl widgets testlib gui-private core-private HEADERS += tst_qglthreads.h SOURCES += tst_qglthreads.cpp - -x11 { - LIBS += $$QMAKE_LIBS_X11 -} - - - diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro index ba4e51a4161..499ca65516c 100644 --- a/tests/auto/widgets/kernel/qwidget/qwidget.pro +++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro @@ -16,8 +16,4 @@ mac { OBJECTIVE_SOURCES += tst_qwidget_mac_helpers.mm } -x11 { - LIBS += $$QMAKE_LIBS_X11 -} - win32:!winrt: LIBS += -luser32 -lgdi32 diff --git a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro index 8672c363a25..a6248dfd168 100644 --- a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro +++ b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro @@ -2,8 +2,3 @@ CONFIG += testcase TARGET = tst_qwidget_window QT += widgets testlib core-private gui-private SOURCES += tst_qwidget_window.cpp - -x11 { - LIBS += $$QMAKE_LIBS_X11 -} - From 337ce2fa68030638efdf140d1f6d936c6762ea98 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 9 Aug 2016 14:19:53 +0200 Subject: [PATCH 100/236] rename the eglfs-* tests the test names should be about the dependency, not the purpose. Change-Id: I6e45f4caa36e6c6a9e62092416bcab89893db3d2 Reviewed-by: Lars Knoll --- configure.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/configure.json b/configure.json index d9faed3b902..727fdb73bf6 100644 --- a/configure.json +++ b/configure.json @@ -701,23 +701,23 @@ "test": "qpa/egl-x11", "pkg-config-args": "egl" }, - "eglfs-brcm": { + "egl-brcm": { "description": "Broadcom EGL (Rasberry Pi)", "type": "compile", "test": "qpa/eglfs-brcm", "pkg-config-args": "egl" }, - "eglfs-egldevice": { + "egl-egldevice": { "description": "EGLDevice", "type": "compile", "test": "qpa/eglfs-egldevice" }, - "eglfs-mali": { + "egl-mali": { "description": "Mali EGL", "type": "compile", "test": "qpa/eglfs-mali" }, - "eglfs-viv": { + "egl-viv": { "description": "i.Mx6 EGL", "type": "compile", "test": "qpa/eglfs-viv" @@ -1840,12 +1840,12 @@ }, "eglfs_brcm": { "description": "EGLFS Rasberry Pi", - "condition": "features.eglfs && tests.eglfs-brcm", + "condition": "features.eglfs && tests.egl-brcm", "output": [ "publicQtConfig" ] }, "eglfs_egldevice": { "description": "EGLFS EGLDevice", - "condition": "features.eglfs && tests.eglfs-egldevice", + "condition": "features.eglfs && tests.egl-egldevice", "output": [ "publicQtConfig" ] }, "eglfs_gbm": { @@ -1855,12 +1855,12 @@ }, "eglfs_mali": { "description": "EGLFS Mali", - "condition": "features.eglfs && tests.eglfs-mali", + "condition": "features.eglfs && tests.egl-mali", "output": [ "publicQtConfig" ] }, "eglfs_viv": { "description": "EGLFS i.Mx6", - "condition": "features.eglfs && tests.eglfs-viv", + "condition": "features.eglfs && tests.egl-viv", "output": [ "publicQtConfig" ] }, "eglfs_viv_wl": { From 1e6b403ecc8aa4ab34c1516f503d926b60d0d785 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 3 Aug 2016 17:56:10 +0200 Subject: [PATCH 101/236] restore lost egl-mali-2 test Change-Id: I6e9e8244768d7e702a8a20ed18f5f0293dfefead Reviewed-by: Lars Knoll --- configure.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/configure.json b/configure.json index 727fdb73bf6..6f12123caee 100644 --- a/configure.json +++ b/configure.json @@ -717,6 +717,11 @@ "type": "compile", "test": "qpa/eglfs-mali" }, + "egl-mali-2": { + "description": "Mali 2 EGL", + "type": "compile", + "test": "qpa/eglfs-mali-2" + }, "egl-viv": { "description": "i.Mx6 EGL", "type": "compile", @@ -1855,7 +1860,7 @@ }, "eglfs_mali": { "description": "EGLFS Mali", - "condition": "features.eglfs && tests.egl-mali", + "condition": "features.eglfs && (tests.egl-mali || tests.egl-mali-2)", "output": [ "publicQtConfig" ] }, "eglfs_viv": { From 4f8b40d74e1840f9e9c266dd86bdd907d2959287 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 3 Aug 2016 19:10:09 +0200 Subject: [PATCH 102/236] make the egl-viv and egl-brcm config tests less convoluted don't mix in gles2 stuff, and rely on the library definitions from the mkspec. Change-Id: Id81b27a8c4f24729866d3ceb5cf97b443def542c Reviewed-by: Lars Knoll --- config.tests/qpa/eglfs-brcm/eglfs-brcm.cpp | 1 - config.tests/qpa/eglfs-viv/eglfs-viv.cpp | 1 - config.tests/qpa/eglfs-viv/eglfs-viv.pro | 4 +--- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/config.tests/qpa/eglfs-brcm/eglfs-brcm.cpp b/config.tests/qpa/eglfs-brcm/eglfs-brcm.cpp index 8a46ec9fff3..e6ba06f89b9 100644 --- a/config.tests/qpa/eglfs-brcm/eglfs-brcm.cpp +++ b/config.tests/qpa/eglfs-brcm/eglfs-brcm.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include -#include #include int main(int, char **) diff --git a/config.tests/qpa/eglfs-viv/eglfs-viv.cpp b/config.tests/qpa/eglfs-viv/eglfs-viv.cpp index 96935a2aa0b..e6e17919dc7 100644 --- a/config.tests/qpa/eglfs-viv/eglfs-viv.cpp +++ b/config.tests/qpa/eglfs-viv/eglfs-viv.cpp @@ -39,7 +39,6 @@ #include #include -#include int main(int, char **) { diff --git a/config.tests/qpa/eglfs-viv/eglfs-viv.pro b/config.tests/qpa/eglfs-viv/eglfs-viv.pro index 3b36dc533fd..1617ee38ad1 100644 --- a/config.tests/qpa/eglfs-viv/eglfs-viv.pro +++ b/config.tests/qpa/eglfs-viv/eglfs-viv.pro @@ -6,9 +6,7 @@ integrity { } CONFIG -= qt -LIBS += -lEGL -lGLESv2 -lGAL - -for(p, QMAKE_LIBDIR_OPENGL_ES2) { +for(p, QMAKE_LIBDIR_OPENGL_EGL) { exists($$p):LIBS += -L$$p } From 46cb5a4dce74671efed44ba45e10472795d9813f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 4 Aug 2016 19:05:09 +0200 Subject: [PATCH 103/236] make it impossible to lie about the feature an output belongs to overriding an output's 'feature' field would just lead to confusing error messages. the right way is setting the 'name' field. adjust the 'dbus' library output to this policy. Change-Id: I912133f3a0a50fc55f2e16a1ed6bfa464aae8d88 Reviewed-by: Lars Knoll --- configure.json | 2 +- mkspecs/features/qt_configure.prf | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/configure.json b/configure.json index 6f12123caee..6f4ab05499f 100644 --- a/configure.json +++ b/configure.json @@ -1788,7 +1788,7 @@ "condition": "features.dbus && tests.dbus", "output": [ "publicQtConfig", - { "type": "library", "feature": "dbus", "test": "dbus" } + { "type": "library", "name": "dbus", "test": "dbus" } ] }, "host-dbus": { diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 84891a83e5b..b2d1817d167 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -1134,15 +1134,13 @@ defineTest(qtConfProcessOneOutput) { !defined("qtConfOutput_$$call", test): \ error("Undefined type '$$call' in output '$$2' of feature '$$feature'.") - isEmpty($${opfx}.feature): \ - $${opfx}.feature = $$feature - condition = $$eval($${opfx}.condition) !isEmpty(condition) { !$$qtConfEvaluate($$condition): \ return(false) } + $${opfx}.feature = $$feature qtConfOutput_$${call}($$opfx, $$eval($${fpfx}.available)) } From e7183f26f16db503a6c2a8e4243d2f4ede3326d4 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 9 Aug 2016 13:28:28 +0300 Subject: [PATCH 104/236] AtSpiAdaptor: fix 'defined' field in GetAttributeValue Value was inverted. Found by own code review. Change-Id: I2027d97e1f9d52f6d79fb72ecad9ee2034f9af25 Reviewed-by: Frederik Gladhorn --- src/platformsupport/linuxaccessibility/atspiadaptor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index f902ec230be..ad77a8977ad 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -2079,7 +2079,6 @@ QVariantList AtSpiAdaptor::getAttributeValue(QAccessibleInterface *interface, in QSpiAttributeSet map; int startOffset; int endOffset; - bool defined; joined = interface->textInterface()->attributes(offset, &startOffset, &endOffset); attributes = joined.split (QLatin1Char(';'), QString::SkipEmptyParts, Qt::CaseSensitive); @@ -2091,7 +2090,7 @@ QVariantList AtSpiAdaptor::getAttributeValue(QAccessibleInterface *interface, in map[attribute.name] = attribute.value; } mapped = map[attributeName]; - defined = mapped.isEmpty(); + const bool defined = !mapped.isEmpty(); QVariantList list; list << mapped << startOffset << endOffset << defined; return list; From 08a3a52958b1a6cec46c3afb82b69d3dcf7ed859 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 5 Aug 2016 21:10:41 +0300 Subject: [PATCH 105/236] Remove ~tst_QImageWriter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test no longer writes to SRCDIR, so don't try to remove generated files from there, either. Amends bb5570082ecbb1494fd39a971f722cc159bf213a. Change-Id: I1d5df88b1865f3dbd914ec71147de61e173f2f4e Reviewed-by: JÄ™drzej Nowacki --- .../auto/gui/image/qimagewriter/tst_qimagewriter.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index 0347ef88100..dfefd6f0364 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -62,7 +62,6 @@ class tst_QImageWriter : public QObject public: tst_QImageWriter(); - virtual ~tst_QImageWriter(); public slots: void init(); @@ -167,16 +166,6 @@ tst_QImageWriter::tst_QImageWriter() { } -tst_QImageWriter::~tst_QImageWriter() -{ - QDir dir(prefix); - QStringList filesToDelete = dir.entryList(QStringList() << "gen-*" , QDir::NoDotAndDotDot | QDir::Files); - foreach( QString file, filesToDelete) { - QFile::remove(dir.absoluteFilePath(file)); - } - -} - void tst_QImageWriter::init() { } From 3b0ea7860372339fd557dc1affbf1001a524d5b5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 9 Aug 2016 13:15:53 +0300 Subject: [PATCH 106/236] tst_QSslSocket::setLocalCertificateChain(): fix resource leak when test fail The deleteLater() call wasn't reliably reached when tests fail, so use a QScopedPointer with QScopedPointerDeleteLater deleter. Change-Id: Ica73bc73c2a0ac1e9b77e4804f2aedcad9b662a0 Reviewed-by: Timur Pocheptsov Reviewed-by: Richard J. Moore --- tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index 7846dc99c55..2d35081dff3 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -1390,7 +1390,8 @@ void tst_QSslSocket::setLocalCertificateChain() QEventLoop loop; QTimer::singleShot(5000, &loop, SLOT(quit())); - socket = new QSslSocket(); + const QScopedPointer client(new QSslSocket); + socket = client.data(); connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit())); connect(socket, SIGNAL(sslErrors(QList)), this, SLOT(ignoreErrorSlot())); @@ -1402,8 +1403,6 @@ void tst_QSslSocket::setLocalCertificateChain() QCOMPARE(chain.size(), 2); QCOMPARE(chain[0].serialNumber(), QByteArray("10:a0:ad:77:58:f6:6e:ae:46:93:a3:43:f9:59:8a:9e")); QCOMPARE(chain[1].serialNumber(), QByteArray("3b:eb:99:c5:ea:d8:0b:5d:0b:97:5d:4f:06:75:4b:e1")); - - socket->deleteLater(); } void tst_QSslSocket::setPrivateKey() From 04e676c03cf7c320bd5c5a21dfcb62613af711b6 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Sat, 26 Mar 2016 15:28:19 +0200 Subject: [PATCH 107/236] QAbstractSocket: prevent waitForReadyRead() from early exit According to documentation, waitForReadyRead() returns 'true' if the readyRead() signal is emitted and there is new data available for reading. Thus, waitForReadyRead() is being blocked in cycle until canReadNotification() will return 'true'. This patch adjusts canReadNotification() to return 'true' only when new data arrives on buffered socket that ensures waitForReadyRead() to succeed correctly. Change-Id: Ic38c4a4dd8ef9128f04b6c1d5f3d03068f6c9894 Reviewed-by: Thiago Macieira --- src/network/socket/qabstractsocket.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 88237dc4167..ccb63f4716e 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -687,10 +687,11 @@ bool QAbstractSocketPrivate::canReadNotification() socketEngine->setReadNotificationEnabled(false); // If buffered, read data from the socket into the read buffer - qint64 newBytes = 0; if (isBuffered) { + const qint64 oldBufferSize = buffer.size(); + // Return if there is no space in the buffer - if (readBufferMaxSize && buffer.size() >= readBufferMaxSize) { + if (readBufferMaxSize && oldBufferSize >= readBufferMaxSize) { #if defined (QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::canReadNotification() buffer is full"); #endif @@ -699,7 +700,6 @@ bool QAbstractSocketPrivate::canReadNotification() // If reading from the socket fails after getting a read // notification, close the socket. - newBytes = buffer.size(); if (!readFromSocket()) { #if defined (QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::canReadNotification() disconnecting socket"); @@ -707,7 +707,13 @@ bool QAbstractSocketPrivate::canReadNotification() q->disconnectFromHost(); return false; } - newBytes = buffer.size() - newBytes; + + // Return if there is no new data available. + if (buffer.size() == oldBufferSize) { + // If the socket is opened only for writing, return true + // to indicate that the data was discarded. + return !q->isReadable(); + } // If read buffer is full, disable the read socket notifier. if (readBufferMaxSize && buffer.size() == readBufferMaxSize) { @@ -715,9 +721,7 @@ bool QAbstractSocketPrivate::canReadNotification() } } - // Only emit readyRead() if there is data available. - if (newBytes > 0 || !isBuffered) - emitReadyRead(); + emitReadyRead(); // If we were closed as a result of the readyRead() signal, // return. From 615b9c1f06c1d95da5bfad7dca2b27e4fbaaada8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 Jul 2016 20:46:24 +0200 Subject: [PATCH 108/236] make sure that we capture the entire test command's output the command can be a compound statement (usually 'foo && bar' style), so enclose it in parens before redirecting stderr. Change-Id: Ib72a2c8ddfd17bf9457e9cfe2652121258ce9a64 Reviewed-by: Lars Knoll --- mkspecs/features/configure_base.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/configure_base.prf b/mkspecs/features/configure_base.prf index 3397a7703e2..31e81164904 100644 --- a/mkspecs/features/configure_base.prf +++ b/mkspecs/features/configure_base.prf @@ -33,7 +33,7 @@ defineTest(qtLog) { defineTest(qtRunLoggedCommand) { qtLog($$1) - output = $$system("$$1 2>&1", blob, result) + output = $$system("( $$1 ) 2>&1", blob, result) write_file($${QMAKE_CONFIG_LOG}, output, append) $$QMAKE_CONFIG_VERBOSE: log($$output) From f18cc7e3cc21c6a318f28077294400d5b7fe90cf Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Aug 2016 09:42:14 +0200 Subject: [PATCH 109/236] fix configure qtLog() its actual function was qtLogCommand(), but all callers outside configure_base.prf apparently didn't know that. adjust implementation. Change-Id: I910d4ba33c6f31debc81c37e3bfff1a288190355 Reviewed-by: Lars Knoll --- mkspecs/features/configure_base.prf | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mkspecs/features/configure_base.prf b/mkspecs/features/configure_base.prf index 31e81164904..b19bbae51da 100644 --- a/mkspecs/features/configure_base.prf +++ b/mkspecs/features/configure_base.prf @@ -25,13 +25,12 @@ QMAKE_MAKE = "$${SETENV_PFX}MAKEFLAGS=$$SETENV_SFX $$QMAKE_MAKE" isEmpty(QMAKE_CONFIG_VERBOSE): QMAKE_CONFIG_VERBOSE = false defineTest(qtLog) { - msg = "+ $$1" - write_file($$QMAKE_CONFIG_LOG, msg, append) - $$QMAKE_CONFIG_VERBOSE: log("$$msg$$escape_expand(\\n)") + write_file($$QMAKE_CONFIG_LOG, 1, append) + $$QMAKE_CONFIG_VERBOSE: log("$$1$$escape_expand(\\n)") } defineTest(qtRunLoggedCommand) { - qtLog($$1) + qtLog("+ $$1") output = $$system("( $$1 ) 2>&1", blob, result) write_file($${QMAKE_CONFIG_LOG}, output, append) From 622ab0aca5a35396b7369effc346a81fbbefd8b1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Aug 2016 13:04:12 +0200 Subject: [PATCH 110/236] use qtLog() to also print command output Change-Id: I950bc86b0b2dafcb8f2369478f391dc05280194f Reviewed-by: Lars Knoll --- mkspecs/features/configure_base.prf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mkspecs/features/configure_base.prf b/mkspecs/features/configure_base.prf index b19bbae51da..f62142f84d5 100644 --- a/mkspecs/features/configure_base.prf +++ b/mkspecs/features/configure_base.prf @@ -33,8 +33,7 @@ defineTest(qtRunLoggedCommand) { qtLog("+ $$1") output = $$system("( $$1 ) 2>&1", blob, result) - write_file($${QMAKE_CONFIG_LOG}, output, append) - $$QMAKE_CONFIG_VERBOSE: log($$output) + qtLog($$output) !equals(result, 0): return(false) return(true) From b093aec1d15679384f826a630d5b44aed719b2dd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Aug 2016 10:10:32 +0200 Subject: [PATCH 111/236] don't use error() for user errors, take 2 missed configure.pri previously. Change-Id: Ie642526a830ca6471d3f92507c7b22c812db0d86 Reviewed-by: Lars Knoll --- configure.pri | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.pri b/configure.pri index 96b0d4ea568..526a4bb7117 100644 --- a/configure.pri +++ b/configure.pri @@ -15,10 +15,10 @@ defineTest(qtConfCommandline_cxxstd) { qtConfCommandlineSetInput("c++14", "yes") qtConfCommandlineSetInput("c++1z", "yes") } else { - error("Invalid argument $$val to command line parameter $$arg") + qtConfAddError("Invalid argument $$val to command line parameter $$arg") } } else { - error("Missing argument to command line parameter $$arg") + qtConfAddError("Missing argument to command line parameter $$arg") } } @@ -36,10 +36,10 @@ defineTest(qtConfCommandline_sanitize) { } else: equals(val, "undefined") { qtConfCommandlineSetInput("sanitize_undefined", "yes") } else { - error("Invalid argument $$val to command line parameter $$arg") + qtConfAddError("Invalid argument $$val to command line parameter $$arg") } } else { - error("Missing argument to command line parameter $$arg") + qtConfAddError("Missing argument to command line parameter $$arg") } } From e23471abc0ced787fcae5adec99b5358919d916c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 Jul 2016 15:57:43 +0200 Subject: [PATCH 112/236] fix quoting in the basic qmake command construction ... and refactor it to make it less scary. note that "qmake_args" now basically means "qmake + args". Change-Id: Ifa5b756642de95e2aadf01606d936ea1d7a18210 Reviewed-by: Lars Knoll --- mkspecs/features/qt_configure.prf | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index b2d1817d167..711eec8a2cd 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -394,8 +394,12 @@ defineTest(qtConfTest_compile) { test_dir = $$test_dir/$$eval($${1}.pro) test_cmd_base = "cd $$system_quote($$system_path($$test_out_dir)) &&" + qmake_args = $$qtConfPkgConfigEnv()$$system_quote($$system_path($$QMAKE_QMAKE)) + !isEmpty(QMAKE_QTCONF): \ + qmake_args += -qtconf $$system_quote($$QMAKE_QTCONF) + # Disable qmake features which are typically counterproductive for tests - qmake_args = "\"CONFIG -= qt debug_and_release app_bundle lib_bundle\"" + qmake_args += "\"CONFIG -= qt debug_and_release app_bundle lib_bundle\"" # allow tests to behave differently depending on the type of library # being built (shared/static). e.g. see config.tests/unix/icu @@ -445,12 +449,10 @@ defineTest(qtConfTest_compile) { mkpath($$test_out_dir)|error() - !isEmpty(QMAKE_QTCONF): qtconfarg = -qtconf $$QMAKE_QTCONF - # add possible command line args qmake_args += $$qtConfPrepareArgs($$eval($${1}.args)) - qtRunLoggedCommand("$$test_cmd_base $$qtConfPkgConfigEnv()$$system_quote($$system_path($$QMAKE_QMAKE)) $$qtconfarg $$qmake_args $$shell_quote($$test_dir)") { + qtRunLoggedCommand("$$test_cmd_base $$qmake_args $$system_quote($$test_dir)") { qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE"): \ return(true) } From c41dd40bff781df2aa570066159a72b823d159e7 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 4 Jul 2016 10:44:39 +0200 Subject: [PATCH 113/236] Fix ssl handling in configure to be compatible with configure.exe Change-Id: I0fdd3aebaa9d2a4c68ee6ebc0b7a24868f3c2aa5 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- configure.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.json b/configure.json index 6f4ab05499f..976903fd517 100644 --- a/configure.json +++ b/configure.json @@ -162,6 +162,7 @@ "sse3": "boolean", "sse4.1": { "type": "boolean", "name": "sse4_1" }, "sse4.2": { "type": "boolean", "name": "sse4_2" }, + "ssl": "boolean", "ssse3": "boolean", "static": { "type": "enum", "name": "shared", "values": { "yes": "no", "no": "yes" } }, "strip": "boolean", @@ -1600,6 +1601,7 @@ }, "securetransport": { "description": "SecureTransport", + "disable": "input.securetransport == 'no' || input.ssl == 'no'", "condition": "config.darwin && (input.openssl == '' || input.openssl == 'no')", "output": [ "publicQtConfig", @@ -1609,6 +1611,7 @@ "openssl": { "description": "OpenSSL", "enable": "input.openssl == 'yes' || input.openssl == 'linked' || input.openssl == 'runtime'", + "disable": "input.openssl == 'no' || input.ssl == 'no'", "condition": "!features.securetransport && tests.openssl", "output": [ { "type": "publicQtConfig", "condition": "!features.openssl-linked" }, From 30cac3ed2d5c24ce151911dec59fb6f6cf8ca6c6 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 5 Aug 2016 17:58:02 +0200 Subject: [PATCH 114/236] refactor the configure help output - remove the redundantly listed -no-* options and indicate the defaults differently - completely regroup the options into somewhat logical sections Change-Id: Iaa87c2f3749944cd3fc2ec18975767c04892f746 Reviewed-by: Lars Knoll --- config_help.txt | 692 ++++++++++++++++++------------------------------ 1 file changed, 263 insertions(+), 429 deletions(-) diff --git a/config_help.txt b/config_help.txt index 2ea2a812e42..944e5201184 100644 --- a/config_help.txt +++ b/config_help.txt @@ -1,431 +1,265 @@ Usage: configure [options] -Installation options: - - These are optional, but you may specify install directories. - - -prefix ...... The deployment directory, as seen on the target device. - (default /usr/local/Qt-$QT_VERSION, $PWD if -developer-build is active) - - -extprefix ... The installation directory, as seen on the host machine. - (default SYSROOT/PREFIX) - - -hostprefix [dir] .. The installation directory for build tools running on the - host machine. If [dir] is not given, the current build - directory will be used. (default EXTPREFIX) - - You may use these to change the layout of the install. Note that all directories - except -sysconfdir should be located under -prefix/-hostprefix: - - -bindir ......... User executables will be installed to - (default PREFIX/bin) - -headerdir ...... Headers will be installed to - (default PREFIX/include) - -libdir ......... Libraries will be installed to - (default PREFIX/lib) - -archdatadir .... Arch-dependent data used by Qt will be installed to - (default PREFIX) - -plugindir ...... Plugins will be installed to - (default ARCHDATADIR/plugins) - -libexecdir ..... Program executables will be installed to - (default ARCHDATADIR/libexec, ARCHDATADIR/bin for MinGW) - -importdir ...... Imports for QML1 will be installed to - (default ARCHDATADIR/imports) - -qmldir ......... Imports for QML2 will be installed to - (default ARCHDATADIR/qml) - -datadir ........ Arch-independent data used by Qt will be installed to - (default PREFIX) - -docdir ......... Documentation will be installed to - (default DATADIR/doc) - -translationdir . Translations of Qt programs will be installed to - (default DATADIR/translations) - -sysconfdir ..... Settings used by Qt programs will be looked for in - (default PREFIX/etc/xdg) - -examplesdir .... Examples will be installed to - (default PREFIX/examples) - -testsdir ....... Tests will be installed to - (default PREFIX/tests) - - -hostbindir ..... Host executables will be installed to - (default HOSTPREFIX/bin) - -hostlibdir ..... Host libraries will be installed to - (default HOSTPREFIX/lib) - -hostdatadir .... Data used by qmake will be installed to - (default HOSTPREFIX) - -Configure options: - - The defaults (*) are usually acceptable. A plus (+) denotes a default value - that needs to be evaluated. If the evaluation succeeds, the feature is - included. Here is a short explanation of each option: - - * -release ............. Compile and link Qt with debugging turned off. - -debug ............... Compile and link Qt with debugging turned on. - -debug-and-release ... Compile and link two versions of Qt, with and without - debugging turned on (Apple platforms only). - - -force-debug-info .... Create symbol files for release builds. - - -developer-build ..... Compile and link Qt with Qt developer options (including auto-tests exporting) - - * -no-optimized-tools .. Do not build optimized host tools even in debug build. - -optimized-tools ..... Build optimized host tools even in debug build. - - -opensource .......... Compile and link the Open-Source Edition of Qt. - -commercial .......... Compile and link the Commercial Edition of Qt. - - -confirm-license ..... Automatically acknowledge the license (use with - either -opensource or -commercial) - - -c++std .... Compile Qt with C++ standard edition (c++11, c++14, c++1z) - Default: highest supported - - * -shared .............. Create and use shared Qt libraries. - -static .............. Create and use static Qt libraries. - - -no-accessibility .... Do not compile Accessibility support. - Disabling accessibility is not recommended, as it will break QStyle - and may break other internal parts of Qt. - With this switch you create a source incompatible version of Qt, - which is unsupported. - + -accessibility ....... Compile Accessibility support. - - -no-sql- ..... Disable SQL . - -sql- Enable SQL plugin. - - Possible values for : - [db2, ibase, mysql, oci, odbc, psql, sqlite, sqlite2, tds] - - -system-sqlite ....... Use sqlite from the operating system. - - -no-qml-debug ........ Do not build the in-process QML debugging support. - + -qml-debug ........... Build the QML debugging support. - - -platform target ..... The operating system and compiler you are building - on (default detected from host system). - - See the README file for a list of supported - operating systems and compilers. - - -no-sse2 ............. Do not compile with use of SSE2 instructions. - -no-sse3 ............. Do not compile with use of SSE3 instructions. - -no-ssse3 ............ Do not compile with use of SSSE3 instructions. - -no-sse4.1 ........... Do not compile with use of SSE4.1 instructions. - -no-sse4.2 ........... Do not compile with use of SSE4.2 instructions. - -no-avx .............. Do not compile with use of AVX instructions. - -no-avx2 ............. Do not compile with use of AVX2 instructions. - -no-avx512 ........... Do not compile with use of AVX512 instructions. - -no-mips_dsp ......... Do not compile with use of MIPS DSP instructions. - -no-mips_dspr2 ....... Do not compile with use of MIPS DSP rev2 instructions. - - -qtnamespace .. Wraps all Qt library code in 'namespace {...}'. - -qtlibinfix .. Renames all libQt*.so to libQt*.so. - - -testcocoon .......... Instrument Qt with the TestCocoon code coverage tool. - -gcov ................ Instrument Qt with the GCov code coverage tool. - - -D .......... Add an explicit define to the preprocessor. - -I .......... Add an explicit include path. - -L .......... Add an explicit library path. - - + -pkg-config .......... Use pkg-config to detect include and library paths. By default, - configure determines whether to use pkg-config or not with - some heuristics such as checking the environment variables. - -no-pkg-config ....... Disable use of pkg-config. - -force-pkg-config .... Force usage of pkg-config (skips pkg-config usability - detection heuristic). - - -help, -h ............ Display this information. - -Third Party Libraries: - - -qt-zlib ............. Use the zlib bundled with Qt. - + -system-zlib ......... Use zlib from the operating system. - See http://www.gzip.org/zlib - - -no-mtdev ............ Do not compile mtdev support. - + -mtdev ............... Enable mtdev support. - - + -no-journald ......... Do not send logging output to journald. - -journald ............ Send logging output to journald. - - + -no-syslog ........... Do not send logging output to syslog. - -syslog .............. Send logging output to syslog. - - -no-gif .............. Do not compile GIF reading support. - - -no-libpng ........... Do not compile PNG support. - -qt-libpng ........... Use the libpng bundled with Qt. - + -system-libpng ....... Use libpng from the operating system. - See http://www.libpng.org/pub/png - - -no-libjpeg .......... Do not compile JPEG support. - -qt-libjpeg .......... Use the libjpeg bundled with Qt. - + -system-libjpeg ...... Use libjpeg from the operating system. - See http://www.ijg.org - - -no-doubleconversion ..... Use sscanf_l and snprintf_l for (imprecise) double conversion. - -qt-doubleconversion ..... Use the libdouble-conversion bundled with Qt. - + -system-doubleconversion . Use the libdouble-conversion provided by the system. - See https://github.com/google/double-conversion - - -no-freetype ......... Do not compile in Freetype2 support. - -qt-freetype ......... Use the libfreetype bundled with Qt. - + -system-freetype...... Use the libfreetype provided by the system (enabled if -fontconfig is active). - See http://www.freetype.org - - -no-harfbuzz ......... Do not compile HarfBuzz-NG support. - -qt-harfbuzz ......... Use HarfBuzz-NG bundled with Qt to do text shaping. - It can still be disabled by setting - the QT_HARFBUZZ environment variable to "old". - + -system-harfbuzz ..... Use HarfBuzz-NG from the operating system - to do text shaping. It can still be disabled - by setting the QT_HARFBUZZ environment variable to "old". - See http://www.harfbuzz.org - - -no-openssl .......... Do not compile support for OpenSSL. - + -openssl ............. Enable run-time OpenSSL support. - -openssl-linked ...... Enabled linked OpenSSL support. - - * -no-libproxy ......... Do not compile support for libproxy - -libproxy ............ Use libproxy from the operating system. - - -qt-pcre ............. Use the PCRE library bundled with Qt. - + -system-pcre ......... Use the PCRE library from the operating system. - - -qt-xcb .............. Use xcb- libraries bundled with Qt. - (libxcb.so will still be used from operating system). - + -system-xcb .......... Use xcb- libraries from the operating system. - - -xkb-config-root ..... Set default XKB config root. This option is used only together with -qt-xkbcommon-x11. - -qt-xkbcommon-x11 .... Use the xkbcommon library bundled with Qt in combination with xcb. - + -system-xkbcommon-x11 Use the xkbcommon library from the operating system in combination with xcb. - - -no-xkbcommon-evdev .. Do not use X-less xkbcommon when compiling libinput support. - * -xkbcommon-evdev ..... Use X-less xkbcommon when compiling libinput support. - - -no-xinput2 .......... Do not compile XInput2 support. - * -xinput2 ............. Compile XInput2 support. - - -no-xcb-xlib.......... Do not compile Xcb-Xlib support. - * -xcb-xlib............. Compile Xcb-Xlib support. - - -no-glib ............. Do not compile Glib support. - + -glib ................ Compile Glib support. - - -no-pulseaudio ....... Do not compile PulseAudio support. - + -pulseaudio .......... Compile PulseAudio support. - - -no-alsa ............. Do not compile ALSA support. - + -alsa ................ Compile ALSA support. - - -no-gtk .............. Do not compile GTK platform theme support. - + -gtk ................. Compile GTK platform theme support. - -Additional options: - - -make ......... Add part to the list of parts to be built at make time. - (defaults to: libs tools examples) - -nomake ....... Exclude part from the list of parts to be built. - - -skip ....... Exclude an entire module from the build. - - -no-compile-examples . Install only the sources of examples. - - -no-gui .............. Don't build the Qt GUI module and dependencies. - + -gui ................. Build the Qt GUI module and dependencies. - - -no-widgets .......... Don't build the Qt Widgets module and dependencies. - + -widgets ............. Build the Qt Widgets module and dependencies. - - -R .......... Add an explicit runtime library path to the Qt - libraries. - - -no-rpath ............ Do not use the library install path as a runtime - library path. On Apple platforms, this implies using - absolute install names (based in -libdir) for dynamic - libraries and frameworks. - + -rpath ............... Link Qt libraries and executables using the library - install path as a runtime library path. Equivalent - to -R install_libpath - - -continue ............ Continue as far as possible if an error occurs. - - -verbose, -v ......... Print verbose information about each step of the - configure process. - - -silent .............. Reduce the build output so that warnings and errors - can be seen more easily. - - -no-cups ............. Do not compile CUPS support. - * -cups ................ Compile CUPS support. - Requires cups/cups.h and libcups.so.2. - - -no-iconv ............ Do not compile support for iconv(3). - * -iconv ............... Compile support for iconv(3). - - -no-evdev ............ Do not compile support for evdev. - * -evdev ............... Compile support for evdev. - - -no-tslib ............ Do not compile support for tslib. - * -tslib ............... Compile support for tslib. - - -no-icu .............. Do not compile support for ICU libraries. - + -icu ................. Compile support for ICU libraries. - - -no-fontconfig ....... Do not compile FontConfig support. - + -fontconfig .......... Compile FontConfig support. - - -no-strip ............ Do not strip binaries and libraries of unneeded symbols. - * -strip ............... Strip binaries and libraries of unneeded symbols when installing. - - * -no-pch .............. Do not use precompiled header support. - -pch ................. Use precompiled header support. - - * -no-ltcg Do not use Link Time Code Generation - -ltcg Use Link Time Code Generation. - - -no-dbus ............. Do not compile the Qt D-Bus module. - + -dbus-linked ......... Compile the Qt D-Bus module and link to libdbus-1. - -dbus-runtime ........ Compile the Qt D-Bus module and dynamically load libdbus-1. - - -reduce-relocations .. Reduce relocations in the libraries through extra - linker optimizations (Qt/X11 and Qt for Embedded Linux only; - experimental; needs GNU ld >= 2.18). - - -no-use-gold-linker .. Do not link using the GNU gold linker. - + -use-gold-linker ..... Link using the GNU gold linker if available. - - -force-asserts ....... Force Q_ASSERT to be enabled even in release builds. - - -sanitize [address|thread|memory|undefined] Enables the specified compiler sanitizer. - - -device ............... Cross-compile for device (experimental) - -device-option ... Add device specific options for the device mkspec - (experimental) - - -host-option ..... Add host specific options for the host mkspec - - * -no-separate-debug-info ...... Do not store debug information in a separate file. - -separate-debug-info ......... Strip debug information into a separate file. - - -no-xcb .............. Do not compile Xcb (X protocol C-language Binding) support. - * -xcb ................. Compile Xcb support. - - -no-eglfs ............ Do not compile EGLFS (EGL Full Screen/Single Surface) support. - * -eglfs ............... Compile EGLFS support. - - -no-kms .............. Do not compile backends for KMS. - * -kms ................. Compile backends for KMS. - - -no-gbm .............. Do not compile backends for GBM. - * -gbm ................. Compile backends for GBM. - - * -no-directfb ......... Do not compile DirectFB support. - -directfb ............ Compile DirectFB support. - - -no-linuxfb .......... Do not compile Linux Framebuffer support. - * -linuxfb ............. Compile Linux Framebuffer support. - - * -no-mirclient......... Do not compile Mir client support. - -mirclient............ Compile Mir client support. - - -qpa .......... Sets the default QPA platform (e.g xcb, cocoa, windows). - - -xplatform target .... The target platform when cross-compiling. - - -sysroot ....... Sets as the target compiler's and qmake's sysroot and also sets pkg-config paths. - -no-gcc-sysroot ...... When using -sysroot, it disables the passing of --sysroot to the compiler - - -external-hostbindir .. Path to Qt tools built for this machine. Use this when -platform - does not match the current system, i.e., to make a Canadian Cross Build. - - -no-feature- Do not compile in . - -feature- ... Compile in . The available features - are described in src/corelib/global/qfeatures.txt - - -qreal [double|float] typedef qreal to the specified type. The default is double. - Note that changing this flag affects binary compatibility. - - -no-opengl ........... Do not support OpenGL. - -opengl ........ Enable OpenGL support - With no parameter, this will attempt to auto-detect - OpenGL ES 2.0 and higher, or regular desktop OpenGL. - Use es2 for to override auto-detection. - - -no-libinput ......... Do not support libinput. - * -libinput ............ Enable libinput support. - - -no-gstreamer ........ Do not support GStreamer. - + -gstreamer . Enable GStreamer support - With no parameter, this will attempt to auto-detect GStreamer 0.10 and - 1.0. GStreamer 1.0 is used by default when available. - Use 0.10 or 1.0 for to override auto-detection. - - -no-system-proxies ... Do not use system network proxies by default. - * -system-proxies ...... Use system network proxies by default. - - * -no-sctp ............. Do not compile SCTP network protocol support. - -sctp ................ Compile SCTP support. - - -no-warnings-are-errors Make warnings be treated normally - -warnings-are-errors Make warnings be treated as errors - (enabled if -developer-build is active) - -QNX options: - - -no-slog2 ........... Do not compile with slog2 support. - -slog2 .............. Compile with slog2 support. - - -no-pps ............. Do not compile with pps support. - -pps ................ Compile with pps support. - - -no-imf ............. Do not compile with imf support. - -imf ................ Compile with imf support. - - -no-lgmon ........... Do not compile with lgmon support. - -lgmon .............. Compile with lgmon support. - -Apple platform options: - - -Fstring ............ Add an explicit framework path. - - * -framework .......... Build Qt as a series of frameworks and - link tools against those frameworks. - -no-framework ....... Do not build Qt as a series of frameworks. - - * -securetransport .... Use SecureTransport instead of OpenSSL - - -no-securetransport . Do not use SecureTransport, either use OpenSSL or do not use any SSL backend - at all (if combined with -no-openssl). - - -sdk .......... Build Qt using Apple provided SDK . The argument should be - one of the available SDKs as listed by 'xcodebuild -showsdks'. - Note that the argument applies only to Qt libraries and applications built - using the target mkspec - not host tools such as qmake, moc, rcc, etc. - -Android options: - - -android-sdk path .............. The Android SDK root path. - (default $ANDROID_SDK_ROOT) - - -android-ndk path .............. The Android NDK root path. - (default $ANDROID_NDK_ROOT) - - -android-ndk-platform .......... Sets the android platform - - -android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.) - (default $ANDROID_NDK_HOST) - - -android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips, - arm64-v8a, x86_64, mips64) - - -android-toolchain-version ..... Sets the android toolchain version - - -no-android-style-assets ....... Do not compile in the code which automatically extracts - style assets from the run-time device. Setting this will - make the Android style behave incorrectly, but will enable - compatibility with the LGPL2.1 license. - * -android-style-assets .......... Compile the code which automatically extracts style assets - from the run-time device. This option will make the - Android platform plugin incompatible with the LGPL2.1. +Top-level installation directories: + -prefix ...... The deployment directory, as seen on the target device. + [/usr/local/Qt-$QT_VERSION, $PWD if -developer-build] + -extprefix ... The installation directory, as seen on the host machine. + [SYSROOT/PREFIX] + -hostprefix [dir] .. The installation directory for build tools running on + the host machine. If [dir] is not given, the current + build directory will be used. [EXTPREFIX] + -external-hostbindir ... Path to Qt tools built for this machine. + Use this when -platform does not match the current + system, i.e., to make a Canadian Cross Build. + +Fine tuning of installation directory layout. Note that all directories +except -sysconfdir should be located under -prefix/-hostprefix: + + -bindir ......... Executables [PREFIX/bin] + -headerdir ...... Header files [PREFIX/include] + -libdir ......... Libraries [PREFIX/lib] + -archdatadir .... Arch-dependent data [PREFIX] + -plugindir ...... Plugins [ARCHDATADIR/plugins] + -libexecdir ..... Helper programs [ARCHDATADIR/bin on Windows, + ARCHDATADIR/libexec otherwise] + -importdir ...... QML1 imports [ARCHDATADIR/imports] + -qmldir ......... QML2 imports [ARCHDATADIR/qml] + -datadir ........ Arch-independent data [PREFIX] + -docdir ......... Documentation [DATADIR/doc] + -translationdir . Translations [DATADIR/translations] + -sysconfdir ..... Settings used by Qt programs [PREFIX/etc/xdg] + -examplesdir .... Examples [PREFIX/examples] + -testsdir ....... Tests [PREFIX/tests] + + -hostbindir ..... Host executables [HOSTPREFIX/bin] + -hostlibdir ..... Host libraries [HOSTPREFIX/lib] + -hostdatadir .... Data used by qmake [HOSTPREFIX] + +Conventions for the remaining options: When an option's description is +followed by a list of values in brackets, the interpretation is as follows: +'yes' represents the bare option; all other values are possible prefixes to +the option, e.g., -no-gui. Alternatively, the value can be assigned, e.g., +-gui=yes. Values are listed in the order they are tried if not specified; +'auto' is a shorthand for 'yes/no'. Solitary 'yes' and 'no' represent binary +options without auto-detection. + +Configure meta: + + -help, -h ............ Display this help screen + -verbose, -v ......... Print verbose messages during configuration + -continue ............ Continue configure despite errors + +Build options: + + -opensource .......... Build the Open-Source Edition of Qt + -commercial .......... Build the Commercial Edition of Qt + -confirm-license ..... Automatically acknowledge the license + + -release ............. Build Qt with debugging turned off [yes] + -debug ............... Build Qt with debugging turned on [no] + -debug-and-release ... Build two versions of Qt, with and without + debugging turned on [yes] (Apple and Windows only) + -optimized-tools ..... Build optimized host tools even in debug build [no] + -force-debug-info .... Create symbol files for release builds [no] + -separate-debug-info . Split off debug information to separate files [no] + -strip ............... Strip release binaries of unneeded symbols [yes] + -force-asserts ....... Enable Q_ASSERT even in release builds [no] + -developer-build ..... Compile and link Qt for developing Qt itself + (exports for auto-tests, extra checks, etc.) [no] + + -shared .............. Build shared Qt libraries [yes] (no for UIKit) + -static .............. Build static Qt libraries [no] (yes for UIKit) + -framework ........... Build Qt framework bundles [yes] (Apple only) + + -platform ... Select host mkspec [detected] + -host-option ..... Add option for the host mkspec + -xplatform .. Select target mkspec when cross-compiling [PLATFORM] + -device ....... Cross-compile for device + -device-option ... Add option for the device mkspec + + -qtnamespace .. Wrap all Qt library code in 'namespace {...}'. + -qtlibinfix .. Rename all libQt5*.so to libQt5*.so. + + -testcocoon .......... Instrument with the TestCocoon code coverage tool [no] + -gcov ................ Instrument with the GCov code coverage tool [no] + -sanitize {address|thread|memory|undefined} + Instrument with the specified compiler sanitizer. + + -c++std .... Select C++ standard [c++1z/c++14/c++11] + + -sse2 ................ Use SSE2 instructions [auto] + -sse3/-ssse3/-sse4.1/-sse4.2/-avx/-avx2/-avx512 + Enable use of particular x86 instructions [auto] + Enabled ones are still subject to runtime detection. + -mips_dsp/-mips_dspr2 Use MIPS DSP/rev2 instructions [auto] + + -qreal ........ typedef qreal to the specified type. [double] + Note: this affects binary compatibility. + + -R .......... Add an explicit runtime library path to the Qt + libraries. Supports paths relative to LIBDIR. + -rpath ............... Link Qt libraries and executables using the library + install path as a runtime library path. Similar to + -R LIBDIR. On Apple platforms, disabling this implies + using absolute install names (based in LIBDIR) for + dynamic libraries and frameworks. [auto] + + -reduce-exports ...... Reduce amount of exported symbols [auto] + -reduce-relocations .. Reduce amount of relocations [auto] + + -pch ................. Use precompiled headers [auto] + -ltcg ................ Use Link Time Code Generation [no] + -use-gold-linker ..... Use the GNU gold linker [auto] + + -warnings-are-errors . Treat warnings as errors [no; yes if -developer-build] + -silent .............. Reduce the build output so that warnings and errors + can be seen more easily + +Build environment: + + -sysroot ....... Set as the target sysroot + -gcc-sysroot ......... With -sysroot, pass --sysroot to the compiler [yes] + + -pkg-config .......... Use pkg-config [auto] + + -D .......... Pass additional preprocessor define + -I .......... Pass additional include path + -L .......... Pass additional library path + -F .......... Pass additional framework path (Apple only) + + -sdk ........... Build Qt using Apple provided SDK . The argument + should be one of the available SDKs as listed by + 'xcodebuild -showsdks'. + Note that the argument applies only to Qt libraries + and applications built using the target mkspec - not + host tools such as qmake, moc, rcc, etc. + + -android-sdk path .... Set Android SDK root path [$ANDROID_SDK_ROOT] + -android-ndk path .... Set Android NDK root path [$ANDROID_NDK_ROOT] + -android-ndk-platform Set Android platform + -android-ndk-host .... Set Android NDK host (linux-x86, linux-x86_64, etc.) + [$ANDROID_NDK_HOST] + -android-arch ........ Set Android architecture (armeabi, armeabi-v7a, + arm64-v8a, x86, x86_64, mips, mips64) + -android-toolchain-version ... Set Android toolchain version + -android-style-assets Automatically extract style assets from the device at + run time. This option makes the Android style behave + correctly, but also makes the Android platform plugin + incompatible with the LGPL2.1. [yes] + +Component selection: + + -skip ......... Exclude an entire repository from the build. + -make ......... Add to the list of parts to be built. + Specifying this option clears the default list first. + [libs and examples, also tools if not cross-building, + also tests if -developer-build] + -nomake ....... Exclude from the list of parts to be built. + -compile-examples .... When unset, install only the sources of examples [yes] + -gui ................. Build the Qt GUI module and dependencies [yes] + -widgets ............. Build the Qt Widgets module and dependencies [yes] + -no-dbus ............. Do not build the Qt D-Bus module [default on Android] + -dbus-linked ......... Build Qt D-Bus and link to libdbus-1 [auto] + -dbus-runtime ........ Build Qt D-Bus and dynamically load libdbus-1 [no] + -feature- ... Enable . The available features are described + in src/corelib/global/qfeatures.txt. [all enabled] + -accessibility ....... Enable accessibility support [yes] + Note: Disabling accessibility is not recommended. + -qml-debug ........... Enable QML debugging support [yes] + +Qt comes with bundled copies of some 3rd party libraries. These are used +by default if auto-detection of the respective system library fails. + +Core options: + + -doubleconversion .... Select used double conversion library [system/qt/no] + No implies use of sscanf_l and snprintf_l (imprecise). + -glib ................ Enable Glib support [auto] + -iconv ............... Enable iconv(3) support [auto] + -icu ................. Enable ICU support [auto] + -pps ................. Enable PPS support [auto] (QNX only) + -pcre ................ Select used libpcre3 [system/qt] + -zlib ................ Select used zlib [system/qt] + + Logging backends: + -journald .......... Enable journald support [no] + -syslog ............ Enable syslog support [no] + -slog2 ............. Enable slog2 support [auto] (QNX only) + +Network options: + + -ssl ................. Enable either SSL support method [auto] + -no-openssl .......... Do not use OpenSSL [default on Apple] + -openssl-linked ...... Use OpenSSL and link to libssl [no] + -openssl-runtime ..... Use OpenSSL and dynamically load libssl [auto] + -securetransport ..... Use SecureTransport [auto] (Apple only) + + -sctp ................ Enable SCTP support [no] + + -libproxy ............ Enable use of libproxy [no] + -system-proxies ...... Use system network proxies by default [yes] + +Gui, printing, widget options: + + -cups ................ Enable CUPS support [auto] + + -fontconfig .......... Enable Fontconfig support [auto] + -freetype ............ Select used FreeType [system/qt/no] + -harfbuzz ............ Select used HarfBuzz-NG [system/qt/no] + (Not auto-detected on Apple and Windows) + + -gtk ................. Enable GTK platform theme support [auto] + + -lgmon ............... Enable lgmon support [auto] (QNX only) + + -no-opengl ........... Disable OpenGL support + -opengl ........ Enable OpenGL support. Supported APIs: + es2 (default on Windows), desktop (default on Unix) + -opengles3 ........... Enable OpenGL ES 3.x support instead of ES 2.x [auto] + + -qpa .......... Select default QPA backend (e.g., xcb, cocoa, windows) + -xcb-xlib............. Enable Xcb-Xlib support [auto] + + Platform backends: + -directfb .......... Enable DirectFB support [no] (Unix only) + -eglfs ............. Enable EGLFS support [auto; no on Android] + -gbm ............... Enable backends for GBM [auto] (Linux only) + -kms ............... Enable backends for KMS [auto] (Linux only) + -linuxfb ........... Enable Linux Framebuffer support [auto] (Linux only) + -mirclient ......... Enable Mir client support [no] (Linux only) + -xcb ............... Select used xcb-* libraries [system/qt/no] + (-qt-xcb still uses system version of libxcb itself) + + Input backends: + -evdev ............. Enable evdev support [auto] + -imf ............... Enable IMF support [auto] (QNX only) + -libinput .......... Enable libinput support [auto] + -mtdev ............. Enable mtdev support [auto] + -tslib ............. Enable tslib support [auto] + -xinput2 ........... Enable XInput2 support [auto] + -xkbcommon-x11 ..... Select xkbcommon used in combination with xcb + [system/qt/no] + -xkb-config-root ... With -qt-xkbcommon-x11, set default XKB config + root [detect] + -xkbcommon-evdev ... Enable X-less xkbcommon in combination with libinput + [auto] + + Image formats: + -gif ............... Enable reading support for GIF [auto] + -libpng ............ Select used libpng [system/qt/no] + -libjpeg ........... Select used libjpeg [system/qt/no] + +Database options: + + -sql- ........ Enable SQL plugin. Supported drivers: + db2 ibase mysql oci odbc psql sqlite2 sqlite tds + [all auto] + -sqlite .............. Select used sqlite3 [system/qt] + +Multimedia options: + + -pulseaudio .......... Enable PulseAudio support [auto] + -alsa ................ Enable ALSA support [auto] + -no-gstreamer ........ Disable support for GStreamer + -gstreamer [version] . Enable GStreamer support [auto] + With no parameter, 1.0 is tried first, then 0.10. From 0a434cc00f930ffd24e2466f8f8209baebce20ec Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Aug 2016 10:31:12 +0200 Subject: [PATCH 115/236] add missing 'disable' fields to {sun,gnu}-libiconv features Change-Id: Ieed30c1cf388157c47c8a58979b8c214223d351a Reviewed-by: Lars Knoll --- configure.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.json b/configure.json index 976903fd517..167caff646e 100644 --- a/configure.json +++ b/configure.json @@ -1735,11 +1735,13 @@ }, "sun-libiconv": { "description": "SUN iconv", + "disable": "input.iconv == 'no'", "condition": "!config.win32 && !tests.posix-iconv && tests.sun-iconv", "output": [ "publicQtConfig" ] }, "gnu-libiconv": { "description": "GNU iconv", + "disable": "input.iconv == 'no'", "condition": "!config.win32 && !tests.posix-iconv && !tests.sun-iconv && tests.gnu-iconv", "output": [ "publicQtConfig" ] }, From 615616b0699d98cfb9f4eeb67e005e3226398097 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 14 Jul 2016 12:46:44 +0200 Subject: [PATCH 116/236] add some unix-specific options understood by configure.exe it's really a bit weird that the windows configure has more options to configure unix features than the unix one, even if some are just workarounds for missing auto-detection. unlike in configure.exe itself, -posix-iconv is now also understood for symmetry with -gnu-iconv and -sun-iconv. Change-Id: Ic15376e5822e43b998bd17f02c11e5dd0567dc2b Reviewed-by: Lars Knoll --- config_help.txt | 4 +++- configure.json | 23 +++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/config_help.txt b/config_help.txt index 944e5201184..85277afd3b7 100644 --- a/config_help.txt +++ b/config_help.txt @@ -175,7 +175,9 @@ Core options: -doubleconversion .... Select used double conversion library [system/qt/no] No implies use of sscanf_l and snprintf_l (imprecise). -glib ................ Enable Glib support [auto] - -iconv ............... Enable iconv(3) support [auto] + -eventfd ............. Enable eventfd support + -inotify ............. Enable inotify support + -iconv ............... Enable iconv(3) support [posix/sun/gnu/no] -icu ................. Enable ICU support [auto] -pps ................. Enable PPS support [auto] (QNX only) -pcre ................ Select used libpcre3 [system/qt] diff --git a/configure.json b/configure.json index 167caff646e..0c811e22754 100644 --- a/configure.json +++ b/configure.json @@ -65,6 +65,7 @@ "egl": "boolean", "eglfs": "boolean", "evdev": "boolean", + "eventfd": "boolean", "fontconfig": "boolean", "force-asserts": { "type": "boolean", "name": "force_asserts" }, "force-debug-info": { "type": "boolean", "name": "force_debug_info" }, @@ -83,9 +84,10 @@ "harfbuzz": { "type": "enum", "values": [ "no", "qt", "system" ] }, "headersclean": "boolean", "host-option": "string", - "iconv": "boolean", + "iconv": { "type": "enum", "values": [ "no", "yes", "posix", "sun", "gnu" ] }, "icu": "boolean", "imf": { "type": "boolean", "name": "qqnx_imf" }, + "inotify": "boolean", "journald": "boolean", "lgmon": "boolean", "libinput": "boolean", @@ -116,6 +118,7 @@ "pkg-config": "boolean", "platform": "string", "pps": { "type": "boolean", "name": "qqnx_pps" }, + "posix-ipc": { "type": "boolean", "name": "ipc_posix" }, "profile": "boolean", "psql_config": "string", "pulseaudio": "boolean", @@ -1730,19 +1733,27 @@ }, "iconv": { "description": "iconv", - "condition": "!config.win32 && (tests.posix-iconv || features.sun-libiconv || features.gnu-libiconv)", + "condition": "features.posix-libiconv || features.sun-libiconv || features.gnu-libiconv", "output": [ "feature" ] }, + "posix-libiconv": { + "description": "POSIX iconv", + "enable": "input.iconv == 'posix'", + "disable": "input.iconv == 'sun' || input.iconv == 'gnu' || input.iconv == 'no'", + "condition": "!config.win32 && tests.posix-iconv" + }, "sun-libiconv": { "description": "SUN iconv", - "disable": "input.iconv == 'no'", - "condition": "!config.win32 && !tests.posix-iconv && tests.sun-iconv", + "enable": "input.iconv == 'sun'", + "disable": "input.iconv == 'posix' || input.iconv == 'gnu' || input.iconv == 'no'", + "condition": "!config.win32 && !features.posix-libiconv && tests.sun-iconv", "output": [ "publicQtConfig" ] }, "gnu-libiconv": { "description": "GNU iconv", - "disable": "input.iconv == 'no'", - "condition": "!config.win32 && !tests.posix-iconv && !tests.sun-iconv && tests.gnu-iconv", + "enable": "input.iconv == 'gnu'", + "disable": "input.iconv == 'posix' || input.iconv == 'sun' || input.iconv == 'no'", + "condition": "!config.win32 && !features.posix-libiconv && !features.sun-libiconv && tests.gnu-iconv", "output": [ "publicQtConfig" ] }, "freetype": { From 6c473b7e08479a3abd117a11a75dff9630bbf98e Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 4 Apr 2016 11:19:53 +0200 Subject: [PATCH 117/236] QDateTimeParser::getAmPmText() use QLocale instead of tr() I am not convinced toUpper/toLower is a generally sound solution here; however, QLocale doesn't make the upper/lower case distinction this parser does and a bug report shows tr() isn't doing an adequate job. Task-number: QTBUG-47815 Change-Id: Iaf654d1d76d4c38d74fc647e168d50debb924a8f Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetimeparser.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index 180f76bcc1b..5b7bf0d3d42 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -1712,11 +1712,9 @@ QDateTime QDateTimeParser::getMaximum() const QString QDateTimeParser::getAmPmText(AmPm ap, Case cs) const { - if (ap == AmText) { - return (cs == UpperCase ? tr("AM") : tr("am")); - } else { - return (cs == UpperCase ? tr("PM") : tr("pm")); - } + const QLocale loc = locale(); + QString raw = ap == AmText ? loc.amText() : loc.pmText(); + return cs == UpperCase ? raw.toUpper() : raw.toLower(); } /* From fbc9edb5e7bf1417959e9c9fb5f70979ff176483 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 9 Aug 2016 14:37:11 +0200 Subject: [PATCH 118/236] Doc: Fix typo in the Semaphores Example Change-Id: I140915014836a3bbc449c953aa54452483b0b886 Reviewed-by: Venugopal Shivashankar --- examples/corelib/threads/doc/src/semaphores.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/corelib/threads/doc/src/semaphores.qdoc b/examples/corelib/threads/doc/src/semaphores.qdoc index abc961811a6..64142133320 100644 --- a/examples/corelib/threads/doc/src/semaphores.qdoc +++ b/examples/corelib/threads/doc/src/semaphores.qdoc @@ -129,7 +129,7 @@ \c{freeBytes.available()} is \c BufferSize - 1 and \c{usedBytes.available()} is 1. At that point, two things can happen: Either the consumer thread takes over and reads that - byte, or the consumer gets to produce a second byte. + byte, or the producer thread gets to produce a second byte. The producer-consumer model presented in this example makes it possible to write highly concurrent multithreaded applications. From 0681e603803634f89f72b37b216b91cab2e085d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Fri, 5 Aug 2016 10:51:49 +0100 Subject: [PATCH 119/236] Cache the current QOpenGLFramebufferObject This doesn't cover FBOs bound directly with glBindFramebuffer(), but it's perfect to create a fast path for code we know uses QOGLFBO, thus avoiding expensive glGetIntegerv() driver calls. The use case is to use this in QSG24BitTextMaskShader::activate(), where we need to check if the current FBO is sRGB capable. Change-Id: I434eeeb7e6a3d16be9327315536ad7280245085d Reviewed-by: Laszlo Agocs Reviewed-by: Sean Harmer --- src/gui/kernel/qopenglcontext_p.h | 7 +++++++ src/gui/opengl/qopenglframebufferobject.cpp | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 4a746bf12b6..7c8c698a7db 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE class QOpenGLFunctions; class QOpenGLContext; +class QOpenGLFramebufferObject; class QOpenGLMultiGroupSharedResource; class Q_GUI_EXPORT QOpenGLSharedResource @@ -204,6 +205,7 @@ public: , workaround_missingPrecisionQualifiers(false) , active_engine(0) , qgl_current_fbo_invalid(false) + , qgl_current_fbo(Q_NULLPTR) , defaultFboRedirect(0) { requestedFormat = QSurfaceFormat::defaultFormat(); @@ -242,6 +244,11 @@ public: bool qgl_current_fbo_invalid; + // Set and unset in QOpenGLFramebufferObject::bind()/unbind(). + // (Only meaningful for QOGLFBO since an FBO might be bound by other means) + // Saves us from querying the driver for the current FBO in most paths. + QOpenGLFramebufferObject *qgl_current_fbo; + QVariant nativeHandle; GLuint defaultFboRedirect; diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 6fc18b1d012..1ee90a08271 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -1068,6 +1068,7 @@ bool QOpenGLFramebufferObject::bind() d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, d->fbo()); QOpenGLContextPrivate::get(current)->qgl_current_fbo_invalid = true; + QOpenGLContextPrivate::get(current)->qgl_current_fbo = this; if (d->format.samples() == 0) { // Create new textures to replace the ones stolen via takeTexture(). @@ -1107,7 +1108,9 @@ bool QOpenGLFramebufferObject::release() if (current) { d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, current->defaultFramebufferObject()); - QOpenGLContextPrivate::get(current)->qgl_current_fbo_invalid = true; + QOpenGLContextPrivate *contextPrv = QOpenGLContextPrivate::get(current); + contextPrv->qgl_current_fbo_invalid = true; + contextPrv->qgl_current_fbo = Q_NULLPTR; } return true; From b6f5b38f8c883f5c82d9dc0332f55521f59b70db Mon Sep 17 00:00:00 2001 From: Fredrik Orderud Date: Mon, 8 Aug 2016 22:39:00 +0200 Subject: [PATCH 120/236] Define _WINDLL when building a DLL Visual Studio automatically defines _WINDLL when building a DLL, regardless of project settings (https://msdn.microsoft.com/en-us/library/8x480de8.aspx). This define is therefore widely used to detect DLL vs. static library or executable build target on Windows. For makefiles, _WINDLL need to be manually defined, which QMake failed to do so far. Task-number: QTBUG-55183 Change-Id: Ic62201666c44e730e6881706d568ce9eaf22b7a4 Reviewed-by: Oswald Buddenhagen --- qmake/generators/win32/msvc_nmake.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 31abed57ef2..ae139c23be2 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -426,6 +426,12 @@ void NmakeMakefileGenerator::init() if (!defines.contains("NDEBUG")) defines.append("NDEBUG"); } + + if (project->values("QMAKE_APP_FLAG").isEmpty() && project->isActiveConfig("dll")) { + ProStringList &defines = project->values("DEFINES"); + if (!defines.contains("_WINDLL")) + defines.append("_WINDLL"); + } } QStringList NmakeMakefileGenerator::sourceFilesForImplicitRulesFilter() From 193abdfc0798cf10eac06769b650ac03e86eb55e Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 9 Aug 2016 19:22:48 +0200 Subject: [PATCH 121/236] http2frame - do not rely on a socket's buffer - Whenever we have a read notification, read this data, even if it's not enough for a frame's header - otherwise, QNAM can use a socket in an Ubuffered mode and FrameReader can potentially fail to read anything correctly. - Do not call/rely on bytesAvailable and do not try to invoke _q_receiveReply in Qt::QueuedConnection mode, instead try to read until we end up in an incomplete frame or some error. Change-Id: I7f44ba9e34bc64f3e26bd29080f0050da635b3ae Reviewed-by: Alex Trotsenko Reviewed-by: Edward Welbourne --- src/network/access/http2/http2frames.cpp | 83 ++++++++++----- src/network/access/http2/http2frames_p.h | 11 +- src/network/access/qhttp2protocolhandler.cpp | 106 +++++++++---------- 3 files changed, 115 insertions(+), 85 deletions(-) diff --git a/src/network/access/http2/http2frames.cpp b/src/network/access/http2/http2frames.cpp index 55e9f93b192..95f00dd2861 100644 --- a/src/network/access/http2/http2frames.cpp +++ b/src/network/access/http2/http2frames.cpp @@ -148,7 +148,7 @@ FrameStatus validate_frame_payload(FrameType type, FrameFlags flags, FrameReader::FrameReader(FrameReader &&rhs) - : framePayload(std::move(rhs.framePayload)) + : frameBuffer(std::move(rhs.frameBuffer)) { type = rhs.type; rhs.type = FrameType::LAST_FRAME_TYPE; @@ -162,8 +162,8 @@ FrameReader::FrameReader(FrameReader &&rhs) payloadSize = rhs.payloadSize; rhs.payloadSize = 0; - incompleteRead = rhs.incompleteRead; - rhs.incompleteRead = false; + state = rhs.state; + rhs.state = Idle; offset = rhs.offset; rhs.offset = 0; @@ -171,7 +171,7 @@ FrameReader::FrameReader(FrameReader &&rhs) FrameReader &FrameReader::operator = (FrameReader &&rhs) { - framePayload = std::move(rhs.framePayload); + frameBuffer = std::move(rhs.frameBuffer); type = rhs.type; rhs.type = FrameType::LAST_FRAME_TYPE; @@ -185,8 +185,8 @@ FrameReader &FrameReader::operator = (FrameReader &&rhs) payloadSize = rhs.payloadSize; rhs.payloadSize = 0; - incompleteRead = rhs.incompleteRead; - rhs.incompleteRead = false; + state = rhs.state; + rhs.state = Idle; offset = rhs.offset; rhs.offset = 0; @@ -196,10 +196,13 @@ FrameReader &FrameReader::operator = (FrameReader &&rhs) FrameStatus FrameReader::read(QAbstractSocket &socket) { - if (!incompleteRead) { + if (state != ReadingPayload) { + // Either Idle or ReadingHeader: if (!readHeader(socket)) return FrameStatus::incompleteFrame; + Q_ASSERT(state == Idle); + const auto status = validate_frame_header(type, flags, payloadSize); if (status != FrameStatus::goodFrame) { // No need to read any payload. @@ -209,16 +212,17 @@ FrameStatus FrameReader::read(QAbstractSocket &socket) if (Http2PredefinedParameters::maxFrameSize < payloadSize) return FrameStatus::sizeError; - framePayload.resize(payloadSize); + frameBuffer.resize(payloadSize); offset = 0; } - if (framePayload.size()) { + if (frameBuffer.size()) { if (!readPayload(socket)) return FrameStatus::incompleteFrame; + Q_ASSERT(state == Idle); } - return validate_frame_payload(type, flags, framePayload); + return validate_frame_payload(type, flags, frameBuffer); } bool FrameReader::padded(uchar *pad) const @@ -231,8 +235,8 @@ bool FrameReader::padded(uchar *pad) const if (type == FrameType::DATA || type == FrameType::PUSH_PROMISE || type == FrameType::HEADERS) { - Q_ASSERT(framePayload.size() >= 1); - *pad = framePayload[0]; + Q_ASSERT(frameBuffer.size() >= 1); + *pad = frameBuffer[0]; return true; } @@ -244,10 +248,10 @@ bool FrameReader::priority(quint32 *streamID, uchar *weight) const Q_ASSERT(streamID); Q_ASSERT(weight); - if (!framePayload.size()) + if (!frameBuffer.size()) return false; - const uchar *src = &framePayload[0]; + const uchar *src = &frameBuffer[0]; if (type == FrameType::HEADERS && flags.testFlag(FrameFlag::PADDED)) ++src; @@ -263,7 +267,7 @@ bool FrameReader::priority(quint32 *streamID, uchar *weight) const quint32 FrameReader::dataSize() const { - quint32 size = quint32(framePayload.size()); + quint32 size = quint32(frameBuffer.size()); uchar pad = 0; if (padded(&pad)) { // + 1 one for a byte with padding number itself: @@ -280,10 +284,10 @@ quint32 FrameReader::dataSize() const const uchar *FrameReader::dataBegin() const { - if (!framePayload.size()) + if (!frameBuffer.size()) return nullptr; - const uchar *src = &framePayload[0]; + const uchar *src = &frameBuffer[0]; uchar dummyPad = 0; if (padded(&dummyPad)) ++src; @@ -298,14 +302,30 @@ const uchar *FrameReader::dataBegin() const bool FrameReader::readHeader(QAbstractSocket &socket) { - if (socket.bytesAvailable() < frameHeaderSize) + Q_ASSERT(state != ReadingPayload); + + if (state == Idle) { + offset = 0; + frameBuffer.resize(frameHeaderSize); + state = ReadingHeader; + } + + Q_ASSERT(offset < frameHeaderSize); + + const auto chunkSize = socket.read(reinterpret_cast(&frameBuffer[offset]), + frameHeaderSize - offset); + if (chunkSize > 0) + offset += chunkSize; + + if (offset < frameHeaderSize) return false; - uchar src[frameHeaderSize] = {}; - socket.read(reinterpret_cast(src), frameHeaderSize); + // We got a complete frame header: + state = Idle; + + const uchar *src = &frameBuffer[0]; payloadSize = src[0] << 16 | src[1] << 8 | src[2]; - type = FrameType(src[3]); if (int(type) >= int(FrameType::LAST_FRAME_TYPE)) type = FrameType::LAST_FRAME_TYPE; // To be ignored, 5.1 @@ -318,16 +338,23 @@ bool FrameReader::readHeader(QAbstractSocket &socket) bool FrameReader::readPayload(QAbstractSocket &socket) { - Q_ASSERT(offset <= framePayload.size()); + Q_ASSERT(offset < frameBuffer.size()); + Q_ASSERT(state != ReadingHeader); + + state = ReadingPayload; // Casts and ugliness - to deal with MSVC. Values are guaranteed to fit into quint32. - if (const auto residue = std::min(qint64(framePayload.size() - offset), socket.bytesAvailable())) { - socket.read(reinterpret_cast(&framePayload[offset]), residue); - offset += quint32(residue); - } + const auto residue = qint64(frameBuffer.size() - offset); + const auto chunkSize = socket.read(reinterpret_cast(&frameBuffer[offset]), residue); + if (chunkSize > 0) + offset += quint32(chunkSize); - incompleteRead = offset < framePayload.size(); - return !incompleteRead; + if (offset < frameBuffer.size()) + return false; + + // Complete payload read: + state = Idle; + return true; } diff --git a/src/network/access/http2/http2frames_p.h b/src/network/access/http2/http2frames_p.h index 6abed315ca9..c85be57a2ea 100644 --- a/src/network/access/http2/http2frames_p.h +++ b/src/network/access/http2/http2frames_p.h @@ -101,13 +101,20 @@ private: bool readHeader(QAbstractSocket &socket); bool readPayload(QAbstractSocket &socket); + enum ReaderState { + Idle, + ReadingHeader, + ReadingPayload + }; + + ReaderState state = Idle; + // As soon as we got a header, we // know payload size, offset is // needed if we do not have enough // data and will read the next chunk. - bool incompleteRead = false; quint32 offset = 0; - std::vector framePayload; + std::vector frameBuffer; }; class Q_AUTOTEST_EXPORT FrameWriter diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp index 937686920cc..89d4a24e377 100644 --- a/src/network/access/qhttp2protocolhandler.cpp +++ b/src/network/access/qhttp2protocolhandler.cpp @@ -170,64 +170,60 @@ void QHttp2ProtocolHandler::_q_receiveReply() Q_ASSERT(m_socket); Q_ASSERT(m_channel); - const auto result = inboundFrame.read(*m_socket); - switch (result) { - case FrameStatus::incompleteFrame: - return; - case FrameStatus::protocolError: - return connectionError(PROTOCOL_ERROR, "invalid frame"); - case FrameStatus::sizeError: - return connectionError(FRAME_SIZE_ERROR, "invalid frame size"); - default: - break; - } + do { + const auto result = inboundFrame.read(*m_socket); + switch (result) { + case FrameStatus::incompleteFrame: + return; + case FrameStatus::protocolError: + return connectionError(PROTOCOL_ERROR, "invalid frame"); + case FrameStatus::sizeError: + return connectionError(FRAME_SIZE_ERROR, "invalid frame size"); + default: + break; + } - Q_ASSERT(result == FrameStatus::goodFrame); + Q_ASSERT(result == FrameStatus::goodFrame); - if (continuationExpected && inboundFrame.type != FrameType::CONTINUATION) - return connectionError(PROTOCOL_ERROR, "CONTINUATION expected"); + if (continuationExpected && inboundFrame.type != FrameType::CONTINUATION) + return connectionError(PROTOCOL_ERROR, "CONTINUATION expected"); - switch (inboundFrame.type) { - case FrameType::DATA: - handleDATA(); - break; - case FrameType::HEADERS: - handleHEADERS(); - break; - case FrameType::PRIORITY: - handlePRIORITY(); - break; - case FrameType::RST_STREAM: - handleRST_STREAM(); - break; - case FrameType::SETTINGS: - handleSETTINGS(); - break; - case FrameType::PUSH_PROMISE: - handlePUSH_PROMISE(); - break; - case FrameType::PING: - handlePING(); - break; - case FrameType::GOAWAY: - handleGOAWAY(); - break; - case FrameType::WINDOW_UPDATE: - handleWINDOW_UPDATE(); - break; - case FrameType::CONTINUATION: - handleCONTINUATION(); - break; - case FrameType::LAST_FRAME_TYPE: - // 5.1 - ignore unknown frames. - break; - } - - if (goingAway && !activeStreams.size()) - return; - - if (m_socket->bytesAvailable()) - QMetaObject::invokeMethod(m_channel, "_q_receiveReply", Qt::QueuedConnection); + switch (inboundFrame.type) { + case FrameType::DATA: + handleDATA(); + break; + case FrameType::HEADERS: + handleHEADERS(); + break; + case FrameType::PRIORITY: + handlePRIORITY(); + break; + case FrameType::RST_STREAM: + handleRST_STREAM(); + break; + case FrameType::SETTINGS: + handleSETTINGS(); + break; + case FrameType::PUSH_PROMISE: + handlePUSH_PROMISE(); + break; + case FrameType::PING: + handlePING(); + break; + case FrameType::GOAWAY: + handleGOAWAY(); + break; + case FrameType::WINDOW_UPDATE: + handleWINDOW_UPDATE(); + break; + case FrameType::CONTINUATION: + handleCONTINUATION(); + break; + case FrameType::LAST_FRAME_TYPE: + // 5.1 - ignore unknown frames. + break; + } + } while (!goingAway || activeStreams.size()); } bool QHttp2ProtocolHandler::sendRequest() From 69ff49e8f1885b48e14efdd5e58d3e780c63c727 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 4 Aug 2016 14:40:33 +0200 Subject: [PATCH 122/236] Enable cleartext HTTP/2 and bring the auto-test back to life HTTP/2 does not require TLS connection, it can work in a cleartext mode. Plus at the moment only OpenSSL backend allows HTTP/2 negotiation via ALPN/NPN (and none of our CI configurations with OpenSSL supports these extensions, rendering HTTP/2 auto-test useless). This patch implements cleartext HTTP/2 ('h2c') in 'direct' mode - this is allowed if a client has a prior knowledge that HTTP/2 is supported by a server. Change-Id: I4978775e9732c40bc77f549b83bb4a5d1761887e Reviewed-by: Alex Trotsenko Reviewed-by: Edward Welbourne --- src/network/access/qhttp2protocolhandler.cpp | 4 +- src/network/access/qhttp2protocolhandler_p.h | 4 +- .../access/qhttpnetworkconnectionchannel.cpp | 42 +++++--- .../access/qhttpnetworkconnectionchannel_p.h | 5 +- src/network/access/qhttpthreaddelegate.cpp | 5 +- tests/auto/network/access/access.pro | 13 +-- tests/auto/network/access/http2/http2.pro | 1 - tests/auto/network/access/http2/http2srv.cpp | 96 ++++++++++++------- tests/auto/network/access/http2/http2srv.h | 9 +- tests/auto/network/access/http2/tst_http2.cpp | 32 +++---- 10 files changed, 119 insertions(+), 92 deletions(-) diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp index 89d4a24e377..f50224f64af 100644 --- a/src/network/access/qhttp2protocolhandler.cpp +++ b/src/network/access/qhttp2protocolhandler.cpp @@ -40,7 +40,7 @@ #include "qhttpnetworkconnection_p.h" #include "qhttp2protocolhandler_p.h" -#if !defined(QT_NO_HTTP) && !defined(QT_NO_SSL) +#if !defined(QT_NO_HTTP) #include "http2/bitstreams_p.h" @@ -1210,4 +1210,4 @@ void QHttp2ProtocolHandler::closeSession() QT_END_NAMESPACE -#endif // !defined(QT_NO_HTTP) && !defined(QT_NO_SSL) +#endif // !defined(QT_NO_HTTP) diff --git a/src/network/access/qhttp2protocolhandler_p.h b/src/network/access/qhttp2protocolhandler_p.h index b146e37dd3e..6804c329b99 100644 --- a/src/network/access/qhttp2protocolhandler_p.h +++ b/src/network/access/qhttp2protocolhandler_p.h @@ -55,7 +55,7 @@ #include #include -#if !defined(QT_NO_HTTP) && !defined(QT_NO_SSL) +#if !defined(QT_NO_HTTP) #include "http2/http2protocol_p.h" #include "http2/http2streams_p.h" @@ -202,6 +202,6 @@ private: QT_END_NAMESPACE -#endif // !defined(QT_NO_HTTP) && !defined(QT_NO_SSL) +#endif // !defined(QT_NO_HTTP) #endif diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 3a780f636b6..3317b9e5b92 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -179,8 +179,11 @@ void QHttpNetworkConnectionChannel::init() if (!sslConfiguration.isNull()) sslSocket->setSslConfiguration(sslConfiguration); } else { -#endif // QT_NO_SSL - protocolHandler.reset(new QHttpProtocolHandler(this)); +#endif // !QT_NO_SSL + if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) + protocolHandler.reset(new QHttp2ProtocolHandler(this)); + else + protocolHandler.reset(new QHttpProtocolHandler(this)); #ifndef QT_NO_SSL } #endif @@ -835,10 +838,17 @@ void QHttpNetworkConnectionChannel::_q_connected() #endif } else { state = QHttpNetworkConnectionChannel::IdleState; - if (!reply) - connection->d_func()->dequeueRequest(socket); - if (reply) - sendRequest(); + if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) { + if (spdyRequestsToSend.count() > 0) { + // wait for data from the server first (e.g. initial window, max concurrent requests) + QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); + } + } else { + if (!reply) + connection->d_func()->dequeueRequest(socket); + if (reply) + sendRequest(); + } } } @@ -972,9 +982,12 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket } } while (!connection->d_func()->highPriorityQueue.isEmpty() || !connection->d_func()->lowPriorityQueue.isEmpty()); + + if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2 #ifndef QT_NO_SSL - if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY || - connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) { + || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY +#endif + ) { QList spdyPairs = spdyRequestsToSend.values(); for (int a = 0; a < spdyPairs.count(); ++a) { // emit error for all replies @@ -983,7 +996,6 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket emit currentReply->finishedWithError(errorCode, errorString); } } -#endif // QT_NO_SSL // send the next request QMetaObject::invokeMethod(that, "_q_startNextRequest", Qt::QueuedConnection); @@ -1005,20 +1017,19 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket #ifndef QT_NO_NETWORKPROXY void QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator* auth) { + if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2 #ifndef QT_NO_SSL - if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY || - connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) { + || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY +#endif + ) { connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth); } else { // HTTP -#endif // QT_NO_SSL // Need to dequeue the request before we can emit the error. if (!reply) connection->d_func()->dequeueRequest(socket); if (reply) connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth); -#ifndef QT_NO_SSL } -#endif // QT_NO_SSL } #endif @@ -1077,9 +1088,10 @@ void QHttpNetworkConnectionChannel::_q_encrypted() if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) { // we call setSpdyWasUsed(true) on the replies in the SPDY handler when the request is sent - if (spdyRequestsToSend.count() > 0) + if (spdyRequestsToSend.count() > 0) { // wait for data from the server first (e.g. initial window, max concurrent requests) QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); + } } else { // HTTP if (!reply) connection->d_func()->dequeueRequest(socket); diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h index d7d5d86a7af..48f10d62862 100644 --- a/src/network/access/qhttpnetworkconnectionchannel_p.h +++ b/src/network/access/qhttpnetworkconnectionchannel_p.h @@ -121,11 +121,14 @@ public: bool authenticationCredentialsSent; bool proxyCredentialsSent; QScopedPointer protocolHandler; + // SPDY or HTTP/2 requests; SPDY is TLS-only, but + // HTTP/2 can be cleartext also, that's why it's + // outside of QT_NO_SSL section. Sorted by priority: + QMultiMap spdyRequestsToSend; #ifndef QT_NO_SSL bool ignoreAllSslErrors; QList ignoreSslErrorsList; QSslConfiguration sslConfiguration; - QMultiMap spdyRequestsToSend; // sorted by priority void ignoreSslErrors(); void ignoreSslErrors(const QList &errors); void setSslConfiguration(const QSslConfiguration &config); diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp index e16519c2f22..1dca7f02fb6 100644 --- a/src/network/access/qhttpthreaddelegate.cpp +++ b/src/network/access/qhttpthreaddelegate.cpp @@ -285,10 +285,11 @@ void QHttpThreadDelegate::startRequest() urlCopy.setPort(urlCopy.port(ssl ? 443 : 80)); QHttpNetworkConnection::ConnectionType connectionType - = QHttpNetworkConnection::ConnectionTypeHTTP; + = httpRequest.isHTTP2Allowed() ? QHttpNetworkConnection::ConnectionTypeHTTP2 + : QHttpNetworkConnection::ConnectionTypeHTTP; + #ifndef QT_NO_SSL if (httpRequest.isHTTP2Allowed() && ssl) { - connectionType = QHttpNetworkConnection::ConnectionTypeHTTP2; QList protocols; protocols << QSslConfiguration::ALPNProtocolHTTP2 << QSslConfiguration::NextProtocolHttp1_1; diff --git a/tests/auto/network/access/access.pro b/tests/auto/network/access/access.pro index ef0aeac3c81..58cfd781a96 100644 --- a/tests/auto/network/access/access.pro +++ b/tests/auto/network/access/access.pro @@ -12,17 +12,12 @@ SUBDIRS=\ qftp \ qhttpnetworkreply \ qabstractnetworkcache \ - hpack + hpack \ + http2 !contains(QT_CONFIG, private_tests): SUBDIRS -= \ qhttpnetworkconnection \ qhttpnetworkreply \ qftp \ - hpack - -contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { - contains(QT_CONFIG, private_tests) { - SUBDIRS += \ - http2 - } -} + hpack \ + http2 diff --git a/tests/auto/network/access/http2/http2.pro b/tests/auto/network/access/http2/http2.pro index 5dd8bdf9ae8..e130f307848 100644 --- a/tests/auto/network/access/http2/http2.pro +++ b/tests/auto/network/access/http2/http2.pro @@ -1,7 +1,6 @@ QT += core core-private network network-private testlib CONFIG += testcase parallel_test c++11 -TEMPLATE = app TARGET = tst_http2 HEADERS += http2srv.h SOURCES += tst_http2.cpp http2srv.cpp diff --git a/tests/auto/network/access/http2/http2srv.cpp b/tests/auto/network/access/http2/http2srv.cpp index eb09569cdd9..480fe3467e4 100644 --- a/tests/auto/network/access/http2/http2srv.cpp +++ b/tests/auto/network/access/http2/http2srv.cpp @@ -33,9 +33,13 @@ #include "http2srv.h" +#ifndef QT_NO_SSL #include -#include #include +#endif + +#include + #include #include #include @@ -60,8 +64,9 @@ inline bool is_valid_client_stream(quint32 streamID) } -Http2Server::Http2Server(const Http2Settings &ss, const Http2Settings &cs) - : serverSettings(ss) +Http2Server::Http2Server(bool h2c, const Http2Settings &ss, const Http2Settings &cs) + : serverSettings(ss), + clearTextHTTP2(h2c) { for (const auto &s : cs) expectedClientSettings[quint16(s.identifier)] = s.value; @@ -97,6 +102,11 @@ void Http2Server::setResponseBody(const QByteArray &body) void Http2Server::startServer() { +#ifdef QT_NO_SSL + // Let the test fail with timeout. + if (!clearTextHTTP2) + return; +#endif if (listen()) emit serverStarted(serverPort()); } @@ -160,19 +170,17 @@ void Http2Server::sendDATA(quint32 streamID, quint32 windowSize) Q_ASSERT(offset < quint32(responseBody.size())); const quint32 bytes = std::min(windowSize, responseBody.size() - offset); - outboundFrame.start(FrameType::DATA, FrameFlag::EMPTY, streamID); + const quint32 frameSizeLimit(clientSetting(Settings::MAX_FRAME_SIZE_ID, Http2::maxFrameSize)); + const uchar *src = reinterpret_cast(responseBody.constData() + offset); const bool last = offset + bytes == quint32(responseBody.size()); - const quint32 frameSizeLimit(clientSetting(Settings::MAX_FRAME_SIZE_ID, Http2::maxFrameSize)); - outboundFrame.writeDATA(*socket, frameSizeLimit, - reinterpret_cast(responseBody.constData() + offset), - bytes); + outboundFrame.start(FrameType::DATA, FrameFlag::EMPTY, streamID); + outboundFrame.writeDATA(*socket, frameSizeLimit, src, bytes); if (last) { outboundFrame.start(FrameType::DATA, FrameFlag::END_STREAM, streamID); outboundFrame.setPayloadSize(0); outboundFrame.write(*socket); - suspendedStreams.erase(it); activeRequests.erase(streamID); @@ -194,31 +202,45 @@ void Http2Server::sendWINDOW_UPDATE(quint32 streamID, quint32 delta) void Http2Server::incomingConnection(qintptr socketDescriptor) { - socket.reset(new QSslSocket); - // Add HTTP2 as supported protocol: - auto conf = QSslConfiguration::defaultConfiguration(); - auto protos = conf.allowedNextProtocols(); - protos.prepend(QSslConfiguration::ALPNProtocolHTTP2); - conf.setAllowedNextProtocols(protos); - socket->setSslConfiguration(conf); - // SSL-related setup ... - socket->setPeerVerifyMode(QSslSocket::VerifyNone); - socket->setProtocol(QSsl::TlsV1_2OrLater); - connect(socket.data(), SIGNAL(sslErrors(QList)), - this, SLOT(ignoreErrorSlot())); - QFile file(SRCDIR "certs/fluke.key"); - file.open(QIODevice::ReadOnly); - QSslKey key(file.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey); - socket->setPrivateKey(key); - auto localCert = QSslCertificate::fromPath(SRCDIR "certs/fluke.cert"); - socket->setLocalCertificateChain(localCert); - socket->setSocketDescriptor(socketDescriptor, QAbstractSocket::ConnectedState); - // Stop listening. - close(); - // Start SSL handshake and ALPN: - connect(socket.data(), SIGNAL(encrypted()), - this, SLOT(connectionEncrypted())); - socket->startServerEncryption(); + if (clearTextHTTP2) { + socket.reset(new QTcpSocket); + const bool set = socket->setSocketDescriptor(socketDescriptor); + Q_UNUSED(set) Q_ASSERT(set); + // Stop listening: + close(); + QMetaObject::invokeMethod(this, "connectionEstablished", + Qt::QueuedConnection); + } else { +#ifndef QT_NO_SSL + socket.reset(new QSslSocket); + QSslSocket *sslSocket = static_cast(socket.data()); + // Add HTTP2 as supported protocol: + auto conf = QSslConfiguration::defaultConfiguration(); + auto protos = conf.allowedNextProtocols(); + protos.prepend(QSslConfiguration::ALPNProtocolHTTP2); + conf.setAllowedNextProtocols(protos); + sslSocket->setSslConfiguration(conf); + // SSL-related setup ... + sslSocket->setPeerVerifyMode(QSslSocket::VerifyNone); + sslSocket->setProtocol(QSsl::TlsV1_2OrLater); + connect(sslSocket, SIGNAL(sslErrors(QList)), + this, SLOT(ignoreErrorSlot())); + QFile file(SRCDIR "certs/fluke.key"); + file.open(QIODevice::ReadOnly); + QSslKey key(file.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey); + sslSocket->setPrivateKey(key); + auto localCert = QSslCertificate::fromPath(SRCDIR "certs/fluke.cert"); + sslSocket->setLocalCertificateChain(localCert); + sslSocket->setSocketDescriptor(socketDescriptor, QAbstractSocket::ConnectedState); + // Stop listening. + close(); + // Start SSL handshake and ALPN: + connect(sslSocket, SIGNAL(encrypted()), this, SLOT(connectionEstablished())); + sslSocket->startServerEncryption(); +#else + Q_UNREACHABLE(); +#endif + } } quint32 Http2Server::clientSetting(Http2::Settings identifier, quint32 defaultValue) @@ -229,7 +251,7 @@ quint32 Http2Server::clientSetting(Http2::Settings identifier, quint32 defaultVa return defaultValue; } -void Http2Server::connectionEncrypted() +void Http2Server::connectionEstablished() { using namespace Http2; @@ -250,7 +272,9 @@ void Http2Server::connectionEncrypted() void Http2Server::ignoreErrorSlot() { - socket->ignoreSslErrors(); +#ifndef QT_NO_SSL + static_cast(socket.data())->ignoreSslErrors(); +#endif } // Now HTTP2 "server" part: diff --git a/tests/auto/network/access/http2/http2srv.h b/tests/auto/network/access/http2/http2srv.h index 00cfde944b9..8d02ae60ef1 100644 --- a/tests/auto/network/access/http2/http2srv.h +++ b/tests/auto/network/access/http2/http2srv.h @@ -33,9 +33,9 @@ #include #include +#include #include #include -#include #include #include @@ -62,7 +62,7 @@ class Http2Server : public QTcpServer { Q_OBJECT public: - Http2Server(const Http2Settings &serverSettings, + Http2Server(bool clearText, const Http2Settings &serverSettings, const Http2Settings &clientSettings); ~Http2Server(); @@ -105,7 +105,7 @@ Q_SIGNALS: void windowUpdate(quint32 streamID); private slots: - void connectionEncrypted(); + void connectionEstablished(); void readReady(); private: @@ -113,7 +113,7 @@ private: quint32 clientSetting(Http2::Settings identifier, quint32 defaultValue); - QScopedPointer socket; + QScopedPointer socket; // Connection preface: bool waitingClientPreface = false; @@ -155,6 +155,7 @@ private: quint32 streamRecvWindowSize = Http2::defaultSessionWindowSize; QByteArray responseBody; + bool clearTextHTTP2 = false; protected slots: void ignoreErrorSlot(); diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index dbb89db0f90..582a103b2ec 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -49,7 +49,9 @@ // At the moment our HTTP/2 imlpementation requires ALPN and this means OpenSSL. #if !defined(QT_NO_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT) -#define QT_ALPN +const bool clearTextHTTP2 = false; +#else +const bool clearTextHTTP2 = true; #endif QT_BEGIN_NAMESPACE @@ -139,9 +141,6 @@ tst_Http2::~tst_Http2() void tst_Http2::singleRequest() { -#ifndef QT_ALPN - QSKIP("This test requires ALPN support"); -#endif clearHTTP2State(); serverPort = 0; @@ -154,7 +153,9 @@ void tst_Http2::singleRequest() QVERIFY(serverPort != 0); - const QUrl url(QString("https://127.0.0.1:%1/index.html").arg(serverPort)); + const QString urlAsString(clearTextHTTP2 ? QString("http://127.0.0.1:%1/index.html") + : QString("https://127.0.0.1:%1/index.html")); + const QUrl url(urlAsString.arg(serverPort)); QNetworkRequest request(url); request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, QVariant(true)); @@ -179,9 +180,6 @@ void tst_Http2::singleRequest() void tst_Http2::multipleRequests() { -#ifndef QT_ALPN - QSKIP("This test requires ALPN support"); -#endif clearHTTP2State(); serverPort = 0; @@ -216,16 +214,12 @@ void tst_Http2::multipleRequests() void tst_Http2::flowControlClientSide() { -#ifndef QT_ALPN - QSKIP("This test requires ALPN support"); -#endif // Create a server but impose limits: // 1. Small MAX frame size, so we test CONTINUATION frames. // 2. Small client windows so server responses cause client streams // to suspend and server sends WINDOW_UPDATE frames. // 3. Few concurrent streams, to test protocol handler can resume // suspended requests. - using namespace Http2; clearHTTP2State(); @@ -238,7 +232,7 @@ void tst_Http2::flowControlClientSide() auto srv = newServer(serverSettings); - const QByteArray respond(int(Http2::defaultSessionWindowSize * 100), 'x'); + const QByteArray respond(int(Http2::defaultSessionWindowSize * 50), 'x'); srv->setResponseBody(respond); QMetaObject::invokeMethod(srv, "startServer", Qt::QueuedConnection); @@ -249,7 +243,7 @@ void tst_Http2::flowControlClientSide() for (int i = 0; i < nRequests; ++i) sendRequest(i); - runEventLoop(10000); + runEventLoop(120000); QVERIFY(nRequests == 0); QVERIFY(prefaceOK); @@ -261,9 +255,6 @@ void tst_Http2::flowControlClientSide() void tst_Http2::flowControlServerSide() { -#ifndef QT_ALPN - QSKIP("This test requires ALPN support"); -#endif // Quite aggressive test: // low MAX_FRAME_SIZE forces a lot of small DATA frames, // payload size exceedes stream/session RECV window sizes @@ -281,7 +272,7 @@ void tst_Http2::flowControlServerSide() auto srv = newServer(serverSettings); - const QByteArray payload(int(Http2::defaultSessionWindowSize * 1000), 'x'); + const QByteArray payload(int(Http2::defaultSessionWindowSize * 500), 'x'); QMetaObject::invokeMethod(srv, "startServer", Qt::QueuedConnection); @@ -333,7 +324,7 @@ Http2Server *tst_Http2::newServer(const Http2Settings &serverSettings) // Client's settings are fixed by qhttp2protocolhandler. const Http2Settings clientSettings = {{Settings::MAX_FRAME_SIZE_ID, quint32(Http2::maxFrameSize)}, {Settings::ENABLE_PUSH_ID, quint32(0)}}; - auto srv = new Http2Server(serverSettings, clientSettings); + auto srv = new Http2Server(clearTextHTTP2, serverSettings, clientSettings); using Srv = Http2Server; using Cl = tst_Http2; @@ -357,7 +348,8 @@ void tst_Http2::sendRequest(int streamNumber, QNetworkRequest::Priority priority, const QByteArray &payload) { - static const QString urlAsString("https://127.0.0.1:%1/stream%2.html"); + static const QString urlAsString(clearTextHTTP2 ? "http://127.0.0.1:%1/stream%2.html" + : "https://127.0.0.1:%1/stream%2.html"); const QUrl url(urlAsString.arg(serverPort).arg(streamNumber)); QNetworkRequest request(url); From 23ea54d861be1b68e5df4264c75e0e8d0f5d3c04 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 5 Aug 2016 16:18:50 -0700 Subject: [PATCH 123/236] Drag and Drop: Don't let Cocoa override proposed actions When pressing the Command key, or any other modifier key, Cocoa will filter whatever the application has set in the QDrag object. However, Qt is already taking all this into account, so we should not let yet another voice chime in. Task-number: QTBUG-55177 Change-Id: I7c56e72d846d10cdfc132776bdfdd6b79799bcff Reviewed-by: Timur Pocheptsov Reviewed-by: Jake Petroules --- src/plugins/platforms/cocoa/qnsview.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 913ce08d172..784b1ca14bd 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1922,7 +1922,15 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin - (BOOL) ignoreModifierKeysWhileDragging { - return NO; + // According to the "Dragging Sources" chapter on Cocoa DnD Programming + // (https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/DragandDrop/Concepts/dragsource.html), + // if the control, option, or command key is pressed, the source’s + // operation mask is filtered to only contain a reduced set of operations. + // + // Since Qt already takes care of tracking the keyboard modifiers, we + // don't need (or want) Cocoa to filter anything. Instead, we'll let + // the application do the actual filtering. + return YES; } - (BOOL)wantsPeriodicDraggingUpdates From 4c002a8343baa8453a5485ce7939569bfc5b3267 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 5 Aug 2016 11:41:47 -0700 Subject: [PATCH 124/236] Cocoa: Update deprecated dragging session APIs Change-Id: I06e2dd3861c4bc5d85421ac71daf188732279e77 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qnsview.mm | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 784b1ca14bd..c67bcfd23bb 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1913,15 +1913,18 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin return target->mapFromGlobal(source->mapToGlobal(point)); } -- (NSDragOperation) draggingSourceOperationMaskForLocal:(BOOL)isLocal +- (NSDragOperation)draggingSession:(NSDraggingSession *)session + sourceOperationMaskForDraggingContext:(NSDraggingContext)context { - Q_UNUSED(isLocal); + Q_UNUSED(session); + Q_UNUSED(context); QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); return qt_mac_mapDropActions(nativeDrag->currentDrag()->supportedActions()); } -- (BOOL) ignoreModifierKeysWhileDragging +- (BOOL)ignoreModifierKeysForDraggingSession:(NSDraggingSession *)session { + Q_UNUSED(session); // According to the "Dragging Sources" chapter on Cocoa DnD Programming // (https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/DragandDrop/Concepts/dragsource.html), // if the control, option, or command key is pressed, the source’s @@ -2075,27 +2078,27 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin return response.isAccepted(); } -- (void)draggedImage:(NSImage*) img endedAt:(NSPoint) point operation:(NSDragOperation) operation +- (void)draggingSession:(NSDraggingSession *)session + endedAtPoint:(NSPoint)screenPoint + operation:(NSDragOperation)operation { - Q_UNUSED(img); + Q_UNUSED(session); Q_UNUSED(operation); QWindow *target = findEventTargetWindow(m_window); if (!target) return; -// keep our state, and QGuiApplication state (buttons member) in-sync, -// or future mouse events will be processed incorrectly + // keep our state, and QGuiApplication state (buttons member) in-sync, + // or future mouse events will be processed incorrectly NSUInteger pmb = [NSEvent pressedMouseButtons]; for (int buttonNumber = 0; buttonNumber < 32; buttonNumber++) { // see cocoaButton2QtButton() for the 32 value if (!(pmb & (1 << buttonNumber))) m_buttons &= ~cocoaButton2QtButton(buttonNumber); } - NSPoint windowPoint = [self convertPoint: point fromView: nil]; + NSPoint windowPoint = [self.window convertRectFromScreen:NSMakeRect(screenPoint.x, screenPoint.y, 1, 1)].origin; QPoint qtWindowPoint(windowPoint.x, windowPoint.y); - NSWindow *window = [self window]; - NSPoint screenPoint = [window convertRectToScreen:NSMakeRect(point.x, point.y, 0, 0)].origin; QPoint qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y)); QWindowSystemInterface::handleMouseEvent(target, mapWindowCoordinates(m_window, target, qtWindowPoint), qtScreenPoint, m_buttons); From ce2419af895eb303f4d44e85e20dc97fcd52cfd2 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 11 Aug 2016 15:23:17 +0200 Subject: [PATCH 125/236] Document HTTP2Allowed attribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia318bf4b73f4716106f60370ed9ddff94f677eba Reviewed-by: Topi Reiniö --- src/network/access/qnetworkrequest.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 63332d4fd17..29362b81e26 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -260,6 +260,14 @@ QT_BEGIN_NAMESPACE Indicates whether SPDY was used for receiving this reply. + \value HTTP2AllowedAttribute + Requests only, type: QMetaType::Bool (default: false) + Indicates whether the QNetworkAccessManager code is + allowed to use HTTP/2 with this request. This applies + to SSL requests or 'cleartext' HTTP/2. + + \omitvalue HTTP2WasUsedAttribute + \value EmitAllUploadProgressSignalsAttribute Requests only, type: QMetaType::Bool (default: false) Indicates whether all upload signals should be emitted. From 2afead0211302799519abee5c164ae0602a7e13b Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 9 Aug 2016 10:08:46 +0200 Subject: [PATCH 126/236] eglfs: Configurable screen order in the virtual desktop Say one wants a virtual desktop with the display on HDMI above the display on DisplayPort: { "device": "drm-nvdc", "virtualDesktopOrientation": "vertical", "outputs": [ { "name": "HDMI1", "virtualIndex": 0 }, { "name": "DP1" } ] } Undefined virtualIndex values map to INT_MAX and will go after the explicitly specified ones. However, the sorting is stable so the original order from the DRM connector list is preserved between such outputs. Task-number: QTBUG-55188 Change-Id: I204fb08205ea7dbfbcdefd1d22ed22f5387f3e8c Reviewed-by: Andy Nichols --- .../eglfs_kms/qeglfskmsgbmdevice.cpp | 4 +- .../eglfs_kms/qeglfskmsgbmdevice.h | 3 +- .../eglfs_kms/qeglfskmsgbmscreen.cpp | 7 +- .../eglfs_kms/qeglfskmsgbmscreen.h | 5 +- .../qeglfskmsegldevice.cpp | 4 +- .../eglfs_kms_egldevice/qeglfskmsegldevice.h | 3 +- .../qeglfskmsegldevicescreen.cpp | 4 +- .../qeglfskmsegldevicescreen.h | 3 +- .../eglfs_kms_support/qeglfskmsdevice.cpp | 77 +++++++++++++------ .../eglfs_kms_support/qeglfskmsdevice.h | 5 +- .../qeglfskmsintegration.cpp | 2 +- .../eglfs_kms_support/qeglfskmsscreen.cpp | 35 +++------ .../eglfs_kms_support/qeglfskmsscreen.h | 6 +- 13 files changed, 84 insertions(+), 74 deletions(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp index 278752bddf6..99f6cfb0ca3 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp @@ -142,10 +142,10 @@ void QEglFSKmsGbmDevice::handleDrmEvent() drmHandleEvent(fd(), &drmEvent); } -QEglFSKmsScreen *QEglFSKmsGbmDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position) +QEglFSKmsScreen *QEglFSKmsGbmDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output) { static bool firstScreen = true; - QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(integration, device, output, position); + QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(integration, device, output); if (firstScreen && integration->hwCursor()) { m_globalCursor = new QEglFSKmsGbmCursor(screen); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h index 6a45f9ffa0b..7c0af84422d 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h @@ -68,8 +68,7 @@ public: virtual QEglFSKmsScreen *createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position) Q_DECL_OVERRIDE; + QEglFSKmsOutput output) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QEglFSKmsGbmDevice) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp index 9ffffd74718..dde386fc578 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp @@ -93,10 +93,9 @@ QEglFSKmsGbmScreen::FrameBuffer *QEglFSKmsGbmScreen::framebufferForBufferObject( } QEglFSKmsGbmScreen::QEglFSKmsGbmScreen(QEglFSKmsIntegration *integration, - QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position) - : QEglFSKmsScreen(integration, device, output, position) + QEglFSKmsDevice *device, + QEglFSKmsOutput output) + : QEglFSKmsScreen(integration, device, output) , m_gbm_surface(Q_NULLPTR) , m_gbm_bo_current(Q_NULLPTR) , m_gbm_bo_next(Q_NULLPTR) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h index 3381bbfdbbf..d7ad348291b 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h @@ -55,9 +55,8 @@ class QEglFSKmsGbmScreen : public QEglFSKmsScreen { public: QEglFSKmsGbmScreen(QEglFSKmsIntegration *integration, - QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position); + QEglFSKmsDevice *device, + QEglFSKmsOutput output); ~QEglFSKmsGbmScreen(); QPlatformCursor *cursor() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp index f45b947fa62..d30963ff96a 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp @@ -83,9 +83,9 @@ EGLNativeDisplayType QEglFSKmsEglDevice::nativeDisplay() const } QEglFSKmsScreen *QEglFSKmsEglDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, QPoint position) + QEglFSKmsOutput output) { - QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(integration, device, output, position); + QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(integration, device, output); if (!m_globalCursor && !integration->separateScreens()) { qCDebug(qLcEglfsKmsDebug, "Creating new global mouse cursor"); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h index a27112fb4f0..8c8f79f70c0 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h @@ -58,8 +58,7 @@ public: virtual QEglFSKmsScreen *createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position) Q_DECL_OVERRIDE; + QEglFSKmsOutput output) Q_DECL_OVERRIDE; QPlatformCursor *globalCursor() { return m_globalCursor; } void destroyGlobalCursor(); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp index b0deabe8344..55d5941e5f0 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp @@ -43,8 +43,8 @@ QT_BEGIN_NAMESPACE -QEglFSKmsEglDeviceScreen::QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position) - : QEglFSKmsScreen(integration, device, output, position) +QEglFSKmsEglDeviceScreen::QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output) + : QEglFSKmsScreen(integration, device, output) { } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h index 7fceae49786..c57f52c6b73 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h @@ -49,8 +49,7 @@ class QEglFSKmsEglDeviceScreen : public QEglFSKmsScreen public: QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position); + QEglFSKmsOutput output); ~QEglFSKmsEglDeviceScreen(); QPlatformCursor *cursor() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index 74c7667f1f8..842896bbad2 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -159,7 +159,7 @@ static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode) return true; } -QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos) +QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, int *virtualIndex) { const QByteArray connectorName = nameForConnector(connector); @@ -192,6 +192,8 @@ QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resourc qWarning("Invalid mode \"%s\" for output %s", mode.constData(), connectorName.constData()); configuration = OutputConfigPreferred; } + if (virtualIndex) + *virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt(); const uint32_t crtc_id = resources->crtcs[crtc]; @@ -303,6 +305,7 @@ QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resourc physSize.setHeight(connector->mmHeight); } } + qCDebug(qLcEglfsKmsDebug) << "Physical size is" << physSize << "mm" << "for output" << connectorName; QEglFSKmsOutput output = { QString::fromUtf8(connectorName), @@ -320,7 +323,7 @@ QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resourc m_crtc_allocator |= (1 << output.crtc_id); m_connector_allocator |= (1 << output.connector_id); - return createScreen(m_integration, this, output, pos); + return createScreen(m_integration, this, output); } drmModePropertyPtr QEglFSKmsDevice::connectorProperty(drmModeConnectorPtr connector, const QByteArray &name) @@ -352,6 +355,26 @@ QEglFSKmsDevice::~QEglFSKmsDevice() { } +struct OrderedScreen +{ + OrderedScreen() : screen(nullptr), index(-1) { } + OrderedScreen(QEglFSKmsScreen *screen, int index) : screen(screen), index(index) { } + QEglFSKmsScreen *screen; + int index; +}; + +QDebug operator<<(QDebug dbg, const OrderedScreen &s) +{ + QDebugStateSaver saver(dbg); + dbg.nospace() << "OrderedScreen(" << s.screen << " : " << s.index << ")"; + return dbg; +} + +static bool orderedScreenLessThan(const OrderedScreen &a, const OrderedScreen &b) +{ + return a.index < b.index; +} + void QEglFSKmsDevice::createScreens() { drmModeResPtr resources = drmModeGetResources(m_dri_fd); @@ -360,38 +383,46 @@ void QEglFSKmsDevice::createScreens() return; } - QEglFSKmsScreen *primaryScreen = Q_NULLPTR; - QList siblings; - QPoint pos(0, 0); - QEglFSIntegration *integration = static_cast(QGuiApplicationPrivate::platformIntegration()); + QVector screens; for (int i = 0; i < resources->count_connectors; i++) { drmModeConnectorPtr connector = drmModeGetConnector(m_dri_fd, resources->connectors[i]); if (!connector) continue; - QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, pos); - if (screen) { - integration->addScreen(screen); - - if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical) - pos.ry() += screen->geometry().height(); - else - pos.rx() += screen->geometry().width(); - - siblings << screen; - - if (!primaryScreen) - primaryScreen = screen; - } + int virtualIndex; + QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, &virtualIndex); + if (screen) + screens.append(OrderedScreen(screen, virtualIndex)); drmModeFreeConnector(connector); } drmModeFreeResources(resources); + // Use stable sort to preserve the original order for outputs with unspecified indices. + std::stable_sort(screens.begin(), screens.end(), orderedScreenLessThan); + qCDebug(qLcEglfsKmsDebug) << "Sorted screen list:" << screens; + + QPoint pos(0, 0); + QList siblings; + QEglFSIntegration *qpaIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); + + for (const OrderedScreen &orderedScreen : screens) { + QEglFSKmsScreen *s = orderedScreen.screen; + // set up a horizontal or vertical virtual desktop + s->setVirtualPosition(pos); + if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical) + pos.ry() += s->geometry().height(); + else + pos.rx() += s->geometry().width(); + qCDebug(qLcEglfsKmsDebug) << "Adding screen" << s << "to QPA with geometry" << s->geometry(); + qpaIntegration->addScreen(s); + siblings << s; + } + if (!m_integration->separateScreens()) { - // set up a virtual desktop + // enable the virtual desktop Q_FOREACH (QPlatformScreen *screen, siblings) static_cast(screen)->setVirtualSiblings(siblings); } @@ -407,9 +438,9 @@ QString QEglFSKmsDevice::devicePath() const return m_path; } -QEglFSKmsScreen *QEglFSKmsDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position) +QEglFSKmsScreen *QEglFSKmsDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output) { - return new QEglFSKmsScreen(integration, device, output, position); + return new QEglFSKmsScreen(integration, device, output); } void QEglFSKmsDevice::setFd(int fd) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h index 65619497800..4aad2e0143f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h @@ -68,8 +68,7 @@ public: protected: virtual QEglFSKmsScreen *createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position); + QEglFSKmsOutput output); void setFd(int fd); QEglFSKmsIntegration *m_integration; @@ -80,7 +79,7 @@ protected: quint32 m_connector_allocator; int crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr connector); - QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos); + QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, int *virtualIndex); drmModePropertyPtr connectorProperty(drmModeConnectorPtr connector, const QByteArray &name); static void pageFlipHandler(int fd, diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp index 0f64d5b28e2..6c30e8f930f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp @@ -201,7 +201,7 @@ void QEglFSKmsIntegration::loadConfig() else if (vdOriString == QLatin1String("vertical")) m_virtualDesktopLayout = VirtualDesktopLayoutVertical; else - qCWarning(qLcEglfsKmsDebug) << "Unknown virtualDesktop value" << vdOriString; + qCWarning(qLcEglfsKmsDebug) << "Unknown virtualDesktopOrientation value" << vdOriString; } const QJsonArray outputs = object.value(QLatin1String("outputs")).toArray(); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp index 55417e4525f..f690cd668ed 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp @@ -71,13 +71,11 @@ private: QEglFSKmsScreen::QEglFSKmsScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position) + QEglFSKmsOutput output) : QEglFSScreen(eglGetDisplay(device->nativeDisplay())) , m_integration(integration) , m_device(device) , m_output(output) - , m_pos(position) , m_powerState(PowerStateOn) , m_interruptHandler(new QEglFSKmsInterruptHandler(this)) { @@ -98,34 +96,19 @@ QEglFSKmsScreen::~QEglFSKmsScreen() delete m_interruptHandler; } +void QEglFSKmsScreen::setVirtualPosition(const QPoint &pos) +{ + m_pos = pos; +} + // Reimplement rawGeometry(), not geometry(). The base class implementation of // geometry() calls rawGeometry() and may apply additional transforms. QRect QEglFSKmsScreen::rawGeometry() const { const int mode = m_output.mode; - QRect r(m_pos.x(), m_pos.y(), - m_output.modes[mode].hdisplay, - m_output.modes[mode].vdisplay); - - static int rotation = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION"); - switch (rotation) { - case 0: - case 180: - case -180: - break; - case 90: - case -90: { - int h = r.height(); - r.setHeight(r.width()); - r.setWidth(h); - break; - } - default: - qWarning("Invalid rotation %d specified in QT_QPA_EGLFS_ROTATION", rotation); - break; - } - - return r; + return QRect(m_pos.x(), m_pos.y(), + m_output.modes[mode].hdisplay, + m_output.modes[mode].vdisplay); } int QEglFSKmsScreen::depth() const diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h index 7b424b53825..2b6a0ffe6c1 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h @@ -74,11 +74,13 @@ class Q_EGLFS_EXPORT QEglFSKmsScreen : public QEglFSScreen public: QEglFSKmsScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, - QEglFSKmsOutput output, - QPoint position); + QEglFSKmsOutput output); ~QEglFSKmsScreen(); + void setVirtualPosition(const QPoint &pos); + QRect rawGeometry() const Q_DECL_OVERRIDE; + int depth() const Q_DECL_OVERRIDE; QImage::Format format() const Q_DECL_OVERRIDE; From dfae6a7593a6bb4ad6accc30d6aaf01a98bc2a6f Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 9 Aug 2016 15:48:12 +0200 Subject: [PATCH 127/236] evdevtouch: Enable touch in multi-screen eglfs environments Parse the touchDevice property from the KMS/DRM config file. When all outputs have an explicitly specified index in the virtual desktop, we can set up a mapping between the device node and the screen index. It is somewhat fragile (device nodes may change, requires explicit virtualIndex properties for all outputs, etc.) but better than nothing. For example, having the screen on DisplayPort as primary and the touchscreen on HDMI as the secondary screen breaks by default because touching the second screen generates touch (and synthesized mouse) events for the first screen. Assuming the touchscreen is /dev/input/event5, the issue can now be fixed by setting QT_QPA_EGLFS_KMS_CONFIG with a configuration like the following: { "device": "drm-nvdc", "outputs": [ { "name": "HDMI1", "touchDevice": "/dev/input/event5", "virtualIndex": 1 }, { "name": "DP1", "virtualIndex": 0 } ] } Task-number: QTBUG-54151 Change-Id: If97fa18a65599ccfe64ce408ea43086ec3863682 Reviewed-by: Andy Nichols --- .../input/evdevtouch/evdevtouch.pri | 3 +- .../input/evdevtouch/qevdevtouchhandler.cpp | 40 +++++++- src/platformsupport/input/input.pri | 4 + .../input/libinput/libinput.pri | 2 + .../input/libinput/qlibinputtouch.cpp | 11 ++- .../input/shared/qtouchoutputmapping.cpp | 91 +++++++++++++++++++ .../input/shared/qtouchoutputmapping_p.h | 71 +++++++++++++++ src/platformsupport/input/shared/shared.pri | 5 + .../eglfs_kms_support/qeglfskmsdevice.cpp | 3 + 9 files changed, 221 insertions(+), 9 deletions(-) create mode 100644 src/platformsupport/input/shared/qtouchoutputmapping.cpp create mode 100644 src/platformsupport/input/shared/qtouchoutputmapping_p.h create mode 100644 src/platformsupport/input/shared/shared.pri diff --git a/src/platformsupport/input/evdevtouch/evdevtouch.pri b/src/platformsupport/input/evdevtouch/evdevtouch.pri index c2edc13143a..44eb9da1132 100644 --- a/src/platformsupport/input/evdevtouch/evdevtouch.pri +++ b/src/platformsupport/input/evdevtouch/evdevtouch.pri @@ -6,6 +6,8 @@ SOURCES += \ $$PWD/qevdevtouchhandler.cpp \ $$PWD/qevdevtouchmanager.cpp +INCLUDEPATH += $$PWD/../shared + contains(QT_CONFIG, libudev) { LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV } @@ -14,4 +16,3 @@ contains(QT_CONFIG, mtdev) { CONFIG += link_pkgconfig PKGCONFIG_PRIVATE += mtdev } - diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index 6b98ed30a90..5f9455559dc 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qevdevtouchhandler_p.h" +#include "qtouchoutputmapping_p.h" #include #include #include @@ -116,6 +117,7 @@ public: int findClosestContact(const QHash &contacts, int x, int y, int *dist); void addTouchPoint(const Contact &contact, Qt::TouchPointStates *combinedStates); void reportPoints(); + void loadMultiScreenMappings(); int hw_range_x_min; int hw_range_x_max; @@ -124,10 +126,12 @@ public: int hw_pressure_min; int hw_pressure_max; QString hw_name; + QString deviceNode; bool m_forceToActiveWindow; bool m_typeB; QTransform m_rotate; bool m_singleTouch; + int m_screenIndex; }; QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, const QStringList &args) @@ -137,7 +141,8 @@ QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, co hw_range_x_min(0), hw_range_x_max(0), hw_range_y_min(0), hw_range_y_max(0), hw_pressure_min(0), hw_pressure_max(0), - m_typeB(false), m_singleTouch(false) + m_typeB(false), m_singleTouch(false), + m_screenIndex(-1) { m_forceToActiveWindow = args.contains(QLatin1String("force_window")); } @@ -222,7 +227,9 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const } #endif - qCDebug(qLcEvdevTouch, "evdevtouch: %s: Protocol type %c %s (%s)", qPrintable(device), + d->deviceNode = device; + + qCDebug(qLcEvdevTouch, "evdevtouch: %s: Protocol type %c %s (%s)", qPrintable(d->deviceNode), d->m_typeB ? 'B' : 'A', mtdevStr, d->m_singleTouch ? "single" : "multi"); input_absinfo absInfo; @@ -292,6 +299,14 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const if (inverty) d->m_rotate *= QTransform::fromTranslate(0.5, 0.5).scale(1.0, -1.0).translate(-0.5, -0.5); + QTouchOutputMapping mapping; + if (mapping.load()) { + d->m_screenIndex = mapping.screenIndexForDeviceNode(d->deviceNode); + if (d->m_screenIndex >= 0) + qCDebug(qLcEvdevTouch, "evdevtouch: Mapping device %s to screen index %d", + qPrintable(d->deviceNode), d->m_screenIndex); + } + registerTouchDevice(); } @@ -643,8 +658,23 @@ void QEvdevTouchScreenData::reportPoints() return; winRect = QHighDpi::toNativePixels(win->geometry(), win); } else { - QScreen *primary = QGuiApplication::primaryScreen(); - winRect = QHighDpi::toNativePixels(primary->geometry(), primary); + // Now it becomes tricky. Traditionally we picked the primaryScreen() + // and were done with it. But then, enter multiple screens, and + // suddenly it was all broken. + // + // For now we only support the display configuration of the KMS/DRM + // backends of eglfs. See QTouchOutputMapping. + // + // The good news it that once winRect refers to the correct screen + // geometry in the full virtual desktop space, there is nothing else + // left to do since qguiapp will handle the rest. + QScreen *screen = QGuiApplication::primaryScreen(); + if (m_screenIndex >= 0) { + const QList screens = QGuiApplication::screens(); + if (m_screenIndex < screens.count()) + screen = screens.at(m_screenIndex); + } + winRect = QHighDpi::toNativePixels(screen->geometry(), screen); } const int hw_w = hw_range_x_max - hw_range_x_min; @@ -675,10 +705,12 @@ void QEvdevTouchScreenData::reportPoints() tp.pressure = (tp.pressure - hw_pressure_min) / qreal(hw_pressure_max - hw_pressure_min); } + // Let qguiapp pick the target window. QWindowSystemInterface::handleTouchEvent(Q_NULLPTR, q->touchDevice(), m_touchPoints); } + QEvdevTouchScreenHandlerThread::QEvdevTouchScreenHandlerThread(const QString &device, const QString &spec, QObject *parent) : QDaemonThread(parent), m_device(device), m_spec(spec), m_handler(Q_NULLPTR), m_touchDeviceRegistered(false) { diff --git a/src/platformsupport/input/input.pri b/src/platformsupport/input/input.pri index 3b9593eb314..5ce9e6844f6 100644 --- a/src/platformsupport/input/input.pri +++ b/src/platformsupport/input/input.pri @@ -12,3 +12,7 @@ contains(QT_CONFIG, tslib) { contains(QT_CONFIG, libinput) { include($$PWD/libinput/libinput.pri) } + +contains(QT_CONFIG, evdev)|contains(QT_CONFIG, libinput) { + include($$PWD/shared/shared.pri) +} diff --git a/src/platformsupport/input/libinput/libinput.pri b/src/platformsupport/input/libinput/libinput.pri index 35d962ff3cf..aeba6c725a6 100644 --- a/src/platformsupport/input/libinput/libinput.pri +++ b/src/platformsupport/input/libinput/libinput.pri @@ -13,6 +13,8 @@ SOURCES += \ INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV $$QMAKE_INCDIR_LIBINPUT LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV $$QMAKE_LIBS_LIBINPUT +INCLUDEPATH += $$PWD/../shared + contains(QT_CONFIG, xkbcommon-evdev) { INCLUDEPATH += $$QMAKE_INCDIR_XKBCOMMON_EVDEV LIBS_PRIVATE += $$QMAKE_LIBS_XKBCOMMON_EVDEV diff --git a/src/platformsupport/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp index 1e82ce5c91d..42925a18e19 100644 --- a/src/platformsupport/input/libinput/qlibinputtouch.cpp +++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp @@ -64,11 +64,14 @@ QLibInputTouch::DeviceState *QLibInputTouch::deviceState(libinput_event_touch *e static inline QPointF getPos(libinput_event_touch *e) { + // TODO Map to correct screen using QTouchOutputMapping. + // Perhaps investigate libinput_device_get_output_name as well. + // For now just use the primary screen. QScreen *screen = QGuiApplication::primaryScreen(); - const QSize screenSize = QHighDpi::toNativePixels(screen->geometry().size(), screen); - const double x = libinput_event_touch_get_x_transformed(e, screenSize.width()); - const double y = libinput_event_touch_get_y_transformed(e, screenSize.height()); - return QPointF(x, y); + const QRect geom = QHighDpi::toNativePixels(screen->geometry(), screen); + const double x = libinput_event_touch_get_x_transformed(e, geom.width()); + const double y = libinput_event_touch_get_y_transformed(e, geom.height()); + return geom.topLeft() + QPointF(x, y); } void QLibInputTouch::registerDevice(libinput_device *dev) diff --git a/src/platformsupport/input/shared/qtouchoutputmapping.cpp b/src/platformsupport/input/shared/qtouchoutputmapping.cpp new file mode 100644 index 00000000000..55c1dc34f44 --- /dev/null +++ b/src/platformsupport/input/shared/qtouchoutputmapping.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtouchoutputmapping_p.h" +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +bool QTouchOutputMapping::load() +{ + static QByteArray configFile = qgetenv("QT_QPA_EGLFS_KMS_CONFIG"); + if (configFile.isEmpty()) + return false; + + QFile file(QString::fromUtf8(configFile)); + if (!file.open(QFile::ReadOnly)) { + qWarning("touch input support: Failed to open %s", configFile.constData()); + return false; + } + + const QJsonDocument doc = QJsonDocument::fromJson(file.readAll()); + if (!doc.isObject()) { + qWarning("touch input support: Failed to parse %s", configFile.constData()); + return false; + } + + // What we are interested is the virtualIndex and touchDevice properties for + // each element in the outputs array. + const QJsonArray outputs = doc.object().value(QLatin1String("outputs")).toArray(); + for (int i = 0; i < outputs.size(); ++i) { + const QVariantMap output = outputs.at(i).toObject().toVariantMap(); + if (!output.contains(QStringLiteral("touchDevice"))) + continue; + if (!output.contains(QStringLiteral("virtualIndex"))) { + qWarning("evdevtouch: Output %d specifies touchDevice but not virtualIndex, this is wrong", i); + continue; + } + const QString &deviceNode = output.value(QStringLiteral("touchDevice")).toString(); + const int screenIndex = output.value(QStringLiteral("virtualIndex")).toInt(); + m_screenIndexTable.insert(deviceNode, screenIndex); + } + + return true; +} + +int QTouchOutputMapping::screenIndexForDeviceNode(const QString &deviceNode) +{ + return m_screenIndexTable.value(deviceNode, -1); +} + +QT_END_NAMESPACE diff --git a/src/platformsupport/input/shared/qtouchoutputmapping_p.h b/src/platformsupport/input/shared/qtouchoutputmapping_p.h new file mode 100644 index 00000000000..74999d93ce5 --- /dev/null +++ b/src/platformsupport/input/shared/qtouchoutputmapping_p.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTOUCHOUTPUTMAPPING_P_H +#define QTOUCHOUTPUTMAPPING_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +QT_BEGIN_NAMESPACE + +class QTouchOutputMapping +{ +public: + bool load(); + int screenIndexForDeviceNode(const QString &deviceNode); + +private: + QHash m_screenIndexTable; +}; + +QT_END_NAMESPACE + +#endif // QTOUCHOUTPUTMAPPING_P_H diff --git a/src/platformsupport/input/shared/shared.pri b/src/platformsupport/input/shared/shared.pri new file mode 100644 index 00000000000..1443235244b --- /dev/null +++ b/src/platformsupport/input/shared/shared.pri @@ -0,0 +1,5 @@ +HEADERS += \ + $$PWD/qtouchoutputmapping_p.h + +SOURCES += \ + $$PWD/qtouchoutputmapping.cpp diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index 842896bbad2..5944e8d51f5 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -417,6 +417,9 @@ void QEglFSKmsDevice::createScreens() else pos.rx() += s->geometry().width(); qCDebug(qLcEglfsKmsDebug) << "Adding screen" << s << "to QPA with geometry" << s->geometry(); + // The order in qguiapp's screens list will match the order set by + // virtualIndex. This is not only handy but also required since for instance + // evdevtouch relies on it when performing touch device - screen mapping. qpaIntegration->addScreen(s); siblings << s; } From b0abe20d4b05e9e1e0800b8be64df15fa1660367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 2 Nov 2015 10:49:17 +0100 Subject: [PATCH 128/236] Darwin: Add QImage::toCGImage() conversion function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (Move QT_FORWARD_DECLARE_CG to qglobal.h) This function converts to CGImage for supported formats. This is done by creating a CGImageRef that reuses the QImage data. The CGImage and QImage ref counting systems are bridged, implemented by using CGDataProvider that holds a copy of the QImage. Unlike the previous internal implementation this public version does not implicitly convert unsupported formats to ARGB32_Premultiplied. See included documentation for the complete description. Change-Id: Ie3984a7a8331e02a6f1c42943caaf76854e93538 Reviewed-by: Morten Johan Sørvig Reviewed-by: Gabriel de Dietrich --- src/corelib/global/qglobal.h | 6 + src/corelib/io/qdebug.h | 4 +- src/gui/image/image.pri | 2 + src/gui/image/qimage.h | 9 ++ src/gui/image/qimage_darwin.mm | 141 +++++++++++++++++++++ tests/auto/gui/image/qimage/tst_qimage.cpp | 45 +++++++ 6 files changed, 205 insertions(+), 2 deletions(-) create mode 100644 src/gui/image/qimage_darwin.mm diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index c5d891cc287..3d8baf7188a 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -538,6 +538,12 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max #ifndef Q_FORWARD_DECLARE_MUTABLE_CF_TYPE # define Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) typedef struct __ ## type * type ## Ref #endif +#ifndef Q_FORWARD_DECLARE_CG_TYPE +#define Q_FORWARD_DECLARE_CG_TYPE(type) typedef const struct type *type ## Ref; +#endif +#ifndef Q_FORWARD_DECLARE_MUTABLE_CG_TYPE +#define Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) typedef struct type *type ## Ref; +#endif #ifdef Q_OS_DARWIN # define QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) \ diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 8021f29e161..abc2abeaecd 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -438,8 +438,8 @@ inline QDebug operator<<(QDebug debug, const QFlags &flags) #define QT_FORWARD_DECLARE_CF_TYPE(type) Q_FORWARD_DECLARE_CF_TYPE(type); #define QT_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type); -#define QT_FORWARD_DECLARE_CG_TYPE(type) typedef const struct type *type ## Ref; -#define QT_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) typedef struct type *type ## Ref; +#define QT_FORWARD_DECLARE_CG_TYPE(type) Q_FORWARD_DECLARE_CG_TYPE(type); +#define QT_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type); QT_END_NAMESPACE Q_FORWARD_DECLARE_CF_TYPE(CFString); diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 378256516ca..fe21ff4cc00 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -53,6 +53,8 @@ SOURCES += \ win32:!winrt: SOURCES += image/qpixmap_win.cpp +darwin: OBJECTIVE_SOURCES += image/qimage_darwin.mm + NO_PCH_SOURCES += image/qimage_compat.cpp false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index a99134d3bb9..91aaf673d00 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -54,6 +54,10 @@ #include #endif +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) +Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(CGImage); +#endif + QT_BEGIN_NAMESPACE @@ -321,6 +325,11 @@ public: static QPixelFormat toPixelFormat(QImage::Format format) Q_DECL_NOTHROW; static QImage::Format toImageFormat(QPixelFormat format) Q_DECL_NOTHROW; + // Platform spesific conversion functions +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + CGImageRef toCGImage() const Q_DECL_CF_RETURNS_RETAINED; +#endif + #if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED inline QString text(const char *key, const char *lang = Q_NULLPTR) const; QT_DEPRECATED inline QList textList() const; diff --git a/src/gui/image/qimage_darwin.mm b/src/gui/image/qimage_darwin.mm new file mode 100644 index 00000000000..d72733abd32 --- /dev/null +++ b/src/gui/image/qimage_darwin.mm @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qimage.h" + +#include + +#import +#import + +QT_BEGIN_NAMESPACE + +/*! + Creates a \c CGImage equivalent to the QImage \a image. Returns a + \c CGImageRef handle. + + The returned CGImageRef partakes in the QImage implicit sharing, + and holds a reference to the QImage data. CGImage is immutable + and will never detach the QImage. Writing to the QImage will detach + as usual. + + This function is fast, and does not copy or convert image data. + + The following image formats are supported, and will be mapped to + a corresponding native image type: + + \table + \header + \li Qt + \li CoreGraphics + \row + \li Format_ARGB32 + \li kCGImageAlphaFirst | kCGBitmapByteOrder32Host + \row + \li Format_RGB32 + \li kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host + \row + \li Format_RGBA8888_Premultiplied + \li kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big + \row + \li Format_RGBA8888 + \li kCGImageAlphaLast | kCGBitmapByteOrder32Big + \row + \li Format_RGBX8888 + \li kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big + \row + \li Format_ARGB32_Premultiplied + \li kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host + \endtable + + Other formats are not supported; this function returns a null + CGImageRef for those cases. Users of this function may then + convert the QImage to a supported formate first, for example + Format_ARGB32_Premultiplied. + + The CGImageRef color space is set to the sRGB color space. + + \sa toNSImage() +*/ +CGImageRef QImage::toCGImage() const +{ + if (isNull()) + return nil; + + // Determine the target native format + uint cgflags = kCGImageAlphaNone; + switch (format()) { + case QImage::Format_ARGB32: + cgflags = kCGImageAlphaFirst | kCGBitmapByteOrder32Host; + break; + case QImage::Format_RGB32: + cgflags = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host; + break; + case QImage::Format_RGBA8888_Premultiplied: + cgflags = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big; + break; + case QImage::Format_RGBA8888: + cgflags = kCGImageAlphaLast | kCGBitmapByteOrder32Big; + break; + case QImage::Format_RGBX8888: + cgflags = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big; + break; + case QImage::Format_ARGB32_Premultiplied: + cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host; + break; + default: break; + } + + // Format not supported: return nil CGImageRef + if (cgflags == kCGImageAlphaNone) + return nil; + + // Create a data provider that owns a copy of the QImage and references the image data. + auto deleter = [](void *image, const void *, size_t) + { delete static_cast(image); }; + QCFType dataProvider = + CGDataProviderCreateWithData(new QImage(*this), bits(), byteCount(), deleter); + + QCFType colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); + + const size_t bitsPerComponent = 8; + const size_t bitsPerPixel = 32; + const CGFloat *decode = nullptr; + const bool shouldInterpolate = false; + + return CGImageCreate(width(), height(), bitsPerComponent, bitsPerPixel, + this->bytesPerLine(), colorSpace, cgflags, dataProvider, + decode, shouldInterpolate, kCGRenderingIntentDefault); +} + +QT_END_NAMESPACE diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 18812fd090e..a1ab812aaa3 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -39,6 +39,10 @@ #include #include +#ifdef Q_OS_DARWIN +#include +#endif + Q_DECLARE_METATYPE(QImage::Format) Q_DECLARE_METATYPE(Qt::GlobalColor) @@ -201,6 +205,11 @@ private slots: void ditherGradient_data(); void ditherGradient(); +#ifdef Q_OS_DARWIN + void toCGImage_data(); + void toCGImage(); +#endif + private: const QString m_prefix; }; @@ -3307,5 +3316,41 @@ void tst_QImage::ditherGradient() QVERIFY(observedGradientSteps >= minimumExpectedGradient); } +#ifdef Q_OS_DARWIN + +void tst_QImage::toCGImage_data() +{ + QTest::addColumn("format"); + QTest::addColumn("supported"); + + // Populate test data with supported status for all QImage formats. + QSet supported = + { QImage::Format_ARGB32, QImage::Format_RGB32, QImage::Format_RGBA8888_Premultiplied, + QImage::Format_RGBA8888, QImage::Format_RGBX8888, QImage::Format_ARGB32_Premultiplied }; + + for (int i = QImage::Format_Invalid; i < QImage::Format_Grayscale8; ++i) { + QTest::newRow(qPrintable(formatToString(QImage::Format(i)))) + << QImage::Format(i) << supported.contains(QImage::Format(i)); + } +} + +// Verify that toCGImage() returns a valid CGImageRef for supported image formats. +void tst_QImage::toCGImage() +{ + QFETCH(QImage::Format, format); + QFETCH(bool, supported); + + QImage qimage(64, 64, format); + qimage.fill(Qt::red); + + CGImageRef cgimage = qimage.toCGImage(); + QCOMPARE(cgimage != nullptr, supported); + + CGImageRelease(cgimage); +} + +#endif + + QTEST_GUILESS_MAIN(tst_QImage) #include "tst_qimage.moc" From 7833f7bc06e073165a629e08afa0945d7cf211b7 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 29 Jun 2016 16:28:15 -0700 Subject: [PATCH 129/236] QCoreTextFontEngine: Remove calls to deprecated API on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CGContextShowGlyphsWithAdvances has been deprecated since 10.9. We use instead CTFontDrawGlyphs as recommended by Apple. Change-Id: I568bf588f403228e3b695e42dfe39de807537a9d Reviewed-by: Timur Pocheptsov Reviewed-by: Morten Johan Sørvig Reviewed-by: Jake Petroules --- .../fontdatabases/mac/qfontengine_coretext.mm | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index a0047c0b7d6..fbad61af433 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -440,31 +440,25 @@ void QCoreTextFontEngine::draw(CGContextRef ctx, qreal x, qreal y, const QTextIt CGContextSetTextDrawingMode(ctx, kCGTextFill); - - QVarLengthArray advances(glyphs.size()); + QVarLengthArray cgPositions(glyphs.size()); QVarLengthArray cgGlyphs(glyphs.size()); - - for (int i = 0; i < glyphs.size() - 1; ++i) { - advances[i].width = (positions[i + 1].x - positions[i].x).toReal(); - advances[i].height = (positions[i + 1].y - positions[i].y).toReal(); + const qreal firstX = positions[0].x.toReal(); + const qreal firstY = positions[0].y.toReal(); + for (int i = 0; i < glyphs.size(); ++i) { + cgPositions[i].x = positions[i].x.toReal() - firstX; + cgPositions[i].y = positions[i].y.toReal() - firstY; cgGlyphs[i] = glyphs[i]; } - advances[glyphs.size() - 1].width = 0; - advances[glyphs.size() - 1].height = 0; - cgGlyphs[glyphs.size() - 1] = glyphs[glyphs.size() - 1]; - CGContextSetFont(ctx, cgFont); //NSLog(@"Font inDraw %@ ctfont %@", CGFontCopyFullName(cgFont), CTFontCopyFamilyName(ctfont)); CGContextSetTextPosition(ctx, positions[0].x.toReal(), positions[0].y.toReal()); - - CGContextShowGlyphsWithAdvances(ctx, cgGlyphs.data(), advances.data(), glyphs.size()); + CTFontDrawGlyphs(ctfont, cgGlyphs.data(), cgPositions.data(), glyphs.size(), ctx); if (synthesisFlags & QFontEngine::SynthesizedBold) { CGContextSetTextPosition(ctx, positions[0].x.toReal() + 0.5 * lineThickness().toReal(), positions[0].y.toReal()); - - CGContextShowGlyphsWithAdvances(ctx, cgGlyphs.data(), advances.data(), glyphs.size()); + CTFontDrawGlyphs(ctfont, cgGlyphs.data(), cgPositions.data(), glyphs.size(), ctx); } CGContextSetTextMatrix(ctx, oldTextMatrix); @@ -648,14 +642,13 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition CGContextSetTextMatrix(ctx, cgMatrix); CGContextSetRGBFillColor(ctx, 1, 1, 1, 1); CGContextSetTextDrawingMode(ctx, kCGTextFill); - CGContextSetFont(ctx, cgFont); CGContextSetTextPosition(ctx, pos_x, pos_y); - CGContextShowGlyphsWithAdvances(ctx, &cgGlyph, &CGSizeZero, 1); + CTFontDrawGlyphs(ctfont, &cgGlyph, &CGPointZero, 1, ctx); if (synthesisFlags & QFontEngine::SynthesizedBold) { CGContextSetTextPosition(ctx, pos_x + 0.5 * lineThickness().toReal(), pos_y); - CGContextShowGlyphsWithAdvances(ctx, &cgGlyph, &CGSizeZero, 1); + CTFontDrawGlyphs(ctfont, &cgGlyph, &CGPointZero, 1, ctx); } } else { // CGContextSetTextMatrix does not work with color glyphs, so we use From 8e29d463dc6f5f91dc03f638115b491732c1ff76 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 11 Aug 2016 10:48:17 +0200 Subject: [PATCH 130/236] Make imageAt and formatAt more robus against different font metrics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't try to locate the text by coordinates at the edge of the text but simply aim at the center vertically _and_ horizontally. Task-number: QTBUG-52991 Change-Id: Ia9e84fc5d12491840e739c4eea730fe13058f3c7 Reviewed-by: Simo Fält --- tests/auto/gui/text/qabstracttextdocumentlayout/BLACKLIST | 7 ------- .../tst_qabstracttextdocumentlayout.cpp | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) delete mode 100644 tests/auto/gui/text/qabstracttextdocumentlayout/BLACKLIST diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/BLACKLIST b/tests/auto/gui/text/qabstracttextdocumentlayout/BLACKLIST deleted file mode 100644 index fa033cee09e..00000000000 --- a/tests/auto/gui/text/qabstracttextdocumentlayout/BLACKLIST +++ /dev/null @@ -1,7 +0,0 @@ -#QTBUG-53648 -[imageAt] -opensuse-42.1 -rhel-7.2 -#QTBUG-52991 -[formatAt] -opensuse-42.1 diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp index 9542d306ba4..be3ef968ef1 100644 --- a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp +++ b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp @@ -194,7 +194,7 @@ void tst_QAbstractTextDocumentLayout::imageAt() QCOMPARE(documentLayout->anchorAt(imagePoint), QString("link")); // imageAt on start returns nothing (there's the "foo" text) - QPointF fooPoint(fooBr.width() + blockStart.x(), (fooBr.height() / 2) + blockStart.y()); + QPointF fooPoint(blockStart.x() + (fooBr.width() / 2), (fooBr.height() / 2) + blockStart.y()); QCOMPARE(documentLayout->imageAt(fooPoint), QString()); } @@ -221,7 +221,7 @@ void tst_QAbstractTextDocumentLayout::formatAt() QVERIFY(format.isImageFormat()); // move over the unformatted "foo" text) - QPointF fooPoint(fooBr.width() + blockStart.x(), (fooBr.height() / 2) + blockStart.y()); + QPointF fooPoint(blockStart.x() + (fooBr.width() / 2), (fooBr.height() / 2) + blockStart.y()); format = documentLayout->formatAt(fooPoint); QVERIFY(format.isCharFormat()); QVERIFY(!format.toCharFormat().isAnchor()); From 492ca3e503c77cc5f41eb0a6c232d39b876f8d91 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 31 May 2016 12:59:43 +0200 Subject: [PATCH 131/236] Add qt_attribution.json files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The format is documented in http://wiki.qt.io/Qt_attribution.json Also add a LICENSE file in case there is none yet (usually copied from the source headers). Task-number: QTBUG-55139 Change-Id: Ib54c73d0bb9946cfd8579e86c6858035184ca516 Reviewed-by: Topi Reiniö Reviewed-by: Edward Welbourne --- src/3rdparty/android/LICENSE | 11 + src/3rdparty/android/qt_attribution.json | 11 + src/3rdparty/angle/SYSTEMINFO_LICENSE | 22 + src/3rdparty/angle/TRACEEVENT_LICENSE | 27 + src/3rdparty/angle/qt_attribution.json | 61 +++ src/3rdparty/atspi2/LICENSE | 482 ++++++++++++++++++ src/3rdparty/atspi2/qt_attribution.json | 11 + .../double-conversion/qt_attribution.json | 14 + src/3rdparty/easing/LICENSE | 25 + src/3rdparty/easing/qt_attribution.json | 11 + src/3rdparty/forkfd/LICENSE | 19 + src/3rdparty/forkfd/qt_attribution.json | 12 + src/3rdparty/freebsd/LICENSE | 31 ++ src/3rdparty/freebsd/qt_attribution.json | 17 + src/3rdparty/freetype/qt_attribution.json | 13 + src/3rdparty/harfbuzz-ng/qt_attribution.json | 25 + src/3rdparty/harfbuzz/qt_attribution.json | 17 + src/3rdparty/iaccessible2/LICENSE | 38 ++ src/3rdparty/iaccessible2/qt_attribution.json | 17 + src/3rdparty/libjpeg/LICENSE | 50 ++ src/3rdparty/libjpeg/qt_attribution.json | 13 + src/3rdparty/libpng/qt_attribution.json | 15 + src/3rdparty/md4/qt_attribution.json | 10 + src/3rdparty/md5/qt_attribution.json | 11 + src/3rdparty/pcre/qt_attribution.json | 15 + src/3rdparty/pixman/LICENSE | 20 + src/3rdparty/pixman/qt_attribution.json | 13 + src/3rdparty/rfc6234/LICENSE | 34 ++ src/3rdparty/rfc6234/qt_attribution.json | 12 + src/3rdparty/sha1/qt_attribution.json | 12 + src/3rdparty/sha3/BRG_ENDIAN_LICENSE | 21 + src/3rdparty/sha3/CC0_LICENSE | 99 ++++ src/3rdparty/sha3/qt_attribution.json | 29 ++ src/3rdparty/sqlite/qt_attribution.json | 12 + src/3rdparty/wintab/qt_attribution.json | 12 + src/3rdparty/xcb/LICENSE | 23 + src/3rdparty/xcb/qt_attribution.json | 24 + src/3rdparty/xkbcommon/qt_attribution.json | 26 + src/3rdparty/zlib/LICENSE | 28 + src/3rdparty/zlib/qt_attribution.json | 15 + 40 files changed, 1358 insertions(+) create mode 100644 src/3rdparty/android/LICENSE create mode 100644 src/3rdparty/android/qt_attribution.json create mode 100644 src/3rdparty/angle/SYSTEMINFO_LICENSE create mode 100644 src/3rdparty/angle/TRACEEVENT_LICENSE create mode 100644 src/3rdparty/angle/qt_attribution.json create mode 100644 src/3rdparty/atspi2/LICENSE create mode 100644 src/3rdparty/atspi2/qt_attribution.json create mode 100644 src/3rdparty/double-conversion/qt_attribution.json create mode 100644 src/3rdparty/easing/LICENSE create mode 100644 src/3rdparty/easing/qt_attribution.json create mode 100644 src/3rdparty/forkfd/LICENSE create mode 100644 src/3rdparty/forkfd/qt_attribution.json create mode 100644 src/3rdparty/freebsd/LICENSE create mode 100644 src/3rdparty/freebsd/qt_attribution.json create mode 100644 src/3rdparty/freetype/qt_attribution.json create mode 100644 src/3rdparty/harfbuzz-ng/qt_attribution.json create mode 100644 src/3rdparty/harfbuzz/qt_attribution.json create mode 100644 src/3rdparty/iaccessible2/LICENSE create mode 100644 src/3rdparty/iaccessible2/qt_attribution.json create mode 100644 src/3rdparty/libjpeg/LICENSE create mode 100644 src/3rdparty/libjpeg/qt_attribution.json create mode 100644 src/3rdparty/libpng/qt_attribution.json create mode 100644 src/3rdparty/md4/qt_attribution.json create mode 100644 src/3rdparty/md5/qt_attribution.json create mode 100644 src/3rdparty/pcre/qt_attribution.json create mode 100644 src/3rdparty/pixman/LICENSE create mode 100644 src/3rdparty/pixman/qt_attribution.json create mode 100644 src/3rdparty/rfc6234/LICENSE create mode 100644 src/3rdparty/rfc6234/qt_attribution.json create mode 100644 src/3rdparty/sha1/qt_attribution.json create mode 100644 src/3rdparty/sha3/BRG_ENDIAN_LICENSE create mode 100644 src/3rdparty/sha3/CC0_LICENSE create mode 100644 src/3rdparty/sha3/qt_attribution.json create mode 100644 src/3rdparty/sqlite/qt_attribution.json create mode 100644 src/3rdparty/wintab/qt_attribution.json create mode 100644 src/3rdparty/xcb/LICENSE create mode 100644 src/3rdparty/xcb/qt_attribution.json create mode 100644 src/3rdparty/xkbcommon/qt_attribution.json create mode 100644 src/3rdparty/zlib/LICENSE create mode 100644 src/3rdparty/zlib/qt_attribution.json diff --git a/src/3rdparty/android/LICENSE b/src/3rdparty/android/LICENSE new file mode 100644 index 00000000000..c026b6b79a3 --- /dev/null +++ b/src/3rdparty/android/LICENSE @@ -0,0 +1,11 @@ +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/src/3rdparty/android/qt_attribution.json b/src/3rdparty/android/qt_attribution.json new file mode 100644 index 00000000000..c1f89fd8bd9 --- /dev/null +++ b/src/3rdparty/android/qt_attribution.json @@ -0,0 +1,11 @@ +{ + "Id": "android-native-style", + "Name": "Native Style for Android", + "QDocModule": "qtgui", + "QtUsage": "Used in Android platform plugin.", + + "License": "Apache License 2.0", + "LicenseId": "Apache-2.0", + "LicenseFile": "LICENSE", + "Copyright": "Copyright (C) 2005 The Android Open Source Project" +} diff --git a/src/3rdparty/angle/SYSTEMINFO_LICENSE b/src/3rdparty/angle/SYSTEMINFO_LICENSE new file mode 100644 index 00000000000..c12444e3bc4 --- /dev/null +++ b/src/3rdparty/angle/SYSTEMINFO_LICENSE @@ -0,0 +1,22 @@ +Copyright (C) 2009 Apple Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 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. diff --git a/src/3rdparty/angle/TRACEEVENT_LICENSE b/src/3rdparty/angle/TRACEEVENT_LICENSE new file mode 100644 index 00000000000..34d6cd92689 --- /dev/null +++ b/src/3rdparty/angle/TRACEEVENT_LICENSE @@ -0,0 +1,27 @@ +Copyright 2013 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +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. diff --git a/src/3rdparty/angle/qt_attribution.json b/src/3rdparty/angle/qt_attribution.json new file mode 100644 index 00000000000..230f30940bb --- /dev/null +++ b/src/3rdparty/angle/qt_attribution.json @@ -0,0 +1,61 @@ +[ + { + "Id": "angle", + "Name": "ANGLE Library", + "QDocModule": "qtgui", + "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.", + + "License": "BSD 3-clause \"New\" or \"Revised\" License", + "LicenseId": "BSD-3-Clause", + "LicenseFile": "LICENSE", + "Copyright": "Copyright (C) 2002-2013 The ANGLE Project Authors" + }, + { + "Id": "angle-arrayboundsclamper", + "Name": "ANGLE Array Bounds Clamper for WebKit", + "QDocModule": "qtgui", + "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.", + + "Path": "src/third_party/compiler", + "Description": "Implements clamping of array indexing expressions during shader translation.", + "License": "BSD 2-clause \"Simplified\" License", + "LicenseId": "BSD-2-Clause", + "LicenseFile": "src/third_party/compiler/LICENSE", + "Copyright": "Copyright (C) 2012 Apple Inc." + }, + { + "Id": "angle-murmurhash", + "Name": "Murmurhash (as part of ANGLE)", + "QDocModule": "qtgui", + "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.", + + "Path": "src/third_party/murmurhash", + "License": "Public Domain", + "LicenseId": "NONE", + "Copyright": "MurmurHash3 was written by Austin Appleby, and is placed in the public domain. The author hereby disclaims copyright to this source code." + }, + { + "Id": "angle-systeminfo", + "Name": "Systeminfo (as part of ANGLE)", + "QDocModule": "qtgui", + "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.", + + "Path": "src/third_party/systeminfo", + "License": "BSD 2-clause \"Simplified\" License", + "LicenseId": "BSD-2-Clause", + "LicenseFile": "SYSTEMINFO_LICENSE", + "Copyright": "Copyright (C) 2009 Apple Inc. All Rights Reserved." + }, + { + "Id": "angle-trace_event", + "Name": "trace_event (as part of ANGLE)", + "QDocModule": "qtgui", + "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.", + + "Path": "src/third_party/trace_event", + "License": "BSD 3-clause \"New\" or \"Revised\" License", + "LicenseId": "BSD-3-Clause", + "LicenseFile": "TRACEEVENT_LICENSE", + "Copyright": "Copyright (c) 2013 The Chromium Authors." + } +] diff --git a/src/3rdparty/atspi2/LICENSE b/src/3rdparty/atspi2/LICENSE new file mode 100644 index 00000000000..dc5f1b170d6 --- /dev/null +++ b/src/3rdparty/atspi2/LICENSE @@ -0,0 +1,482 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, 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 +this service 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 make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +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 +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library 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 Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey 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 library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + diff --git a/src/3rdparty/atspi2/qt_attribution.json b/src/3rdparty/atspi2/qt_attribution.json new file mode 100644 index 00000000000..ed2ef85158e --- /dev/null +++ b/src/3rdparty/atspi2/qt_attribution.json @@ -0,0 +1,11 @@ +{ + "Id": "atspi2", + "Name": "at-spi2 (Assistive Technology Service Provider Interface)", + "QDocModule": "qtgui", + "QtUsage": "Optionally ysed on Linux for accessibility. Configure without dbus (QT_CONFIG-=accessibility-atspi-bridge) to avoid.", + + "License": "GNU Library General Public License v2 or later", + "LicenseId": "LGPL-2.0+", + "LicenseFile": "LICENSE", + "Copyright": "Copyright 2010, 2011 Novell, Inc., Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany." +} diff --git a/src/3rdparty/double-conversion/qt_attribution.json b/src/3rdparty/double-conversion/qt_attribution.json new file mode 100644 index 00000000000..92118ac7791 --- /dev/null +++ b/src/3rdparty/double-conversion/qt_attribution.json @@ -0,0 +1,14 @@ +{ + "Id": "doubleconversion", + "Name": "Efficient Binary-Decimal and Decimal-Binary Conversion Routines for IEEE Doubles", + "QDocModule": "qtcore", + "QtUsage": "Used in Qt Core. Configure with -system-doubleconversion or -no-doubleconversion to avoid.", + + "Homepage": "https://github.com/google/double-conversion", + "Version": "2.0.1", + "DownloadLocation": "https://github.com/google/double-conversion/commit/2fb03de56faa32bbba5e02222528e7b760f71d77", + "License": "BSD 3-clause \"New\" or \"Revised\" License", + "LicenseId": "BSD-3-Clause", + "LicenseFile": "LICENSE", + "Copyright": "Copyright 2006-2012, the V8 project authors" +} diff --git a/src/3rdparty/easing/LICENSE b/src/3rdparty/easing/LICENSE new file mode 100644 index 00000000000..5dc85c4712b --- /dev/null +++ b/src/3rdparty/easing/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2001 Robert Penner +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the author nor the names of contributors may be used + to endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY 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. diff --git a/src/3rdparty/easing/qt_attribution.json b/src/3rdparty/easing/qt_attribution.json new file mode 100644 index 00000000000..b6240c61c89 --- /dev/null +++ b/src/3rdparty/easing/qt_attribution.json @@ -0,0 +1,11 @@ +{ + "Id": "easing", + "Name": "Easing Equations by Robert Penner", + "QDocModule": "qtcore", + "QtUsage": "Used in Qt Core (QEasingCurve).", + + "License": "BSD 3-clause \"New\" or \"Revised\" License", + "LicenseId": "BSD-3-Clause", + "LicenseFile": "LICENSE", + "Copyright": "Copyright (c) 2001 Robert Penner" +} diff --git a/src/3rdparty/forkfd/LICENSE b/src/3rdparty/forkfd/LICENSE new file mode 100644 index 00000000000..351ebf705d1 --- /dev/null +++ b/src/3rdparty/forkfd/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2016 Intel Corporation. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/3rdparty/forkfd/qt_attribution.json b/src/3rdparty/forkfd/qt_attribution.json new file mode 100644 index 00000000000..89f25f4870c --- /dev/null +++ b/src/3rdparty/forkfd/qt_attribution.json @@ -0,0 +1,12 @@ +{ + "Id": "forkfd", + "Name": "forkfd", + "QDocModule": "qtcore", + "QtUsage": "Used on most Unix platforms in Qt Core.", + + "License": "MIT License", + "LicenseId": "MIT", + "LicenseFile": "LICENSE", + "Copyright": "Copyright (C) 2013-2016 Intel Corporation +Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com" +} diff --git a/src/3rdparty/freebsd/LICENSE b/src/3rdparty/freebsd/LICENSE new file mode 100644 index 00000000000..5bb30318eb7 --- /dev/null +++ b/src/3rdparty/freebsd/LICENSE @@ -0,0 +1,31 @@ +Copyright (c) 1992, 1993 + The Regents of the University of California. All rights reserved. + +Copyright (c) 2011 The FreeBSD Foundation +All rights reserved. +Portions of this software were developed by David Chisnall +under sponsorship from the FreeBSD Foundation. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY 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. diff --git a/src/3rdparty/freebsd/qt_attribution.json b/src/3rdparty/freebsd/qt_attribution.json new file mode 100644 index 00000000000..40c337cc674 --- /dev/null +++ b/src/3rdparty/freebsd/qt_attribution.json @@ -0,0 +1,17 @@ +{ + "Id": "freebsd", + "Name": "FreeBSD strtoll and strtoull", + "QDocModule": "qtcore", + "QtUsage": "Used in Qt Core.", + + "License": "BSD 3-clause \"New\" or \"Revised\" License", + "LicenseId": "BSD-3-Clause", + "LicenseFile": "LICENSE", + "Copyright": "Copyright (c) 1992, 1993 + The Regents of the University of California. All rights reserved. + +Copyright (c) 2011 The FreeBSD Foundation +All rights reserved. +Portions of this software were developed by David Chisnall +under sponsorship from the FreeBSD Foundation." +} diff --git a/src/3rdparty/freetype/qt_attribution.json b/src/3rdparty/freetype/qt_attribution.json new file mode 100644 index 00000000000..6c11f1b6170 --- /dev/null +++ b/src/3rdparty/freetype/qt_attribution.json @@ -0,0 +1,13 @@ +{ + "Id": "freetype", + "Name": "Freetype 2", + "QDocModule": "qtgui", + "QtUsage": "Optionally used in Qt GUI and platform plugins. Configure with -no-freetype, or -system-freetype to avoid.", + + "Description": "FreeType is a freely available software library to render fonts.", + "Homepage": "http://www.freetype.org", + "License": "Freetype Project License or GNU General Public License v2.0 only", + "LicenseId": "FTL or GPL-2.0", + "LicenseFile": "docs/LICENSE.TXT", + "Copyright": "Copyright 2006-2015 by David Turner, Robert Wilhelm, and Werner Lemberg." +} diff --git a/src/3rdparty/harfbuzz-ng/qt_attribution.json b/src/3rdparty/harfbuzz-ng/qt_attribution.json new file mode 100644 index 00000000000..4d3eb791501 --- /dev/null +++ b/src/3rdparty/harfbuzz-ng/qt_attribution.json @@ -0,0 +1,25 @@ +{ + "Id": "harfbuzz-ng", + "Name": "HarfBuzz-NG", + "QDocModule": "qtgui", + "QtUsage": "Optionally used in Qt GUI. Configure with -system-harfbuzz or -qt-harfbuzz to avoid.", + + "Description": "HarfBuzz is an OpenType text shaping engine.", + "Homepage": "http://harfbuzz.org", + + "License": "MIT License", + "LicenseId": "MIT", + "LicenseFile": "COPYING", + "Copyright": "Copyright © 2010,2011,2012 Google, Inc. +Copyright © 2012 Mozilla Foundation +Copyright © 2011 Codethink Limited +Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies) +Copyright © 2009 Keith Stribley +Copyright © 2009 Martin Hosken and SIL International +Copyright © 2007 Chris Wilson +Copyright © 2006 Behdad Esfahbod +Copyright © 2005 David Turner +Copyright © 2004,2007,2008,2009,2010 Red Hat, Inc. +Copyright © 1998-2004 David Turner and Werner Lemberg +" +} diff --git a/src/3rdparty/harfbuzz/qt_attribution.json b/src/3rdparty/harfbuzz/qt_attribution.json new file mode 100644 index 00000000000..2c2b31e4a9d --- /dev/null +++ b/src/3rdparty/harfbuzz/qt_attribution.json @@ -0,0 +1,17 @@ +{ + "Id": "harfbuzz", + "Name": "HarfBuzz", + "QDocModule": "qtgui", + "QtUsage": "Optionally used in Qt GUI. Configure with -system-harfbuzz or -qt-harfbuzz to avoid.", + + "License": "MIT License", + "LicenseId": "MIT", + "LicenseFile": "COPYING", + "Copyright": "Copyright (c) 1992, 1993 + The Regents of the University of California. All rights reserved. + +Copyright (c) 2011 The FreeBSD Foundation +All rights reserved. +Portions of this software were developed by David Chisnall +under sponsorship from the FreeBSD Foundation." +} diff --git a/src/3rdparty/iaccessible2/LICENSE b/src/3rdparty/iaccessible2/LICENSE new file mode 100644 index 00000000000..688d9d3197a --- /dev/null +++ b/src/3rdparty/iaccessible2/LICENSE @@ -0,0 +1,38 @@ +Copyright (c) 2013 Linux Foundation +All rights reserved. + + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + 3. Neither the name of the Linux Foundation nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY 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. + +This BSD License conforms to the Open Source Initiative "Simplified +BSD License" as published at: +http://www.opensource.org/licenses/bsd-license.php diff --git a/src/3rdparty/iaccessible2/qt_attribution.json b/src/3rdparty/iaccessible2/qt_attribution.json new file mode 100644 index 00000000000..545ffe4d636 --- /dev/null +++ b/src/3rdparty/iaccessible2/qt_attribution.json @@ -0,0 +1,17 @@ +{ + "Id": "iaccessible2", + "Name": "IAccessible2 IDL Specification", + "QDocModule": "qtgui", + "QtUsage": "Optionally used in the Windows platform plugin. Configure with -no-accessibility to avoid.", + + "Description": "IAccessible2 is a new accessibility API which complements Microsoft's earlier work on MSAA", + "Homepage": "http://www.linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2", + "License": "BSD 3-clause \"New\" or \"Revised\" License", + "LicenseId": "BSD-3-Clause", + "LicenseFile": "LICENSE", + "Copyright": "Copyright (c) 2000, 2006 Sun Microsystems, Inc. +Copyright (c) 2006 IBM Corporation +Copyright (c) 2007, 2010, 2012, 2013 Linux Foundation + +IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 mark may be used in accordance with the Linux Foundation Trademark Policy to indicate compliance with the IAccessible2 specification." +} diff --git a/src/3rdparty/libjpeg/LICENSE b/src/3rdparty/libjpeg/LICENSE new file mode 100644 index 00000000000..797a6d56680 --- /dev/null +++ b/src/3rdparty/libjpeg/LICENSE @@ -0,0 +1,50 @@ +from qtbase/src/3rdparty/libjpeg/README: + +LEGAL ISSUES +============ + +In plain English: + +1. We don't promise that this software works. (But if you find any bugs, + please let us know!) +2. You can use this software for whatever you want. You don't have to pay us. +3. You may not pretend that you wrote this software. If you use it in a + program, you must acknowledge somewhere in your documentation that + you've used the IJG code. + +In legalese: + +The authors make NO WARRANTY or representation, either express or implied, +with respect to this software, its quality, accuracy, merchantability, or +fitness for a particular purpose. This software is provided "AS IS", and you, +its user, assume the entire risk as to its quality and accuracy. + +This software is copyright (C) 1991-1998, Thomas G. Lane. +All Rights Reserved except as specified below. + +Permission is hereby granted to use, copy, modify, and distribute this +software (or portions thereof) for any purpose, without fee, subject to these +conditions: +(1) If any part of the source code for this software is distributed, then this +README file must be included, with this copyright and no-warranty notice +unaltered; and any additions, deletions, or changes to the original files +must be clearly indicated in accompanying documentation. +(2) If only executable code is distributed, then the accompanying +documentation must state that "this software is based in part on the work of +the Independent JPEG Group". +(3) Permission for use of this software is granted only if the user accepts +full responsibility for any undesirable consequences; the authors accept +NO LIABILITY for damages of any kind. + +These conditions apply to any software derived from or based on the IJG code, +not just to the unmodified library. If you use our work, you ought to +acknowledge us. + +Permission is NOT granted for the use of any IJG author's name or company name +in advertising or publicity relating to this software or products derived from +it. This software may be referred to only as "the Independent JPEG Group's +software". + +We specifically permit and encourage the use of this software as the basis of +commercial products, provided that all warranty or liability claims are +assumed by the product vendor. diff --git a/src/3rdparty/libjpeg/qt_attribution.json b/src/3rdparty/libjpeg/qt_attribution.json new file mode 100644 index 00000000000..ee5c094a0f7 --- /dev/null +++ b/src/3rdparty/libjpeg/qt_attribution.json @@ -0,0 +1,13 @@ +{ + "Id": "libjpeg", + "Name": "LibJPEG", + "QDocModule": "qtgui", + "QtUsage": "Used in the QJPEG image plugin. Configure with -no-jpeg to avoid.", + + "Description": "The Independent JPEG Group's JPEG software", + "Homepage": "http://www.ijg.org/", + "License": "Independent JPEG Group License", + "LicenseId": "IJG", + "LicenseFile": "LICENSE", + "Copyright": "Copyright (C) 1991-2011, Thomas G. Lane, Guido Vollbeding." +} diff --git a/src/3rdparty/libpng/qt_attribution.json b/src/3rdparty/libpng/qt_attribution.json new file mode 100644 index 00000000000..93e73243af1 --- /dev/null +++ b/src/3rdparty/libpng/qt_attribution.json @@ -0,0 +1,15 @@ +{ + "Id": "libpng", + "Name": "LibPNG", + "QDocModule": "qtgui", + "QtUsage": "Used in the qpng image plugin. Configure with -system-png or -no-png to avoid.", + + "Description": "libpng is the official PNG reference library.", + "Homepage": "http://www.libpng.org/pub/png/libpng.html", + "License": "libpng License", + "LicenseId": "Libpng", + "LicenseFile": "LICENSE", + "Copyright": "Copyright (c) 1998-2015 Glenn Randers-Pehrson +Copyright (c) 1996-1997 Andreas Dilger +Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." +} diff --git a/src/3rdparty/md4/qt_attribution.json b/src/3rdparty/md4/qt_attribution.json new file mode 100644 index 00000000000..f1bca24660f --- /dev/null +++ b/src/3rdparty/md4/qt_attribution.json @@ -0,0 +1,10 @@ +{ + "Id": "md4", + "Name": "MD4", + "QDocModule": "qtcore", + "QtUsage": "Used in Qt Core (QCryptographicHash). Configure with -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 to avoid.", + + "Description": "An OpenSSL-compatible implementation of the RSA Data Security, Inc. MD4 Message-Digest Algorithm.", + "License": "Public Domain", + "Copyright": "Written by Alexander Peslyak - better known as Solar Designer - in 2001, and placed in the public domain. There's absolutely no warranty." +} diff --git a/src/3rdparty/md5/qt_attribution.json b/src/3rdparty/md5/qt_attribution.json new file mode 100644 index 00000000000..52b613cf6cf --- /dev/null +++ b/src/3rdparty/md5/qt_attribution.json @@ -0,0 +1,11 @@ +{ + "Id": "md5", + "Name": "MD5", + "QDocModule": "qtcore", + "QtUsage": "Used in Qt Core (QCryptographicHash). Configure with -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 to avoid.", + + "Description": "MD5 message-digest algorithm.", + "License": "Public Domain", + "Copyright": "Written by Colin Plumb in 1993, no copyright is claimed. +Ian Jackson ." +} diff --git a/src/3rdparty/pcre/qt_attribution.json b/src/3rdparty/pcre/qt_attribution.json new file mode 100644 index 00000000000..ec8832486b2 --- /dev/null +++ b/src/3rdparty/pcre/qt_attribution.json @@ -0,0 +1,15 @@ +{ + "Id": "pcre", + "Name": "PCRE", + "QDocModule": "qtcore", + "QtUsage": "Optionally used in Qt Core (QRegularExpression). Configure with -system-pcre or -no-pcre to avoid.", + + "Description": "The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.", + "Homepage": "http://www.pcre.org/", + "License": "BSD 3-clause \"New\" or \"Revised\" License", + "LicenseId": "BSD-3-Clause", + "LicenseFile": "LICENCE", + "Copyright": "Copyright (c) 1997-2015 University of Cambridge +Copyright (c) 2010-2015 Zoltan Herczeg +Copyright (c) 2007-2012, Google Inc." +} diff --git a/src/3rdparty/pixman/LICENSE b/src/3rdparty/pixman/LICENSE new file mode 100644 index 00000000000..3cb51484f10 --- /dev/null +++ b/src/3rdparty/pixman/LICENSE @@ -0,0 +1,20 @@ +Copyright © 2009 Nokia Corporation + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/src/3rdparty/pixman/qt_attribution.json b/src/3rdparty/pixman/qt_attribution.json new file mode 100644 index 00000000000..607bda754db --- /dev/null +++ b/src/3rdparty/pixman/qt_attribution.json @@ -0,0 +1,13 @@ +{ + "Id": "pixman", + "Name": "Pixman", + "QDocModule": "qtgui", + "QtUsage": "Used in Qt GUI on ARM NEON.", + + "Description": "pixman is a library that provides low-level pixel manipulation features such as image compositing and trapezoid rasterization.", + "Homepage": "http://www.pixman.org/", + "License": "MIT License", + "LicenseFile": "LICENSE", + "LicenseId": "MIT", + "Copyright": "Copyright © 2009 Nokia Corporation" +} diff --git a/src/3rdparty/rfc6234/LICENSE b/src/3rdparty/rfc6234/LICENSE new file mode 100644 index 00000000000..7075960ee23 --- /dev/null +++ b/src/3rdparty/rfc6234/LICENSE @@ -0,0 +1,34 @@ +Copyright (c) 2011 IETF Trust and the persons identified as +authors of the code. All rights reserved. + +Redistribution and use in source and binary forms, with or +without modification, are permitted provided that the following +conditions are met: + +- Redistributions of source code must retain the above + copyright notice, this list of conditions and + the following disclaimer. + +- Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + +- Neither the name of Internet Society, IETF or IETF Trust, nor + the names of specific contributors, may be used to endorse or + promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY 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. diff --git a/src/3rdparty/rfc6234/qt_attribution.json b/src/3rdparty/rfc6234/qt_attribution.json new file mode 100644 index 00000000000..9fc427b4a63 --- /dev/null +++ b/src/3rdparty/rfc6234/qt_attribution.json @@ -0,0 +1,12 @@ +{ + "Id": "rfc6234", + "Name": "Secure Hash Algorithms SHA-384 and SHA-512", + "QDocModule": "qtcore", + "QtUsage": "Used in Qt Core (QCryptographicHash and QMessageAuthenticationCode)", + + "Description": "Implements the Secure Hash Algorithms SHA 384 and SHA-521", + "License": "BSD 3-clause \"New\" or \"Revised\" License", + "LicenseFile": "LICENSE", + "LicenseId": "BSD-3-Clause", + "Copyright": "Copyright (c) 2011 IETF Trust and the persons identified as authors of the code." +} diff --git a/src/3rdparty/sha1/qt_attribution.json b/src/3rdparty/sha1/qt_attribution.json new file mode 100644 index 00000000000..707c239f8d0 --- /dev/null +++ b/src/3rdparty/sha1/qt_attribution.json @@ -0,0 +1,12 @@ +{ + "Id": "sha1", + "Name": "Secure Hash Algorithm SHA-1", + "QDocModule": "qtcore", + "QtUsage": "Used in Qt Core (QCryptographicHash).", + + "Description": "Implements the Secure Hash Algorithms SHA 1", + "Homepage": "http://www.dominik-reichl.de/projects/csha1/", + "License": "Public Domain", + "Copyright": "Copyright (C) Dominik Reichl +Copyright (C) 2016 The Qt Company Ltd" +} diff --git a/src/3rdparty/sha3/BRG_ENDIAN_LICENSE b/src/3rdparty/sha3/BRG_ENDIAN_LICENSE new file mode 100644 index 00000000000..0a4fdcbc3b1 --- /dev/null +++ b/src/3rdparty/sha3/BRG_ENDIAN_LICENSE @@ -0,0 +1,21 @@ +Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved. + +LICENSE TERMS + +The redistribution and use of this software (with or without changes) +is allowed without the payment of fees or royalties provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + +DISCLAIMER + +This software is provided 'as is' with no explicit or implied warranties +in respect of its properties, including, but not limited to, correctness +and/or fitness for purpose. diff --git a/src/3rdparty/sha3/CC0_LICENSE b/src/3rdparty/sha3/CC0_LICENSE new file mode 100644 index 00000000000..cff12c3d889 --- /dev/null +++ b/src/3rdparty/sha3/CC0_LICENSE @@ -0,0 +1,99 @@ +CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF +THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS +INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS +DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES +RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and +Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") +of an original work of authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing +to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and +without fear of later claims of infringement build upon, modify, incorporate in other works, reuse +and redistribute as freely as possible in any form whatsoever and for any purposes, including +without limitation commercial purposes. These owners may contribute to the Commons to promote the +ideal of a free culture and the further production of creative, cultural and scientific works, or to +gain reputation or greater distribution for their Work in part through the use and efforts of +others. + +For these and/or other purposes and motivations, and without any expectation of additional +consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the +extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to +apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her +Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those +rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and + related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights + include, but are not limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; + + ii. moral rights retained by the original author(s) and/or performer(s); + + iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; + + iv. rights protecting against unfair competition in regards to a Work, subject to the limitations + in paragraph 4(a), below; + + v. rights protecting the extraction, dissemination, use and reuse of data in a Work; + + vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and + of the Council of 11 March 1996 on the legal protection of databases, and under any national + implementation thereof, including any amended or successor version of such directive); and + + vii. other similar, equivalent or corresponding rights throughout the world based on applicable + law or treaty, and any national implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, + Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, + and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of + action, whether now known or unknown (including existing as well as future claims and causes of + action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by + applicable law or treaty (including future time extensions), (iii) in any current or future + medium and for any number of copies, and (iv) for any purpose whatsoever, including without + limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the + Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's + heirs and successors, fully intending that such Waiver shall not be subject to revocation, + rescission, cancellation, termination, or any other legal or equitable action to disrupt the + quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of + Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid + or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent + permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent + the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non + transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise + Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for + the maximum duration provided by applicable law or treaty (including future time extensions), + (iii) in any current or future medium and for any number of copies, and (iv) for any purpose + whatsoever, including without limitation commercial, advertising or promotional purposes (the + "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to + the Work. Should any part of the License for any reason be judged legally invalid or ineffective + under applicable law, such partial invalidity or ineffectiveness shall not invalidate the + remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) + exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any + associated claims and causes of action with respect to the Work, in either case contrary to + Affirmer's express Statement of Purpose. + +4. Limitations and Disclaimers. + +a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or + otherwise affected by this document. + +b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning + the Work, express, implied, statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non infringement, or the absence of + latent or other defects, accuracy, or the present or absence of errors, whether or not + discoverable, all to the greatest extent permissible under applicable law. + +c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work + or any use thereof, including without limitation any person's Copyright and Related Rights in the + Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, + permissions or other rights required for any use of the Work. + +d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and + has no duty or obligation with respect to this CC0 or use of the Work. diff --git a/src/3rdparty/sha3/qt_attribution.json b/src/3rdparty/sha3/qt_attribution.json new file mode 100644 index 00000000000..13e6e971d9a --- /dev/null +++ b/src/3rdparty/sha3/qt_attribution.json @@ -0,0 +1,29 @@ +[ + { + "Id": "sha3_endian", + "Name": "Secure Hash Algorithm SHA-3 - brg_endian", + "QDocModule": "qtcore", + "QtUsage": "Used in Qt Core (QCryptographicHash).", + + "Description": "SHA-3, originally known as Keccak, is a cryptographic hash function.", + "License": "BSD 3-clause \"New\" or \"Revised\" License", + "LicenseFile": "BRG_ENDIAN_LICENSE", + "LicenseId": "BSD-3-Clause", + "Copyright": "Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved." + }, + { + "Id": "sha3_keccak", + "Name": "Secure Hash Algorithm SHA-3 - Keccak", + "QDocModule": "qtcore", + "QtUsage": "Used in Qt Core (QCryptographicHash).", + + "Description": "SHA-3, originally known as Keccak, is a cryptographic hash function.", + "License": "Creative Commons Zero v1.0 Universal", + "LicenseId": "CC0-1.0", + "LicenseFile": "CC0_LICENSE", + "Copyright": "Guido Bertoni, Joan Daemen, MichaĂ«l Peeters and Gilles Van Assche. + +To the extent possible under law, the implementers have waived all copyright +and related or neighboring rights to the source code in this file." + } +] diff --git a/src/3rdparty/sqlite/qt_attribution.json b/src/3rdparty/sqlite/qt_attribution.json new file mode 100644 index 00000000000..a4ea0cdbd2f --- /dev/null +++ b/src/3rdparty/sqlite/qt_attribution.json @@ -0,0 +1,12 @@ +{ + "Id": "sqlite", + "Name": "SQLite", + "QDocModule": "qtsql", + "QtUsage": "Used in Qt SQL Lite plugin. Configure Qt with -system-sqlite or -no-sqlite to avoid.", + + "Description": "SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.", + "Homepage": "http://www.sqlite.org/", + "Version": "3.11.1.0", + "License": "Public Domain", + "Copyright": "The authors disclaim copyright to the source code. However, a license can be obtained if needed." +} diff --git a/src/3rdparty/wintab/qt_attribution.json b/src/3rdparty/wintab/qt_attribution.json new file mode 100644 index 00000000000..742278fb26d --- /dev/null +++ b/src/3rdparty/wintab/qt_attribution.json @@ -0,0 +1,12 @@ +{ + "Id": "wintab", + "Name": "Wintab API", + "QDocModule": "qtgui", + "QtUsage": "Used in the Qt platform plugin for Windows. Configure with -DQT_NO_TABLETEVENT to avoid.", + + "Description": "Wintab is a de facto API for pointing devices on Windows.", + "Homepage": "http://www.pointing.com/Wintab.html", + "License": "Public Domain", + "LicenseId": "NONE", + "Copyright": "Copyright 1991-1998 by LCS/Telegraphics." +} diff --git a/src/3rdparty/xcb/LICENSE b/src/3rdparty/xcb/LICENSE new file mode 100644 index 00000000000..8f4e5c3a72e --- /dev/null +++ b/src/3rdparty/xcb/LICENSE @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the names of the authors or +their institutions shall not be used in advertising or otherwise to +promote the sale, use or other dealings in this Software without +prior written authorization from the authors. diff --git a/src/3rdparty/xcb/qt_attribution.json b/src/3rdparty/xcb/qt_attribution.json new file mode 100644 index 00000000000..30b9af3818d --- /dev/null +++ b/src/3rdparty/xcb/qt_attribution.json @@ -0,0 +1,24 @@ +{ + "Id": "xcb", + "Name": "XCB", + "QDocModule": "qtgui", + "QtUsage": "Optionally used in xcb platform plugin if configured with -qt-xcb.", + + "Description": "Selected xcb libraries.", + "Homepage": "https://xcb.freedesktop.org/", + "License": "MIT License", + "LicenseId": "MIT", + "LicenseFile": "LICENSE", + "Copyright": "Copyright © 2000 Keith Packard +Copyright © 2006 Jamey Sharp +Copyright © 2007-2008 Vincent Torri +Copyright © 2007 Bart Massey +Copyright © 2008-2009 Julien Danjou +Copyright © 2008 Arnaud Fontaine +Copyright © 2008 Bart Massey +Copyright © 2008 Ian Osgood +Copyright © 2008 Jamey Sharp +Copyright © 2008 Josh Triplett +Copyright © 2008 Ulrich Eckhardt +" +} diff --git a/src/3rdparty/xkbcommon/qt_attribution.json b/src/3rdparty/xkbcommon/qt_attribution.json new file mode 100644 index 00000000000..8ee0df1b228 --- /dev/null +++ b/src/3rdparty/xkbcommon/qt_attribution.json @@ -0,0 +1,26 @@ +{ + "Id": "xkbcommon", + "Name": "xkbcommon", + "QDocModule": "qtgui", + "QtUsage": "Used in xcb platform plugin. Configure with -system-xkbcommon-x11 to avoid.", + + "Description": "xkbcommon is a keymap compiler and support library which processes a reduced subset of keymaps as defined by the XKB specification.", + "Homepage": "http://xkbcommon.org/", + "License": "MIT Licenses (with no-advertisement clause)", + "LicenseId": "MIT", + "LicenseFile": "COPYING", + "Copyright": "Copyright 1985, 1987, 1988, 1990, 1998 The Open Group +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. +Copyright 1993, 1994, 1995, 1996 by Silicon Graphics Computer Systems, Inc. +Copyright 1996 by Joseph Moss +Copyright 2002-2007 Free Software Foundation, Inc. +Copyright 2003-2004 Dmitry Golubev +Copyright 2004, Gregory Mokhin +Copyright 2006 Erdal RonahĂ® +Copyright 2008, 2009 Dan Nicholson +Copyright 2009-2012 Daniel Stone +Copyright 2010, 2012 Intel Corporation +Copyright 2010 Francisco Jerez +Copyright 2011 Joseph Adams +Copyright 2012 Ran Benita " +} diff --git a/src/3rdparty/zlib/LICENSE b/src/3rdparty/zlib/LICENSE new file mode 100644 index 00000000000..9c57e18006e --- /dev/null +++ b/src/3rdparty/zlib/LICENSE @@ -0,0 +1,28 @@ + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* receiving +lengthy legal documents to sign. The sources are provided for free but without +warranty of any kind. The library has been entirely written by Jean-loup +Gailly and Mark Adler; it does not include third-party code. + +If you redistribute modified sources, we would appreciate that you include in +the file ChangeLog history information documenting your changes. Please read +the FAQ for more information on the distribution of modified source versions. + diff --git a/src/3rdparty/zlib/qt_attribution.json b/src/3rdparty/zlib/qt_attribution.json new file mode 100644 index 00000000000..a10fd1921fa --- /dev/null +++ b/src/3rdparty/zlib/qt_attribution.json @@ -0,0 +1,15 @@ +{ + "Id": "zlib", + "Name": "Data Compression Library (zlib)", + "QDocModule": "qtcore", + "QtUsage": "Optionally used in Qt Core and and development tools. Configure with -system-zlib to avoid.", + + "Description": "zlib is a general purpose data compression library.", + "Homepage": "http://zlib.net/", + "Version": "1.2.5", + + "License": "ZLib license", + "LicenseId": "Zlib", + "LicenseFile": "LICENSE", + "Copyright": "(C) 1995-2010 Jean-loup Gailly and Mark Adler" +} From 357a35eaf0730caa35fc4264415defe856d9e52c Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 1 Jul 2016 16:47:55 +0200 Subject: [PATCH 132/236] Add \externalpage for The Qt Company Change-Id: If8f8e949c6c6799fbe2e382fee3b1fcccab6a350 Reviewed-by: Lars Knoll --- doc/global/externalsites/qt-webpages.qdoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/global/externalsites/qt-webpages.qdoc b/doc/global/externalsites/qt-webpages.qdoc index 5eea92c6016..f17f85da9f6 100644 --- a/doc/global/externalsites/qt-webpages.qdoc +++ b/doc/global/externalsites/qt-webpages.qdoc @@ -36,6 +36,10 @@ \externalpage http://qt.io/download \title Downloads */ +/*! + \externalpage http://www.qt.io/about-us/ + \title The Qt Company +*/ /*! \externalpage http://qt.io/licensing/ \title Qt Licensing Overview From 7c5ccdd83ba3a2fe1a182c177e51e8c5987ce0ac Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 1 Jul 2016 16:34:38 +0200 Subject: [PATCH 133/236] Add list of 3rd party code attributions to Qt Core, Qt GUI, Qt SQL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also document the current license the modules are available from, since this is not consistent anymore across Qt. Task-number: QTBUG-55139 Change-Id: I117fdb0cda7bd7ff92aa825e29c28f22a8a2f96d Reviewed-by: Lars Knoll Reviewed-by: Topi Reiniö --- src/corelib/doc/src/qtcore-index.qdoc | 14 +++++++++++++- src/gui/doc/src/qtgui.qdoc | 13 +++++++++++++ src/sql/doc/src/qtsql.qdoc | 13 +++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/corelib/doc/src/qtcore-index.qdoc b/src/corelib/doc/src/qtcore-index.qdoc index e2fce5797d4..fe9b43507cb 100644 --- a/src/corelib/doc/src/qtcore-index.qdoc +++ b/src/corelib/doc/src/qtcore-index.qdoc @@ -101,7 +101,19 @@ \li \l{The Event System} \endlist - \section1 Related Information + \section1 Licenses and Attributions + + Qt Core is available under commercial licenses from \l{The Qt Company}. + In addition, it is available under the + \l{GNU Lesser General Public License, version 3}, or + the \l{GNU General Public License, version 2}. + See \l{Qt Licensing} for further details. + + Furthermore Qt Core potentially contains third party + modules under following permissive licenses: + + \generatelist{groupsbymodule attributions-qtcore} + \section1 Reference These are links to the API reference materials. \list diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc index 97811359601..a9fe520d5e9 100644 --- a/src/gui/doc/src/qtgui.qdoc +++ b/src/gui/doc/src/qtgui.qdoc @@ -187,6 +187,19 @@ More info in \l{Drag and Drop} + \section1 Licenses and Attributions + + Qt GUI is available under commercial licenses from \l{The Qt Company}. + In addition, it is available under the + \l{GNU Lesser General Public License, version 3}, or + the \l{GNU General Public License, version 2}. + See \l{Qt Licensing} for further details. + + Furthermore Qt GUI potentially contains third party + modules under following permissive licenses: + + \generatelist{groupsbymodule attributions-qtgui} + \section1 Reference \list \li \l{Qt GUI C++ Classes} diff --git a/src/sql/doc/src/qtsql.qdoc b/src/sql/doc/src/qtsql.qdoc index 9d3a8fbfed3..56d714becf6 100644 --- a/src/sql/doc/src/qtsql.qdoc +++ b/src/sql/doc/src/qtsql.qdoc @@ -51,6 +51,19 @@ QT += sql \endcode + \section1 Licenses and Attributions + + Qt SQL is available under commercial licenses from \l{The Qt Company}. + In addition, it is available under the + \l{GNU Lesser General Public License, version 3}, or + the \l{GNU General Public License, version 2}. + See \l{Qt Licensing} for further details. + + Furthermore Qt SQL potentially contains third party + modules under following permissive licenses: + + \generatelist{groupsbymodule attributions-qtsql} + \section1 Related Information These are links to the API reference materials and related pages. From 4e24ff2e68f942db1d8f90de43dae8db410e706b Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 7 Aug 2016 22:32:33 +0200 Subject: [PATCH 134/236] QCommandLineParser: call qCoreApp post routines before ::exit() This gives a chance for some cleanups at least. Change-Id: I3a628e32c6fc8c7fa00943769210c517005f2a0a Reviewed-by: Thiago Macieira --- src/corelib/tools/qcommandlineparser.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index 2bc60c5b9ee..fa163cf4414 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -46,6 +46,8 @@ QT_BEGIN_NAMESPACE +extern void Q_CORE_EXPORT qt_call_post_routines(); + typedef QHash NameHash_t; class QCommandLineParserPrivate @@ -580,6 +582,7 @@ void QCommandLineParser::process(const QStringList &arguments) { if (!d->parse(arguments)) { showParserMessage(errorText() + QLatin1Char('\n'), ErrorMessage); + qt_call_post_routines(); ::exit(EXIT_FAILURE); } @@ -990,6 +993,7 @@ Q_NORETURN void QCommandLineParser::showVersion() showParserMessage(QCoreApplication::applicationName() + QLatin1Char(' ') + QCoreApplication::applicationVersion() + QLatin1Char('\n'), UsageMessage); + qt_call_post_routines(); ::exit(EXIT_SUCCESS); } @@ -1007,6 +1011,7 @@ Q_NORETURN void QCommandLineParser::showVersion() Q_NORETURN void QCommandLineParser::showHelp(int exitCode) { showParserMessage(d->helpText(), UsageMessage); + qt_call_post_routines(); ::exit(exitCode); } From b57f743c469f16f0c9ad5a9f0182454b74deff97 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 3 Aug 2016 12:11:38 +0300 Subject: [PATCH 135/236] QStringListModel: fix dataChanged's roles parameter In QStringListModel, the display and the edit roles are synonyms, so when one is changed, the other changes with it. However, in setData() we only emitted a vector with just the role that was passed in by the user. Fix by always passing both roles, regardless of which one was used to set the data. Change-Id: I498e7cb33796fae266901817b01ad85d861d4bb4 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/itemmodels/qstringlistmodel.cpp | 8 +++- .../tst_qsortfilterproxymodel.cpp | 10 ++++- .../qstringlistmodel/tst_qstringlistmodel.cpp | 45 +++++++++++++++++++ 3 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp index c6a1fac9c89..725b7356ea9 100644 --- a/src/corelib/itemmodels/qstringlistmodel.cpp +++ b/src/corelib/itemmodels/qstringlistmodel.cpp @@ -181,7 +181,13 @@ bool QStringListModel::setData(const QModelIndex &index, const QVariant &value, if (index.row() >= 0 && index.row() < lst.size() && (role == Qt::EditRole || role == Qt::DisplayRole)) { lst.replace(index.row(), value.toString()); - emit dataChanged(index, index, QVector() << role); + QVector roles; + roles.reserve(2); + roles.append(Qt::DisplayRole); + roles.append(Qt::EditRole); + emit dataChanged(index, index, roles); + // once Q_COMPILER_UNIFORM_INIT can be used, change to: + // emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole}); return true; } return false; diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 5928ee8688a..4dd0b19ce8b 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -2134,17 +2134,23 @@ void tst_QSortFilterProxyModel::changeSourceDataForwardsRoles_qtbug35440() QModelIndex index; + // QStringListModel doesn't distinguish between edit and display roles, + // so changing one always changes the other, too. + QVector expectedChangedRoles; + expectedChangedRoles.append(Qt::DisplayRole); + expectedChangedRoles.append(Qt::EditRole); + index = model.index(0, 0); QVERIFY(index.isValid()); model.setData(index, QStringLiteral("teststring"), Qt::DisplayRole); QCOMPARE(spy.length(), 1); - QCOMPARE(spy.at(0).at(2).value >(), QVector() << Qt::DisplayRole); + QCOMPARE(spy.at(0).at(2).value >(), expectedChangedRoles); index = model.index(1, 0); QVERIFY(index.isValid()); model.setData(index, QStringLiteral("teststring2"), Qt::EditRole); QCOMPARE(spy.length(), 2); - QCOMPARE(spy.at(1).at(2).value >(), QVector() << Qt::EditRole); + QCOMPARE(spy.at(1).at(2).value >(), expectedChangedRoles); } void tst_QSortFilterProxyModel::sortFilterRole() diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp index 53f3d9c0a20..60952616d55 100644 --- a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp +++ b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp @@ -40,6 +40,8 @@ #include "qmodellistener.h" #include +#include + void QModelListener::rowsAboutToBeRemovedOrInserted(const QModelIndex & parent, int start, int end ) { for (int i = 0; start + i <= end; i++) { @@ -80,6 +82,9 @@ private slots: void rowsAboutToBeInserted_rowsInserted(); void rowsAboutToBeInserted_rowsInserted_data(); + + void setData_emits_both_roles_data(); + void setData_emits_both_roles(); }; void tst_QStringListModel::rowsAboutToBeRemoved_rowsRemoved_data() @@ -216,5 +221,45 @@ void tst_QStringListModel::rowsAboutToBeInserted_rowsInserted() delete model; } +void tst_QStringListModel::setData_emits_both_roles_data() +{ + QTest::addColumn("row"); + QTest::addColumn("data"); + QTest::addColumn("role"); + +#define ROW(row, string, role) \ + QTest::newRow(#row " -> " string) << row << QString(string) << int(Qt::role) + ROW(0, "1", EditRole); + ROW(1, "2", DisplayRole); +#undef ROW +} + +template +C sorted(C c) +{ + std::sort(c.begin(), c.end()); + return qMove(c); +} + +void tst_QStringListModel::setData_emits_both_roles() +{ + QFETCH(int, row); + QFETCH(QString, data); + QFETCH(int, role); + + QStringListModel model(QStringList() << "one" << "two"); + QVector expected; + expected.reserve(2); + expected.append(Qt::DisplayRole); + expected.append(Qt::EditRole); + + QSignalSpy spy(&model, &QAbstractItemModel::dataChanged); + QVERIFY(spy.isValid()); + model.setData(model.index(row, 0), data, role); + QCOMPARE(spy.size(), 1); + QCOMPARE(sorted(spy.at(0).at(2).value >()), + expected); +} + QTEST_MAIN(tst_QStringListModel) #include "tst_qstringlistmodel.moc" From c38ac3dab8cbbdb494e09ccebe93c4e57a9987c3 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 3 Aug 2016 14:08:04 +0300 Subject: [PATCH 136/236] tst_QStringListModel: don't leak memory when tests fail Simply allocate objects on the stack instead of the heap. Change-Id: Ic047d78e49668878821cce1c8ab599a8551b6476 Reviewed-by: David Faure --- .../qstringlistmodel/tst_qstringlistmodel.cpp | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp index 60952616d55..efb9f8384c4 100644 --- a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp +++ b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp @@ -139,22 +139,19 @@ void tst_QStringListModel::rowsAboutToBeRemoved_rowsRemoved() QFETCH(QStringList, aboutto); QFETCH(QStringList, res); - QStringListModel *model = new QStringListModel(input); - QModelListener *pListener = new QModelListener(&aboutto, &res, model); - pListener->connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), - pListener, SLOT(rowsAboutToBeRemovedOrInserted(QModelIndex,int,int)) ); + QStringListModel model(input); + QModelListener listener(&aboutto, &res, &model); + connect(&model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), + &listener, SLOT(rowsAboutToBeRemovedOrInserted(QModelIndex,int,int))); - pListener->connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), - pListener, SLOT(rowsRemovedOrInserted(QModelIndex,int,int)) ); + connect(&model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + &listener, SLOT(rowsRemovedOrInserted(QModelIndex,int,int))); - model->removeRows(row,count); + model.removeRows(row, count); // At this point, control goes to our connected slots inn this order: // 1. rowsAboutToBeRemovedOrInserted // 2. rowsRemovedOrInserted // Control returns here - - delete pListener; - delete model; } void tst_QStringListModel::rowsAboutToBeInserted_rowsInserted_data() @@ -203,22 +200,19 @@ void tst_QStringListModel::rowsAboutToBeInserted_rowsInserted() QFETCH(QStringList, aboutto); QFETCH(QStringList, res); - QStringListModel *model = new QStringListModel(input); - QModelListener *pListener = new QModelListener(&aboutto, &res, model); - connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), - pListener, SLOT(rowsAboutToBeRemovedOrInserted(QModelIndex,int,int)) ); + QStringListModel model(input); + QModelListener listener(&aboutto, &res, &model); + connect(&model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), + &listener, SLOT(rowsAboutToBeRemovedOrInserted(QModelIndex,int,int))); - connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), - pListener, SLOT(rowsRemovedOrInserted(QModelIndex,int,int)) ); + connect(&model, SIGNAL(rowsInserted(QModelIndex,int,int)), + &listener, SLOT(rowsRemovedOrInserted(QModelIndex,int,int))); - model->insertRows(row,count); + model.insertRows(row, count); // At this point, control goes to our connected slots inn this order: // 1. rowsAboutToBeRemovedOrInserted // 2. rowsRemovedOrInserted // Control returns here - - delete pListener; - delete model; } void tst_QStringListModel::setData_emits_both_roles_data() From a2ae631c04fee752e492f2c0b8fd25f06abffd6b Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 3 Aug 2016 12:00:41 +0200 Subject: [PATCH 137/236] Doc: Change instances of '(Mac) OS X' to 'macOS' As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change the occurrences where the Mac platform is discussed to use a macro \macos, which expands to 'macOS'. This helps with adapting to future renaming. Update the instructions on mac-specific Q_OS_* macro usage. Add a \target for the old 'Qt for OS X' topic to keep links working for other documentation modules that try to link with the old name. Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85 Reviewed-by: Leena Miettinen --- doc/global/macros.qdocconf | 1 + .../desktop/systray/doc/src/systray.qdoc | 4 +- examples/widgets/doc/src/application.qdoc | 6 +-- examples/widgets/doc/src/classwizard.qdoc | 4 +- examples/widgets/doc/src/licensewizard.qdoc | 4 +- examples/widgets/doc/src/plugandpaint.qdoc | 2 +- qmake/doc/src/qmake-manual.qdoc | 40 +++++++------- src/corelib/doc/src/resource-system.qdoc | 2 +- src/corelib/global/qglobal.cpp | 54 +++++++++---------- src/corelib/global/qnamespace.qdoc | 50 ++++++++--------- src/corelib/io/qabstractfileengine.cpp | 2 +- src/corelib/io/qfileinfo.cpp | 8 +-- src/corelib/io/qfilesystemwatcher.cpp | 2 +- src/corelib/io/qiodevice.cpp | 2 +- src/corelib/io/qlockfile_unix.cpp | 2 +- src/corelib/io/qloggingcategory.cpp | 2 +- src/corelib/io/qprocess.cpp | 8 +-- src/corelib/io/qsettings.cpp | 44 +++++++-------- src/corelib/io/qstandardpaths.cpp | 4 +- src/corelib/io/qstorageinfo.cpp | 2 +- src/corelib/kernel/qcoreapplication.cpp | 4 +- src/corelib/kernel/qcoreevent.cpp | 4 +- src/corelib/mimetypes/qmimedatabase.cpp | 2 +- src/corelib/plugin/qlibrary.cpp | 8 +-- src/corelib/plugin/qpluginloader.cpp | 2 +- src/corelib/tools/qelapsedtimer.cpp | 6 +-- src/corelib/tools/qelapsedtimer_generic.cpp | 2 +- src/corelib/tools/qstring.cpp | 12 ++--- src/gui/accessible/qaccessible.cpp | 2 +- src/gui/accessible/qaccessiblebridge.cpp | 2 +- src/gui/doc/src/dnd.qdoc | 4 +- src/gui/image/qicon.cpp | 2 +- src/gui/kernel/qclipboard.cpp | 18 +++---- src/gui/kernel/qdrag.cpp | 4 +- src/gui/kernel/qevent.cpp | 30 +++++------ src/gui/kernel/qguiapplication.cpp | 2 +- src/gui/kernel/qhighdpiscaling.cpp | 2 +- src/gui/kernel/qkeysequence.cpp | 24 ++++----- src/gui/kernel/qpalette.cpp | 2 +- src/gui/opengl/qopenglversionfunctions.cpp | 2 +- src/gui/painting/qpaintengine.cpp | 6 +-- src/gui/painting/qregion.cpp | 2 +- src/gui/text/qfont.cpp | 4 +- src/gui/text/qfontdatabase.cpp | 2 +- src/gui/text/qrawfont.cpp | 2 +- src/gui/text/qtextformat.cpp | 2 +- src/network/kernel/qnetworkinterface.cpp | 2 +- src/network/kernel/qnetworkproxy.cpp | 4 +- src/network/socket/qabstractsocket.cpp | 4 +- src/network/socket/qlocalserver.cpp | 2 +- src/network/ssl/qsslsocket.cpp | 2 +- src/opengl/doc/src/qtopengl-index.qdoc | 2 +- src/opengl/doc/src/qtopengl-module.qdoc | 2 +- src/opengl/qgl.cpp | 2 +- src/opengl/qglpixelbuffer.cpp | 6 +-- src/plugins/platforms/cocoa/qcocoahelpers.mm | 2 +- .../dialogs/qabstractprintdialog.cpp | 8 +-- src/printsupport/dialogs/qpagesetupdialog.cpp | 6 +-- src/printsupport/kernel/qprinter.cpp | 6 +-- src/sql/doc/src/sql-driver.qdoc | 16 +++--- src/testlib/doc/src/qttestlib-manual.qdoc | 2 +- src/widgets/dialogs/qcolordialog.cpp | 8 +-- src/widgets/dialogs/qfiledialog.cpp | 10 ++-- src/widgets/dialogs/qmessagebox.cpp | 18 +++---- src/widgets/dialogs/qwizard.cpp | 20 +++---- src/widgets/doc/src/graphicsview.qdoc | 2 +- .../doc/src/widgets-and-layouts/focus.qdoc | 4 +- .../doc/src/widgets-and-layouts/styles.qdoc | 2 +- .../src/widgets-and-layouts/stylesheet.qdoc | 8 +-- src/widgets/doc/src/widgets-tutorial.qdoc | 2 +- .../graphicsview/qgraphicssceneevent.cpp | 2 +- src/widgets/kernel/qaction.cpp | 10 ++-- src/widgets/kernel/qapplication.cpp | 4 +- src/widgets/kernel/qdesktopwidget.qdoc | 2 +- src/widgets/kernel/qformlayout.cpp | 4 +- src/widgets/kernel/qopenglwidget.cpp | 4 +- src/widgets/kernel/qsizepolicy.cpp | 2 +- src/widgets/kernel/qwidget.cpp | 18 +++---- src/widgets/kernel/qwidgetaction.cpp | 6 +-- src/widgets/styles/qmacstyle.qdoc | 12 ++--- src/widgets/styles/qmacstyle_mac.mm | 2 +- src/widgets/styles/qstyle.cpp | 6 +-- src/widgets/styles/qstyleoption.cpp | 2 +- src/widgets/util/qscroller.cpp | 2 +- src/widgets/util/qsystemtrayicon.cpp | 10 ++-- src/widgets/widgets/qdialogbuttonbox.cpp | 4 +- .../widgets/qmaccocoaviewcontainer_mac.mm | 6 +-- src/widgets/widgets/qmacnativewidget_mac.mm | 4 +- src/widgets/widgets/qmainwindow.cpp | 2 +- src/widgets/widgets/qmenu.cpp | 2 +- src/widgets/widgets/qmenu_mac.mm | 8 +-- src/widgets/widgets/qmenubar.cpp | 14 ++--- src/widgets/widgets/qrubberband.cpp | 2 +- src/widgets/widgets/qtabbar.cpp | 2 +- src/widgets/widgets/qtabwidget.cpp | 2 +- src/widgets/widgets/qtoolbutton.cpp | 2 +- tests/auto/corelib/io/qfile/tst_qfile.cpp | 2 +- 97 files changed, 336 insertions(+), 335 deletions(-) diff --git a/doc/global/macros.qdocconf b/doc/global/macros.qdocconf index 71a9dc30d1f..da583aedcd3 100644 --- a/doc/global/macros.qdocconf +++ b/doc/global/macros.qdocconf @@ -10,6 +10,7 @@ macro.gui = "\\b" macro.HR.HTML = "
" macro.iacute.HTML = "í" macro.key = "\\b" +macro.macos = "macOS" macro.menu = "\\b" macro.oslash.HTML = "ø" macro.ouml.HTML = "ö" diff --git a/examples/widgets/desktop/systray/doc/src/systray.qdoc b/examples/widgets/desktop/systray/doc/src/systray.qdoc index ae6df351bbb..65a4018085a 100644 --- a/examples/widgets/desktop/systray/doc/src/systray.qdoc +++ b/examples/widgets/desktop/systray/doc/src/systray.qdoc @@ -137,7 +137,7 @@ to show the message with the title, body, and icon for the time specified in milliseconds. - OS X users note: The Growl notification system must be + \macos users note: The Growl notification system must be installed for QSystemTrayIcon::showMessage() to display messages. QSystemTrayIcon also has the corresponding, \l {QSystemTrayIcon::} @@ -172,7 +172,7 @@ We have reimplemented the QWidget::closeEvent() event handler to receive widget close events, showing the above message to the - users when they are closing the editor window. On OS X we need to + users when they are closing the editor window. On \macos we need to avoid showing the message and accepting the close event when the user really intends to quit the application, that is, when the user has triggered "Quit" in the menu bar or pressed the Command+Q diff --git a/examples/widgets/doc/src/application.qdoc b/examples/widgets/doc/src/application.qdoc index cd284ecba0b..dc061724d10 100644 --- a/examples/widgets/doc/src/application.qdoc +++ b/examples/widgets/doc/src/application.qdoc @@ -234,7 +234,7 @@ Just before we create the \uicontrol{Help} menu, we call QMenuBar::addSeparator(). This has no effect for most widget - styles (e.g., Windows and OS X styles), but for some + styles (e.g., Windows and \macos styles), but for some styles this makes sure that \uicontrol{Help} is pushed to the right side of the menu bar. @@ -253,7 +253,7 @@ load the user's preferences and other application settings. The QSettings class provides a high-level interface for storing settings permanently on disk. On Windows, it uses the (in)famous - Windows registry; on OS X, it uses the native XML-based + Windows registry; on \macos, it uses the native XML-based CFPreferences API; on Unix/X11, it uses text files. The QSettings constructor takes arguments that identify your @@ -305,7 +305,7 @@ We start by opening the file in read-only mode. The QFile::Text flag indicates that the file is a text file, not a binary file. - On Unix and OS X, this makes no difference, but on Windows, + On Unix and \macos, this makes no difference, but on Windows, it ensures that the "\\r\\n" end-of-line sequence is converted to "\\n" when reading. diff --git a/examples/widgets/doc/src/classwizard.qdoc b/examples/widgets/doc/src/classwizard.qdoc index 579dcb20553..c3ffa37c1b7 100644 --- a/examples/widgets/doc/src/classwizard.qdoc +++ b/examples/widgets/doc/src/classwizard.qdoc @@ -76,7 +76,7 @@ \endlist Although the program is just an example, if you press \uicontrol Finish - (\uicontrol Done on OS X), actual C++ source files will actually be + (\uicontrol Done on \macos), actual C++ source files will actually be generated. \section1 The ClassWizard Class @@ -158,7 +158,7 @@ layouts. The \c className field is created with an asterisk (\c *) next to its name. This makes it a \l{mandatory fields}{mandatory field}, that is, a field that must be filled before the user can press the - \uicontrol Next button (\uicontrol Continue on OS X). The fields' values + \uicontrol Next button (\uicontrol Continue on \macos). The fields' values can be accessed from any other page using QWizardPage::field(), or from the wizard code using QWizard::field(). diff --git a/examples/widgets/doc/src/licensewizard.qdoc b/examples/widgets/doc/src/licensewizard.qdoc index 29e2f2779a1..117933945cc 100644 --- a/examples/widgets/doc/src/licensewizard.qdoc +++ b/examples/widgets/doc/src/licensewizard.qdoc @@ -94,7 +94,7 @@ \snippet dialogs/licensewizard/licensewizard.cpp 4 We set the style to \l{QWizard::}{ModernStyle} on all platforms - except OS X, + except \macos, \snippet dialogs/licensewizard/licensewizard.cpp 5 \snippet dialogs/licensewizard/licensewizard.cpp 6 @@ -160,7 +160,7 @@ layouts. The fields are created with an asterisk (\c *) next to their name. This makes them \l{mandatory fields}, that is, fields that must be filled before the user can press the - \uicontrol Next button (\uicontrol Continue on OS X). The fields' values + \uicontrol Next button (\uicontrol Continue on \macos). The fields' values can be accessed from any other page using QWizardPage::field(). Resetting the page amounts to clearing the two text fields. diff --git a/examples/widgets/doc/src/plugandpaint.qdoc b/examples/widgets/doc/src/plugandpaint.qdoc index a79f8546eaa..26e9a71d5b0 100644 --- a/examples/widgets/doc/src/plugandpaint.qdoc +++ b/examples/widgets/doc/src/plugandpaint.qdoc @@ -162,7 +162,7 @@ subdirectory of the Plug & Paint example. On Unix, this is just a matter of initializing the QDir variable with QApplication::applicationDirPath(), the path of the executable - file, and to do a \l{QDir::cd()}{cd()}. On Windows and OS X, + file, and to do a \l{QDir::cd()}{cd()}. On Windows and \macos, this file is usually located in a subdirectory, so we need to take this into account. diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 9cd4ab98aa5..ea400c5faf2 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -657,7 +657,7 @@ qmake knows about many of these features, which can be accessed via specific variables that only take effect on the platforms where they are relevant. - \section1 OS X and iOS + \section1 \macos and iOS Features specific to these platforms include support for creating universal binaries, frameworks and bundles. @@ -681,7 +681,7 @@ qmake is able to automatically generate build rules for linking against frameworks in the standard framework directory on - OS X, located at \c{/Library/Frameworks/}. + \macos, located at \c{/Library/Frameworks/}. Directories other than the standard framework directory need to be specified to the build system, and this is achieved by appending linker options to the @@ -722,13 +722,13 @@ and \l{QMAKE_FRAMEWORK_VERSION} variables. By default, the values used for these variables are obtained from the \l{TARGET} and \l{VERSION} variables. - See \l{Qt for OS X - Deployment} for more information about + See \l{Qt for macOS - Deployment} for more information about deploying applications and libraries. \section2 Creating and Moving Xcode Projects - Developers on OS X can take advantage of the qmake support for Xcode - project files, as described in \l{Qt for OS X#Additional Command-Line Options}{Qt for OS X} documentation. + Developers on \macos can take advantage of the qmake support for Xcode + project files, as described in \l{Qt for macOS#Additional Command-Line Options}{Qt for \macos} documentation. by running qmake to generate an Xcode project from an existing qmake project file. For example: @@ -1069,7 +1069,7 @@ See \l{Platform Notes#Visual Studio Manifest Files}{Platform Notes} for more information about the options for embedding manifest files. - The following options take an effect only on OS X: + The following options take an effect only on \macos: \table \header \li Option \li Description @@ -1439,7 +1439,7 @@ \target QMAKE_BUNDLE_DATA \section1 QMAKE_BUNDLE_DATA - \note This variable is used on OS X and iOS only. + \note This variable is used on \macos and iOS only. Specifies the data that will be installed with a library bundle, and is often used to specify a collection of header files. @@ -1461,7 +1461,7 @@ \section1 QMAKE_BUNDLE_EXTENSION - \note This variable is used on OS X and iOS only. + \note This variable is used on \macos and iOS only. Specifies the extension to be used for library bundles. This allows frameworks to be created with custom extensions instead of the @@ -1695,7 +1695,7 @@ \section1 QMAKE_FRAMEWORK_BUNDLE_NAME - \note This variable is used on OS X and iOS only. + \note This variable is used on \macos and iOS only. In a framework project, this variable contains the name to be used for the framework that is built. @@ -1709,9 +1709,9 @@ \target QMAKE_FRAMEWORK_VERSION \section1 QMAKE_FRAMEWORK_VERSION - \note This variable is used on OS X and iOS only. + \note This variable is used on \macos and iOS only. - For projects where the build target is an OS X or iOS framework, this variable + For projects where the build target is a \macos or an iOS framework, this variable is used to specify the version number that will be applied to the framework that is built. @@ -1804,10 +1804,10 @@ \target QMAKE_INFO_PLIST \section1 QMAKE_INFO_PLIST - \note This variable is used on OS X and iOS platforms only. + \note This variable is used on \macos and iOS platforms only. Specifies the name of the property list file, \c{.plist}, you - would like to include in your OS X and iOS application bundle. + would like to include in your \macos and iOS application bundle. In the \c{.plist} file, you can define some variables, e.g., @EXECUTABLE@, which qmake will replace with the actual executable name. Other variables @@ -2077,16 +2077,16 @@ \section1 QMAKE_MAC_SDK - This variable is used on OS X when building universal binaries. + This variable is used on \macos when building universal binaries. \section1 QMAKE_MACOSX_DEPLOYMENT_TARGET - This variable only takes effect when building on OS X. On that + This variable only takes effect when building on \macos. On that platform, the variable will be forwarded to the MACOSX_DEPLOYMENT_TARGET environment variable, which is interpreted by the compiler or linker. For more information, see the - \l{Qt for OS X - Deployment#OS X Version Dependencies}{Deploying - an Application on OS X} document. + \l{Qt for macOS - Deployment#macOS Version Dependencies}{Deploying + an Application on \macos} document. \section1 QMAKE_MAKEFILE @@ -4308,7 +4308,7 @@ \li nmake \li Visual Studio projects (VS 2008 and later) \endlist - \li OS X and iOS + \li \macos and iOS \list \li Makefile \li Xcode @@ -4679,7 +4679,7 @@ them uses project-specific variables to customize output files. Platform-specific variables are not described here. For more information, - see \l{Qt for Windows - Deployment} and \l{Qt for OS X}. + see \l{Qt for Windows - Deployment} and \l{Qt for macOS}. \target Application \section1 Building an Application @@ -4827,7 +4827,7 @@ \endlist The target file name for the library is platform-dependent. For example, on - X11, OS X, and iOS, the library name will be prefixed by \c lib. On Windows, + X11, \macos, and iOS, the library name will be prefixed by \c lib. On Windows, no prefix is added to the file name. \target Plugin diff --git a/src/corelib/doc/src/resource-system.qdoc b/src/corelib/doc/src/resource-system.qdoc index cbb2d4efb39..296387bd574 100644 --- a/src/corelib/doc/src/resource-system.qdoc +++ b/src/corelib/doc/src/resource-system.qdoc @@ -136,7 +136,7 @@ \image resources.png Building resources into an application Currently, Qt always stores the data directly in the executable, - even on Windows, OS X, and iOS, where the operating system provides + even on Windows, \macos, and iOS, where the operating system provides native support for resources. This might change in a future Qt release. diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 8b6d8745f84..eff94f53612 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1001,8 +1001,8 @@ bool qSharedBuild() Q_DECL_NOTHROW \endlist Some constants are defined only on certain platforms. You can use - the preprocessor symbols Q_OS_WIN and Q_OS_OSX to test that - the application is compiled under Windows or OS X. + the preprocessor symbols Q_OS_WIN and Q_OS_MACOS to test that + the application is compiled under Windows or \macos. \sa QLibraryInfo */ @@ -1041,7 +1041,7 @@ bool qSharedBuild() Q_DECL_NOTHROW /*! \fn QSysInfo::MacVersion QSysInfo::macVersion() - Returns the version of Darwin (OS X or iOS) on which the + Returns the version of Darwin (\macos or iOS) on which the application is run, or MV_None if the operating system is not a version of Darwin. */ @@ -1117,24 +1117,24 @@ bool qSharedBuild() Q_DECL_NOTHROW \enum QSysInfo::MacVersion This enum provides symbolic names for the various versions of the - Darwin operating system, covering both OS X and iOS. The + Darwin operating system, covering both \macos and iOS. The QSysInfo::MacintoshVersion variable gives the version of the system on which the application is run. - \value MV_9 Mac OS 9 - \value MV_10_0 Mac OS X 10.0 - \value MV_10_1 Mac OS X 10.1 - \value MV_10_2 Mac OS X 10.2 - \value MV_10_3 Mac OS X 10.3 - \value MV_10_4 Mac OS X 10.4 - \value MV_10_5 Mac OS X 10.5 - \value MV_10_6 Mac OS X 10.6 - \value MV_10_7 Mac OS X 10.7 - \value MV_10_8 OS X 10.8 - \value MV_10_9 OS X 10.9 - \value MV_10_10 OS X 10.10 - \value MV_10_11 OS X 10.11 - \value MV_10_12 macOS 10.12 + \value MV_9 \macos 9 + \value MV_10_0 \macos 10.0 + \value MV_10_1 \macos 10.1 + \value MV_10_2 \macos 10.2 + \value MV_10_3 \macos 10.3 + \value MV_10_4 \macos 10.4 + \value MV_10_5 \macos 10.5 + \value MV_10_6 \macos 10.6 + \value MV_10_7 \macos 10.7 + \value MV_10_8 \macos 10.8 + \value MV_10_9 \macos 10.9 + \value MV_10_10 \macos 10.10 + \value MV_10_11 \macos 10.11 + \value MV_10_12 \macos 10.12 \value MV_Unknown An unknown and currently unsupported platform \value MV_CHEETAH Apple codename for MV_10_0 @@ -1179,7 +1179,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \macro Q_OS_DARWIN \relates - Defined on Darwin-based operating systems such as OS X and iOS. + Defined on Darwin-based operating systems such as \macos and iOS. */ /*! @@ -1200,7 +1200,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \macro Q_OS_MACOS \relates - Defined on macOS. + Defined on \macos. */ /*! @@ -2515,7 +2515,7 @@ static QString unknownText() Note that this function may return surprising values: it returns "linux" for all operating systems running Linux (including Android), "qnx" for all operating systems running QNX (including BlackBerry 10), "freebsd" for - Debian/kFreeBSD, and "darwin" for OS X and iOS. For information on the type + Debian/kFreeBSD, and "darwin" for \macos and iOS. For information on the type of product the application is running on, see productType(). \sa QFileSelector, kernelVersion(), productType(), productVersion(), prettyProductName() @@ -2539,7 +2539,7 @@ QString QSysInfo::kernelType() Returns the release version of the operating system kernel. On Windows, it returns the version of the NT or CE kernel. On Unix systems, including - Android, BlackBerry and OS X, it returns the same as the \c{uname -r} + Android, BlackBerry and \macos, it returns the same as the \c{uname -r} command would return. If the version could not be determined, this function may return an empty @@ -2584,11 +2584,11 @@ QString QSysInfo::kernelVersion() running the BlackBerry userspace, but "qnx" for all other QNX-based systems. - \b{Darwin, OS X and iOS note}: this function returns "macos" for macOS + \b{Darwin, \macos and iOS note}: this function returns "macos" for \macos systems, "ios" for iOS systems and "darwin" in case the system could not be determined. - \b{OS X note}: this function returns "osx" for versions of macOS prior to 10.12. + \b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12. \b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and "unknown" otherwise. @@ -2646,8 +2646,8 @@ QString QSysInfo::productType() Returns the product version of the operating system in string form. If the version could not be determined, this function returns "unknown". - It will return the Android, BlackBerry, iOS, OS X, Windows full-product - versions on those systems. In particular, on OS X, iOS and Windows, the + It will return the Android, BlackBerry, iOS, \macos, Windows full-product + versions on those systems. In particular, on \macos, iOS and Windows, the returned string is similar to the macVersion() or windowsVersion() enums. On Linux systems, it will try to determine the distribution version and will @@ -2657,7 +2657,7 @@ QString QSysInfo::productType() In all other Unix-type systems, this function always returns "unknown". \note The version string returned from this function is only guaranteed to - be orderable on Android, BlackBerry, OS X and iOS. On Windows, some Windows + be orderable on Android, BlackBerry, \macos and iOS. On Windows, some Windows versions are text ("XP" and "Vista", for example). On Linux, the version of the distribution may jump unexpectedly, please refer to the distribution's documentation for versioning practices. diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 527bded3c21..23eeb016406 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -111,7 +111,7 @@ shown in any menus unless specifically set by the QAction::iconVisibleInMenu property. Menus that are currently open or menus already created in the native - OS X menubar \e{may not} pick up a change in this attribute. Changes + \macos menubar \e{may not} pick up a change in this attribute. Changes in the QAction::iconVisibleInMenu property will always be picked up. \value AA_NativeWindows Ensures that widgets have native windows. @@ -129,9 +129,9 @@ \value AA_DontUseNativeMenuBar All menubars created while this attribute is set to true won't be used as a native menubar (e.g, the menubar at - the top of the main screen on OS X or at the bottom in Windows CE). + the top of the main screen on \macos or at the bottom in Windows CE). - \value AA_MacDontSwapCtrlAndMeta On OS X by default, Qt swaps the + \value AA_MacDontSwapCtrlAndMeta On \macos by default, Qt swaps the Control and Meta (Command) keys (i.e., whenever Control is pressed, Qt sends Meta, and whenever Meta is pressed Control is sent). When this attribute is true, Qt will not do the flip. \l QKeySequence::StandardKey @@ -315,7 +315,7 @@ \omitvalue KeyboardModifierMask - \note On OS X, the \c ControlModifier value corresponds to + \note On \macos, the \c ControlModifier value corresponds to the Command keys on the Macintosh keyboard, and the \c MetaModifier value corresponds to the Control keys. The \c KeypadModifier value will also be set when an arrow key is pressed as the arrow keys are considered part of the @@ -333,7 +333,7 @@ This enum provides shorter names for the keyboard modifier keys supported by Qt. - \note On OS X, the \c CTRL value corresponds to + \note On \macos, the \c CTRL value corresponds to the Command keys on the Macintosh keyboard, and the \c META value corresponds to the Control keys. @@ -934,34 +934,34 @@ \value WA_MacOpaqueSizeGrip Indicates that the native Carbon size grip should be opaque instead of transparent (the default). This attribute - is only applicable to OS X and is set by the widget's author. + is only applicable to \macos and is set by the widget's author. \value WA_MacShowFocusRect Indicates that this widget should get a QFocusFrame around it. Some widgets draw their own focus halo regardless of this attribute. Not that the QWidget::focusPolicy also plays the main role in whether something is given focus or not, this only controls whether or not this gets the focus - frame. This attribute is only applicable to OS X. + frame. This attribute is only applicable to \macos. \value WA_MacNormalSize Indicates the widget should have the - normal size for widgets in OS X. This attribute is only - applicable to OS X. + normal size for widgets in \macos. This attribute is only + applicable to \macos. \value WA_MacSmallSize Indicates the widget should have the small - size for widgets in OS X. This attribute is only applicable to - OS X. + size for widgets in \macos. This attribute is only applicable to + \macos. \value WA_MacMiniSize Indicates the widget should have the mini - size for widgets in OS X. This attribute is only applicable to - OS X. + size for widgets in \macos. This attribute is only applicable to + \macos. \value WA_MacVariableSize Indicates the widget can choose between alternative sizes for widgets to avoid clipping. - This attribute is only applicable to OS X. + This attribute is only applicable to \macos. \value WA_MacBrushedMetal Indicates the widget should be drawn in the brushed metal style as supported by the windowing system. This - attribute is only applicable to OS X. + attribute is only applicable to \macos. \omitvalue WA_MacMetalStyle @@ -1111,14 +1111,14 @@ \b Warning: This flag must \e never be set or cleared by the widget's author. \value WA_WindowModified Indicates that the window is marked as modified. - On some platforms this flag will do nothing, on others (including OS X + On some platforms this flag will do nothing, on others (including \macos and Windows) the window will take a modified appearance. This flag is set or cleared by QWidget::setWindowModified(). \value WA_WindowPropagation Makes a toplevel window inherit font and palette from its parent. - \value WA_MacAlwaysShowToolWindow On OS X, show the tool window even + \value WA_MacAlwaysShowToolWindow On \macos, show the tool window even when the application is not active. By default, all tool windows are hidden when the application is inactive. @@ -1301,8 +1301,8 @@ \value Key_PageUp \value Key_PageDown \value Key_Shift - \value Key_Control On OS X, this corresponds to the Command keys. - \value Key_Meta On OS X, this corresponds to the Control keys. + \value Key_Control On \macos, this corresponds to the Command keys. + \value Key_Meta On \macos, this corresponds to the Control keys. On Windows keyboards, this key is mapped to the Windows key. \value Key_Alt @@ -1962,7 +1962,7 @@ \value TabFocus the widget accepts focus by tabbing. \value ClickFocus the widget accepts focus by clicking. \value StrongFocus the widget accepts focus by both tabbing - and clicking. On OS X this will also + and clicking. On \macos this will also be indicate that the widget accepts tab focus when in 'Text/List focus mode'. \value WheelFocus like Qt::StrongFocus plus the widget accepts @@ -2068,7 +2068,7 @@ system supports it, a tool window can be decorated with a somewhat lighter frame. It can also be combined with Qt::FramelessWindowHint. - On OS X, tool windows correspond to the + On \macos, tool windows correspond to the \l{http://developer.apple.com/documentation/Carbon/Conceptual/HandlingWindowsControls/hitb-wind_cont_concept/chapter_2_section_2.html}{Floating} class of windows. This means that the window lives on a level above normal windows; it impossible to put a normal @@ -2157,10 +2157,10 @@ \value WindowContextHelpButtonHint Adds a context help button to dialogs. On some platforms this implies Qt::WindowSystemMenuHint for it to work. - \value MacWindowToolBarButtonHint On OS X adds a tool bar button (i.e., + \value MacWindowToolBarButtonHint On \macos adds a tool bar button (i.e., the oblong button that is on the top right of windows that have toolbars). - \value WindowFullscreenButtonHint On OS X adds a fullscreen button. + \value WindowFullscreenButtonHint On \macos adds a fullscreen button. \value BypassGraphicsProxyWidget Prevents the window and its children from automatically embedding themselves into a QGraphicsProxyWidget if the @@ -2184,7 +2184,7 @@ that support _NET_WM_STATE_BELOW atom. If a window always on the bottom has a parent, the parent will also be left on the bottom. This window hint is currently not implemented - for OS X. + for \macos. \value WindowOkButtonHint Adds an OK button to the window decoration of a dialog. Only supported for Windows CE. @@ -3049,7 +3049,7 @@ \value CoarseTimer Coarse timers try to keep accuracy within 5% of the desired interval \value VeryCoarseTimer Very coarse timers only keep full second accuracy - On UNIX (including Linux, OS X, and iOS), Qt will keep millisecond accuracy + On UNIX (including Linux, \macos, and iOS), Qt will keep millisecond accuracy for Qt::PreciseTimer. For Qt::CoarseTimer, the interval will be adjusted up to 5% to align the timer with other timers that are expected to fire at or around the same time. The objective is to make most timers wake up at the diff --git a/src/corelib/io/qabstractfileengine.cpp b/src/corelib/io/qabstractfileengine.cpp index 2ab789e0af5..3f89dc1a076 100644 --- a/src/corelib/io/qabstractfileengine.cpp +++ b/src/corelib/io/qabstractfileengine.cpp @@ -299,7 +299,7 @@ QAbstractFileEngine *QAbstractFileEngine::create(const QString &fileName) the file system (i.e. not a file or directory). \value FileType The file is a regular file to the file system (i.e. not a link or directory) - \value BundleType OS X and iOS: the file is a bundle; implies DirectoryType + \value BundleType \macos and iOS: the file is a bundle; implies DirectoryType \value DirectoryType The file is a directory in the file system (i.e. not a link or file). diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index cb1ce6fd659..3458d5eb256 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -234,7 +234,7 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request) isSymLink(). The symLinkTarget() function provides the name of the file the symlink points to. - On Unix (including OS X and iOS), the symlink has the same size() has + On Unix (including \macos and iOS), the symlink has the same size() has the file it points to, because Unix handles symlinks transparently; similarly, opening a symlink using QFile effectively opens the link's target. For example: @@ -754,7 +754,7 @@ QString QFileInfo::fileName() const \since 4.3 Returns the name of the bundle. - On OS X and iOS this returns the proper localized name for a bundle if the + On \macos and iOS this returns the proper localized name for a bundle if the path isBundle(). On all other platforms an empty QString is returned. Example: @@ -1036,7 +1036,7 @@ bool QFileInfo::isDir() const /*! \since 4.3 Returns \c true if this object points to a bundle or to a symbolic - link to a bundle on OS X and iOS; otherwise returns \c false. + link to a bundle on \macos and iOS; otherwise returns \c false. \sa isDir(), isSymLink(), isFile() */ @@ -1057,7 +1057,7 @@ bool QFileInfo::isBundle() const Returns \c true if this object points to a symbolic link (or to a shortcut on Windows); otherwise returns \c false. - On Unix (including OS X and iOS), opening a symlink effectively opens + On Unix (including \macos and iOS), opening a symlink effectively opens the \l{symLinkTarget()}{link's target}. On Windows, it opens the \c .lnk file itself. diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index d8564c4c40f..52ba1b59773 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -185,7 +185,7 @@ void QFileSystemWatcherPrivate::_q_directoryChanged(const QString &path, bool re the file system monitor. Also note that your process may have other file descriptors open in addition to the ones for files being monitored, and these other open descriptors also count in - the total. OS X uses a different backend and does not + the total. \macos uses a different backend and does not suffer from this issue. diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index eba38d06d63..2b95a757a72 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -688,7 +688,7 @@ bool QIODevice::seek(qint64 pos) For some devices, atEnd() can return true even though there is more data to read. This special case only applies to devices that generate data in direct response to you calling read() (e.g., \c /dev or \c /proc files on - Unix and OS X, or console input / \c stdin on all platforms). + Unix and \macos, or console input / \c stdin on all platforms). \sa bytesAvailable(), read(), isSequential() */ diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index 7bef253e591..82aefcc4ce8 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -129,7 +129,7 @@ static QBasicMutex fcntlLock; /*! \internal Checks that the OS isn't using POSIX locks to emulate flock(). - OS X is one of those. + \macos is one of those. */ static bool fcntlWorksAfterFlock(const QString &fn) { diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index a0c6f4a6f4d..9df7d23f4c8 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -177,7 +177,7 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift) by QStandardPaths::GenericConfigLocation, e.g. \list - \li on OS X and iOS: \c ~/Library/Preferences + \li on \macos and iOS: \c ~/Library/Preferences \li on Unix: \c ~/.config, \c /etc/xdg \li on Windows: \c %LOCALAPPDATA%, \c %ProgramData%, \l QCoreApplication::applicationDirPath(), diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 6e1a7712587..9dba96b1da8 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1892,7 +1892,7 @@ void QProcess::setProcessState(ProcessState state) /*! This function is called in the child process context just before the - program is executed on Unix or OS X (i.e., after \c fork(), but before + program is executed on Unix or \macos (i.e., after \c fork(), but before \c execve()). Reimplement this function to do last minute initialization of the child process. Example: @@ -1903,7 +1903,7 @@ void QProcess::setProcessState(ProcessState state) execution, your workaround is to emit finished() and then call exit(). - \warning This function is called by QProcess on Unix and OS X + \warning This function is called by QProcess on Unix and \macos only. On Windows and QNX, it is not called. */ void QProcess::setupChildProcess() @@ -2357,7 +2357,7 @@ void QProcess::setArguments(const QStringList &arguments) On Windows, terminate() posts a WM_CLOSE message to all top-level windows of the process and then to the main thread of the process itself. On Unix - and OS X the \c SIGTERM signal is sent. + and \macos the \c SIGTERM signal is sent. Console applications on Windows that do not run an event loop, or whose event loop does not handle the WM_CLOSE message, can only be terminated by @@ -2374,7 +2374,7 @@ void QProcess::terminate() /*! Kills the current process, causing it to exit immediately. - On Windows, kill() uses TerminateProcess, and on Unix and OS X, the + On Windows, kill() uses TerminateProcess, and on Unix and \macos, the SIGKILL signal is sent to the process. \sa terminate() diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 1c7ceed3c19..64a7b9529b1 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -1951,7 +1951,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, Users normally expect an application to remember its settings (window sizes and positions, options, etc.) across sessions. This information is often stored in the system registry on Windows, - and in property list files on OS X and iOS. On Unix systems, in the + and in property list files on \macos and iOS. On Unix systems, in the absence of a standard, many applications (including the KDE applications) use INI text files. @@ -1996,8 +1996,8 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, \snippet settings/settings.cpp 4 (Here, we also specify the organization's Internet domain. When - the Internet domain is set, it is used on OS X and iOS instead of the - organization name, since OS X and iOS applications conventionally use + the Internet domain is set, it is used on \macos and iOS instead of the + organization name, since \macos and iOS applications conventionally use Internet domains to identify themselves. If no domain is set, a fake domain is derived from the organization name. See the \l{Platform-Specific Notes} below for details.) @@ -2055,7 +2055,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, Setting keys can contain any Unicode characters. The Windows registry and INI files use case-insensitive keys, whereas the - CFPreferences API on OS X and iOS uses case-sensitive keys. To + CFPreferences API on \macos and iOS uses case-sensitive keys. To avoid portability problems, follow these simple rules: \list 1 @@ -2229,7 +2229,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, \li \c{/etc/xdg/MySoft.conf} \endlist - On Mac OS X versions 10.2 and 10.3, these files are used by + On \macos versions 10.2 and 10.3, these files are used by default: \list 1 @@ -2258,7 +2258,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, in the application's home directory. If the file format is IniFormat, the following files are - used on Unix, OS X, and iOS: + used on Unix, \macos, and iOS: \list 1 \li \c{$HOME/.config/MySoft/Star Runner.ini} (Qt for Embedded Linux: \c{$HOME/Settings/MySoft/Star Runner.ini}) @@ -2286,7 +2286,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, in the application's home directory. The paths for the \c .ini and \c .conf files can be changed using - setPath(). On Unix, OS X, and iOS the user can override them by + setPath(). On Unix, \macos, and iOS the user can override them by setting the \c XDG_CONFIG_HOME environment variable; see setPath() for details. @@ -2303,7 +2303,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, You can then use the QSettings object to read and write settings in the file. - On OS X and iOS, you can access property list \c .plist files by passing + On \macos and iOS, you can access property list \c .plist files by passing QSettings::NativeFormat as second argument. For example: \snippet code/src_corelib_io_qsettings.cpp 3 @@ -2357,13 +2357,13 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, limitations is to store the settings using the IniFormat instead of the NativeFormat. - \li On OS X and iOS, allKeys() will return some extra keys for global + \li On \macos and iOS, allKeys() will return some extra keys for global settings that apply to all applications. These keys can be read using value() but cannot be changed, only shadowed. Calling setFallbacksEnabled(false) will hide these global settings. - \li On OS X and iOS, the CFPreferences API used by QSettings expects + \li On \macos and iOS, the CFPreferences API used by QSettings expects Internet domain names rather than organization names. To provide a uniform API, QSettings derives a fake domain name from the organization name (unless the organization name @@ -2380,7 +2380,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, \snippet code/src_corelib_io_qsettings.cpp 7 - \li On OS X, permissions to access settings not belonging to the + \li On \macos, permissions to access settings not belonging to the current user (i.e. SystemScope) have changed with 10.7 (Lion). Prior to that version, users having admin rights could access these. For 10.7 and 10.8 (Mountain Lion), only root can. However, 10.9 (Mavericks) changes @@ -2420,7 +2420,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, \value NativeFormat Store the settings using the most appropriate storage format for the platform. On Windows, this means the system registry; - on OS X and iOS, this means the CFPreferences + on \macos and iOS, this means the CFPreferences API; on Unix, this means textual configuration files in INI format. \value IniFormat Store the settings in INI files. @@ -2583,7 +2583,7 @@ QSettings::QSettings(Format format, Scope scope, const QString &organization, If \a format is QSettings::NativeFormat, the meaning of \a fileName depends on the platform. On Unix, \a fileName is the - name of an INI file. On OS X and iOS, \a fileName is the name of a + name of an INI file. On \macos and iOS, \a fileName is the name of a \c .plist file. On Windows, \a fileName is a path in the system registry. @@ -2636,7 +2636,7 @@ QSettings::QSettings(const QString &fileName, Format format, QObject *parent) called, the QSettings object will not be able to read or write any settings, and status() will return AccessError. - On OS X and iOS, if both a name and an Internet domain are specified + On \macos and iOS, if both a name and an Internet domain are specified for the organization, the domain is preferred over the name. On other platforms, the name is preferred over the domain. @@ -3152,7 +3152,7 @@ bool QSettings::isWritable() const exists, the previous value is overwritten. Note that the Windows registry and INI files use case-insensitive - keys, whereas the CFPreferences API on OS X and iOS uses + keys, whereas the CFPreferences API on \macos and iOS uses case-sensitive keys. To avoid portability problems, see the \l{Section and Key Syntax} rules. @@ -3191,7 +3191,7 @@ void QSettings::setValue(const QString &key, const QVariant &value) \snippet code/src_corelib_io_qsettings.cpp 25 Note that the Windows registry and INI files use case-insensitive - keys, whereas the CFPreferences API on OS X and iOS uses + keys, whereas the CFPreferences API on \macos and iOS uses case-sensitive keys. To avoid portability problems, see the \l{Section and Key Syntax} rules. @@ -3226,7 +3226,7 @@ void QSettings::remove(const QString &key) relative to that group. Note that the Windows registry and INI files use case-insensitive - keys, whereas the CFPreferences API on OS X and iOS uses + keys, whereas the CFPreferences API on \macos and iOS uses case-sensitive keys. To avoid portability problems, see the \l{Section and Key Syntax} rules. @@ -3288,7 +3288,7 @@ bool QSettings::event(QEvent *event) returned. Note that the Windows registry and INI files use case-insensitive - keys, whereas the CFPreferences API on OS X and iOS uses + keys, whereas the CFPreferences API on \macos and iOS uses case-sensitive keys. To avoid portability problems, see the \l{Section and Key Syntax} rules. @@ -3391,18 +3391,18 @@ void QSettings::setUserIniPath(const QString &dir) \row \li SystemScope \li \c /etc/xdg \row \li{1,2} Qt for Embedded Linux \li{1,2} NativeFormat, IniFormat \li UserScope \li \c $HOME/Settings \row \li SystemScope \li \c /etc/xdg - \row \li{1,2} OS X and iOS \li{1,2} IniFormat \li UserScope \li \c $HOME/.config + \row \li{1,2} \macos and iOS \li{1,2} IniFormat \li UserScope \li \c $HOME/.config \row \li SystemScope \li \c /etc/xdg \endtable - The default UserScope paths on Unix, OS X, and iOS (\c + The default UserScope paths on Unix, \macos, and iOS (\c $HOME/.config or $HOME/Settings) can be overridden by the user by setting the \c XDG_CONFIG_HOME environment variable. The default SystemScope - paths on Unix, OS X, and iOS (\c /etc/xdg) can be overridden when + paths on Unix, \macos, and iOS (\c /etc/xdg) can be overridden when building the Qt library using the \c configure script's \c -sysconfdir flag (see QLibraryInfo for details). - Setting the NativeFormat paths on Windows, OS X, and iOS has no + Setting the NativeFormat paths on Windows, \macos, and iOS has no effect. \warning This function doesn't affect existing QSettings objects. diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp index 8828e09e8f0..bb4721c55bf 100644 --- a/src/corelib/io/qstandardpaths.cpp +++ b/src/corelib/io/qstandardpaths.cpp @@ -146,7 +146,7 @@ QT_BEGIN_NAMESPACE paths, if any, represent non-writable locations. \table - \header \li Path type \li OS X \li Windows + \header \li Path type \li \macos \li Windows \row \li DesktopLocation \li "~/Desktop" \li "C:/Users//Desktop" @@ -622,7 +622,7 @@ QString QStandardPaths::displayName(StandardLocation type) On Unix, \c XDG_DATA_HOME is set to \e ~/.qttest/share, \c XDG_CONFIG_HOME is set to \e ~/.qttest/config, and \c XDG_CACHE_HOME is set to \e ~/.qttest/cache. - On OS X, data goes to \e ~/.qttest/Application Support, cache goes to + On \macos, data goes to \e ~/.qttest/Application Support, cache goes to \e ~/.qttest/Cache, and config goes to \e ~/.qttest/Preferences. On Windows, everything goes to a "qttest" directory under Application Data. diff --git a/src/corelib/io/qstorageinfo.cpp b/src/corelib/io/qstorageinfo.cpp index 99a2a1a42a4..e14c954e563 100644 --- a/src/corelib/io/qstorageinfo.cpp +++ b/src/corelib/io/qstorageinfo.cpp @@ -250,7 +250,7 @@ QByteArray QStorageInfo::fileSystemType() const /*! Returns the device for this volume. - For example, on Unix filesystems (including OS X), this returns the + For example, on Unix filesystems (including \macos), this returns the devpath like \c /dev/sda0 for local storages. On Windows, it returns the UNC path starting with \c \\\\?\\ for local storages (in other words, the volume GUID). diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index b3b35dc9b6c..f5b15207cc3 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -714,7 +714,7 @@ QCoreApplication::QCoreApplication(QCoreApplicationPrivate &p) If you are doing graphical changes inside a loop that does not return to the event loop on asynchronous window systems like X11 - or double buffered window systems like Quartz (OS X and iOS), and you want to + or double buffered window systems like Quartz (\macos and iOS), and you want to visualize these changes immediately (e.g. Splash Screens), call this function. @@ -2073,7 +2073,7 @@ void QCoreApplicationPrivate::setApplicationFilePath(const QString &path) directory, and you run the \c{regexp} example, this function will return "C:/Qt/examples/tools/regexp". - On OS X and iOS this will point to the directory actually containing + On \macos and iOS this will point to the directory actually containing the executable, which may be inside an application bundle (if the application is bundled). diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 05c18995ffe..03c68a6d1f6 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -167,7 +167,7 @@ QT_BEGIN_NAMESPACE \value NonClientAreaMouseButtonPress A mouse button press occurred outside the client area. \value NonClientAreaMouseButtonRelease A mouse button release occurred outside the client area. \value NonClientAreaMouseMove A mouse move occurred outside the client area. - \value MacSizeChange The user changed his widget sizes (OS X only). + \value MacSizeChange The user changed his widget sizes (\macos only). \value MetaCall An asynchronous method invocation via QMetaObject::invokeMethod(). \value ModifiedChange Widgets modification state has been changed. \value MouseButtonDblClick Mouse press again (QMouseEvent). @@ -211,7 +211,7 @@ QT_BEGIN_NAMESPACE \omitvalue ThemeChange \value ThreadChange The object is moved to another thread. This is the last event sent to this object in the previous thread. See QObject::moveToThread(). \value Timer Regular timer events (QTimerEvent). - \value ToolBarChange The toolbar button is toggled on OS X. + \value ToolBarChange The toolbar button is toggled on \macos. \value ToolTip A tooltip was requested (QHelpEvent). \value ToolTipChange The widget's tooltip has changed. \value TouchBegin Beginning of a sequence of touch-screen or track-pad events (QTouchEvent). diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp index cf6abbd5cbc..5c272d420b1 100644 --- a/src/corelib/mimetypes/qmimedatabase.cpp +++ b/src/corelib/mimetypes/qmimedatabase.cpp @@ -239,7 +239,7 @@ bool QMimeDatabasePrivate::inherits(const QString &mime, const QString &parent) The MIME type database is provided by the freedesktop.org shared-mime-info project. If the MIME type database cannot be found on the system, as is the case - on most Windows, OS X, and iOS systems, Qt will use its own copy of it. + on most Windows, \macos, and iOS systems, Qt will use its own copy of it. Applications which want to define custom MIME types need to install an XML file into the locations searched for MIME definitions. diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 17a211a8f0f..ae0c84f63de 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -597,7 +597,7 @@ bool QLibraryPrivate::loadPlugin() \row \li Unix/Linux \li \c .so \row \li AIX \li \c .a \row \li HP-UX \li \c .sl, \c .so (HP-UXi) - \row \li OS X and iOS \li \c .dylib, \c .bundle, \c .so + \row \li \macos and iOS \li \c .dylib, \c .bundle, \c .so \endtable Trailing versioning numbers on Unix are ignored. @@ -834,7 +834,7 @@ QLibrary::QLibrary(QObject *parent) We recommend omitting the file's suffix in \a fileName, since QLibrary will automatically look for the file with the appropriate suffix in accordance with the platform, e.g. ".so" on Unix, - ".dylib" on OS X and iOS, and ".dll" on Windows. (See \l{fileName}.) + ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) */ QLibrary::QLibrary(const QString& fileName, QObject *parent) :QObject(parent), d(0), did_load(false) @@ -851,7 +851,7 @@ QLibrary::QLibrary(const QString& fileName, QObject *parent) We recommend omitting the file's suffix in \a fileName, since QLibrary will automatically look for the file with the appropriate suffix in accordance with the platform, e.g. ".so" on Unix, - ".dylib" on OS X and iOS, and ".dll" on Windows. (See \l{fileName}.) + ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) */ QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent) :QObject(parent), d(0), did_load(false) @@ -867,7 +867,7 @@ QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent) We recommend omitting the file's suffix in \a fileName, since QLibrary will automatically look for the file with the appropriate suffix in accordance with the platform, e.g. ".so" on Unix, - ".dylib" on OS X and iOS, and ".dll" on Windows. (See \l{fileName}.) + ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) */ QLibrary::QLibrary(const QString& fileName, const QString &version, QObject *parent) :QObject(parent), d(0), did_load(false) diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index 24101be87b4..37f2368413e 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -139,7 +139,7 @@ QPluginLoader::QPluginLoader(QObject *parent) To be loadable, the file's suffix must be a valid suffix for a loadable library in accordance with the platform, e.g. \c .so on - Unix, - \c .dylib on OS X and iOS, and \c .dll on Windows. The suffix + Unix, - \c .dylib on \macos and iOS, and \c .dll on Windows. The suffix can be verified with QLibrary::isLibrary(). \sa setFileName() diff --git a/src/corelib/tools/qelapsedtimer.cpp b/src/corelib/tools/qelapsedtimer.cpp index 8360f11632b..9336f18eba4 100644 --- a/src/corelib/tools/qelapsedtimer.cpp +++ b/src/corelib/tools/qelapsedtimer.cpp @@ -131,7 +131,7 @@ QT_BEGIN_NAMESPACE \value SystemTime The human-readable system time. This clock is not monotonic. \value MonotonicClock The system's monotonic clock, usually found in Unix systems. This clock is monotonic and does not overflow. \value TickCounter The system's tick counter, used on Windows systems. This clock may overflow. - \value MachAbsoluteTime The Mach kernel's absolute time (OS X and iOS). This clock is monotonic and does not overflow. + \value MachAbsoluteTime The Mach kernel's absolute time (\macos and iOS). This clock is monotonic and does not overflow. \value PerformanceCounter The high-resolution performance counter provided by Windows. This clock is monotonic and does not overflow. \section2 SystemTime @@ -173,8 +173,8 @@ QT_BEGIN_NAMESPACE \section2 MachAbsoluteTime This clock type is based on the absolute time presented by Mach kernels, - such as that found on OS X. This clock type is presented separately - from MonotonicClock since OS X and iOS are also Unix systems and may support + such as that found on \macos. This clock type is presented separately + from MonotonicClock since \macos and iOS are also Unix systems and may support a POSIX monotonic clock with values differing from the Mach absolute time. diff --git a/src/corelib/tools/qelapsedtimer_generic.cpp b/src/corelib/tools/qelapsedtimer_generic.cpp index 8679aec8107..590e9d800d2 100644 --- a/src/corelib/tools/qelapsedtimer_generic.cpp +++ b/src/corelib/tools/qelapsedtimer_generic.cpp @@ -139,7 +139,7 @@ qint64 QElapsedTimer::elapsed() const Q_DECL_NOTHROW number of milliseconds since January 1st, 1970 at 0:00 UTC (that is, it is the Unix time expressed in milliseconds). - On Linux, Windows and OS X/iOS systems, this value is usually the time + On Linux, Windows and Apple platforms, this value is usually the time since the system boot, though it usually does not include the time the system has spent in sleep states. diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 9aeec77632f..ff7e7fd406e 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -5465,7 +5465,7 @@ int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2, platform-dependent manner. Use this function to present sorted lists of strings to the user. - On OS X and iOS this function compares according the + On \macos and iOS this function compares according the "Order for sorted lists" setting in the International preferences panel. \sa compare(), QLocale @@ -7967,7 +7967,7 @@ QString QString::multiArg(int numArgs, const QString **args) const Constructs a new QString containing a copy of the \a string CFString. - \note this function is only available on OS X and iOS. + \note this function is only available on \macos and iOS. */ /*! \fn CFStringRef QString::toCFString() const @@ -7976,7 +7976,7 @@ QString QString::multiArg(int numArgs, const QString **args) const Creates a CFString from a QString. The caller owns the CFString and is responsible for releasing it. - \note this function is only available on OS X and iOS. + \note this function is only available on \macos and iOS. */ /*! \fn QString QString::fromNSString(const NSString *string) @@ -7984,7 +7984,7 @@ QString QString::multiArg(int numArgs, const QString **args) const Constructs a new QString containing a copy of the \a string NSString. - \note this function is only available on OS X and iOS. + \note this function is only available on \macos and iOS. */ /*! \fn NSString QString::toNSString() const @@ -7992,7 +7992,7 @@ QString QString::multiArg(int numArgs, const QString **args) const Creates a NSString from a QString. The NSString is autoreleased. - \note this function is only available on OS X and iOS. + \note this function is only available on \macos and iOS. */ /*! \fn bool QString::isSimpleText() const @@ -9316,7 +9316,7 @@ QStringRef QStringRef::appendTo(QString *string) const platform-dependent manner. Use this function to present sorted lists of strings to the user. - On OS X and iOS, this function compares according the + On \macos and iOS, this function compares according the "Order for sorted lists" setting in the International prefereces panel. \sa compare(), QLocale diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 658e0f26ba8..6d9ad2c160f 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -85,7 +85,7 @@ QT_BEGIN_NAMESPACE to replace or extend the default behavior of the static functions in QAccessible. - Qt supports Microsoft Active Accessibility (MSAA), OS X + Qt supports Microsoft Active Accessibility (MSAA), \macos Accessibility, and the Unix/X11 AT-SPI standard. Other backends can be supported using QAccessibleBridge. diff --git a/src/gui/accessible/qaccessiblebridge.cpp b/src/gui/accessible/qaccessiblebridge.cpp index ddee4b06761..164dc732698 100644 --- a/src/gui/accessible/qaccessiblebridge.cpp +++ b/src/gui/accessible/qaccessiblebridge.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE \ingroup accessibility \inmodule QtWidgets - Qt supports Microsoft Active Accessibility (MSAA), OS X + Qt supports Microsoft Active Accessibility (MSAA), \macos Accessibility, and the Unix/X11 AT-SPI standard. By subclassing QAccessibleBridge, you can support other backends than the predefined ones. diff --git a/src/gui/doc/src/dnd.qdoc b/src/gui/doc/src/dnd.qdoc index 6e76c2faa9a..27f236b7a65 100644 --- a/src/gui/doc/src/dnd.qdoc +++ b/src/gui/doc/src/dnd.qdoc @@ -399,7 +399,7 @@ On X11, the public \l{http://www.newplanetsoftware.com/xdnd/}{XDND protocol} is used, while on Windows Qt uses the OLE standard, and - Qt for OS X uses the Cocoa Drag Manager. On X11, XDND uses MIME, + Qt for \macos uses the Cocoa Drag Manager. On X11, XDND uses MIME, so no translation is necessary. The Qt API is the same regardless of the platform. On Windows, MIME-aware applications can communicate by using clipboard format names that are MIME types. Already some @@ -408,6 +408,6 @@ Custom classes for translating proprietary clipboard formats can be registered by reimplementing QWinMime on Windows or - QMacPasteboardMime on OS X. + QMacPasteboardMime on \macos. */ diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index d9e1347e4b0..e1e53677665 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1223,7 +1223,7 @@ void QIcon::setIsMask(bool isMask) Returns \c true if this icon has been marked as a mask image. Certain platforms render mask icons differently (for example, - menu icons on OS X). + menu icons on \macos). \sa setIsMask() */ diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index 817c50d9b21..1aac3d60212 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -110,22 +110,22 @@ QT_BEGIN_NAMESPACE \endlist - \section1 Notes for OS X Users + \section1 Notes for \macos Users - OS X supports a separate find buffer that holds the current + \macos supports a separate find buffer that holds the current search string in Find operations. This find clipboard can be accessed by specifying the FindBuffer mode. - \section1 Notes for Windows and OS X Users + \section1 Notes for Windows and \macos Users \list - \li Windows and OS X do not support the global mouse + \li Windows and \macos do not support the global mouse selection; they only supports the global clipboard, i.e. they only add text to the clipboard when an explicit copy or cut is made. - \li Windows and OS X does not have the concept of ownership; + \li Windows and \macos does not have the concept of ownership; the clipboard is a fully global resource so all applications are notified of changes. @@ -181,7 +181,7 @@ QClipboard::~QClipboard() This signal is emitted when the clipboard data is changed. - On OS X and with Qt version 4.3 or higher, clipboard + On \macos and with Qt version 4.3 or higher, clipboard changes made by other applications will only be detected when the application is activated. @@ -193,7 +193,7 @@ QClipboard::~QClipboard() This signal is emitted when the selection is changed. This only applies to windowing systems that support selections, e.g. X11. - Windows and OS X don't support selections. + Windows and \macos don't support selections. \sa dataChanged(), findBufferChanged(), changed() */ @@ -203,7 +203,7 @@ QClipboard::~QClipboard() \since 4.2 This signal is emitted when the find buffer is changed. This only - applies to OS X. + applies to \macos. With Qt version 4.3 or higher, clipboard changes made by other applications will only be detected when the application is activated. @@ -226,7 +226,7 @@ QClipboard::~QClipboard() systems with a global mouse selection (e.g. X11). \value FindBuffer indicates that data should be stored and retrieved from - the Find buffer. This mode is used for holding search strings on OS X. + the Find buffer. This mode is used for holding search strings on \macos. \omitvalue LastMode diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp index 2736fac8e0b..c2d168de5d4 100644 --- a/src/gui/kernel/qdrag.cpp +++ b/src/gui/kernel/qdrag.cpp @@ -218,7 +218,7 @@ QObject *QDrag::target() const from are specified in \a supportedActions. The default proposed action will be selected among the allowed actions in the following order: Move, Copy and Link. - \b{Note:} On Linux and OS X, the drag and drop operation + \b{Note:} On Linux and \macos, the drag and drop operation can take some time, but this function does not block the event loop. Other events are still delivered to the application while the operation is performed. On Windows, the Qt event loop is @@ -240,7 +240,7 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions) The \a defaultDropAction determines which action will be proposed when the user performs a drag without using modifier keys. - \b{Note:} On Linux and OS X, the drag and drop operation + \b{Note:} On Linux and \macos, the drag and drop operation can take some time, but this function does not block the event loop. Other events are still delivered to the application while the operation is performed. On Windows, the Qt event loop is diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 43da81e8a6a..a3d39f13b29 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -653,7 +653,7 @@ QHoverEvent::~QHoverEvent() wheel event delta: angleDelta() returns the delta in wheel degrees. This value is always provided. pixelDelta() returns the delta in screen pixels and is available on platforms that - have high-resolution trackpads, such as OS X. If that is the + have high-resolution trackpads, such as \macos. If that is the case, source() will return Qt::MouseEventSynthesizedBySystem. The functions pos() and globalPos() return the mouse cursor's @@ -883,7 +883,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, Returns the scrolling distance in pixels on screen. This value is provided on platforms that support high-resolution pixel-based - delta values, such as OS X. The value should be used directly + delta values, such as \macos. The value should be used directly to scroll content on screen. Example: @@ -1024,7 +1024,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, Returns the scrolling phase of this wheel event. \note The Qt::ScrollBegin and Qt::ScrollEnd phases are currently - supported only on OS X. + supported only on \macos. */ @@ -1642,7 +1642,7 @@ QCloseEvent::~QCloseEvent() \ingroup events Icon drag events are sent to widgets when the main icon of a window - has been dragged away. On OS X, this happens when the proxy + has been dragged away. On \macos, this happens when the proxy icon of a window is dragged off the title bar. It is normal to begin using drag and drop in response to this @@ -2653,15 +2653,15 @@ Qt::MouseButtons QTabletEvent::buttons() const \row \li Qt::ZoomNativeGesture \li Magnification delta in percent. - \li OS X: Two-finger pinch. + \li \macos: Two-finger pinch. \row \li Qt::SmartZoomNativeGesture \li Boolean magnification state. - \li OS X: Two-finger douple tap (trackpad) / One-finger douple tap (magic mouse). + \li \macos: Two-finger douple tap (trackpad) / One-finger douple tap (magic mouse). \row \li Qt::RotateNativeGesture \li Rotation delta in degrees. - \li OS X: Two-finger rotate. + \li \macos: Two-finger rotate. \endtable @@ -2684,7 +2684,7 @@ Qt::MouseButtons QTabletEvent::buttons() const gesture position relative to the receiving widget or item, window, and screen, respectively. - \a realValue is the OS X event parameter, \a sequenceId and \a intValue are the Windows event parameters. + \a realValue is the \macos event parameter, \a sequenceId and \a intValue are the Windows event parameters. */ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue) @@ -3421,16 +3421,16 @@ QShowEvent::~QShowEvent() when the operating system requests that a file or URL should be opened. This is a high-level event that can be caused by different user actions depending on the user's desktop environment; for example, double - clicking on an file icon in the Finder on OS X. + clicking on an file icon in the Finder on \macos. This event is only used to notify the application of a request. It may be safely ignored. - \note This class is currently supported for OS X only. + \note This class is currently supported for \macos only. - \section1 OS X Example + \section1 \macos Example - In order to trigger the event on OS X, the application must be configured + In order to trigger the event on \macos, the application must be configured to let the OS know what kind of file(s) it should react on. For example, the following \c Info.plist file declares that the application @@ -3507,13 +3507,13 @@ bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const \internal \class QToolBarChangeEvent \brief The QToolBarChangeEvent class provides an event that is - sent whenever a the toolbar button is clicked on OS X. + sent whenever a the toolbar button is clicked on \macos. \ingroup events \inmodule QtGui - The QToolBarChangeEvent is sent when the toolbar button is clicked. On Mac - OS X, this is the long oblong button on the right side of the window + The QToolBarChangeEvent is sent when the toolbar button is clicked. On + \macos, this is the long oblong button on the right side of the window title bar. The default implementation is to toggle the appearance (hidden or shown) of the associated toolbars for the window. */ diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 7b05ee562b2..9cbcd714abd 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1013,7 +1013,7 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos) \list \li \c android - \li \c cocoa is a platform plugin for OS X. + \li \c cocoa is a platform plugin for \macos. \li \c directfb \li \c eglfs is a platform plugin for running Qt5 applications on top of EGL and OpenGL ES 2.0 without an actual windowing system (like X11 diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index b0ef2a284fe..2d00b9dce91 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -118,7 +118,7 @@ static inline qreal initialGlobalScaleFactor() The devicePixelRatio seen by applications is the product of the Qt scale factor and the OS scale factor. The value of the scale factors may be 1, in which case two or more of the coordinate systems are equivalent. Platforms - that (may) have an OS scale factor include OS X, iOS and Wayland. + that (may) have an OS scale factor include \macos, iOS and Wayland. Note that the functions in this file do not work with the OS scale factor directly and are limited to converting between device independent and native diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index f3ebf002247..a36719c344e 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -147,7 +147,7 @@ static bool qt_sequence_no_mnemonics = false; Specifies whether mnemonics for menu items, labels, etc., should be honored or not. On Windows and X11, this feature is - on by default; on OS X, it is off. When this feature is off + on by default; on \macos, it is off. When this feature is off (that is, when \a b is false), QKeySequence::mnemonic() always returns an empty string. @@ -211,7 +211,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni QKeySequence objects can be cast to a QString to obtain a human-readable translated version of the sequence. Similarly, the toString() function - produces human-readable strings for use in menus. On OS X, the + produces human-readable strings for use in menus. On \macos, the appropriate symbols are used to describe keyboard shortcuts using special keys on the Macintosh keyboard. @@ -219,12 +219,12 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni code point of the character; for example, 'A' gives the same key sequence as Qt::Key_A. - \note On OS X, references to "Ctrl", Qt::CTRL, Qt::Key_Control + \note On \macos, references to "Ctrl", Qt::CTRL, Qt::Key_Control and Qt::ControlModifier correspond to the \uicontrol Command keys on the Macintosh keyboard, and references to "Meta", Qt::META, Qt::Key_Meta and Qt::MetaModifier correspond to the \uicontrol Control keys. Developers on - OS X can use the same shortcut descriptions across all platforms, - and their applications will automatically work as expected on OS X. + \macos can use the same shortcut descriptions across all platforms, + and their applications will automatically work as expected on \macos. \section1 Standard Shortcuts @@ -233,12 +233,12 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni setting up actions in a typical application. The table below shows some common key sequences that are often used for these standard shortcuts by applications on four widely-used platforms. Note - that on OS X, the \uicontrol Ctrl value corresponds to the \uicontrol + that on \macos, the \uicontrol Ctrl value corresponds to the \uicontrol Command keys on the Macintosh keyboard, and the \uicontrol Meta value corresponds to the \uicontrol Control keys. \table - \header \li StandardKey \li Windows \li OS X \li KDE \li GNOME + \header \li StandardKey \li Windows \li \macos \li KDE \li GNOME \row \li HelpContents \li F1 \li Ctrl+? \li F1 \li F1 \row \li WhatsThis \li Shift+F1 \li Shift+F1 \li Shift+F1 \li Shift+F1 \row \li Open \li Ctrl+O \li Ctrl+O \li Ctrl+O \li Ctrl+O @@ -720,7 +720,7 @@ static const struct { \value InsertLineSeparator Insert a new line. \value InsertParagraphSeparator Insert a new paragraph. \value Italic Italic text. - \value MoveToEndOfBlock Move cursor to end of block. This shortcut is only used on the OS X. + \value MoveToEndOfBlock Move cursor to end of block. This shortcut is only used on the \macos. \value MoveToEndOfDocument Move cursor to end of document. \value MoveToEndOfLine Move cursor to end of line. \value MoveToNextChar Move cursor to next character. @@ -731,7 +731,7 @@ static const struct { \value MoveToPreviousLine Move cursor to previous line. \value MoveToPreviousPage Move cursor to previous page. \value MoveToPreviousWord Move cursor to previous word. - \value MoveToStartOfBlock Move cursor to start of a block. This shortcut is only used on OS X. + \value MoveToStartOfBlock Move cursor to start of a block. This shortcut is only used on \macos. \value MoveToStartOfDocument Move cursor to start of document. \value MoveToStartOfLine Move cursor to start of line. \value New Create new document. @@ -749,7 +749,7 @@ static const struct { \value Save Save document. \value SelectAll Select all text. \value Deselect Deselect text. Since 5.1 - \value SelectEndOfBlock Extend selection to the end of a text block. This shortcut is only used on OS X. + \value SelectEndOfBlock Extend selection to the end of a text block. This shortcut is only used on \macos. \value SelectEndOfDocument Extend selection to end of document. \value SelectEndOfLine Extend selection to end of line. \value SelectNextChar Extend selection to next character. @@ -760,7 +760,7 @@ static const struct { \value SelectPreviousLine Extend selection to previous line. \value SelectPreviousPage Extend selection to previous page. \value SelectPreviousWord Extend selection to previous word. - \value SelectStartOfBlock Extend selection to the start of a text block. This shortcut is only used on OS X. + \value SelectStartOfBlock Extend selection to the start of a text block. This shortcut is only used on \macos. \value SelectStartOfDocument Extend selection to start of document. \value SelectStartOfLine Extend selection to start of line. \value Underline Underline text. @@ -1516,7 +1516,7 @@ bool QKeySequence::isDetached() const If the key sequence has no keys, an empty string is returned. - On OS X, the string returned resembles the sequence that is + On \macos, the string returned resembles the sequence that is shown in the menu bar. \sa fromString() diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index ae05245e2fa..a8102125fbe 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -382,7 +382,7 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button) \warning Some styles do not use the palette for all drawing, for instance, if they make use of native theme engines. This is the - case for both the Windows XP, Windows Vista, and the OS X + case for both the Windows XP, Windows Vista, and the \macos styles. \sa QApplication::setPalette(), QWidget::setPalette(), QColor diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp index 17cd55720a9..fda2f84b391 100644 --- a/src/gui/opengl/qopenglversionfunctions.cpp +++ b/src/gui/opengl/qopenglversionfunctions.cpp @@ -139,7 +139,7 @@ void QAbstractOpenGLFunctionsPrivate::removeExternalFunctions(QOpenGLContext *co Please note that some vendors, notably Apple, do not implement the Compatibility profile. Therefore if you wish to target new OpenGL features - on OS X then you should ensure that you request a Core profile context via + on \macos then you should ensure that you request a Core profile context via QSurfaceFormat::setProfile(). Qt provides classes for all version and Core and Compatibility profile diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index ef930943873..f056207d195 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -149,7 +149,7 @@ QFont QTextItem::font() const provided is the raster paint engine, which contains a software rasterizer which supports the full feature set on all supported platforms. This is the default for painting on QWidget-based classes in e.g. on Windows, - X11 and OS X, it is the backend for painting on QImage and it is + X11 and \macos, it is the backend for painting on QImage and it is used as a fallback for paint engines that do not support a certain capability. In addition we provide QPaintEngine implementations for OpenGL (accessible through QGLWidget) and printing (which allows using @@ -363,8 +363,8 @@ void QPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDraw \value X11 \value Windows \value MacPrinter - \value CoreGraphics OS X's Quartz2D (CoreGraphics) - \value QuickDraw OS X's QuickDraw + \value CoreGraphics \macos's Quartz2D (CoreGraphics) + \value QuickDraw \macos's QuickDraw \value QWindowSystem Qt for Embedded Linux \value PostScript (No longer supported) \value OpenGL diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 757c78cec8e..3c191b3c072 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -927,7 +927,7 @@ QRegion QRegion::intersect(const QRect &r) const sort key and X as the minor sort key. \endlist \omit - Only some platforms have these restrictions (Qt for Embedded Linux, X11 and OS X). + Only some platforms have these restrictions (Qt for Embedded Linux, X11 and \macos). \endomit */ diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index ea34614cb5b..2496147f11c 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -727,7 +727,7 @@ void QFont::setFamily(const QString &family) Returns the requested font style name, it will be used to match the font with irregular styles (that can't be normalized in other style properties). It depends on system font support, thus only works for - OS X and X11 so far. On Windows irregular styles will be added + \macos and X11 so far. On Windows irregular styles will be added as separate font families so there is no need for this. \sa setFamily(), setStyle() @@ -822,7 +822,7 @@ int QFont::pointSize() const \li Vertical hinting (light) \li Full hinting \row - \li Cocoa on OS X + \li Cocoa on \macos \li No hinting \li No hinting \li No hinting diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 074d9707f16..0621f2a5243 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -2043,7 +2043,7 @@ bool QFontDatabase::hasFamily(const QString &family) const Returns \c true if and only if the \a family font family is private. - This happens, for instance, on OS X and iOS, where the system UI fonts are not + This happens, for instance, on \macos and iOS, where the system UI fonts are not accessible to the user. For completeness, QFontDatabase::families() returns all font families, including the private ones. You should use this function if you are developing a font selection control in order to keep private fonts hidden. diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 5d4044b0968..9e045f91c3d 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -79,7 +79,7 @@ QT_BEGIN_NAMESPACE also have accessors to some relevant data in the physical font. QRawFont only provides support for the main font technologies: GDI and DirectWrite on Windows - platforms, FreeType on Linux platforms and CoreText on OS X. For other + platforms, FreeType on Linux platforms and CoreText on \macos. For other font back-ends, the APIs will be disabled. QRawFont can be constructed in a number of ways: diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 4b31b49df2d..277d946202c 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -1328,7 +1328,7 @@ bool QTextFormat::operator==(const QTextFormat &rhs) const \value WaveUnderline The text is underlined using a wave shaped line. \value SpellCheckUnderline The underline is drawn depending on the QStyle::SH_SpellCeckUnderlineStyle style hint of the QApplication style. By default this is mapped to - WaveUnderline, on OS X it is mapped to DashDotLine. + WaveUnderline, on \macos it is mapped to DashDotLine. \sa Qt::PenStyle */ diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index 4a527052d1b..df102cbeb41 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -358,7 +358,7 @@ void QNetworkAddressEntry::setBroadcast(const QHostAddress &newBroadcast) Not all operating systems support reporting all features. Only the IPv4 addresses are guaranteed to be listed by this class in all platforms. In particular, IPv6 address listing is only supported - on Windows, Linux, OS X and the BSDs. + on Windows, Linux, \macos and the BSDs. \sa QNetworkAddressEntry */ diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 4c7c0c5442c..c152821aa64 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -1522,7 +1522,7 @@ void QNetworkProxyFactory::setApplicationProxyFactory(QNetworkProxyFactory *fact those settings are not found, this function will attempt to obtain Internet Explorer's settings and use them. - On MacOS X, this function will obtain the proxy settings using the + On \macos, this function will obtain the proxy settings using the SystemConfiguration framework from Apple. It will apply the FTP, HTTP and HTTPS proxy configurations for queries that contain the protocol tag "ftp", "http" and "https", respectively. If the SOCKS @@ -1547,7 +1547,7 @@ void QNetworkProxyFactory::setApplicationProxyFactory(QNetworkProxyFactory *fact listed here. \list - \li On MacOS X, this function will ignore the Proxy Auto Configuration + \li On \macos, this function will ignore the Proxy Auto Configuration settings, since it cannot execute the associated ECMAScript code. \li On Windows platforms, this function may take several seconds to diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 9fd659376d7..9c1e7a6a499 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -420,7 +420,7 @@ allowed to rebind, even if they pass ReuseAddressHint. This option provides more security than ShareAddress, but on certain operating systems, it requires you to run the server with administrator privileges. - On Unix and OS X, not sharing is the default behavior for binding + On Unix and \macos, not sharing is the default behavior for binding an address and port, so this option is ignored. On Windows, this option uses the SO_EXCLUSIVEADDRUSE socket option. @@ -430,7 +430,7 @@ socket option. \value DefaultForPlatform The default option for the current platform. - On Unix and OS X, this is equivalent to (DontShareAddress + On Unix and \macos, this is equivalent to (DontShareAddress + ReuseAddressHint), and on Windows, its equivalent to ShareAddress. */ diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp index 1c60cba903c..1788bde0202 100644 --- a/src/network/socket/qlocalserver.cpp +++ b/src/network/socket/qlocalserver.cpp @@ -141,7 +141,7 @@ QLocalServer::~QLocalServer() and are created based on the umask. Setting the access flags will overide this and will restrict or permit access as specified. - Other Unix-based operating systems, such as OS X, do not + Other Unix-based operating systems, such as \macos, do not honor file permissions for Unix domain sockets and by default have WorldAccess and these permission flags will have no effect. diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index c4536062628..549906ac643 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -136,7 +136,7 @@ addDefaultCaCertificates(), and QSslConfiguration::defaultConfiguration().setCaCertificates(). \endlist - \note If available, root certificates on Unix (excluding OS X) will be + \note If available, root certificates on Unix (excluding \macos) will be loaded on demand from the standard certificate directories. If you do not want to load root certificates on demand, you need to call either QSslConfiguration::defaultConfiguration().setCaCertificates() before the first diff --git a/src/opengl/doc/src/qtopengl-index.qdoc b/src/opengl/doc/src/qtopengl-index.qdoc index a01ccc67f64..54dc1af84f7 100644 --- a/src/opengl/doc/src/qtopengl-index.qdoc +++ b/src/opengl/doc/src/qtopengl-index.qdoc @@ -37,7 +37,7 @@ OpenGL is a standard API for rendering 3D graphics. OpenGL only deals with 3D rendering and provides little or no support for GUI programming issues. The user interface for an OpenGL application - must be created with another toolkit, such as Cocoa on the OS X + must be created with another toolkit, such as Cocoa on the \macos platform, Microsoft Foundation Classes (MFC) under Windows, or Qt on both platforms. diff --git a/src/opengl/doc/src/qtopengl-module.qdoc b/src/opengl/doc/src/qtopengl-module.qdoc index 80742dd5887..a0962fdac58 100644 --- a/src/opengl/doc/src/qtopengl-module.qdoc +++ b/src/opengl/doc/src/qtopengl-module.qdoc @@ -40,7 +40,7 @@ OpenGL is a standard API for rendering 3D graphics. OpenGL only deals with 3D rendering and provides little or no support for GUI programming issues. The user interface for an OpenGL application - must be created with another toolkit, such as Cocoa on the OS X + must be created with another toolkit, such as Cocoa on the \macos platform, Microsoft Foundation Classes (MFC) under Windows, or Qt on both platforms. diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index d84b59efff8..652a498930e 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -3690,7 +3690,7 @@ void QGLContext::doneCurrent() QGLWidget. This will side-step the issue altogether, and is what we recommend for users that need this kind of functionality. - On OS X, when Qt is built with Cocoa support, a QGLWidget + On \macos, when Qt is built with Cocoa support, a QGLWidget can't have any sibling widgets placed ontop of itself. This is due to limitations in the Cocoa API and is not supported by Apple. diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp index 943ec7ad30d..696cd81e371 100644 --- a/src/opengl/qglpixelbuffer.cpp +++ b/src/opengl/qglpixelbuffer.cpp @@ -60,7 +60,7 @@ an OpenGL texture.} The texture is then updated automatically when the pbuffer contents change, eliminating the need for additional copy operations. This is supported only on Windows - and OS X systems that provide the \c render_texture + and \macos systems that provide the \c render_texture extension. Note that under Windows, a multi-sampled pbuffer can't be used in conjunction with the \c render_texture extension. If a multi-sampled pbuffer is requested under @@ -287,7 +287,7 @@ QGLContext *QGLPixelBuffer::context() const pbuffer contents to a texture using updateDynamicTexture(). \warning For the bindToDynamicTexture() call to succeed on the - OS X, the pbuffer needs a shared context, i.e. the + \macos, the pbuffer needs a shared context, i.e. the QGLPixelBuffer must be created with a share widget. \sa generateDynamicTexture(), releaseFromDynamicTexture() @@ -316,7 +316,7 @@ QGLContext *QGLPixelBuffer::context() const \snippet code/src_opengl_qglpixelbuffer.cpp 1 - An alternative on Windows and OS X systems that support the + An alternative on Windows and \macos systems that support the \c render_texture extension is to use bindToDynamicTexture() to get dynamic updates of the texture. diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 58d29611117..058209da7e5 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -649,7 +649,7 @@ QString qt_mac_removeAmpersandEscapes(QString s) returned if it can't be obtained. It is the caller's responsibility to CGContextRelease the context when finished using it. - \warning This function is only available on OS X. + \warning This function is only available on \macos. \warning This function is duplicated in qmacstyle_mac.mm */ CGContextRef qt_mac_cg_context(QPaintDevice *pdev) diff --git a/src/printsupport/dialogs/qabstractprintdialog.cpp b/src/printsupport/dialogs/qabstractprintdialog.cpp index 68027fdae8c..bf7c8829d7a 100644 --- a/src/printsupport/dialogs/qabstractprintdialog.cpp +++ b/src/printsupport/dialogs/qabstractprintdialog.cpp @@ -387,13 +387,13 @@ void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter) settings for each available printer can be modified via the dialog's \uicontrol{Properties} push button. - On Windows and OS X, the native print dialog is used, which means that + On Windows and \macos, the native print dialog is used, which means that some QWidget and QDialog properties set on the dialog won't be respected. - The native print dialog on OS X does not support setting printer options, + The native print dialog on \macos does not support setting printer options, i.e. setOptions() and setOption() have no effect. In Qt 4.4, it was possible to use the static functions to show a sheet on - OS X. This is no longer supported in Qt 4.5. If you want this + \macos. This is no longer supported in Qt 4.5. If you want this functionality, use QPrintDialog::open(). \sa QPageSetupDialog, QPrinter @@ -453,7 +453,7 @@ void QAbstractPrintDialog::setOptionTabs(const QList &tabs) and exec() to return \a result. \note This function does not apply to the Native Print Dialog on the Mac - OS X and Windows platforms, because the dialog is required to be modal + \macos and Windows platforms, because the dialog is required to be modal and only the user can close it. \sa QDialog::done() diff --git a/src/printsupport/dialogs/qpagesetupdialog.cpp b/src/printsupport/dialogs/qpagesetupdialog.cpp index 425a8cd9d50..9a358a97e7c 100644 --- a/src/printsupport/dialogs/qpagesetupdialog.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog.cpp @@ -50,12 +50,12 @@ QT_BEGIN_NAMESPACE \ingroup printing \inmodule QtPrintSupport - On Windows and OS X the page setup dialog is implemented using + On Windows and \macos the page setup dialog is implemented using the native page setup dialogs. - Note that on Windows and OS X custom paper sizes won't be + Note that on Windows and \macos custom paper sizes won't be reflected in the native page setup dialogs. Additionally, custom - page margins set on a QPrinter won't show in the native OS X + page margins set on a QPrinter won't show in the native \macos page setup dialog. \sa QPrinter, QPrintDialog diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 2cecf615733..539ba06bdb7 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -311,7 +311,7 @@ public: features, such as orientation and resolution, and to step through the pages in a document as it is generated. - When printing directly to a printer on Windows or OS X, QPrinter uses + When printing directly to a printer on Windows or \macos, QPrinter uses the built-in printer drivers. On X11, QPrinter uses the \l{Common Unix Printing System (CUPS)} to send PDF output to the printer. As an alternative, @@ -909,7 +909,7 @@ QString QPrinter::outputFileName() const QPrinter uses Qt's cross-platform PDF print engines respectively. If you can produce this format natively, for example - OS X can generate PDF's from its print engine, set the output format + \macos can generate PDF's from its print engine, set the output format back to NativeFormat. \sa outputFileName(), setOutputFormat() @@ -1379,7 +1379,7 @@ QPrinter::ColorMode QPrinter::colorMode() const \obsolete Returns the number of copies to be printed. The default value is 1. - On Windows, OS X and X11 systems that support CUPS, this will always + On Windows, \macos and X11 systems that support CUPS, this will always return 1 as these operating systems can internally handle the number of copies. diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc index 5c75505d3cc..a2f84a09a08 100644 --- a/src/sql/doc/src/sql-driver.qdoc +++ b/src/sql/doc/src/sql-driver.qdoc @@ -77,7 +77,7 @@ \target building \section1 Building the Drivers Using Configure - On Unix and OS X, the Qt \c configure script tries to + On Unix and \macos, the Qt \c configure script tries to automatically detect the available client libraries on your machine. Run \c{configure -help} to see what drivers can be built. You should get an output similar to this: @@ -139,7 +139,7 @@ Please refer to the MySQL documentation, chapter "libmysqld, the Embedded MySQL Server Library" for more information about the MySQL embedded server. - \section3 How to Build the QMYSQL Plugin on Unix and OS X + \section3 How to Build the QMYSQL Plugin on Unix and \macos You need the MySQL header files and as well as the shared library \c{libmysqlclient.so}. Depending on your Linux distribution you may @@ -208,7 +208,7 @@ BLOBs are bound to placeholders or QSqlTableModel, which uses a prepared query to do this internally. - \section3 How to Build the OCI Plugin on Unix and OS X + \section3 How to Build the OCI Plugin on Unix and \macos For Oracle 10g, all you need is the "Instant Client Package - Basic" and "Instant Client Package - SDK". For Oracle prior to 10g, you require @@ -343,7 +343,7 @@ "SQL_WCHAR support" in the ODBC driver manager otherwise Oracle will convert all Unicode strings to local 8-bit. - \section3 How to Build the ODBC Plugin on Unix and OS X + \section3 How to Build the ODBC Plugin on Unix and \macos It is recommended that you use unixODBC. You can find the latest version and ODBC drivers at \l http://www.unixodbc.org. @@ -400,7 +400,7 @@ Binary Large Objects are supported through the \c BYTEA field type in PostgreSQL server versions >= 7.1. - \section3 How to Build the QPSQL Plugin on Unix and OS X + \section3 How to Build the QPSQL Plugin on Unix and \macos You need the PostgreSQL client library and headers installed. @@ -440,7 +440,7 @@ Sybase client library. Refer to the Sybase documentation for information on how to set up a Sybase client configuration file to enable connections to databases on non-default ports. - \section3 How to Build the QTDS Plugin on Unix and OS X + \section3 How to Build the QTDS Plugin on Unix and \macos Under Unix, two libraries are available which support the TDS protocol: @@ -493,7 +493,7 @@ We suggest using a forward-only query when calling stored procedures in DB2 (see QSqlQuery::setForwardOnly()). - \section3 How to Build the QDB2 Plugin on Unix and OS X + \section3 How to Build the QDB2 Plugin on Unix and \macos \snippet code/doc_src_sql-driver.qdoc 18 @@ -643,7 +643,7 @@ \snippet code/doc_src_sql-driver.cpp 26 - \section3 How to Build the QIBASE Plugin on Unix and OS X + \section3 How to Build the QIBASE Plugin on Unix and \macos The following assumes InterBase or Firebird is installed in \c{/opt/interbase}: diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc index d8e2dc2516e..d0f62964801 100644 --- a/src/testlib/doc/src/qttestlib-manual.qdoc +++ b/src/testlib/doc/src/qttestlib-manual.qdoc @@ -314,7 +314,7 @@ \li All platforms \row \li CPU tick counter \li -tickcounter - \li Windows, OS X, Linux, many UNIX-like systems. + \li Windows, \macos, Linux, many UNIX-like systems. \row \li Event Counter \li -eventcounter \li All platforms diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 6a1135920da..547a55f19ea 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -535,8 +535,8 @@ QColor QColorDialog::customColor(int index) /*! Sets the custom color at \a index to the QColor \a color value. - \note This function does not apply to the Native Color Dialog on the Mac - OS X platform. If you still require this function, use the + \note This function does not apply to the Native Color Dialog on the + \macos platform. If you still require this function, use the QColorDialog::DontUseNativeDialog option. */ void QColorDialog::setCustomColor(int index, QColor color) @@ -557,8 +557,8 @@ QColor QColorDialog::standardColor(int index) /*! Sets the standard color at \a index to the QColor \a color value. - \note This function does not apply to the Native Color Dialog on the Mac - OS X platform. If you still require this function, use the + \note This function does not apply to the Native Color Dialog on the + \macos platform. If you still require this function, use the QColorDialog::DontUseNativeDialog option. */ void QColorDialog::setStandardColor(int index, QColor color) diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 7d34b6de4a3..bc2de899f5b 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -2076,7 +2076,7 @@ QString QFileDialog::labelText(DialogLabel label) const The dialog's caption is set to \a caption. If \a caption is not specified then a default caption will be used. - On Windows, and OS X, this static function will use the + On Windows, and \macos, this static function will use the native file dialog and not a QFileDialog. On Windows the dialog will spin a blocking modal event loop that will not @@ -2187,7 +2187,7 @@ QUrl QFileDialog::getOpenFileUrl(QWidget *parent, The dialog's caption is set to \a caption. If \a caption is not specified then a default caption will be used. - On Windows, and OS X, this static function will use the + On Windows, and \macos, this static function will use the native file dialog and not a QFileDialog. On Windows the dialog will spin a blocking modal event loop that will not @@ -2310,12 +2310,12 @@ QList QFileDialog::getOpenFileUrls(QWidget *parent, The dialog's caption is set to \a caption. If \a caption is not specified, a default caption will be used. - On Windows, and OS X, this static function will use the + On Windows, and \macos, this static function will use the native file dialog and not a QFileDialog. 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. On OS X, with its native file + dialog just below the parent's title bar. On \macos, with its native file dialog, the filter argument is ignored. On Unix/X11, the normal behavior of the file dialog is to resolve and @@ -2418,7 +2418,7 @@ 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 + On Windows and \macos, 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 diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index f32f7b0417a..61a890c0640 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -580,7 +580,7 @@ void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button This is the approach recommended in the \l{http://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/Windows/Windows.html#//apple_ref/doc/uid/20000961-BABCAJID} - {OS X Guidelines}. Similar guidelines apply for the other + {\macos Guidelines}. Similar guidelines apply for the other platforms, but note the different ways the \l{QMessageBox::informativeText} {informative text} is handled for different platforms. @@ -795,7 +795,7 @@ void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button Constructs a message box with no text and no buttons. \a parent is passed to the QDialog constructor. - On OS X, if you want your message box to appear + On \macos, if you want your message box to appear as a Qt::Sheet of its \a parent, set the message box's \l{setWindowModality()} {window modality} to Qt::WindowModal or use open(). Otherwise, the message box will be a standard dialog. @@ -817,7 +817,7 @@ QMessageBox::QMessageBox(QWidget *parent) The message box is an \l{Qt::ApplicationModal} {application modal} dialog box. - On OS X, if \a parent is not 0 and you want your message box + On \macos, if \a parent is not 0 and you want your message box to appear as a Qt::Sheet of that parent, set the message box's \l{setWindowModality()} {window modality} to Qt::WindowModal (default). Otherwise, the message box will be a standard dialog. @@ -985,7 +985,7 @@ QAbstractButton *QMessageBox::button(StandardButton which) const \list 1 \li If there is only one button, it is made the escape button. \li If there is a \l Cancel button, it is made the escape button. - \li On OS X only, if there is exactly one button with the role + \li On \macos only, if there is exactly one button with the role QMessageBox::RejectRole, it is made the escape button. \endlist @@ -1800,7 +1800,7 @@ QMessageBox::StandardButton QMessageBox::critical(QWidget *parent, const QString \li As a last resort it uses the Information icon. \endlist - The about box has a single button labelled "OK". On OS X, the + The about box has a single button labelled "OK". On \macos, the about box is popped up as a modeless window; on other platforms, it is currently application modal. @@ -1854,7 +1854,7 @@ void QMessageBox::about(QWidget *parent, const QString &title, const QString &te QApplication provides this functionality as a slot. - On OS X, the about box is popped up as a modeless window; on + On \macos, the about box is popped up as a modeless window; on other platforms, it is currently application modal. \sa QApplication::aboutQt() @@ -2619,8 +2619,8 @@ void QMessageBox::setInformativeText(const QString &text) This function shadows QWidget::setWindowTitle(). - Sets the title of the message box to \a title. On OS X, - the window title is ignored (as required by the OS X + Sets the title of the message box to \a title. On \macos, + the window title is ignored (as required by the \macos Guidelines). */ void QMessageBox::setWindowTitle(const QString &title) @@ -2641,7 +2641,7 @@ void QMessageBox::setWindowTitle(const QString &title) Sets the modality of the message box to \a windowModality. - On OS X, if the modality is set to Qt::WindowModal and the message box + On \macos, if the modality is set to Qt::WindowModal and the message box has a parent, then the message box will be a Qt::Sheet, otherwise the message box will be a standard dialog. */ diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index b9906f13da0..219cfb62b11 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -1817,7 +1817,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *) \inmodule QtWidgets - A wizard (also called an assistant on OS X) is a special type + A wizard (also called an assistant on \macos) is a special type of input dialog that consists of a sequence of pages. A wizard's purpose is to guide the user through a process step by step. Wizards are useful for complex or infrequent tasks that users may @@ -2115,10 +2115,10 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *) This enum specifies the buttons in a wizard. - \value BackButton The \uicontrol Back button (\uicontrol {Go Back} on OS X) - \value NextButton The \uicontrol Next button (\uicontrol Continue on OS X) + \value BackButton The \uicontrol Back button (\uicontrol {Go Back} on \macos) + \value NextButton The \uicontrol Next button (\uicontrol Continue on \macos) \value CommitButton The \uicontrol Commit button - \value FinishButton The \uicontrol Finish button (\uicontrol Done on OS X) + \value FinishButton The \uicontrol Finish button (\uicontrol Done on \macos) \value CancelButton The \uicontrol Cancel button (see also NoCancelButton) \value HelpButton The \uicontrol Help button (see also HaveHelpButton) \value CustomButton1 The first user-defined button (see also HaveCustomButton1) @@ -2158,7 +2158,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *) \value ClassicStyle Classic Windows look \value ModernStyle Modern Windows look - \value MacStyle OS X look + \value MacStyle \macos look \value AeroStyle Windows Aero look \omitvalue NStyles @@ -2631,7 +2631,7 @@ bool QWizard::testOption(WizardOption option) const \list \li Windows: HelpButtonOnRight. - \li OS X: NoDefaultButton and NoCancelButton. + \li \macos: NoDefaultButton and NoCancelButton. \li X11 and QWS (Qt for Embedded Linux): none. \endlist @@ -2675,7 +2675,7 @@ QWizard::WizardOptions QWizard::options() const Sets the text on button \a which to be \a text. By default, the text on buttons depends on the wizardStyle. For - example, on OS X, the \uicontrol Next button is called \uicontrol + example, on \macos, the \uicontrol Next button is called \uicontrol Continue. To add extra buttons to the wizard (e.g., a \uicontrol Print button), @@ -2707,7 +2707,7 @@ void QWizard::setButtonText(WizardButton which, const QString &text) If a text has ben set using setButtonText(), this text is returned. By default, the text on buttons depends on the wizardStyle. For - example, on OS X, the \uicontrol Next button is called \uicontrol + example, on \macos, the \uicontrol Next button is called \uicontrol Continue. \sa button(), setButton(), setButtonText(), QWizardPage::buttonText(), @@ -2893,7 +2893,7 @@ void QWizard::setPixmap(WizardPixmap which, const QPixmap &pixmap) Returns the pixmap set for role \a which. By default, the only pixmap that is set is the BackgroundPixmap on - OS X. + \macos. \sa QWizardPage::pixmap(), {Elements of a Wizard Page} */ @@ -3805,7 +3805,7 @@ void QWizardPage::setButtonText(QWizard::WizardButton which, const QString &text this text is returned. By default, the text on buttons depends on the QWizard::wizardStyle. - For example, on OS X, the \uicontrol Next button is called \uicontrol + For example, on \macos, the \uicontrol Next button is called \uicontrol Continue. \sa setButtonText(), QWizard::buttonText(), QWizard::setButtonText() diff --git a/src/widgets/doc/src/graphicsview.qdoc b/src/widgets/doc/src/graphicsview.qdoc index 6f3bc68f988..8848e43f299 100644 --- a/src/widgets/doc/src/graphicsview.qdoc +++ b/src/widgets/doc/src/graphicsview.qdoc @@ -491,7 +491,7 @@ not supported. For example, you can create decorated windows by passing the Qt::Window window flag to QGraphicsWidget's constructor, but Graphics View currently doesn't support the Qt::Sheet and - Qt::Drawer flags that are common on OS X. + Qt::Drawer flags that are common on \macos. \section3 QGraphicsLayout diff --git a/src/widgets/doc/src/widgets-and-layouts/focus.qdoc b/src/widgets/doc/src/widgets-and-layouts/focus.qdoc index d7a2361dda3..52f8c127323 100644 --- a/src/widgets/doc/src/widgets-and-layouts/focus.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/focus.qdoc @@ -162,13 +162,13 @@ \section2 The User Rotates the Mouse Wheel On Microsoft Windows, mouse wheel usage is always handled by the - widget that has keyboard focus. On OS X and X11, it's handled by + widget that has keyboard focus. On \macos and X11, it's handled by the widget that gets other mouse events. The way Qt handles this platform difference is by letting widgets move the keyboard focus when the wheel is used. With the right focus policy on each widget, applications can work idiomatically correctly on - Windows, OS X, and X11. + Windows, \macos, and X11. \section2 The User Moves the Focus to This Window diff --git a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc index 7d1bffd0b4b..0165d2d5e44 100644 --- a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc @@ -115,7 +115,7 @@ The widget is passed as the last argument in case the style needs it to perform special effects (such as animated default buttons on - OS X), but it isn't mandatory. + \macos), but it isn't mandatory. In the course of this section, we will look at the style elements, the style options, and the functions of QStyle. Finally, we describe diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc index 2fb6819c474..606fe5ce152 100644 --- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -80,7 +80,7 @@ the QPalette::Button role to red for a QPushButton to obtain a red push button. However, this wasn't guaranteed to work for all styles, because style authors are restricted by the different - platforms' guidelines and (on Windows XP and OS X) by the + platforms' guidelines and (on Windows XP and \macos) by the native theme engine. Style sheets let you perform all kinds of customizations that are @@ -121,7 +121,7 @@ \row \li \inlineimage stylesheet-coffee-cleanlooks.png \li \inlineimage stylesheet-pagefold-mac.png \row \li Coffee theme running on Ubuntu Linux - \li Pagefold theme running on OS X + \li Pagefold theme running on \macos \endtable When a style sheet is active, the QStyle returned by QWidget::style() @@ -130,7 +130,7 @@ otherwise forwards the drawing operations to the underlying, platform-specific style (e.g., QWindowsXPStyle on Windows XP). - Since Qt 4.5, Qt style sheets fully supports OS X. + Since Qt 4.5, Qt style sheets fully supports \macos. */ @@ -3793,7 +3793,7 @@ \snippet code/doc_src_stylesheet.qdoc 135 If you want the scroll buttons of the scroll bar to be placed together - (instead of the edges) like on OS X, you can use the following + (instead of the edges) like on \macos, you can use the following stylesheet: \snippet code/doc_src_stylesheet.qdoc 136 diff --git a/src/widgets/doc/src/widgets-tutorial.qdoc b/src/widgets/doc/src/widgets-tutorial.qdoc index a337a7a487e..77d85e63d83 100644 --- a/src/widgets/doc/src/widgets-tutorial.qdoc +++ b/src/widgets/doc/src/widgets-tutorial.qdoc @@ -110,7 +110,7 @@ make sure that the executable is on your path, or enter its full location. - \li On Linux/Unix and OS X, type \c make and press + \li On Linux/Unix and \macos, type \c make and press \uicontrol{Return}; on Windows with Visual Studio, type \c nmake and press \uicontrol{Return}. diff --git a/src/widgets/graphicsview/qgraphicssceneevent.cpp b/src/widgets/graphicsview/qgraphicssceneevent.cpp index 071d34280a2..07842de00c6 100644 --- a/src/widgets/graphicsview/qgraphicssceneevent.cpp +++ b/src/widgets/graphicsview/qgraphicssceneevent.cpp @@ -143,7 +143,7 @@ platforms, this means the right mouse button was clicked. \value Keyboard The keyboard caused this event to be sent. On - Windows and OS X, this means the menu button was pressed. + Windows and \macos, this means the menu button was pressed. \value Other The event was sent by some other means (i.e. not by the mouse or keyboard). diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 1ef9e4ef989..2067e7dbccf 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -249,7 +249,7 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) /*! \enum QAction::MenuRole - This enum describes how an action should be moved into the application menu on OS X. + This enum describes how an action should be moved into the application menu on \macos. \value NoRole This action should not be put into the application menu \value TextHeuristicRole This action should be put in the application menu based on the action's text @@ -258,7 +258,7 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) \value AboutQtRole This action handles the "About Qt" menu item. \value AboutRole This action should be placed where the "About" menu item is in the application menu. The text of the menu item will be set to "About ". The application name is fetched from the - \c{Info.plist} file in the application's bundle (See \l{Qt for OS X - Deployment}). + \c{Info.plist} file in the application's bundle (See \l{Qt for macOS - Deployment}). \value PreferencesRole This action should be placed where the "Preferences..." menu item is in the application menu. \value QuitRole This action should be placed where the Quit menu item is in the application menu. @@ -1230,12 +1230,12 @@ void QAction::activate(ActionEvent event) \brief the action's menu role \since 4.2 - This indicates what role the action serves in the application menu on Mac - OS X. By default all actions have the TextHeuristicRole, which means that + This indicates what role the action serves in the application menu on + \macos. By default all actions have the TextHeuristicRole, which means that the action is added based on its text (see QMenuBar for more information). The menu role can only be changed before the actions are put into the menu - bar in OS X (usually just before the first application window is + bar in \macos (usually just before the first application window is shown). */ void QAction::setMenuRole(MenuRole menuRole) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index fcc195f6010..917273e8cf1 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1530,7 +1530,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* \note Some styles do not use the palette for all drawing, for instance, if they make use of native theme engines. This is the case for the Windows XP, - Windows Vista, and OS X styles. + Windows Vista, and \macos styles. \sa QWidget::setPalette(), palette(), QStyle::polish() */ @@ -4021,7 +4021,7 @@ bool QApplication::keypadNavigationEnabled() Currently this function does nothing on Qt for Embedded Linux. - On OS X, this works more at the application level and will cause the + On \macos, this works more at the application level and will cause the application icon to bounce in the dock. On Windows, this causes the window's taskbar entry to flash for a time. If diff --git a/src/widgets/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc index abdbd35f5bb..00a01bb572b 100644 --- a/src/widgets/kernel/qdesktopwidget.qdoc +++ b/src/widgets/kernel/qdesktopwidget.qdoc @@ -149,7 +149,7 @@ Returns the available geometry of the screen with index \a screen. What is available will be subrect of screenGeometry() based on what the platform decides is available (for example excludes the dock and menu bar - on OS X, or the task bar on Windows). The default screen is used if + on \macos, or the task bar on Windows). The default screen is used if \a screen is -1. \sa screenNumber(), screenGeometry() diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index 124f6b301c3..24bf80f16c5 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -1041,7 +1041,7 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem) \li \b{Adherence to the different platform's look and feel guidelines.} For example, the - \l{http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html}{Mac OS X Aqua} and KDE guidelines specify that the + \l{http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html}{\macos Aqua} and KDE guidelines specify that the labels should be right-aligned, whereas Windows and GNOME applications normally use left-alignment. @@ -1084,7 +1084,7 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem) corresponds to what we would get using a two-column QGridLayout.) \li Style based on the - \l{http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html}{Mac OS X Aqua} guidelines. Labels are right-aligned, + \l{http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html}{\macos Aqua} guidelines. Labels are right-aligned, the fields don't grow beyond their size hint, and the form is horizontally centered. \li Recommended style for diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 1d48be5198e..c94c8bd1c62 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -106,7 +106,7 @@ QT_BEGIN_NAMESPACE \note Calling QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance is mandatory on some platforms (for example, - OS X) when an OpenGL core profile context is requested. This is to + \macos) when an OpenGL core profile context is requested. This is to ensure that resource sharing between contexts stays functional as all internal contexts are created using the correct version and profile. @@ -461,7 +461,7 @@ QT_BEGIN_NAMESPACE recommended to limit the usage of this approach to cases where there is no other choice. Note that this option is not suitable for most embedded and mobile platforms, and it is known to have issues on - certain desktop platforms (e.g. OS X) too. The stable, + certain desktop platforms (e.g. \macos) too. The stable, cross-platform solution is always QOpenGLWidget. \e{OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other diff --git a/src/widgets/kernel/qsizepolicy.cpp b/src/widgets/kernel/qsizepolicy.cpp index 26d1733d26f..b1cdb52c550 100644 --- a/src/widgets/kernel/qsizepolicy.cpp +++ b/src/widgets/kernel/qsizepolicy.cpp @@ -241,7 +241,7 @@ QSizePolicy::ControlType QSizePolicy::controlType() const The control type specifies the type of the widget for which this size policy applies. It is used by some styles, notably QMacStyle, to insert proper spacing between widgets. For example, - the Mac OS X Aqua guidelines specify that push buttons should be + the \macos Aqua guidelines specify that push buttons should be separated by 12 pixels, whereas vertically stacked radio buttons only require 6 pixels. diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 57148eb811a..03f642bd9bd 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2505,7 +2505,7 @@ QWidget *QWidget::find(WId id) If a widget is non-native (alien) and winId() is invoked on it, that widget will be provided a native handle. - On OS X, the type returned depends on which framework Qt was linked + On \macos, the type returned depends on which framework Qt was linked against. If Qt is using Carbon, the {WId} is actually an HIViewRef. If Qt is using Cocoa, {WId} is a pointer to an NSView. @@ -2632,7 +2632,7 @@ QWindow *QWidget::windowHandle() const The style sheet contains a textual description of customizations to the widget's style, as described in the \l{Qt Style Sheets} document. - Since Qt 4.5, Qt style sheets fully supports OS X. + Since Qt 4.5, Qt style sheets fully supports \macos. \warning Qt style sheets are currently not supported for custom QStyle subclasses. We plan to address this in some future release. @@ -5111,7 +5111,7 @@ void QWidget::render(QPaintDevice *target, const QPoint &targetOffset, Transformations and settings applied to the \a painter will be used when rendering. - \note The \a painter must be active. On OS X the widget will be + \note The \a painter must be active. On \macos the widget will be rendered into a QPixmap and then drawn by the \a painter. \sa QPainter::device() @@ -6255,7 +6255,7 @@ QString QWidget::windowIconText() const If the window title is set at any point, then the window title takes precedence and will be shown instead of the file path string. - Additionally, on OS X, this has an added benefit that it sets the + Additionally, on \macos, this has an added benefit that it sets the \l{http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGWindows/chapter_17_section_3.html}{proxy icon} for the window, assuming that the file path exists. @@ -11294,7 +11294,7 @@ bool QWidget::testAttribute_helper(Qt::WidgetAttribute attribute) const By default the value of this property is 1.0. - This feature is available on Embedded Linux, OS X, Windows, + This feature is available on Embedded Linux, \macos, Windows, and X11 platforms that support the Composite extension. This feature is not available on Windows CE. @@ -11357,7 +11357,7 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal level) A modified window is a window whose content has changed but has not been saved to disk. This flag will have different effects - varied by the platform. On OS X the close button will have a + varied by the platform. On \macos the close button will have a modified look; on other platforms, the window title will have an '*' (asterisk). @@ -12503,7 +12503,7 @@ static void releaseMouseGrabOfWidget(QWidget *widget) \note On Windows, grabMouse() only works when the mouse is inside a window owned by the process. - On OS X, grabMouse() only works when the mouse is inside the frame of that widget. + On \macos, grabMouse() only works when the mouse is inside the frame of that widget. \sa releaseMouse(), grabKeyboard(), releaseKeyboard() */ @@ -12975,7 +12975,7 @@ QDebug operator<<(QDebug debug, const QWidget *widget) 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. + \warning This function is only available on \macos. */ /*! \fn Qt::HANDLE QWidget::macQDHandle() const \internal @@ -12984,7 +12984,7 @@ QDebug operator<<(QDebug debug, const QWidget *widget) 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. + \warning This function is only available on \macos. */ /*! \fn const QX11Info &QWidget::x11Info() const \internal diff --git a/src/widgets/kernel/qwidgetaction.cpp b/src/widgets/kernel/qwidgetaction.cpp index 3c0c203fd64..a96ee629962 100644 --- a/src/widgets/kernel/qwidgetaction.cpp +++ b/src/widgets/kernel/qwidgetaction.cpp @@ -79,8 +79,8 @@ QT_BEGIN_NAMESPACE Note that it is up to the widget to activate the action, for example by reimplementing mouse event handlers and calling QAction::trigger(). - \b {OS X}: If you add a widget to a menu in the application's menu - bar on OS X, the widget will be added and it will function but with some + \b {\macos}: If you add a widget to a menu in the application's menu + bar on \macos, the widget will be added and it will function but with some limitations: \list 1 \li The widget is reparented away from the QMenu to the native menu @@ -90,7 +90,7 @@ QT_BEGIN_NAMESPACE \li Due to Apple's design, mouse tracking on the widget currently does not work. \li Connecting the triggered() signal to a slot that opens a modal - dialog will cause a crash in Mac OS X 10.4 (known bug acknowledged + dialog will cause a crash in \macos 10.4 (known bug acknowledged by Apple), a workaround is to use a QueuedConnection instead of a DirectConnection. \endlist diff --git a/src/widgets/styles/qmacstyle.qdoc b/src/widgets/styles/qmacstyle.qdoc index 0800e2d6080..b7969900747 100644 --- a/src/widgets/styles/qmacstyle.qdoc +++ b/src/widgets/styles/qmacstyle.qdoc @@ -28,7 +28,7 @@ /*! \class QMacStyle - \brief The QMacStyle class provides a OS X style using the Apple Appearance Manager. + \brief The QMacStyle class provides a \macos style using the Apple Appearance Manager. \ingroup appearance \inmodule QtWidgets @@ -36,10 +36,10 @@ This class is implemented as a wrapper to the HITheme APIs, allowing applications to be styled according to the current - theme in use on OS X. This is done by having primitives - in QStyle implemented in terms of what OS X would normally theme. + theme in use on \macos. This is done by having primitives + in QStyle implemented in terms of what \macos would normally theme. - \warning This style is only available on OS X because it relies on the + \warning This style is only available on \macos because it relies on the HITheme APIs. There are additional issues that should be taken @@ -56,7 +56,7 @@ involve horizontal and vertical widget alignment and widget size (covered below). - \li Widget size - OS X allows widgets to have specific fixed sizes. Qt + \li Widget size - \macos allows widgets to have specific fixed sizes. Qt does not fully implement this behavior so as to maintain cross-platform compatibility. As a result some widgets sizes may be inappropriate (and subsequently not rendered correctly by the HITheme APIs).The @@ -75,7 +75,7 @@ There are other issues that need to be considered in the feel of your application (including the general color scheme to match the Aqua colors). The Guidelines mentioned above will remain current - with new advances and design suggestions for OS X. + with new advances and design suggestions for \macos. Note that the functions provided by QMacStyle are reimplementations of QStyle functions; see QStyle for their diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 52f6ca2131e..8f724df8578 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -7221,7 +7221,7 @@ static CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintD returned if it can't be obtained. It is the caller's responsibility to CGContextRelease the context when finished using it. - \warning This function is only available on OS X. + \warning This function is only available on \macos. \warning This function is duplicated in the Cocoa platform plugin. */ diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 6a03d73c724..e148e5deec8 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -98,7 +98,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C The style gets all the information it needs to render the graphical element from the QStyleOption class. The widget is passed as the last argument in case the style needs it to perform - special effects (such as animated default buttons on OS X), + special effects (such as animated default buttons on \macos), but it isn't mandatory. In fact, QStyle can be used to draw on any paint device (not just widgets), in which case the widget argument is a zero pointer. @@ -197,7 +197,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C QStyle gets all the information it needs to render the graphical element from QStyleOption. The widget is passed as the last argument in case the style needs it to perform special effects - (such as animated default buttons on OS X), but it isn't + (such as animated default buttons on \macos), but it isn't mandatory. In fact, you can use QStyle to draw on any paint device, not just widgets, by setting the QPainter properly. @@ -1718,7 +1718,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, desktop platforms. \value SH_Menu_SubMenuUniDirection Since Qt 5.5. If the cursor has - to move towards the submenu (like it is on OS X), or if the + to move towards the submenu (like it is on \macos), or if the cursor can move in any direction as long as it reaches the submenu before the sloppy timeout. diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 28c0b41a15c..7aa9a097318 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -1744,7 +1744,7 @@ QStyleOptionMenuItem::QStyleOptionMenuItem(int version) \value DefaultItem A menu item that is the default action as specified with \l QMenu::defaultAction(). \value Separator A menu separator. \value SubMenu Indicates the menu item points to a sub-menu. - \value Scroller A popup menu scroller (currently only used on OS X). + \value Scroller A popup menu scroller (currently only used on \macos). \value TearOff A tear-off handle for the menu. \value Margin The margin of the menu. \value EmptyArea The empty area of the menu. diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp index 270f1c5890d..2adcdd018db 100644 --- a/src/widgets/util/qscroller.cpp +++ b/src/widgets/util/qscroller.cpp @@ -558,7 +558,7 @@ void QScroller::stop() \note Please note that this value should be physically correct. The actual DPI settings that Qt returns for the display may be reported wrongly on purpose by the underlying - windowing system, for example on OS X. + windowing system, for example on \macos. */ QPointF QScroller::pixelPerMeter() const { diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 5589cda50ab..704142fe5c5 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -76,9 +76,9 @@ QT_BEGIN_NAMESPACE \li All X11 desktop environments that implement the D-Bus \l{http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem} specification, including recent versions of KDE and Unity. - \li All supported versions of OS X. Note that the Growl + \li All supported versions of \macos. Note that the Growl notification system must be installed for - QSystemTrayIcon::showMessage() to display messages on Mac OS X prior to 10.8 (Mountain Lion). + QSystemTrayIcon::showMessage() to display messages on \macos prior to 10.8 (Mountain Lion). \endlist To check whether a system tray is present on the user's desktop, @@ -157,7 +157,7 @@ QSystemTrayIcon::~QSystemTrayIcon() The menu will pop up when the user requests the context menu for the system tray icon by clicking the mouse button. - On OS X, this is currenly converted to a NSMenu, so the + On \macos, this is currenly converted to a NSMenu, so the aboutToHide() signal is not emitted. \note The system tray icon does not take ownership of the menu. You must @@ -317,7 +317,7 @@ bool QSystemTrayIcon::event(QEvent *e) This signal is emitted when the message displayed using showMessage() was clicked by the user. - Currently this signal is not sent on OS X. + Currently this signal is not sent on \macos. \note We follow Microsoft Windows XP/Vista behavior, so the signal is also emitted when the user clicks on a tray icon with @@ -368,7 +368,7 @@ bool QSystemTrayIcon::supportsMessages() On Windows, the \a millisecondsTimeoutHint is usually ignored by the system when the application has focus. - On OS X, the Growl notification system must be installed for this function to + On \macos, the Growl notification system must be installed for this function to display messages. Has been turned into a slot in Qt 5.2. diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 4d2c32d43ea..1986344a8c8 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -118,7 +118,7 @@ QT_BEGIN_NAMESPACE \endtable Additionally, button boxes that contain only buttons with ActionRole or - HelpRole can be considered modeless and have an alternate look on OS X: + HelpRole can be considered modeless and have an alternate look on \macos: \table \row \li modeless horizontal MacLayout @@ -583,7 +583,7 @@ QDialogButtonBox::~QDialogButtonBox() contained in the button box. \value WinLayout Use a policy appropriate for applications on Windows. - \value MacLayout Use a policy appropriate for applications on OS X. + \value MacLayout Use a policy appropriate for applications on \macos. \value KdeLayout Use a policy appropriate for applications on KDE. \value GnomeLayout Use a policy appropriate for applications on GNOME. diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm index a384e41d1ba..cc45c101dc7 100644 --- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm @@ -43,7 +43,7 @@ \class QMacCocoaViewContainer \since 4.5 - \brief The QMacCocoaViewContainer class provides a widget for OS X that can be used to wrap arbitrary + \brief The QMacCocoaViewContainer class provides a widget for \macos that can be used to wrap arbitrary Cocoa views (i.e., NSView subclasses) and insert them into Qt hierarchies. \ingroup advanced @@ -58,10 +58,10 @@ of the underlying NSView. QMacCocoaViewContainer works regardless if Qt is built against Carbon or - Cocoa. However, QCocoaContainerView requires Mac OS X 10.5 or better to be + Cocoa. However, QCocoaContainerView requires \macos 10.5 or better to be used with Carbon. - It should be also noted that at the low level on OS X, there is a + It should be also noted that at the low level on \macos, there is a difference between windows (top-levels) and view (widgets that are inside a window). For this reason, make sure that the NSView that you are wrapping doesn't end up as a top-level. The best way to ensure this is to make sure diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm index 46a43c41100..f6f19db9598 100644 --- a/src/widgets/widgets/qmacnativewidget_mac.mm +++ b/src/widgets/widgets/qmacnativewidget_mac.mm @@ -42,13 +42,13 @@ /*! \class QMacNativeWidget \since 4.5 - \brief The QMacNativeWidget class provides a widget for OS X that provides + \brief The QMacNativeWidget class provides a widget for \macos that provides a way to put Qt widgets into Cocoa hierarchies. \ingroup advanced \inmodule QtWidgets - On OS X, there is a difference between a window and view; + On \macos, there is a difference between a window and view; normally expressed as widgets in Qt. Qt makes assumptions about its parent-child hierarchy that make it complex to put an arbitrary Qt widget into a hierarchy of "normal" views from Apple frameworks. QMacNativeWidget diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index 7a9a077e5f7..50ba7f97ec0 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -1547,7 +1547,7 @@ bool QMainWindow::event(QEvent *event) /*! \property QMainWindow::unifiedTitleAndToolBarOnMac - \brief whether the window uses the unified title and toolbar look on OS X + \brief whether the window uses the unified title and toolbar look on \macos Note that the Qt 5 implementation has several limitations compared to Qt 4: \list diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 184dd42fe6e..c194547f2d0 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1432,7 +1432,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) do not support the signals: aboutToHide (), aboutToShow () and hovered (). It is not possible to display an icon in a native menu on Windows Mobile. - \section1 QMenu on OS X with Qt Build Against Cocoa + \section1 QMenu on \macos with Qt Build Against Cocoa QMenu can be inserted only once in a menu/menubar. Subsequent insertions will have no effect or will result in a disabled menu item. diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm index 184e4d7bb16..05d01a7f31c 100644 --- a/src/widgets/widgets/qmenu_mac.mm +++ b/src/widgets/widgets/qmenu_mac.mm @@ -66,7 +66,7 @@ inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePla /*! \since 5.2 - Returns the native NSMenu for this menu. Available on OS X only. + Returns the native NSMenu for this menu. Available on \macos only. \note Qt sets the delegate on the native menu. If you need to set your own delegate, make sure you save the original one and forward any calls to it. @@ -87,7 +87,7 @@ NSMenu *QMenu::toNSMenu() \since 5.2 Set this menu to be the dock menu available by option-clicking - on the application dock icon. Available on OS X only. + on the application dock icon. Available on \macos only. */ void QMenu::setAsDockMenu() { @@ -105,7 +105,7 @@ void QMenu::setAsDockMenu() \deprecated Sets this \a menu to be the dock menu available by option-clicking - on the application dock icon. Available on OS X only. + on the application dock icon. Available on \macos only. Deprecated; use \l QMenu::setAsDockMenu() instead. */ @@ -135,7 +135,7 @@ void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem* /*! \since 5.2 - Returns the native NSMenu for this menu bar. Available on OS X only. + Returns the native NSMenu for this menu bar. Available on \macos only. \note Qt may set the delegate on the native menu bar. If you need to set your own delegate, make sure you save the original one and forward any calls to it. diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 3f42a07f396..d7a8ecdae1f 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -610,15 +610,15 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti for items in the menu bar are only shown when the \uicontrol{Alt} key is pressed. - \section1 QMenuBar on OS X + \section1 QMenuBar on \macos - QMenuBar on OS X is a wrapper for using the system-wide menu bar. + QMenuBar on \macos is a wrapper for using the system-wide menu bar. If you have multiple menu bars in one dialog the outermost menu bar (normally inside a widget with widget flag Qt::Window) will be used for the system-wide menu bar. - Qt for OS X also provides a menu bar merging feature to make - QMenuBar conform more closely to accepted OS X menu bar layout. + Qt for \macos also provides a menu bar merging feature to make + QMenuBar conform more closely to accepted \macos menu bar layout. The merging functionality is based on string matching the title of a QMenu entry. These strings are translated (using QObject::tr()) in the "QMenuBar" context. If an entry is moved its slots will still @@ -657,7 +657,7 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti \b{Note:} The text used for the application name in the menu bar is obtained from the value set in the \c{Info.plist} file in - the application's bundle. See \l{Qt for OS X - Deployment} + the application's bundle. See \l{Qt for macOS - Deployment} for more information. \section1 QMenuBar on Windows CE @@ -902,7 +902,7 @@ void QMenuBar::setActiveAction(QAction *act) /*! Removes all the actions from the menu bar. - \note On OS X, menu items that have been merged to the system + \note On \macos, menu items that have been merged to the system menu bar are not removed by this function. One way to handle this would be to remove the extra actions yourself. You can set the \l{QAction::MenuRole}{menu role} on the different menus, so that @@ -1809,7 +1809,7 @@ QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const \since 4.6 This property specifies whether or not the menubar should be used as a native menubar on platforms - that support it. The currently supported platforms are OS X and Windows CE. On these platforms + that support it. The currently supported platforms are \macos and Windows CE. On these platforms if this property is \c true, the menubar is used in the native menubar and is not in the window of its parent, if false the menubar remains in the window. On other platforms the value of this attribute has no effect. diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp index 60082a89309..ef95c15cb3a 100644 --- a/src/widgets/widgets/qrubberband.cpp +++ b/src/widgets/widgets/qrubberband.cpp @@ -126,7 +126,7 @@ void QRubberBand::initStyleOption(QStyleOptionRubberBand *option) const By default a rectangular rubber band (\a s is \c Rectangle) will use a mask, so that a small border of the rectangle is all - that is visible. Some styles (e.g., native OS X) will + that is visible. Some styles (e.g., native \macos) will change this and call QWidget::setWindowOpacity() to make a semi-transparent filled selection rectangle. */ diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index fc27654addf..ed820888b49 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -2335,7 +2335,7 @@ void QTabBar::setMovable(bool movable) \since 4.5 This property is used as a hint for styles to draw the tabs in a different - way then they would normally look in a tab widget. On OS X this will + way then they would normally look in a tab widget. On \macos this will look similar to the tabs in Safari or Leopard's Terminal.app. \sa QTabWidget::documentMode diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index 0379bad7238..524e2d4fa05 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -1316,7 +1316,7 @@ void QTabWidget::setUsesScrollButtons(bool useButtons) /*! \property QTabWidget::documentMode \brief Whether or not the tab widget is rendered in a mode suitable for document - pages. This is the same as document mode on OS X. + pages. This is the same as document mode on \macos. \since 4.5 When this property is set the tab widget frame is not rendered. This mode is useful diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 375eff7ae8d..f8b2dff720f 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -870,7 +870,7 @@ QToolButton::ToolButtonPopupMode QToolButton::popupMode() const The default is disabled (i.e. false). - This property is currently ignored on OS X when using QMacStyle. + This property is currently ignored on \macos when using QMacStyle. */ void QToolButton::setAutoRaise(bool enable) { diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index b1e383dda17..b38620fcbb8 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -2547,7 +2547,7 @@ void tst_QFile::rename() \since 4.5 Some special files have QFile::atEnd() returning true, even though there is - more data available. True for corner cases, as well as some mounts on OS X. + more data available. True for corner cases, as well as some mounts on \macos. Here, we reproduce that condition by having a QFile sub-class with this peculiar atEnd() behavior. From a825e1ed0d4d5ac8d26142037ba475430d33eabd Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 1 Aug 2016 12:37:21 +0200 Subject: [PATCH 138/236] Doc: Fix incorrect arguments in QTableWidget::setCellWidget() snippet Task-number: QTWEBSITE-722 Change-Id: I15fc2b3e035c48272bbd00edbf227ef5a942597f Reviewed-by: Venugopal Shivashankar --- .../doc/snippets/code/src_gui_itemviews_qtablewidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp b/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp index 39c8427cced..f76bee1bbbf 100644 --- a/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp +++ b/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ //! [0] -setCellWidget(index, new QLineEdit); +setCellWidget(row, column, new QLineEdit); ... -setCellWidget(index, new QTextEdit); +setCellWidget(row, column, new QTextEdit); //! [0] From 98c7997274d804e8bb66d1a2f344a3d2e397c73b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 11 Aug 2016 16:04:38 +0200 Subject: [PATCH 139/236] Add missing \l to create link to QString in the docs Change-Id: I980da5cd47ebc62d0b2f028b79b331b87d07e070 Task-number: QTBUG-55258 Reviewed-by: Leena Miettinen --- examples/widgets/doc/dropsite.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/widgets/doc/dropsite.qdoc b/examples/widgets/doc/dropsite.qdoc index 7825c141c28..89d4e93c089 100644 --- a/examples/widgets/doc/dropsite.qdoc +++ b/examples/widgets/doc/dropsite.qdoc @@ -222,7 +222,7 @@ and Qt::AlignLeft. A QString object, \c text, is customized to display data according to the - contents of \c format. We invoke {QString}'s \l{QString::simplified()} + contents of \c format. We invoke \l{QString}'s \l{QString::simplified()} {simplified()} function on \c text, to obtain a string that has no additional space before, after or in between words. From c98ad6041a6f0a0abc7252bce8fda08f2b875ad9 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 25 Jul 2016 16:13:29 +0200 Subject: [PATCH 140/236] ios_destinations.sh: ignore devices that are marked as placeholders When xcodebuild in Xcode 8 beta dumps out the available destinations, it prints an extra section called 'Ineligible destinations for the "tst_someTest" scheme'. Those destinations doesn't contain valid ID-s for the script to use, which will result in "make check" failing. This patch will filter out devices that are marked as placeholders. Change-Id: I88a25b7307e21b76c6f7764a82f67627aae8f02f Reviewed-by: Jake Petroules --- mkspecs/macx-ios-clang/ios_destinations.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mkspecs/macx-ios-clang/ios_destinations.sh b/mkspecs/macx-ios-clang/ios_destinations.sh index e7b13c212c3..ce6b238a659 100755 --- a/mkspecs/macx-ios-clang/ios_destinations.sh +++ b/mkspecs/macx-ios-clang/ios_destinations.sh @@ -38,6 +38,8 @@ echo "IPHONESIMULATOR_DEVICES = $booted_simulator" xcodebuild test -scheme $1 -destination 'id=0' -destination-timeout 1 2>&1| sed -n 's/{ \(platform:.*\) }/\1/p' | while read destination; do id=$(echo $destination | sed -n -E 's/.*id:([^ ,]+).*/\1/p') + [[ $id == *"placeholder"* ]] && continue + echo $destination | tr ',' '\n' | while read keyval; do key=$(echo $keyval | cut -d ':' -f 1 | tr '[:lower:]' '[:upper:]') val=$(echo $keyval | cut -d ':' -f 2) From 87b256c4359ddd4d29aec7db8962be81f80f79c3 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 19 Jul 2016 15:47:33 +0200 Subject: [PATCH 141/236] iOS, mkspec: remove faulty SDK check We used to check if the SDK used by a project is less than 8.0 and error out if so. The intention of the test was to avoid a situation where a project is built with an SDK that is older than the one used to build Qt, but this was obviously bogus, as Qt could have been built with a newer SDK than the oldest supported one. Also, 8.0 has been outdated for quite a while. On top of that, the check failed now that the major iOS version has two digits. So let's remove the check for now, until we can handle this in a better way. See QTBUG-37592. Change-Id: I6106b9521b5d47d9906d4db30c2ffa21794bc307 Reviewed-by: Oswald Buddenhagen --- mkspecs/macx-ios-clang/features/sdk.prf | 3 --- 1 file changed, 3 deletions(-) diff --git a/mkspecs/macx-ios-clang/features/sdk.prf b/mkspecs/macx-ios-clang/features/sdk.prf index 4d148f22fbf..37181ed2994 100644 --- a/mkspecs/macx-ios-clang/features/sdk.prf +++ b/mkspecs/macx-ios-clang/features/sdk.prf @@ -11,9 +11,6 @@ build_pass:iphonesimulator: \ load(sdk) -lessThan(QMAKE_MAC_SDK_VERSION, "8.0"): \ - error("Current $$QMAKE_MAC_SDK SDK version ($$QMAKE_MAC_SDK_VERSION) is too old. Please upgrade Xcode.") - macx-xcode { sdk_path_iphoneos.name = "QMAKE_MAC_SDK_PATH[sdk=iphoneos*]" sdk_path_iphoneos.value = $$QMAKE_MAC_SDK_PATH From b6fb349ad56302a078eb8ee145ee9cd08b38478a Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Fri, 12 Aug 2016 12:05:42 +0200 Subject: [PATCH 142/236] Fix typo (word repetition) in documentation Change-Id: I1c8785e39f28f94846126fc45b875e6425a4ce12 Reviewed-by: Marc Mutz --- src/corelib/kernel/qvariant.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 4f256cccda7..17269b5feb7 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2722,7 +2722,7 @@ qlonglong QVariant::toLongLong(bool *ok) const } /*! - Returns the variant as as an unsigned long long int if the + Returns the variant as an unsigned long long int if the variant has type() \l QMetaType::ULongLong, \l QMetaType::Bool, \l QMetaType::QByteArray, \l QMetaType::QChar, \l QMetaType::Double, \l QMetaType::Int, \l QMetaType::LongLong, \l QMetaType::QString, or From a24c630990184a45033e04946e140cea48c8f35c Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 12 Aug 2016 11:56:14 +0200 Subject: [PATCH 143/236] Fix grammar in QToolBar docs Change-Id: Ibc65fd7c95246c7b7e38fd7f0d16d83d7c3301d9 Reviewed-by: Marc Mutz --- src/widgets/widgets/qtoolbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index 1e4a39088c4..32cf7dd8fcf 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -399,7 +399,7 @@ void QToolBarPrivate::plug(const QRect &r) When a toolbar is resized in such a way that it is too small to show all the items it contains, an extension button will appear as the last item in the toolbar. Pressing the extension button will - pop up a menu containing the items that does not currently fit in + pop up a menu containing the items that do not currently fit in the toolbar. When a QToolBar is not a child of a QMainWindow, it loses the ability From 033ebfae211b5d6608f152f82beaca5cf445e0fc Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 7 Aug 2016 09:33:11 +0300 Subject: [PATCH 144/236] QSslDiffieHellmanParameters: make fit for release - add missing \since 5.8 on free functions - fix \relates of qHash to point to QSslDHP, not QHash, which is in another module - API fix: use named instead of unnamed ctors - share code between ctors - API fix: add inline move ctor (for now, this requires using a naked d pointer, which isn't much of a problem, since the class is immutable). Change-Id: Ic30f9c3c03b8a3798e0676e38991ead85c587214 Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslcontext_openssl.cpp | 2 +- .../ssl/qssldiffiehellmanparameters.cpp | 68 ++++++++++++------- src/network/ssl/qssldiffiehellmanparameters.h | 13 ++-- .../tst_qssldiffiehellmanparameters.cpp | 8 +-- .../network/ssl/qsslsocket/tst_qsslsocket.cpp | 2 +- 5 files changed, 55 insertions(+), 38 deletions(-) diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp index dec8e12abbc..c92d8fc3f85 100644 --- a/src/network/ssl/qsslcontext_openssl.cpp +++ b/src/network/ssl/qsslcontext_openssl.cpp @@ -320,7 +320,7 @@ init_context: } if (!dhparams.isEmpty()) { - const QByteArray ¶ms = dhparams.d.data()->derData; + const QByteArray ¶ms = dhparams.d->derData; const char *ptr = params.constData(); DH *dh = q_d2i_DHparams(NULL, reinterpret_cast(&ptr), params.length()); if (dh == NULL) diff --git a/src/network/ssl/qssldiffiehellmanparameters.cpp b/src/network/ssl/qssldiffiehellmanparameters.cpp index e6a2fe8a2a9..d0fcb3189a3 100644 --- a/src/network/ssl/qssldiffiehellmanparameters.cpp +++ b/src/network/ssl/qssldiffiehellmanparameters.cpp @@ -77,7 +77,7 @@ QT_BEGIN_NAMESPACE QSslDiffieHellmanParameters QSslDiffieHellmanParameters::defaultParameters() { // The 1024-bit MODP group from RFC 2459 (Second Oakley Group) - return QSslDiffieHellmanParameters( + return fromEncoded( QByteArray::fromBase64(QByteArrayLiteral( "MIGHAoGBAP//////////yQ/aoiFowjTExmKLgNwc0SkCTgiKZ8x0Agu+pjsTmyJR" "Sgh5jjQE3e+VGbPNOkMbMCsKbfJfFDdP4TVtbVHCReSFtXZiXn7G9ExC6aY37WsL" @@ -100,73 +100,82 @@ QSslDiffieHellmanParameters QSslDiffieHellmanParameters::defaultParameters() QSslDiffieHellmanParameters::QSslDiffieHellmanParameters() : d(new QSslDiffieHellmanParametersPrivate) { + d->ref.ref(); } /*! Constructs a QSslDiffieHellmanParameters object using the byte array \a encoded in either PEM or DER form as specified by \a encoding. - After construction, the isValid() method should be used to + Use the isValid() method on the returned object to check whether the Diffie-Hellman parameters were valid and loaded correctly. \sa isValid() \sa QSslConfiguration */ -QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(const QByteArray &encoded, QSsl::EncodingFormat encoding) - : d(new QSslDiffieHellmanParametersPrivate) +QSslDiffieHellmanParameters QSslDiffieHellmanParameters::fromEncoded(const QByteArray &encoded, QSsl::EncodingFormat encoding) { + QSslDiffieHellmanParameters result; switch (encoding) { case QSsl::Der: - d->decodeDer(encoded); + result.d->decodeDer(encoded); break; case QSsl::Pem: - d->decodePem(encoded); + result.d->decodePem(encoded); break; } + return result; } /*! Constructs a QSslDiffieHellmanParameters object by - reading from \a device in either PEM or DER form. + reading from \a device in either PEM or DER form as specified by \a encoding. - After construction, the isValid() method should be used + Use the isValid() method on the returned object to check whether the Diffie-Hellman parameters were valid and loaded correctly. + In particular, if \a device is \c nullptr or not open for reading, an invalid + object will be returned. + \sa isValid() \sa QSslConfiguration */ -QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(QIODevice *device, QSsl::EncodingFormat encoding) - : d(new QSslDiffieHellmanParametersPrivate) +QSslDiffieHellmanParameters QSslDiffieHellmanParameters::fromEncoded(QIODevice *device, QSsl::EncodingFormat encoding) { - if (!device) - return; - - const QByteArray encoded = device->readAll(); - - switch (encoding) { - case QSsl::Der: - d->decodeDer(encoded); - break; - case QSsl::Pem: - d->decodePem(encoded); - break; - } + if (device) + return fromEncoded(device->readAll(), encoding); + else + return QSslDiffieHellmanParameters(); } /*! Constructs an identical copy of \a other. */ -QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other) : d(other.d) +QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other) + : d(other.d) { + if (d) + d->ref.ref(); } +/*! + \fn QSslDiffieHellmanParameters(QSslDiffieHellmanParameters &&other) + + Move-constructs from \a other. + + \note The moved-from object \a other is placed in a partially-formed state, in which + the only valid operations are destruction and assignment of a new value. +*/ + /*! Destroys the QSslDiffieHellmanParameters object. */ QSslDiffieHellmanParameters::~QSslDiffieHellmanParameters() { + if (d && !d->ref.deref()) + delete d; } /*! @@ -177,7 +186,8 @@ QSslDiffieHellmanParameters::~QSslDiffieHellmanParameters() */ QSslDiffieHellmanParameters &QSslDiffieHellmanParameters::operator=(const QSslDiffieHellmanParameters &other) { - d = other.d; + QSslDiffieHellmanParameters copy(other); + swap(copy); return *this; } @@ -185,6 +195,9 @@ QSslDiffieHellmanParameters &QSslDiffieHellmanParameters::operator=(const QSslDi \fn QSslDiffieHellmanParameters &QSslDiffieHellmanParameters::operator=(QSslDiffieHellmanParameters &&other) Move-assigns \a other to this QSslDiffieHellmanParameters instance. + + \note The moved-from object \a other is placed in a partially-formed state, in which + the only valid operations are destruction and assignment of a new value. */ /*! @@ -265,6 +278,7 @@ QString QSslDiffieHellmanParameters::errorString() const Q_DECL_NOTHROW } /*! + \since 5.8 \relates QSslDiffieHellmanParameters Returns \c true if \a lhs is equal to \a rhs; otherwise returns \c false. @@ -276,6 +290,7 @@ bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanP #ifndef QT_NO_DEBUG_STREAM /*! + \since 5.8 \relates QSslDiffieHellmanParameters Writes the set of Diffie-Hellman parameters in \a dhparam into the debug object \a debug for @@ -295,7 +310,8 @@ QDebug operator<<(QDebug debug, const QSslDiffieHellmanParameters &dhparam) #endif /*! - \relates QHash + \since 5.8 + \relates QSslDiffieHellmanParameters Returns an hash value for \a dhparam, using \a seed to seed the calculation. diff --git a/src/network/ssl/qssldiffiehellmanparameters.h b/src/network/ssl/qssldiffiehellmanparameters.h index aa40be83a69..4533ea4ed21 100644 --- a/src/network/ssl/qssldiffiehellmanparameters.h +++ b/src/network/ssl/qssldiffiehellmanparameters.h @@ -82,24 +82,25 @@ public: Q_NETWORK_EXPORT static QSslDiffieHellmanParameters defaultParameters(); Q_NETWORK_EXPORT QSslDiffieHellmanParameters(); - Q_NETWORK_EXPORT explicit QSslDiffieHellmanParameters(const QByteArray &encoded, QSsl::EncodingFormat format = QSsl::Pem); - Q_NETWORK_EXPORT explicit QSslDiffieHellmanParameters(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem); Q_NETWORK_EXPORT QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other); + QSslDiffieHellmanParameters(QSslDiffieHellmanParameters &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; } Q_NETWORK_EXPORT ~QSslDiffieHellmanParameters(); + Q_NETWORK_EXPORT QSslDiffieHellmanParameters &operator=(const QSslDiffieHellmanParameters &other); -#ifdef Q_COMPILER_RVALUE_REFS QSslDiffieHellmanParameters &operator=(QSslDiffieHellmanParameters &&other) Q_DECL_NOTHROW { swap(other); return *this; } -#endif void swap(QSslDiffieHellmanParameters &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + Q_NETWORK_EXPORT static QSslDiffieHellmanParameters fromEncoded(const QByteArray &encoded, QSsl::EncodingFormat format = QSsl::Pem); + Q_NETWORK_EXPORT static QSslDiffieHellmanParameters fromEncoded(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem); + Q_NETWORK_EXPORT bool isEmpty() const Q_DECL_NOTHROW; Q_NETWORK_EXPORT bool isValid() const Q_DECL_NOTHROW; - Q_NETWORK_EXPORT QSslDiffieHellmanParameters::Error error() const Q_DECL_NOTHROW; + Q_NETWORK_EXPORT Error error() const Q_DECL_NOTHROW; Q_NETWORK_EXPORT QString errorString() const Q_DECL_NOTHROW; private: - QExplicitlySharedDataPointer d; + QSslDiffieHellmanParametersPrivate *d; friend class QSslContext; friend Q_NETWORK_EXPORT bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) Q_DECL_NOTHROW; #ifndef QT_NO_DEBUG_STREAM diff --git a/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp b/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp index 32cc982a65b..f3b9003fbb5 100644 --- a/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp +++ b/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp @@ -81,7 +81,7 @@ void tst_QSslDiffieHellmanParameters::constructionDefault() void tst_QSslDiffieHellmanParameters::constructionDER() { // Uniquely generated with 'openssl dhparam -outform DER -out out.der -check -2 4096' - QSslDiffieHellmanParameters dh(QByteArray::fromBase64(QByteArrayLiteral( + const auto dh = QSslDiffieHellmanParameters::fromEncoded(QByteArray::fromBase64(QByteArrayLiteral( "MIICCAKCAgEAsbQYx57ZlyEyWF8jD5WYEswGR2aTVFsHqP3026SdyTwcjY+YlMOae0EagK" "jDA0UlPcih1kguQOvOVgyc5gI3YbBb4pCNEdy048xITlsdqG7qC3+2VvFR3vfixEbQQll9" "2cGIIneD/36p7KJcDnBNUwwWj/VJKhTwelTfKTj2T39si9xGMkqZiQuCaXRk6vSKZ4ZDPk" @@ -103,7 +103,7 @@ void tst_QSslDiffieHellmanParameters::constructionDER() void tst_QSslDiffieHellmanParameters::constructionPEM() { // Uniquely generated with 'openssl dhparam -outform PEM -out out.pem -check -2 4096' - QSslDiffieHellmanParameters dh(QByteArrayLiteral( + const auto dh = QSslDiffieHellmanParameters::fromEncoded(QByteArrayLiteral( "-----BEGIN DH PARAMETERS-----\n" "MIICCAKCAgEA9QTdqhQkbGuhWzBsW5X475AjjrITpg1BHX5+mp1sstUd84Lshq1T\n" "+S2QQQtdl25EPoUblpyyLAf8krFSH4YwR7jjLWklA8paDOwRYod0zLmVZ1Wx6og3\n" @@ -128,7 +128,7 @@ void tst_QSslDiffieHellmanParameters::constructionPEM() void tst_QSslDiffieHellmanParameters::unsafe512Bits() { // Uniquely generated with 'openssl dhparam -outform PEM -out out.pem -check -2 512' - QSslDiffieHellmanParameters dh(QByteArrayLiteral( + const auto dh = QSslDiffieHellmanParameters::fromEncoded(QByteArrayLiteral( "-----BEGIN DH PARAMETERS-----\n" "MEYCQQCf8goDn56akiliAtEL1ZG7VH+9wfLxsv8/B1emTUG+rMKB1yaVAU7HaAiM\n" "Gtmo2bAWUqBczUTOTzqmWTm28P6bAgEC\n" @@ -145,7 +145,7 @@ void tst_QSslDiffieHellmanParameters::unsafeNonPrime() { // Uniquely generated with 'openssl dhparam -outform DER -out out.der -check -2 1024' // and then modified by hand to make P not be a prime number. - QSslDiffieHellmanParameters dh(QByteArray::fromBase64(QByteArrayLiteral( + const auto dh = QSslDiffieHellmanParameters::fromEncoded(QByteArray::fromBase64(QByteArrayLiteral( "MIGHAoGBALLcOLg+ow8TMnbCUeNjwys6wUTIH9mn4ZSeIbD6qvCsJgg4cUxXwJQmPY" "Xl15AsKXgkXWh0n+/N6tjH0sSRJnzDvN2H3KxFLKkvxmBYrDOJMdCuMgZD50aOsVyd" "vholAW9zilkoYkB6sqwxY1Z2dbpTWajCsUAWZQ0AIP4Y5nesAgEC" diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index bf38a09aeb8..cb55c9c1dbb 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -2942,7 +2942,7 @@ void tst_QSslSocket::dhServerCustomParams() QSslConfiguration cfg = server.config; // Custom 2048-bit DH parameters generated with 'openssl dhparam -outform DER -out out.der -check -2 2048' - QSslDiffieHellmanParameters dh(QByteArray::fromBase64(QByteArrayLiteral( + const auto dh = QSslDiffieHellmanParameters::fromEncoded(QByteArray::fromBase64(QByteArrayLiteral( "MIIBCAKCAQEAvVA7b8keTfjFutCtTJmP/pnQfw/prKa+GMed/pBWjrC4N1YwnI8h/A861d9WE/VWY7XMTjvjX3/0" "aaU8wEe0EXNpFdlTH+ZMQctQTSJOyQH0RCTwJfDGPCPT9L+c9GKwEKWORH38Earip986HJc0w3UbnfIwXUdsWHiXi" "Z6r3cpyBmTKlsXTFiDVAOUXSiO8d/zOb6zHZbDfyB/VbtZRmnA7TXVn9oMzC0g9+FXHdrV4K+XfdvNZdCegvoAZiy" From ac899f6d60758fef03ec10850272361bf6a06dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 23 Jun 2016 11:59:32 +0200 Subject: [PATCH 145/236] Cocoa: use QImage::toCGImage() Keep behavior of converting via Format_ARGB32_Premultiplied for unsupported formats Change-Id: I64083a88a99640dde42a0a201ce8ea08affe5259 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 52 ++++---------------- 1 file changed, 10 insertions(+), 42 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 9b4055d92d5..8601e222ec4 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -101,6 +101,16 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list) return result; } +CGImageRef qt_mac_toCGImage(const QImage &inImage) +{ + CGImageRef cgImage = inImage.toCGImage(); + if (cgImage) + return cgImage; + + // Convert image data to a known-good format if the fast conversion fails. + return inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied).toCGImage(); +} + static void qt_mac_deleteImage(void *image, const void *, size_t) { delete static_cast(image); @@ -114,48 +124,6 @@ CGDataProviderRef qt_mac_CGDataProvider(const QImage &image) image.byteCount(), qt_mac_deleteImage); } -CGImageRef qt_mac_toCGImage(const QImage &inImage) -{ - if (inImage.isNull()) - return 0; - - QImage image = inImage; - - uint cgflags = kCGImageAlphaNone; - switch (image.format()) { - case QImage::Format_ARGB32: - cgflags = kCGImageAlphaFirst | kCGBitmapByteOrder32Host; - break; - case QImage::Format_RGB32: - cgflags = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host; - break; - case QImage::Format_RGB888: - cgflags = kCGImageAlphaNone | kCGBitmapByteOrder32Big; - break; - case QImage::Format_RGBA8888_Premultiplied: - cgflags = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big; - break; - case QImage::Format_RGBA8888: - cgflags = kCGImageAlphaLast | kCGBitmapByteOrder32Big; - break; - case QImage::Format_RGBX8888: - cgflags = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big; - break; - default: - // Everything not recognized explicitly is converted to ARGB32_Premultiplied. - image = inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied); - // no break; - case QImage::Format_ARGB32_Premultiplied: - cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host; - break; - } - - QCFType dataProvider = qt_mac_CGDataProvider(image); - return CGImageCreate(image.width(), image.height(), 8, 32, - image.bytesPerLine(), - qt_mac_genericColorSpace(), - cgflags, dataProvider, 0, false, kCGRenderingIntentDefault); -} CGImageRef qt_mac_toCGImageMask(const QImage &image) { From dfa8854cf7e00705e0122cf7022ff1ea4f8e5a74 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 11 Aug 2016 20:25:23 +0200 Subject: [PATCH 146/236] Cocoa: make dialogs emit the "selected" signals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-54951 Change-Id: Iba031a9038aad00e0d06f608eac8d95184ca6950 Reviewed-by: Jake Petroules Reviewed-by: Gabriel de Dietrich Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 9 +++++++++ src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 1 + 2 files changed, 10 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 4eb35f5495c..475e6c7afb7 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -582,6 +582,15 @@ void QCocoaFileDialogHelper::QNSOpenSavePanelDelegate_panelClosed(bool accepted) QCocoaMenuBar::resetKnownMenuItemsToQt(); if (accepted) { emit accept(); + + QString filter = selectedNameFilter(); + if (filter.isEmpty()) + emit filterSelected(filter); + + QList files = selectedFiles(); + emit filesSelected(files); + if (files.count() == 1) + emit fileSelected(files.first()); } else { emit reject(); } diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index dc7dfb788fb..dfda22d376a 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -365,6 +365,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); emit mHelper->reject(); } else { emit mHelper->accept(); + emit mHelper->fontSelected(mHelper->currentFont()); } } } From 68885378929001dd926354a99ad41e4528c19658 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 12 Aug 2016 15:19:47 +0200 Subject: [PATCH 147/236] Fix typo in QKeySequence doc Task-number: QTBUG-55181 Change-Id: I70615a2b4b026a83f506df928a79c9e60543e655 Reviewed-by: Venugopal Shivashankar --- src/gui/kernel/qkeysequence.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index a36719c344e..1934342f96e 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -244,7 +244,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni \row \li Open \li Ctrl+O \li Ctrl+O \li Ctrl+O \li Ctrl+O \row \li Close \li Ctrl+F4, Ctrl+W \li Ctrl+W, Ctrl+F4 \li Ctrl+W \li Ctrl+W \row \li Save \li Ctrl+S \li Ctrl+S \li Ctrl+S \li Ctrl+S - \row \li Quit \li \li Ctrl+Q \li Qtrl+Q \li Qtrl+Q + \row \li Quit \li \li Ctrl+Q \li Ctrl+Q \li Ctrl+Q \row \li SaveAs \li \li Ctrl+Shift+S \li \li Ctrl+Shift+S \row \li New \li Ctrl+N \li Ctrl+N \li Ctrl+N \li Ctrl+N \row \li Delete \li Del \li Del, Meta+D \li Del, Ctrl+D \li Del, Ctrl+D From 805cc2cc1008c144e5f26f718a4ba3ab9a459faa Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 5 Aug 2016 10:12:13 +0300 Subject: [PATCH 148/236] QRegion: mark as shared For BC reasons, it can only be NOT_MOVABLE_UNTIL_QT6. Change-Id: I09e158e0f6ce24f47ad4d19ea78832dbd2352db3 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/painting/qregion.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index 72710553efe..4f0a071da82 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -178,6 +178,7 @@ Q_GUI_EXPORT static const struct QRegionData shared_empty; static void cleanUp(QRegionData *x); }; +Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QRegion) /***************************************************************************** QRegion stream functions From d9e66f63a95b24ce3a7d2a30ccaf4dcab85d55a0 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 2 Aug 2016 13:36:21 +0200 Subject: [PATCH 149/236] Updated Qt logo for the "About Qt" dialog The Qt logo has changed (see http://brand.qt.io/ ) but it had not been updated in the QMessageBox::aboutQt dialog, yet. Task-number: QTBUG-55137 Change-Id: I81431e44efe65f576e62b92214aa835b82675d00 Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/images/qtlogo-64.png | Bin 1676 -> 1032 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/widgets/dialogs/images/qtlogo-64.png b/src/widgets/dialogs/images/qtlogo-64.png index af87e98cf5036136d4b15507fe7dd998198b0f5c..39a4a26f39658d393cbd26485c1aee5c8d8620ea 100644 GIT binary patch delta 1011 zcmVSkq@&(`Z`LXj;^1 zVbyPC)^ldpbZ6IfXxDaY*m!K%d2QKxZrOWp*?e%>eR0}-aevx=bJ~A&+JJT2fp*)1 zdEAA2+=qSLiGSUSfZmLQ-j0RekcQuohToBg-;#*nl8NAxi{O=v;g^l!myY3>kK&n< z;+&J?os{F9m*k+B9efqw65y4uj;n2>bJ7% zxU=iJwClUJ?0>zu?7zG1!MyFlzV5`p@5aIJ$HMQ&!|%w$@5#jQ$;j}{$??s}@y^Qe z&&=`A&hpaF^3>Av*3FD|D?E3ES`|$Go^MCXF^z{7o_5Ahq{Py1NtO`O~ZJwX)hqTS~=$TA9U;BQ_ zeeZdnWPj#l?l?|ebtzgcwaGRwwt2D5i)~(P^J1G9+r0cY-_X+Dm1^5!2KdKWd-~xL z0L+i>tpU*a4MmTeDvcsw060>hO0!MT0Era<@{><9(;fg%q5;ML7SF~+L=vMOKxY&{ zOA*MmmCGT37f}Eg0ER22I|clSM*zG63h|)s1%EgtQnjxdfSUteE5>$!5pzH*z*W`x z0X#Pc90EA6I+H-w9B=~QuXIJP@QW4 z>x}{Z0DDyD7Em-_!Wn>rs&f}uGT+2w04G)F8Svd4&<=1>b!LE%=75+7jH^ZgxNi=S zIe*}1Lr`}C4Eg881J;EBMgWcm^*w;3|GWrn4g;hB<~Ekg{l9^)u3yXo`@#V36u`7U z%^Ulc0nU|rkAO@vp4i!{n~4Yf1D74YIhI)l;BDyxWS}zYwPXEC^;BnJYq`^$D_Jk~ z7t26i&1W|SogRPA^C9GF+ji-Fu>$aRD{P&P+wbN-OBLDy!@WHr9Xhquw0uIeLny6|3up192Mg>`|)=Ul-umY54XvoOiKxj+iV#quU z8N^Vm6f)%h%Sd40MP49;*m6M31@L1s7faz_$PkN-P3L}MOXk=RNbO?l-&_zAeK&el z#}?vZ$!si%6G-CzEwxg@rnzDi5DPgOt8~yNmPH?$;D>zg1c2uhqYbz`m(vBzv<1>w|djfOLOWu`G~HkNA;|2?B3Gy z;*FR8%Wfsq_UHfpCxs@A&1(zejNU2~#s46PdMGYn4i)!Ku`7GdiIk7nBR4st)wyjU z!ix#s; z*(lR?%V%HJ^yl)&YFJYGxW2!nBk|#2fo0hO%5N+5gTKB!`*QLRdgs@YY0>=p%POMoO~d)lYO_W9n6jm~*`eG?!@d6XW;#~e zRu<$w``saZJ0tZ!Mp4?~Z7*(K*pcp)ZK(MG>MuPW7Z`Qn#8BUnV$Tpa{)k9jdRoj( z79Tz5&rB{`aX$<=KJ({d8iP(O)Tmk{)@X~5>UsH|8|AplrY}3*`~1=UDq6F94dQ;t z6jP(>EkQ;lhY{+qmbE2!ONxM0uQr7&O8Df?8mI7v9ez(k3y!`@-dARI-4%xGt7d-o zsW?4tC$NX>zj$V7>(SaS0dR`wRg(wn$__4rp_li`GGr|#pJAlOwRLZN)UG>Bpuu@( z-#Vgjq@-OJi%~l(N_)zDo#(B{y-qY^p+k3F1?>{rXLkj7I&RYkalHgb)G1gDA92eY zrd`C#57cMvs(2^fesfCwdoH_slFF;mZhXWAPZ#Pq7WB`J0} zWBl8!T$23@$5?xMEAphLHu#jUfUjn6vQNk+1Ct!&$5r z+gCY^Zb@_q*rtt`2%|9uVCU#cnZrr%{n||W+kUS9&Gv}NVn+t-B^)Dc*k4by4wbHJ z%&LcPH}AU76;TA&0NP%}v3~O!!JXT0Q5aI`9%j zrJc5$c*l{J0+c(yk2Gv_s50}ntE&7en*3=O=^)DuzK{<;8BvwQX8FR=-$_F3EU0&Z zh@pI8%lErMmx%*x1Uo=Uy@Yy5TajD5;K)$V_A5LFHIf=}lOJ=%BX5hBo!p~l zC-D*6X(JV1beq^n&t>A`7uGk>8@?>N Date: Tue, 9 Aug 2016 15:09:34 +0200 Subject: [PATCH 150/236] remove redundant LIBS += -lGAL it's part of the egl libs. Change-Id: Id41909f2e1cc5a6a1a22a49d4bf24da43e69a417 Reviewed-by: Lars Knoll Reviewed-by: Laszlo Agocs --- .../platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro | 1 - .../eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro | 1 - 2 files changed, 2 deletions(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro index a53aac20411..16880535e30 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro @@ -5,7 +5,6 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr INCLUDEPATH += $$PWD/../.. CONFIG += egl DEFINES += LINUX=1 EGL_API_FB=1 -LIBS += -lGAL QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF SOURCES += $$PWD/qeglfsvivmain.cpp \ diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro index 38259f4a5dc..374c5bba6b6 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro @@ -5,7 +5,6 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr INCLUDEPATH += $$PWD/../.. CONFIG += egl DEFINES += LINUX=1 EGL_API_FB=1 -LIBS += -lGAL QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF SOURCES += $$PWD/qeglfsvivwlmain.cpp \ From d04982dc84d66bec92b4b3767538676cf925ef17 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 11 Aug 2016 11:16:47 +0200 Subject: [PATCH 151/236] QTest::QTouchEventSequence: add a sleep before each touch movement In any code (such as QtQuick Flickable) which calculates velocity as distance / time, it's unrealistic to simulate instantaneous touchpoint movements. So, force a slight delay before each event, so that the touchpoint can only move very fast, but not infinitely fast. We use qSleep() rather than qWait() because qWait() has a minimum qSleep(10), and also processes events. commit() also conditionally calls processEvents(), and we don't want to make that unconditional. Change-Id: I3cee890f8951d7ecb8837a6abe216c5a8e0a6e34 Reviewed-by: Liang Qi --- src/testlib/qtesttouch.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h index bdc964389ec..2c57bf0420c 100644 --- a/src/testlib/qtesttouch.h +++ b/src/testlib/qtesttouch.h @@ -129,6 +129,7 @@ namespace QTest void commit(bool processEvents = true) { if (!points.isEmpty()) { + qSleep(1); if (targetWindow) { qt_handleTouchEvent(targetWindow, device, points.values()); From 2b31f470983626c9478e80bc348b7124b5cf6cbc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jul 2016 12:56:02 +0200 Subject: [PATCH 152/236] rename the -redo status file to config.opt configure.cache is really kinda misleading. the old name is still recognized for backwards compat. Change-Id: I5ca461e99a0f9336ad70adfa5b8f6bb81ad73bbb Reviewed-by: Lars Knoll --- .gitignore | 1 + tools/configure/configureapp.cpp | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 52b064109f1..d583ffa12ef 100644 --- a/.gitignore +++ b/.gitignore @@ -116,6 +116,7 @@ bin/qt.conf bin/servicefw* bin/sfwlisten* configure.cache +config.opt config.status config.summary config.log diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index d8c27af8848..ccfc067c43e 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -4240,20 +4240,22 @@ void Configure::readLicense() void Configure::reloadCmdLine(int idx) { if (dictionary[ "REDO" ] == "yes") { - QFile inFile(buildPath + "/configure.cache"); - if (inFile.open(QFile::ReadOnly)) { - QTextStream inStream(&inFile); - while (!inStream.atEnd()) - configCmdLine.insert(idx++, inStream.readLine().trimmed()); - inFile.close(); + QFile inFile(buildPath + "/config.opt"); + if (!inFile.open(QFile::ReadOnly)) { + inFile.setFileName(buildPath + "/configure.cache"); + if (!inFile.open(QFile::ReadOnly)) + return; } + QTextStream inStream(&inFile); + while (!inStream.atEnd()) + configCmdLine.insert(idx++, inStream.readLine().trimmed()); } } void Configure::saveCmdLine() { if (dictionary[ "REDO" ] != "yes") { - QFile outFile(buildPath + "/configure.cache"); + QFile outFile(buildPath + "/config.opt"); if (outFile.open(QFile::WriteOnly | QFile::Text)) { QTextStream outStream(&outFile); for (QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it) { From a60b0d5b12e34b81d0e4404bcf20c59a21da98c5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Aug 2016 19:09:03 +0200 Subject: [PATCH 153/236] remove left over debug message Change-Id: I2750e9561c006e7e9dae569af0e1c9095cb1b8f7 Reviewed-by: Lars Knoll --- configure.pri | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.pri b/configure.pri index 526a4bb7117..ac2a7e7bb44 100644 --- a/configure.pri +++ b/configure.pri @@ -4,7 +4,6 @@ defineTest(qtConfCommandline_cxxstd) { arg = $${1} val = $${2} isEmpty(val): val = $$qtConfGetNextCommandlineArg() - message("setting c++std: $$arg/$$val") !contains(val, "^-.*"):!isEmpty(val) { contains(val, "(c\+\+)?11") { qtConfCommandlineSetInput("c++14", "no") From deeb9f7fde304ce13e36fccbc500352d836272b4 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 15 Jul 2016 16:30:45 +0200 Subject: [PATCH 154/236] Remove dead code relating to largefile We set CONFIG+=largefile directly from configure, and there is never a largefile feature in QT_CONFIG. Change-Id: I3518c749d674529b272685b6ed6c738e48ee5cd7 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qt_common.prf | 1 - 1 file changed, 1 deletion(-) diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index e50fdb767b7..c94c603e208 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -19,7 +19,6 @@ contains(TEMPLATE, .*lib) { # module and plugins !host_build:contains(QT_CONFIG, reduce_exports): CONFIG += hide_symbols unix:contains(QT_CONFIG, reduce_relocations): CONFIG += bsymbolic_functions - contains(QT_CONFIG, largefile): CONFIG += largefile contains(QT_CONFIG, separate_debug_info): CONFIG += separate_debug_info !isEmpty(_QMAKE_SUPER_CACHE_): \ From ce50eb4a733ab93b4ca3bf206b56f61c989fe717 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Aug 2016 21:14:15 +0200 Subject: [PATCH 155/236] nuke forgotten orphaned test (xkb) d520c825f already mentioned it, but failed to actually remove it. Change-Id: I3aef8f057baad1c1c66aab8b3e5c4e879a544834 Reviewed-by: Lars Knoll --- config.tests/x11/xkb/xkb.cpp | 69 ------------------------------------ config.tests/x11/xkb/xkb.pro | 3 -- 2 files changed, 72 deletions(-) delete mode 100644 config.tests/x11/xkb/xkb.cpp delete mode 100644 config.tests/x11/xkb/xkb.pro diff --git a/config.tests/x11/xkb/xkb.cpp b/config.tests/x11/xkb/xkb.cpp deleted file mode 100644 index 9876f67a71e..00000000000 --- a/config.tests/x11/xkb/xkb.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -int main(int, char **) -{ - Display *display = 0; - - int opcode = -1; - int xkbEventBase = -1; - int xkbErrorBase = -1; - int xkblibMajor = XkbMajorVersion; - int xkblibMinor = XkbMinorVersion; - XkbQueryExtension(display, &opcode, &xkbEventBase, &xkbErrorBase, &xkblibMajor, &xkblibMinor); - - int keycode = 0; - unsigned int state = 0; - KeySym keySym; - unsigned int consumedModifiers; - XkbLookupKeySym(display, keycode, state, &consumedModifiers, &keySym); - - XkbDescPtr xkbDesc = XkbGetMap(display, XkbAllClientInfoMask, XkbUseCoreKbd); - int w = XkbKeyGroupsWidth(xkbDesc, keycode); - keySym = XkbKeySym(xkbDesc, keycode, w-1); - XkbFreeClientMap(xkbDesc, XkbAllClientInfoMask, true); - - state = XkbPCF_GrabsUseXKBStateMask; - (void) XkbSetPerClientControls(display, state, &state); - - return 0; -} diff --git a/config.tests/x11/xkb/xkb.pro b/config.tests/x11/xkb/xkb.pro deleted file mode 100644 index d4ec2223dff..00000000000 --- a/config.tests/x11/xkb/xkb.pro +++ /dev/null @@ -1,3 +0,0 @@ -SOURCES = xkb.cpp -CONFIG += x11 -CONFIG -= qt From 4a1bafcc4ee5b7d968620808e155c1617aa6f273 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 29 Jul 2016 19:58:08 +0200 Subject: [PATCH 156/236] get rid of test type 'shell' it's bound to the bourne shell, which is not readily available on windows hosts. on the way, the pch, fvisibility, and bsymbolic_functions tests were rewritten as regular compile tests. they now just verify that qmake's built-in support for the tested features actually works. Change-Id: Ibac246f21b5ececa40da3f576dc789982eaf9fdf Reviewed-by: Thiago Macieira --- config.tests/common/pch/header.h | 1 + config.tests/common/pch/pch.pro | 3 + config.tests/common/pch/source.cpp | 44 +++++++++++ config.tests/unix/bsymbolic_functions.test | 31 -------- config.tests/unix/fvisibility.test | 74 ------------------- config.tests/unix/precomp.test | 54 -------------- .../unix/reduce_exports/fvisibility.c | 52 +++++++++++++ .../unix/reduce_exports/reduce_exports.pro | 5 ++ .../unix/reduce_relocs/bsymbolic_functions.c | 44 +++++++++++ .../unix/reduce_relocs/reduce_relocs.pro | 5 ++ configure.json | 15 ++-- mkspecs/features/qt_configure.prf | 19 ----- 12 files changed, 160 insertions(+), 187 deletions(-) create mode 100644 config.tests/common/pch/header.h create mode 100644 config.tests/common/pch/pch.pro create mode 100644 config.tests/common/pch/source.cpp delete mode 100755 config.tests/unix/bsymbolic_functions.test delete mode 100755 config.tests/unix/fvisibility.test delete mode 100755 config.tests/unix/precomp.test create mode 100644 config.tests/unix/reduce_exports/fvisibility.c create mode 100644 config.tests/unix/reduce_exports/reduce_exports.pro create mode 100644 config.tests/unix/reduce_relocs/bsymbolic_functions.c create mode 100644 config.tests/unix/reduce_relocs/reduce_relocs.pro diff --git a/config.tests/common/pch/header.h b/config.tests/common/pch/header.h new file mode 100644 index 00000000000..ebc22c4fb04 --- /dev/null +++ b/config.tests/common/pch/header.h @@ -0,0 +1 @@ +#define HEADER_H diff --git a/config.tests/common/pch/pch.pro b/config.tests/common/pch/pch.pro new file mode 100644 index 00000000000..a6f842dff01 --- /dev/null +++ b/config.tests/common/pch/pch.pro @@ -0,0 +1,3 @@ +CONFIG += precompile_header +PRECOMPILED_HEADER = header.h +SOURCES = source.cpp diff --git a/config.tests/common/pch/source.cpp b/config.tests/common/pch/source.cpp new file mode 100644 index 00000000000..855672ffa84 --- /dev/null +++ b/config.tests/common/pch/source.cpp @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the configuration of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef HEADER_H +#error no go +#endif + +int main() { return 0; } diff --git a/config.tests/unix/bsymbolic_functions.test b/config.tests/unix/bsymbolic_functions.test deleted file mode 100755 index 4d66ee6de02..00000000000 --- a/config.tests/unix/bsymbolic_functions.test +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -BSYMBOLIC_FUNCTIONS_SUPPORT=no -COMPILER=$1 -VERBOSE=$2 - - -cat >>bsymbolic_functions.c << EOF -#if !(defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64)) -#error "Symbolic function binding on this architecture may be broken, disabling it (see QTBUG-36129)." -#endif - -int main() { return 0; } -EOF - -if [ "$VERBOSE" = "yes" ] ; then - echo $COMPILER $SYSROOT_FLAG -o libtest.so -shared -Wl,-Bsymbolic-functions -fPIC bsymbolic_functions.c - $COMPILER $SYSROOT_FLAG -o libtest.so -shared -Wl,-Bsymbolic-functions -fPIC bsymbolic_functions.c && BSYMBOLIC_FUNCTIONS_SUPPORT=yes -else - $COMPILER $SYSROOT_FLAG -o libtest.so -shared -Wl,-Bsymbolic-functions -fPIC bsymbolic_functions.c >/dev/null 2>&1 && BSYMBOLIC_FUNCTIONS_SUPPORT=yes -fi -rm -f bsymbolic_functions.c libtest.so - -# done -if [ "$BSYMBOLIC_FUNCTIONS_SUPPORT" != "yes" ]; then - [ "$VERBOSE" = "yes" ] && echo "Symbolic function binding disabled." - exit 0 -else - [ "$VERBOSE" = "yes" ] && echo "Symbolic function binding enabled." - exit 1 -fi diff --git a/config.tests/unix/fvisibility.test b/config.tests/unix/fvisibility.test deleted file mode 100755 index 621af95e638..00000000000 --- a/config.tests/unix/fvisibility.test +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh - -FVISIBILITY_SUPPORT=no -COMPILER=$1 -VERBOSE=$2 - -CMDLINE= - - -RunCompileTest() { - cat >>fvisibility.c << EOF -#if defined(__GNUC__) -# if (__GNUC__ < 4) -# error "GCC3 with backported visibility patch is known to miscompile Qt" -# endif -__attribute((visibility("default"))) void blah(); -#elif defined(__SUNPRO_CC) -# if (__SUNPRO_CC < 0x0550) -# error "SunStudio 8 or later is required for ELF visibility" -# endif -__global void blah(); -#else -# error "GCC4+ or SunStudio 8+ are required to support ELF visibility" -#endif -EOF - - if [ "$VERBOSE" = "yes" ] ; then - echo $COMPILER -c $CMDLINE fvisibility.c - $COMPILER -c $CMDLINE fvisibility.c && FVISIBILITY_SUPPORT=yes - else - $COMPILER -c $CMDLINE fvisibility.c >/dev/null 2>&1 && FVISIBILITY_SUPPORT=yes - fi - rm -f fvisibility.c fvisibility.o -} - - -case "$COMPILER" in -*g++*|*c++*|*qcc*) - CMDLINE="-fvisibility=hidden" - RunCompileTest - ;; - -aCC*) - ;; - -icpc) - ICPC_VERSION=`icpc -dumpversion` - case "$ICPC_VERSION" in - 8.*|9.*|10.0) - # 8.x, 9.x, and 10.0 don't support symbol visibility - ;; - *) - # the compile test works for the intel compiler because it mimics gcc's behavior - CMDLINE="-fvisibility=hidden" - RunCompileTest - ;; - esac - ;; - -CC) - # This should be SunStudio. If not, it'll get caught. - CMDLINE="-xldscope=hidden" - RunCompileTest - ;; -esac - -# done -if [ "$FVISIBILITY_SUPPORT" != "yes" ]; then - [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control disabled." - exit 0 -else - [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control enabled." - exit 1 -fi diff --git a/config.tests/unix/precomp.test b/config.tests/unix/precomp.test deleted file mode 100755 index 0b8377b21a4..00000000000 --- a/config.tests/unix/precomp.test +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh - -PRECOMP_SUPPORT=no -COMPILER=$1 -VERBOSE=$2 - -case "$COMPILER" in -*icpc) - cat >header.h <header.cpp - cat >source.cpp </dev/null 2>&1 \ - && $COMPILER -pch-use header.pchi -include header.h -c source.cpp -o source.o >/dev/null 2>&1 \ - && PRECOMP_SUPPORT=yes - - rm -f header.h header.cpp source.cpp - rm -f header.pchi header.o source.o - ;; - -*g++*|c++|*qcc*) - case `"$COMPILER" -dumpversion 2>/dev/null` in - 3.*) - ;; - *) - - >precomp_header.h - if $COMPILER -x c-header precomp_header.h >/dev/null 2>&1; then - $COMPILER -x c++-header precomp_header.h && PRECOMP_SUPPORT=yes - fi - rm -f precomp_header.h precomp_header.h.gch - ;; - esac - ;; -esac - - -# done -if [ "$PRECOMP_SUPPORT" != "yes" ]; then - [ "$VERBOSE" = "yes" ] && echo "Precompiled-headers support disabled." - exit 0 -else - [ "$VERBOSE" = "yes" ] && echo "Precompiled-headers support enabled." - exit 1 -fi diff --git a/config.tests/unix/reduce_exports/fvisibility.c b/config.tests/unix/reduce_exports/fvisibility.c new file mode 100644 index 00000000000..71af9d99a3c --- /dev/null +++ b/config.tests/unix/reduce_exports/fvisibility.c @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the configuration of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#if defined(__GNUC__) +# if (__GNUC__ < 4) +# error "GCC3 with backported visibility patch is known to miscompile Qt" +# endif +__attribute((visibility("default"))) void blah(); +#elif defined(__SUNPRO_CC) +# if (__SUNPRO_CC < 0x0550) +# error "SunStudio 8 or later is required for ELF visibility" +# endif +__global void blah(); +#else +# error "GCC4+ or SunStudio 8+ are required to support ELF visibility" +#endif diff --git a/config.tests/unix/reduce_exports/reduce_exports.pro b/config.tests/unix/reduce_exports/reduce_exports.pro new file mode 100644 index 00000000000..dc8adc26374 --- /dev/null +++ b/config.tests/unix/reduce_exports/reduce_exports.pro @@ -0,0 +1,5 @@ +TEMPLATE = lib +CONFIG += dll hide_symbols +SOURCES = fvisibility.c + +isEmpty(QMAKE_CFLAGS_HIDESYMS): error("Nope") diff --git a/config.tests/unix/reduce_relocs/bsymbolic_functions.c b/config.tests/unix/reduce_relocs/bsymbolic_functions.c new file mode 100644 index 00000000000..36ff410c818 --- /dev/null +++ b/config.tests/unix/reduce_relocs/bsymbolic_functions.c @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the configuration of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#if !(defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64)) +# error Symbolic function binding on this architecture may be broken, disabling it (see QTBUG-36129). +#endif + +int main() { return 0; } diff --git a/config.tests/unix/reduce_relocs/reduce_relocs.pro b/config.tests/unix/reduce_relocs/reduce_relocs.pro new file mode 100644 index 00000000000..2f23465a3fe --- /dev/null +++ b/config.tests/unix/reduce_relocs/reduce_relocs.pro @@ -0,0 +1,5 @@ +TEMPLATE = lib +CONFIG += dll bsymbolic_functions +SOURCES = bsymbolic_functions.c + +isEmpty(QMAKE_LFLAGS_BSYMBOLIC_FUNC): error("Nope") diff --git a/configure.json b/configure.json index 0c811e22754..f2b0df292d7 100644 --- a/configure.json +++ b/configure.json @@ -251,9 +251,8 @@ }, "precompile_header": { "description": "precompiled header support", - "type": "shell", - "test": "unix/precomp.test", - "args": "$$QMAKE_CXX yes" + "type": "compile", + "test": "common/pch" }, "use_gold_linker": { "description": "gold linker", @@ -267,15 +266,13 @@ }, "reduce_exports": { "description": "symbol visibility support", - "type": "shell", - "test": "unix/fvisibility.test", - "args": "$$QMAKE_CXX yes" + "type": "compile", + "test": "unix/reduce_exports" }, "reduce_relocations": { "description": "-Bsymbolic-functions support", - "type": "shell", - "test": "unix/bsymbolic_functions.test", - "args": "$$QMAKE_CXX yes" + "type": "compile", + "test": "unix/reduce_relocs" }, "skip_modules": { "description": "modules to skip", diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 711eec8a2cd..7a289f7b949 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -248,25 +248,6 @@ defineTest(qtConfParseCommandLine) { } } -defineTest(qtConfTest_shell) { - test = $$eval($${1}.test) - dir = $$replace(test, [^/]*$, "") - test = $$replace(test, ([^/]*/)*, "") - args = $$eval($${1}.args) - # replace any things like $$QMAKE_CXX by their values - eval(args = $$args) - - test_dir = $$QMAKE_CONFIG_TESTS_DIR/$$dir - test_out_dir = $$shadowed($$test_dir) - test_cmd_base = "cd $$system_quote($$system_path($$test_out_dir)) &&" - - mkpath($$test_out_dir)|error() - - qtRunLoggedCommand("$$test_cmd_base $$test_dir/$${test} $${args}"): \ - return(false) - return(true) -} - defineReplace(qtConfToolchainSupportsFlag) { test_out_dir = $$shadowed($$QMAKE_CONFIG_TESTS_DIR) test_cmd_base = "cd $$system_quote($$system_path($$test_out_dir)) &&" From fcd3c11945c20c1b314fee57f7bbe457412844bc Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 10 Aug 2016 11:58:24 +0200 Subject: [PATCH 157/236] Improve vectorized bound calculations Adds a proper bound calculation to vectorized rotated sampling to avoid checking inside the loop, and fixes the existing bounds check to use the incrementor fdx instead the float value it was calculated from which may cause different rounding. Change-Id: I5226926a142573c026db5504414204b6ee8dd8a7 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/painting/qdrawhelper.cpp | 33 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 4812cee9bba..affbc43afe3 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -2180,6 +2180,8 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c if (blendType != BlendTransformedBilinearTiled) { #define BILINEAR_DOWNSCALE_BOUNDS_PROLOG \ + const qint64 min_fx = qint64(image_x1) * fixed_scale; \ + const qint64 max_fx = qint64(image_x2) * fixed_scale; \ while (b < end) { \ int x1 = (fx >> 16); \ int x2; \ @@ -2195,11 +2197,11 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c fx += fdx; \ ++b; \ } \ - uint *boundedEnd; \ + uint *boundedEnd = end; \ if (fdx > 0) \ - boundedEnd = qMin(end, buffer + uint((image_x2 - (fx >> 16)) / data->m11)); \ - else \ - boundedEnd = qMin(end, buffer + uint((image_x1 - (fx >> 16)) / data->m11)); \ + boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx); \ + else if (fdx < 0) \ + boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx); \ boundedEnd -= 3; #if defined(__SSE2__) @@ -2333,6 +2335,10 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c if (blendType != BlendTransformedBilinearTiled) { #define BILINEAR_ROTATE_BOUNDS_PROLOG \ + const qint64 min_fx = qint64(image_x1) * fixed_scale; \ + const qint64 max_fx = qint64(image_x2) * fixed_scale; \ + const qint64 min_fy = qint64(image_y1) * fixed_scale; \ + const qint64 max_fy = qint64(image_y2) * fixed_scale; \ while (b < end) { \ int x1 = (fx >> 16); \ int x2; \ @@ -2355,7 +2361,15 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c fy += fdy; \ ++b; \ } \ - uint *boundedEnd = end - 3; \ + uint *boundedEnd = end; \ + if (fdx > 0) \ + boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx); \ + else if (fdx < 0) \ + boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx); \ + if (fdy > 0) \ + boundedEnd = qMin(boundedEnd, b + (max_fy - fy) / fdy); \ + else if (fdy < 0) \ + boundedEnd = qMin(boundedEnd, b + (min_fy - fy) / fdy); \ boundedEnd -= 3; #if defined(__SSE2__) @@ -2374,15 +2388,6 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c const __m128i vbpl = _mm_shufflelo_epi16(_mm_cvtsi32_si128(bytesPerLine/4), _MM_SHUFFLE(0, 0, 0, 0)); while (b < boundedEnd) { - if (fdx > 0 && (short)_mm_extract_epi16(v_fx, 7) >= image_x2) - break; - if (fdx < 0 && (short)_mm_extract_epi16(v_fx, 7) < image_x1) - break; - if (fdy > 0 && (short)_mm_extract_epi16(v_fy, 7) >= image_y2) - break; - if (fdy < 0 && (short)_mm_extract_epi16(v_fy, 7) < image_y1) - break; - const __m128i vy = _mm_packs_epi32(_mm_srli_epi32(v_fy, 16), _mm_setzero_si128()); // 4x16bit * 4x16bit -> 4x32bit __m128i offset = _mm_unpacklo_epi16(_mm_mullo_epi16(vy, vbpl), _mm_mulhi_epi16(vy, vbpl)); From 9c016cefe9a81de3b01019cb1eb1363b05e3b448 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 7 Aug 2016 16:40:07 +0300 Subject: [PATCH 158/236] QFuture(Interface): remove unneeded special member functions The compiler-generated ones are just fine. This is BC because the class is not exported and QFutureInterfaceBase (needlessly) contains virtual functions (the dtor), so this class will never be trivially copyable. It's also not movable, until I figure out how to add move special member functions to QFutureInterfaceBase. Also made the QFutureInterface(State) constructor explicit, because a State is not a faithful representation of a QFutureInterface. Change-Id: Ifa44f87b41c4ee3c5167c282512ec4860075671d Reviewed-by: Thiago Macieira --- src/corelib/thread/qfuture.h | 25 ------------------------- src/corelib/thread/qfutureinterface.h | 10 +--------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/src/corelib/thread/qfuture.h b/src/corelib/thread/qfuture.h index 7ae5c68bb9c..1f0c747f404 100644 --- a/src/corelib/thread/qfuture.h +++ b/src/corelib/thread/qfuture.h @@ -65,13 +65,7 @@ public: explicit QFuture(QFutureInterface *p) // internal : d(*p) { } - QFuture(const QFuture &other) - : d(other.d) - { } - ~QFuture() - { } - inline QFuture &operator=(const QFuture &other); bool operator==(const QFuture &other) const { return (d == other.d); } bool operator!=(const QFuture &other) const { return (d != other.d); } @@ -156,13 +150,6 @@ public: // Warning: the d pointer is not documented and is considered private. mutable QFutureInterface d; }; -template -inline QFuture &QFuture::operator=(const QFuture &other) -{ - d = other.d; - return *this; -} - template inline T QFuture::result() const { @@ -195,13 +182,7 @@ public: explicit QFuture(QFutureInterfaceBase *p) // internal : d(*p) { } - QFuture(const QFuture &other) - : d(other.d) - { } - ~QFuture() - { } - QFuture &operator=(const QFuture &other); bool operator==(const QFuture &other) const { return (d == other.d); } bool operator!=(const QFuture &other) const { return (d != other.d); } @@ -248,12 +229,6 @@ public: mutable QFutureInterfaceBase d; }; -inline QFuture &QFuture::operator=(const QFuture &other) -{ - d = other.d; - return *this; -} - inline QFuture QFutureInterface::future() { return QFuture(this); diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h index 1787ff3b938..559d26e2314 100644 --- a/src/corelib/thread/qfutureinterface.h +++ b/src/corelib/thread/qfutureinterface.h @@ -285,21 +285,13 @@ template <> class QFutureInterface : public QFutureInterfaceBase { public: - QFutureInterface(State initialState = NoState) + explicit QFutureInterface(State initialState = NoState) : QFutureInterfaceBase(initialState) { } - QFutureInterface(const QFutureInterface &other) - : QFutureInterfaceBase(other) - { } static QFutureInterface canceledResult() { return QFutureInterface(State(Started | Finished | Canceled)); } - QFutureInterface &operator=(const QFutureInterface &other) - { - QFutureInterfaceBase::operator=(other); - return *this; - } inline QFuture future(); // implemented in qfuture.h From 63d24a746da8d7a07eb2f1367757f24cfb4e9eae Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 8 Jun 2016 16:48:28 +0200 Subject: [PATCH 159/236] Copy qmldir file even for prefix builds The qmldir file is needed in the build dir for non-installed static builds, so that qmlimportscanner can work. Change-Id: I9028db6d1e36da5a2be9b0c1ba4c9d475edd5cb5 Task-number: QTBUG-53926 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qml_module.prf | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf index 05f97a55327..fb006efb654 100644 --- a/mkspecs/features/qml_module.prf +++ b/mkspecs/features/qml_module.prf @@ -18,10 +18,15 @@ fq_qml_files = $$qmldir_file for(qmlf, QML_FILES): fq_qml_files += $$absolute_path($$qmlf, $$_PRO_FILE_PWD_) -qml1_target: \ +load(qt_build_paths) + +qml1_target { + DESTDIR = $$MODULE_BASE_OUTDIR/imports/$$TARGETPATH instbase = $$[QT_INSTALL_IMPORTS] -else: \ +} else { + DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH instbase = $$[QT_INSTALL_QML] +} !qml1_target:static: CONFIG += builtin_resources @@ -41,4 +46,11 @@ else: qmldir.files = $$qmldir_file qmldir.path = $$instbase/$$TARGETPATH INSTALLS += qmldir -!prefix_build: COPIES += qmldir +!prefix_build { + COPIES += qmldir +} else { + # For non-installed static builds, qmlimportscanner needs qmldir file in build dir + qmldir2build.files = $$qmldir_file + qmldir2build.path = $$DESTDIR + COPIES += qmldir2build +} From d08db1100874fdc36ea169d34a8902133186b84b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 6 Aug 2016 17:26:37 +0300 Subject: [PATCH 160/236] Remove last uses of Java-style (non-mutable) iterators from QtBase Change-Id: I7531ffd4f2d5b2193bb6231c743ff0a074618b99 Reviewed-by: Lars Knoll --- src/gui/image/qiconloader.cpp | 6 ++-- .../networkmanager/qnetworkmanagerservice.cpp | 30 +++++-------------- .../platforminputcontexts/ibus/qibustypes.cpp | 5 +--- src/plugins/platforms/qnx/qqnxscreen.cpp | 6 ++-- src/tools/uic/cpp/cppwritedeclaration.cpp | 21 ++++--------- src/tools/uic/cpp/cppwriteinitialization.cpp | 8 ++--- src/widgets/util/qsystemtrayicon.cpp | 5 ++-- 7 files changed, 21 insertions(+), 60 deletions(-) diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 219daace5c5..0faf8820dde 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -316,10 +316,8 @@ QIconTheme::QIconTheme(const QString &themeName) #ifndef QT_NO_SETTINGS if (themeIndex.exists()) { const QSettings indexReader(themeIndex.fileName(), QSettings::IniFormat); - QStringListIterator keyIterator(indexReader.allKeys()); - while (keyIterator.hasNext()) { - - const QString key = keyIterator.next(); + const QStringList keys = indexReader.allKeys(); + for (const QString &key : keys) { if (key.endsWith(QLatin1String("/Size"))) { // Note the QSettings ini-format does not accept // slashes in key names, hence we have to cheat diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index 6c3c661db6f..081cb1288d4 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -215,9 +215,7 @@ QString QNetworkManagerInterface::version() const void QNetworkManagerInterface::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) { propertyMap.insert(i.key(),i.value()); if (i.key() == QLatin1String("State")) { @@ -334,11 +332,8 @@ quint32 QNetworkManagerInterfaceAccessPoint::strength() const void QNetworkManagerInterfaceAccessPoint::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) propertyMap.insert(i.key(),i.value()); - } } QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent) @@ -421,9 +416,7 @@ QDBusObjectPath QNetworkManagerInterfaceDevice::ip4config() const void QNetworkManagerInterfaceDevice::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) { if (i.key() == QLatin1String("AvailableConnections")) { //Device const QDBusArgument &dbusArgs = i.value().value(); QDBusObjectPath path; @@ -516,9 +509,7 @@ QStringList QNetworkManagerInterfaceDeviceWired::availableConnections() void QNetworkManagerInterfaceDeviceWired::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) { propertyMap.insert(i.key(),i.value()); if (i.key() == QLatin1String("Carrier")) Q_EMIT carrierChanged(i.value().toBool()); @@ -694,9 +685,7 @@ void QNetworkManagerInterfaceDeviceWireless::requestScan() void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) { propertyMap.insert(i.key(),i.value()); if (i.key() == QLatin1String("ActiveAccessPoint")) //DeviceWireless Q_EMIT propertiesChanged(map); @@ -753,11 +742,8 @@ QNetworkManagerInterfaceDeviceModem::ModemCapabilities QNetworkManagerInterfaceD void QNetworkManagerInterfaceDeviceModem::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) propertyMap.insert(i.key(),i.value()); - } Q_EMIT propertiesChanged(map); } @@ -1051,9 +1037,7 @@ bool QNetworkManagerConnectionActive::default6Route() const void QNetworkManagerConnectionActive::propertiesSwap(QMap map) { - QMapIterator i(map); - while (i.hasNext()) { - i.next(); + for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) { propertyMap.insert(i.key(),i.value()); if (i.key() == QLatin1String("State")) { quint32 state = i.value().toUInt(); diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp index ac82fa39313..a2551f1320e 100644 --- a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp @@ -73,10 +73,7 @@ void QIBusSerializable::serializeTo(QDBusArgument &argument) const argument.beginMap(qMetaTypeId(), qMetaTypeId()); - QHashIterator i(attachments); - while (i.hasNext()) { - i.next(); - + for (auto i = attachments.begin(), end = attachments.end(); i != end; ++i) { argument.beginMapEntry(); argument << i.key(); diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 678e83cd574..f8ae5121d1d 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -385,10 +385,8 @@ Qt::ScreenOrientation QQnxScreen::orientation() const QWindow *QQnxScreen::topLevelAt(const QPoint &point) const { - QListIterator it(m_childWindows); - it.toBack(); - while (it.hasPrevious()) { - QWindow *win = it.previous()->window(); + for (auto it = m_childWindows.rbegin(), end = m_childWindows.rend(); it != end; ++it) { + QWindow *win = (*it)->window(); if (win->geometry().contains(point)) return win; } diff --git a/src/tools/uic/cpp/cppwritedeclaration.cpp b/src/tools/uic/cpp/cppwritedeclaration.cpp index 4c9d2db6dfb..3aadc878e36 100644 --- a/src/tools/uic/cpp/cppwritedeclaration.cpp +++ b/src/tools/uic/cpp/cppwritedeclaration.cpp @@ -44,27 +44,16 @@ QT_BEGIN_NAMESPACE namespace { void openNameSpaces(const QStringList &namespaceList, QTextStream &output) { - if (namespaceList.empty()) - return; - const QStringList::const_iterator cend = namespaceList.constEnd(); - for (QStringList::const_iterator it = namespaceList.constBegin(); it != cend; ++it) { - if (!it->isEmpty()) { + for (auto it = namespaceList.begin(), end = namespaceList.end(); it != end; ++it) { + if (!it->isEmpty()) output << "namespace " << *it << " {\n"; - } } } void closeNameSpaces(const QStringList &namespaceList, QTextStream &output) { - if (namespaceList.empty()) - return; - - QListIterator it(namespaceList); - it.toBack(); - while (it.hasPrevious()) { - const QString ns = it.previous(); - if (!ns.isEmpty()) { - output << "} // namespace " << ns << "\n"; - } + for (auto it = namespaceList.rbegin(), end = namespaceList.rend(); it != end; ++it) { + if (!it->isEmpty()) + output << "} // namespace " << *it << "\n"; } } diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index ade3c5db35c..23b7d269241 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -1713,9 +1713,7 @@ void WriteInitialization::writeColorGroup(DomColorGroup *colorGroup, const QStri // new format const QList colorRoles = colorGroup->elementColorRole(); - QListIterator itRole(colorRoles); - while (itRole.hasNext()) { - const DomColorRole *colorRole = itRole.next(); + for (const DomColorRole *colorRole : colorRoles) { if (colorRole->hasAttributeRole()) { const QString brushName = writeBrushInitialization(colorRole->elementBrush()); m_output << m_indent << paletteName << ".setBrush(" << group @@ -1792,9 +1790,7 @@ void WriteInitialization::writeBrush(const DomBrush *brush, const QString &brush } const QList stops = gradient->elementGradientStop(); - QListIterator it(stops); - while (it.hasNext()) { - const DomGradientStop *stop = it.next(); + for (const DomGradientStop *stop : stops) { const DomColor *color = stop->elementColor(); m_output << m_indent << gradientName << ".setColorAt(" << stop->attributePosition() << ", " diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 7b0ecc69723..6e2601880ba 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -731,9 +731,8 @@ void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const // The recursion depth is the same as menu depth, so should not // be higher than 3 levels. - QListIterator it(menu->actions()); - while (it.hasNext()) { - QAction *action = it.next(); + const auto actions = menu->actions(); + for (QAction *action : actions) { if (action->menu()) addPlatformMenu(action->menu()); } From dbea5092230ec10bcc1cb4c8e34c8a27c8f0b0e0 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 8 Aug 2016 16:50:35 +0300 Subject: [PATCH 161/236] AtSpiAdaptor: eradicate Q_FOREACH In getActions(), simplify the code some more. Change-Id: I93699d09f701959a4206f84becfb80d4d2a1d410 Reviewed-by: Frederik Gladhorn --- .../linuxaccessibility/atspiadaptor.cpp | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index 2b81de43a74..24c646c40b8 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -778,9 +778,8 @@ void AtSpiAdaptor::updateEventListeners() QDBusReply listenersReply = m_dbus->connection().call(m); if (listenersReply.isValid()) { const QSpiEventListenerArray evList = listenersReply.value(); - Q_FOREACH (const QSpiEventListener &ev, evList) { + for (const QSpiEventListener &ev : evList) setBitFlag(ev.eventName); - } m_applicationAdaptor->sendEvents(!evList.isEmpty()); } else { qAtspiDebug("Could not query active accessibility event listeners."); @@ -1508,11 +1507,10 @@ QStringList AtSpiAdaptor::accessibleInterfaces(QAccessibleInterface *interface) QSpiRelationArray AtSpiAdaptor::relationSet(QAccessibleInterface *interface, const QDBusConnection &connection) const { typedef QPair RelationPair; - QVector relationInterfaces; - relationInterfaces = interface->relations(); + const QVector relationInterfaces = interface->relations(); QSpiRelationArray relations; - Q_FOREACH (const RelationPair &pair, relationInterfaces) { + for (const RelationPair &pair : relationInterfaces) { // FIXME: this loop seems a bit strange... "related" always have one item when we check. //And why is it a list, when it always have one item? And it seems to assume that the QAccessible::Relation enum maps directly to AtSpi QSpiObjectReferenceArray related; @@ -1757,24 +1755,20 @@ QSpiActionArray AtSpiAdaptor::getActions(QAccessibleInterface *interface) const QSpiActionArray actions; const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); actions.reserve(actionNames.size()); - Q_FOREACH (const QString &actionName, actionNames) { + for (const QString &actionName : actionNames) { QSpiAction action; - QStringList keyBindings; action.name = actionName; if (actionInterface) { action.description = actionInterface->localizedActionDescription(actionName); - keyBindings = actionInterface->keyBindingsForAction(actionName); + const QStringList keyBindings = actionInterface->keyBindingsForAction(actionName); + if (!keyBindings.isEmpty()) + action.keyBinding = keyBindings.front(); } else { action.description = qAccessibleLocalizedActionDescription(actionName); } - if (keyBindings.length() > 0) - action.keyBinding = keyBindings[0]; - else - action.keyBinding = QString(); - - actions << action; + actions.append(std::move(action)); } return actions; } From af87bf4b148c1d583fe9dbbea5e57df6e49e8d7b Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 15 Jul 2016 16:58:08 +0200 Subject: [PATCH 162/236] Register QStandardPaths enums & flags This allows QML StandardPaths to use the same enums without having to duplicate them. Change-Id: Ibfc63a97a8ba31e5c4dc11e3e8fee9d753087c54 Reviewed-by: Thiago Macieira Reviewed-by: Simon Hausmann --- src/corelib/io/qstandardpaths.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h index fff1a29bf34..58f228d02b3 100644 --- a/src/corelib/io/qstandardpaths.h +++ b/src/corelib/io/qstandardpaths.h @@ -41,6 +41,7 @@ #define QSTANDARDPATHS_H #include +#include QT_BEGIN_NAMESPACE @@ -49,6 +50,8 @@ QT_BEGIN_NAMESPACE class Q_CORE_EXPORT QStandardPaths { + Q_GADGET + public: // Do not re-order, must match QDesktopServices enum StandardLocation { @@ -73,6 +76,7 @@ public: AppConfigLocation, AppLocalDataLocation = DataLocation }; + Q_ENUM(StandardLocation) static QString writableLocation(StandardLocation type); static QStringList standardLocations(StandardLocation type); @@ -82,6 +86,7 @@ public: LocateDirectory = 0x1 }; Q_DECLARE_FLAGS(LocateOptions, LocateOption) + Q_FLAG(LocateOptions) static QString locate(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile); static QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile); From 906fc0f5e394d4d765cb714a52ea46643abcec1e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 14 Aug 2016 17:23:35 +0200 Subject: [PATCH 163/236] Add Q_DECLARE_OPERATORS_FOR_FLAGS(QStandardPaths::LocateOptions) QStandardPaths::LocateOptions was declared with Q_DECLARE_FLAGS(), but missing Q_DECLARE_OPERATORS_FOR_FLAGS(). Change-Id: Id4ab1b1c86cdc9e79fb324d9b9d4d8deb659f718 Reviewed-by: Simon Hausmann --- src/corelib/io/qstandardpaths.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h index 58f228d02b3..df76d73eae2 100644 --- a/src/corelib/io/qstandardpaths.h +++ b/src/corelib/io/qstandardpaths.h @@ -108,6 +108,8 @@ private: ~QStandardPaths(); }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QStandardPaths::LocateOptions) + #endif // QT_NO_STANDARDPATHS QT_END_NAMESPACE From 12eacc3bab00f23d187a295b35e4a0d283ba85f4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 26 Apr 2016 23:01:43 -0700 Subject: [PATCH 164/236] Long live QDeadlineTimer It's like QElapsedTimer, but marks a time in the future instead. [ChangeLog][QtCore] Added QDeadlineTimer, a counterpart to QElapsedTimer, used to mark a time point in the future (a deadline) and determine whether such a deadline has passed. Change-Id: Ifea6e497f11a461db432ffff144921f7fbc1d1d3 Reviewed-by: Lars Knoll --- src/corelib/kernel/kernel.pri | 3 + src/corelib/kernel/qdeadlinetimer.cpp | 827 ++++++++++++++++++ src/corelib/kernel/qdeadlinetimer.h | 190 ++++ src/corelib/kernel/qdeadlinetimer_p.h | 59 ++ src/corelib/kernel/qelapsedtimer.cpp | 7 +- src/corelib/kernel/qelapsedtimer_generic.cpp | 9 + src/corelib/kernel/qelapsedtimer_mac.cpp | 29 +- src/corelib/kernel/qelapsedtimer_unix.cpp | 14 + src/corelib/kernel/qelapsedtimer_win.cpp | 22 + tests/auto/corelib/kernel/kernel.pro | 1 + .../kernel/qdeadlinetimer/qdeadlinetimer.pro | 5 + .../qdeadlinetimer/tst_qdeadlinetimer.cpp | 625 +++++++++++++ 12 files changed, 1783 insertions(+), 8 deletions(-) create mode 100644 src/corelib/kernel/qdeadlinetimer.cpp create mode 100644 src/corelib/kernel/qdeadlinetimer.h create mode 100644 src/corelib/kernel/qdeadlinetimer_p.h create mode 100644 tests/auto/corelib/kernel/qdeadlinetimer/qdeadlinetimer.pro create mode 100644 tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 39fe61ea4e2..f21a1d5d3ec 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -4,6 +4,8 @@ HEADERS += \ kernel/qabstracteventdispatcher.h \ kernel/qabstractnativeeventfilter.h \ kernel/qbasictimer.h \ + kernel/qdeadlinetimer.h \ + kernel/qdeadlinetimer_p.h \ kernel/qelapsedtimer.h \ kernel/qeventloop.h\ kernel/qpointer.h \ @@ -46,6 +48,7 @@ SOURCES += \ kernel/qabstracteventdispatcher.cpp \ kernel/qabstractnativeeventfilter.cpp \ kernel/qbasictimer.cpp \ + kernel/qdeadlinetimer.cpp \ kernel/qelapsedtimer.cpp \ kernel/qeventloop.cpp \ kernel/qcoreapplication.cpp \ diff --git a/src/corelib/kernel/qdeadlinetimer.cpp b/src/corelib/kernel/qdeadlinetimer.cpp new file mode 100644 index 00000000000..7906b29ecec --- /dev/null +++ b/src/corelib/kernel/qdeadlinetimer.cpp @@ -0,0 +1,827 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Intel Corporation. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeadlinetimer.h" +#include "qdeadlinetimer_p.h" +#include + +QT_BEGIN_NAMESPACE + +Q_DECL_CONST_FUNCTION static inline QPair toSecsAndNSecs(qint64 nsecs) +{ + qint64 secs = nsecs / (1000*1000*1000); + if (nsecs < 0) + --secs; + nsecs -= secs * 1000*1000*1000; + return qMakePair(secs, nsecs); +} + +/*! + \class QDeadlineTimer + \inmodule QtCore + \brief The QDeadlineTimer class marks a deadline in the future. + \since 5.8 + + \reentrant + \ingroup tools + + The QDeadlineTimer class is usually used to calculate future deadlines and + verify whether the deadline has expired. QDeadlineTimer can also be used + for deadlines without expiration ("forever"). It forms a counterpart to + QElapsedTimer, which calculates how much time has elapsed since + QElapsedTimer::start() was called. + + QDeadlineTimer provides a more convenient API compared to + QElapsedTimer::hasExpired(). + + The typical use-case for the class is to create a QDeadlineTimer before the + operation in question is started, and then use remainingTime() or + hasExpired() to determine whether to continue trying the operation. + QDeadlineTimer objects can be passed to functions being called to execute + this operation so they know how long to still operate. + + \code + void executeOperation(int msecs) + { + QDeadlineTimer deadline(msecs); + do { + if (readFromDevice(deadline.remainingTime()) + break; + waitForReadyRead(deadline); + } while (!deadline.hasExpired()); + } + \endcode + + Many QDeadlineTimer functions deal with time out values, which all are + measured in milliseconds. There are two special values, the same as many + other Qt functions named \c{waitFor} or similar: + + \list + \o 0: no time left, expired + \o -1: infinite time left, timer never expires + \endlist + + \section1 Reference Clocks + + QDeadlineTimer will use the same clock as QElapsedTimer (see + QElapsedTimer::clockType() and QElapsedTimer::isMonotonic()). + + \section1 Timer types + + Like QTimer, QDeadlineTimer can select among different levels of coarseness + on the timers. You can select precise timing by passing Qt::PreciseTimer to + the functions that set of change the timer, or you can select coarse timing + by passing Qt::CoarseTimer. Qt::VeryCoarseTimer is currently interpreted + the same way as Qt::CoarseTimer. + + This feature is dependent on support from the operating system: if the OS + does not support a coarse timer functionality, then QDeadlineTimer will + behave like Qt::PreciseTimer was passed. + + QDeadlineTimer defaults to Qt::CoarseTimer because on operating systems + that do support coarse timing, making timing calls to that clock source is + often much more efficient. The level of coarseness depends on the + operating system, but should be in the order of a couple of milliseconds. + + \section1 \c{std::chrono} Compatibility + + QDeadlineTimer is compatible with the \c{std::chrono} API from C++11 and + can be constructed from or compared to both \c{std::chrono::duration} and + \c{std::chrono::time_point} objects. In addition, it is fully compatible + with the time literals from C++14, which allow one to write code as: + + \code + using namespace std::chrono; + + QDeadlineTimer deadline(30s); + device->waitForReadyRead(deadline); + if (deadline.remainingTime() > 300ms) + cleanup(); + \endcode + + As can be seen in the example above, QDeadlineTimer offers a templated + version of remainingTime() and deadline() that can be used to return + \c{std::chrono} objects. + + Note that comparing to \c{time_point} is not as efficient as comparing to + \c{duration}, since QDeadlineTimer may need to convert from its own + internal clock source to the clock source used by the \c{time_point} object. + Also note that, due to this conversion, the deadlines will not be precise, + so the following code is not expected to compare equally: + + \code + using namespace std::chrono; + auto now = steady_clock::now(); + QDeadlineTimer deadline(now + 1s); + Q_ASSERT(deadline == now + 1s); + \endcode + + \sa QTime, QTimer, QDeadlineTimer, Qt::TimerType +*/ + +/*! + \enum QDeadlineTimer::ForeverConstant + + \value Forever Used when creating a QDeadlineTimer to indicate the + deadline should not expire +*/ + +/*! + \fn QDeadlineTimer::QDeadlineTimer(Qt::TimerType timerType) + + Constructs an expired QDeadlineTimer object. For this object, + remainingTime() will return 0. + + The timer type \a timerType may be ignored, since the timer is already + expired. Similarly, for optimization purposes, this function will not + attempt to obtain the current time and will use a value known to be in the + past. Therefore, deadline() may return an unexpected value and this object + cannot be used in calculation of how long it is overdue. If that + functionality is required, use QDeadlineTimer::current(). + + \sa hasExpired(), remainingTime(), timerType(), current() +*/ + +/*! + \fn QDeadlineTimer::QDeadlineTimer(ForeverConstant, Qt::TimerType timerType) + + Constructs a QDeadlineTimer object that never expires. For this object, + remainingTime() will return -1, deadline() will return the maximum value, + and isForever() will return true. + + The timer type \a timerType may be ignored, since the timer is already + expired. + + \sa hasExpired(), isForever(), remainingTime(), timerType() +*/ + +/*! + Constructs a QDeadlineTimer object with an expiry time of \a msecs msecs + from the moment of the creation of this object, if msecs is positive. If \a + msecs is zero, this QDeadlineTimer will be marked as expired, causing + remainingTime() to return zero and deadline() to return an indeterminate + time point in the past. If \a msecs is -1, the timer will be set it to + never expire, causing remainingTime() to return -1 and deadline() to return + the maximum value. + + The QDeadlineTimer object will be constructed with a timer type of \a + timerType. + + For optimization purposes, if \a msecs is zero, this function may skip + obtaining the current time and may instead use a value known to be in the + past. If that happens, deadline() may return an unexpected value and this + object cannot be used in calculation of how long it is overdue. If that + functionality is required, use QDeadlineTimer::current() and add time to + it. + + \sa hasExpired(), isForever(), remainingTime(), setRemainingTime() +*/ +QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW + : t2(0) +{ + setRemainingTime(msecs, type); +} + +/*! + \fn QDeadlineTimer::QDeadlineTimer(std::chrono::time_point deadline, Qt::TimerType type) + + Constructs a QDeadlineTimer object with a deadline at \a deadline time + point, converting from the clock source \c{Clock} to Qt's internal clock + source (see QElapsedTimer::clcokType()). + + If \a deadline is in the past, this QDeadlineTimer object is set to + expired, whereas if \a deadline is equal to \c{Duration::max()}, then this + object is set to never expire. + + The QDeadlineTimer object will be constructed with a timer type of \a + timerType. + + \sa hasExpired(), isForever(), remainingTime(), setDeadline() +*/ + +/*! + \fn QDeadlineTimer::QDeadlineTimer(std::chrono::duration remaining, Qt::TimerType type) + + Constructs a QDeadlineTimer object with a remaining time of \a remaining. + If \a remaining is zero or negative, this QDeadlineTimer object will be + mark as expired, whereas if \a remaining is equal to \c{duration::max()}, + the object will be set to never expire. + + The QDeadlineTimer object will be constructed with a timer type of \a + timerType. + + This constructor can be used with C++14's user-defined literals for time, such as in: + + \code + using namespace std::chrono; + QDeadlineTimer deadline(250ms); + \endcode + + For optimization purposes, if \a remaining is zero or negative, this + function may skip obtaining the current time and may instead use a value + known to be in the past. If that happens, deadline() may return an + unexpected value and this object cannot be used in calculation of how long + it is overdue. If that functionality is required, use + QDeadlineTimer::current() and add time to it. + + \sa hasExpired(), isForever(), remainingTime(), setRemainingTime() +*/ + +/*! + \fn void QDeadlineTimer::setDeadline(std::chrono::time_point deadline, Qt::TimerType type) + + Sets this QDeadlineTimer to the deadline marked by \a deadline time + point, converting from the clock source \c{Clock} to Qt's internal clock + source (see QElapsedTimer::clcokType()). + + If \a deadline is in the past, this QDeadlineTimer object is set to + expired, whereas if \a deadline is equal to \c{Duration::max()}, then this + object is set to never expire. + + The timer type for this QDeadlineTimer object will be set to \a timerType type. + + \sa hasExpired(), isForever(), remainingTime(), +*/ + +/*! + Sets the remaining time for this QDeadlineTimer object to \a msecs + milliseconds from now, if \a msecs has a positive value. If \a msecs is + zero, this QDeadlineTimer object will be marked as expired, whereas a value + of -1 will set it to never expire. + + The timer type for this QDeadlineTimer object will be set to \a timerType type. + + \sa setPreciseRemainingTime(), hasExpired(), isForever(), remainingTime() +*/ +void QDeadlineTimer::setRemainingTime(qint64 msecs, Qt::TimerType timerType) Q_DECL_NOTHROW +{ + if (msecs == -1) + *this = QDeadlineTimer(Forever, timerType); + else + setPreciseRemainingTime(0, msecs * 1000 * 1000, timerType); +} + +/*! + Sets the remaining time for this QDeadlineTimer object to \a secs seconds + plus \a nsecs nanoseconds from now, if \a secs has a positive value. If \a + secs is -1, this QDeadlineTimer will be set it to never expire. If both + parameters are zero, this QDeadlineTimer will be marked as expired. + + The timer type for this QDeadlineTimer object will be set to \a timerType type. + + \sa setRemainingTime(), hasExpired(), isForever(), remainingTime() +*/ +void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::TimerType timerType) Q_DECL_NOTHROW +{ + if (secs == -1) { + *this = QDeadlineTimer(Forever, timerType); + return; + } + + *this = current(timerType); + if (QDeadlineTimerNanosecondsInT2) { + t1 += secs + toSecsAndNSecs(nsecs).first; + t2 += toSecsAndNSecs(nsecs).second; + if (t2 > 1000*1000*1000) { + t2 -= 1000*1000*1000; + ++t1; + } + } else { + t1 += secs * 1000 * 1000 * 1000 + nsecs; + } +} + +/*! + \overload + \fn void QDeadlineTimer::setRemainingTime(std::chrono::duration remaining, Qt::TimerType type) + + Sets the remaining time for this QDeadlineTimer object to \a remaining. If + \a remaining is zero or negative, this QDeadlineTimer object will be mark + as expired, whereas if \a remaining is equal to \c{duration::max()}, the + object will be set to never expire. + + The timer type for this QDeadlineTimer object will be set to \a timerType type. + + This function can be used with C++14's user-defined literals for time, such as in: + + \code + using namespace std::chrono; + deadline.setRemainingTime(250ms); + \endcode + + \sa setDeadline(), remainingTime(), hasExpired(), isForever() +*/ + +/*! + \fn void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, unsigned nsecs, Qt::TimerType type) + + Sets the remaining time for this QDeadlineTimer object to \a secs seconds + and \a nsecs nanoseconds from now, if \a secs is a positive value. If both + values are zero, this QDeadlineTimer object will be marked as expired, + whereas if \a secs is -1, it will set it to never expire. + + If value of \a nsecs is more than 1 billion nanoseconds (1 second), this + function will adjust \a secs accordingly. + + The timer type for this QDeadlineTimer object will be set to \a timerType type. + + \sa setRemainingTime(), hasExpired(), isForever(), remainingTime() +*/ + +/*! + \overload + \fn Duration QDeadlineTimer::remainingTime() const + + Returns a \c{std::chrono::duration} object of type \c{Duration} containing + the remaining time in this QDeadlineTimer, if it still has time left. If + the deadline has passed, this returns \c{Duration::zero()}, whereas if the + object is set to never expire, it returns \c{Duration::max()} (instead of + -1). + + It is not possible to obtain the overdue time for expired timers with this + function. To do that, see deadline(). + + \note The overload of this function without template parameter always + returns milliseconds. + + \sa setRemainingTime(), deadline() +*/ + +/*! + \overload + \fn std::chrono::time_point QDeadlineTimer::deadline() const + + Returns the absolute time point for the deadline stored in QDeadlineTimer + object as a \c{std::chrono::time_point} object. The template parameter + \c{Clock} is mandatory and indicates which of the C++ timekeeping clocks to + use as a reference. The value will be in the past if this QDeadlineTimer + has expired. + + If this QDeadlineTimer never expires, this function returns + \c{std::chrono::time_point::max()}. + + This function can be used to calculate the amount of time a timer is + overdue, by subtracting the current time point of the reference clock, as + in the following example: + + \code + auto realTimeLeft = std::chrono::nanoseconds::max(); + auto tp = deadline.deadline(); + if (tp != std::chrono::steady_clock::max()) + realTimeLeft = tp - std::chrono::steady_clock::now(); + \endcode + + \note Timers that were created as expired have an indetermine time point in + the past as their deadline, so the above calculation may not work. + + \sa remainingTime(), deadlineNSecs(), setDeadline() +*/ + +/*! + Returns true if this QDeadlineTimer object never expires, false otherwise. + For timers that never expire, remainingTime() always returns -1 and + deadline() returns the maximum value. + + \sa ForeverConstant, hasExpired(), remainingTime() +*/ +bool QDeadlineTimer::isForever() const Q_DECL_NOTHROW +{ + return t1 == (std::numeric_limits::max)(); +} + +/*! + Returns true if this QDeadlineTimer object has expired, false if there + remains time left. For objects that have expired, remainingTime() will + return zero and deadline() will return a time point in the past. + + QDeadlineTimer objects created with the \ref{ForeverConstant} never expire + and this function always returns false for them. + + \sa isForever(), remainingTime() +*/ +bool QDeadlineTimer::hasExpired() const Q_DECL_NOTHROW +{ + if (isForever()) + return false; + return *this <= current(timerType()); +} + +/*! + \fn Qt::TimerType QDeadlineTimer::timerType() const Q_DECL_NOTHROW + + Returns the timer type is active for this object. + + \sa setTimerType() +*/ + +/*! + Changes the timer type for this object to \a timerType. + + The behavior for each possible value of \a timerType is operating-system + dependent. Qt::PreciseTimer will use the most precise timer that Qt can + find, with resolution of 1 millisecond or better, whereas QDeadlineTimer + will try to use a more coarse timer for Qt::CoarseTimer and + Qt::VeryCoarseTimer. + + \sa timerType() + */ +void QDeadlineTimer::setTimerType(Qt::TimerType timerType) +{ + type = timerType; +} + +/*! + Returns the remaining time in this QDeadlineTimer object in milliseconds. + If the timer has already expired, this function will return zero and it is + not possible to obtain the amount of time overdue with this function (to do + that, see deadline()). If the timer was set to never expire, this function + returns -1. + + This function is suitable for use in Qt APIs that take a millisecond + timeout, such as the many \ref QIODevice \c waitFor functions or the timed + lock functions in \ref QMutex, \ref QWaitCondition, \ref QSemaphore, or + \ref QReadWriteLock. For example: + + \code + mutex.tryLock(deadline.remainingTime()); + \code + + \sa remainingTimeNSecs(), isForever(), hasExpired() +*/ +qint64 QDeadlineTimer::remainingTime() const Q_DECL_NOTHROW +{ + qint64 ns = remainingTimeNSecs(); + return ns <= 0 ? ns : ns / (1000 * 1000); +} + +/*! + Returns the remaining time in this QDeadlineTimer object in nanoseconds. If + the timer has already expired, this function will return zero and it is not + possible to obtain the amount of time overdue with this function. If the + timer was set to never expire, this function returns -1. + + \sa remainingTime(), isForever(), hasExpired() +*/ +qint64 QDeadlineTimer::remainingTimeNSecs() const Q_DECL_NOTHROW +{ + if (isForever()) + return -1; + qint64 raw = rawRemainingTimeNSecs(); + return raw < 0 ? 0 : raw; +} + +/*! + \internal + Same as remainingTimeNSecs, but may return negative remaining times. Does + not deal with Forever. +*/ +qint64 QDeadlineTimer::rawRemainingTimeNSecs() const Q_DECL_NOTHROW +{ + QDeadlineTimer now = current(timerType()); + if (QDeadlineTimerNanosecondsInT2) + return (t1 - now.t1) * (1000*1000*1000) + t2 - now.t2; + return t1 - now.t1; +} + +/*! + Returns the absolute time point for the deadline stored in QDeadlineTimer + object, calculated in milliseconds relative to the reference clock, the + same as QElapsedTimer::msecsSinceReference(). The value will be in the past + if this QDeadlineTimer has expired. + + If this QDeadlineTimer never expires, this function returns + \c{std::numeric_limits::max()}. + + This function can be used to calculate the amount of time a timer is + overdue, by subtracting QDeadlineTimer::current() or + QElapsedTimer::msecsSinceReference(), as in the following example: + + \code + qint64 realTimeLeft = deadline.deadline(); + if (realTimeLeft != (std::numeric_limits::max)()) { + realTimeLeft -= QDeadlineTimer::current().deadline(); + // or: + //QElapsedTimer timer; + //timer.start(); + //realTimeLeft -= timer.msecsSinceReference(); + } + \endcode + + \note Timers that were created as expired have an indetermine time point in + the past as their deadline, so the above calculation may not work. + + \sa remainingTime(), deadlineNSecs(), setDeadline() +*/ +qint64 QDeadlineTimer::deadline() const Q_DECL_NOTHROW +{ + if (isForever()) + return t1; + return deadlineNSecs() / (1000 * 1000); +} + +/*! + Returns the absolute time point for the deadline stored in QDeadlineTimer + object, calculated in nanoseconds relative to the reference clock, the + same as QElapsedTimer::msecsSinceReference(). The value will be in the past + if this QDeadlineTimer has expired. + + If this QDeadlineTimer never expires, this function returns + \c{std::numeric_limits::max()}. + + This function can be used to calculate the amount of time a timer is + overdue, by subtracting QDeadlineTimer::current(), as in the following + example: + + \code + qint64 realTimeLeft = deadline.deadlineNSecs(); + if (realTimeLeft != std::numeric_limits::max()) + realTimeLeft -= QDeadlineTimer::current().deadlineNSecs(); + \endcode + + \note Timers that were created as expired have an indetermine time point in + the past as their deadline, so the above calculation may not work. + + \sa remainingTime(), deadlineNSecs() +*/ +qint64 QDeadlineTimer::deadlineNSecs() const Q_DECL_NOTHROW +{ + if (isForever()) + return t1; + if (QDeadlineTimerNanosecondsInT2) + return t1 * 1000 * 1000 * 1000 + t2; + return t1; +} + +/*! + Sets the deadline for this QDeadlineTimer object to be the \a msecs + absolute time point, counted in milliseconds since the reference clock (the + same as QElapsedTimer::msecsSinceReference()), and the timer type to \a + timerType. If the value is in the past, this QDeadlineTimer will be marked + as expired. + + If \a msecs is \c{std::numeric_limits::max()}, this QDeadlineTimer + will be set to never expire. + + \sa setPreciseDeadline(), deadline(), deadlineNSecs(), setRemainingTime() +*/ +void QDeadlineTimer::setDeadline(qint64 msecs, Qt::TimerType timerType) Q_DECL_NOTHROW +{ + if (msecs == (std::numeric_limits::max)()) { + setPreciseDeadline(msecs, 0, timerType); // msecs == MAX implies Forever + } else { + setPreciseDeadline(msecs / 1000, msecs % 1000 * 1000 * 1000, timerType); + } +} + +/*! + Sets the deadline for this QDeadlineTimer object to be \a secs seconds and + \a nsecs nanoseconds since the reference clock epoch (the same as + QElapsedTimer::msecsSinceReference()), and the timer type to \a timerType. + If the value is in the past, this QDeadlineTimer will be marked as expired. + + If \a secs or \a nsecs is \c{std::numeric_limits::max()}, this + QDeadlineTimer will be set to never expire. If \a nsecs is more than 1 + billion nanoseconds (1 second), then \a secs will be adjusted accordingly. + + \sa setDeadline(), deadline(), deadlineNSecs(), setRemainingTime() +*/ +void QDeadlineTimer::setPreciseDeadline(qint64 secs, qint64 nsecs, Qt::TimerType timerType) Q_DECL_NOTHROW +{ + type = timerType; + if (secs == (std::numeric_limits::max)() || nsecs == (std::numeric_limits::max)()) { + *this = QDeadlineTimer(Forever, timerType); + } else if (QDeadlineTimerNanosecondsInT2) { + t1 = secs + toSecsAndNSecs(nsecs).first; + t2 = toSecsAndNSecs(nsecs).second; + } else { + t1 = secs * (1000*1000*1000) + nsecs; + } +} + +/*! + Returns a QDeadlineTimer object whose deadline is extended from \a dt's + deadline by \a nsecs nanoseconds. If \a dt was set to never expire, this + function returns a QDeadlineTimer that will not expire either. + + \note if \a dt was created as expired, its deadline is indeterminate and + adding an amount of time may or may not cause it to become unexpired. +*/ +QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_NOTHROW +{ + if (dt.isForever() || nsecs == (std::numeric_limits::max)()) { + dt = QDeadlineTimer(Forever, dt.timerType()); + } else if (QDeadlineTimerNanosecondsInT2) { + dt.t1 += toSecsAndNSecs(nsecs).first; + dt.t2 += toSecsAndNSecs(nsecs).second; + if (dt.t2 > 1000*1000*1000) { + dt.t2 -= 1000*1000*1000; + ++dt.t1; + } + } else { + dt.t1 += nsecs; + } + return dt; +} + +/*! + \fn QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) + + Returns a QDeadlineTimer that is expired but is guaranteed to contain the + current time. Objects created by this function can participate in the + calculation of how long a timer is overdue, using the deadline() function. + + The QDeadlineTimer object will be constructed with a timer type of \a + timerType. +*/ + +/*! + \fn qint64 QDeadlineTimer::resolution(Qt::TimerType timerType) + + Returns the resolution in nanoseconds of the system clock that backs timers + of type \a timerType, or 0 if the resolution could not be determined. + + The resolution is not a guarantee that applications will get time values + with an accuracy down to that level. It is only the minimum change value + that can be expected. +*/ + +/*! + \fn bool operator==(QDeadlineTimer d1, QDeadlineTimer d2) + \related QDeadlineTimer + + Returns true if the deadline on \a d1 and the deadline in \a d2 are the + same, false otherwise. The timer type used to create the two deadlines is + ignored. This function is equivalent to: + + \code + return d1.deadlineNSecs() == d2.deadlineNSecs(); + \endcode + + \note comparing QDeadlineTimer objects with different timer types is + not supported and may result in unpredictable behavior. +*/ + +/*! + \fn bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2) + \related QDeadlineTimer + + Returns true if the deadline on \a d1 and the deadline in \a d2 are + diferent, false otherwise. The timer type used to create the two deadlines + is ignored. This function is equivalent to: + + \code + return d1.deadlineNSecs() != d2.deadlineNSecs(); + \endcode + + \note comparing QDeadlineTimer objects with different timer types is + not supported and may result in unpredictable behavior. +*/ + +/*! + \fn bool operator<(QDeadlineTimer d1, QDeadlineTimer d2) + \related QDeadlineTimer + + Returns true if the deadline on \a d1 is earlier than the deadline in \a + d2, false otherwise. The timer type used to create the two deadlines is + ignored. This function is equivalent to: + + \code + return d1.deadlineNSecs() < d2.deadlineNSecs(); + \endcode + + \note comparing QDeadlineTimer objects with different timer types is + not supported and may result in unpredictable behavior. +*/ + +/*! + \fn bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2) + \related QDeadlineTimer + + Returns true if the deadline on \a d1 is earlier than or the same as the + deadline in \a d2, false otherwise. The timer type used to create the two + deadlines is ignored. This function is equivalent to: + + \code + return d1.deadlineNSecs() <= d2.deadlineNSecs(); + \endcode + + \note comparing QDeadlineTimer objects with different timer types is + not supported and may result in unpredictable behavior. +*/ + +/*! + \fn bool operator>(QDeadlineTimer d1, QDeadlineTimer d2) + \related QDeadlineTimer + + Returns true if the deadline on \a d1 is later than the deadline in \a + d2, false otherwise. The timer type used to create the two deadlines is + ignored. This function is equivalent to: + + \code + return d1.deadlineNSecs() > d2.deadlineNSecs(); + \endcode + + \note comparing QDeadlineTimer objects with different timer types is + not supported and may result in unpredictable behavior. +*/ + +/*! + \fn bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2) + \related QDeadlineTimer + + Returns true if the deadline on \a d1 is later than or the same as the + deadline in \a d2, false otherwise. The timer type used to create the two + deadlines is ignored. This function is equivalent to: + + \code + return d1.deadlineNSecs() >= d2.deadlineNSecs(); + \endcode + + \note comparing QDeadlineTimer objects with different timer types is + not supported and may result in unpredictable behavior. +*/ + +/*! + \fn QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs) + \related QDeadlineTimer + + Returns a QDeadlineTimer object whose deadline is \a msecs later than the + deadline stored in \a dt. If \a dt is set to never expire, this function + returns a QDeadlineTimer that does not expire either. + + To add times of precision greater than 1 millisecond, use addNSecs(). +*/ + +/*! + \fn QDeadlineTimer operator+(qint64 msecs, QDeadlineTimer dt) + \related QDeadlineTimer + + Returns a QDeadlineTimer object whose deadline is \a msecs later than the + deadline stored in \a dt. If \a dt is set to never expire, this function + returns a QDeadlineTimer that does not expire either. + + To add times of precision greater than 1 millisecond, use addNSecs(). +*/ + +/*! + \fn QDeadlineTimer operator-(QDeadlineTimer dt, qint64 msecs) + \related QDeadlineTimer + + Returns a QDeadlineTimer object whose deadline is \a msecs before the + deadline stored in \a dt. If \a dt is set to never expire, this function + returns a QDeadlineTimer that does not expire either. + + To subtract times of precision greater than 1 millisecond, use addNSecs(). +*/ + +/*! + \fn QDeadlineTimer &QDeadlineTimer::operator+=(qint64 msecs) + + Extends this QDeadlineTimer object by \a msecs milliseconds and returns + itself. If this object is set to never expire, this function does nothing. + + To add times of precision greater than 1 millisecond, use addNSecs(). +*/ + +/*! + \fn QDeadlineTimer &QDeadlineTimer::operator-=(qint64 msecs) + + Shortens this QDeadlineTimer object by \a msecs milliseconds and returns + itself. If this object is set to never expire, this function does nothing. + + To subtract times of precision greater than 1 millisecond, use addNSecs(). +*/ + +// the rest of the functions are in qelapsedtimer_xxx.cpp + +QT_END_NAMESPACE diff --git a/src/corelib/kernel/qdeadlinetimer.h b/src/corelib/kernel/qdeadlinetimer.h new file mode 100644 index 00000000000..ac8a09ba973 --- /dev/null +++ b/src/corelib/kernel/qdeadlinetimer.h @@ -0,0 +1,190 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Intel Corporation. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDEADLINETIMER_H +#define QDEADLINETIMER_H + +#include +#include +#include + +#ifdef max +// un-pollute the namespace. We need std::numeric_limits::max() and std::chrono::duration::max() +# undef max +#endif + +#include + +#if QT_HAS_INCLUDE() +# include +#endif + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QDeadlineTimer +{ +public: + enum ForeverConstant { Forever }; + + Q_DECL_CONSTEXPR QDeadlineTimer(Qt::TimerType type_ = Qt::CoarseTimer) Q_DECL_NOTHROW + : t1(0), t2(0), type(type_) {} + Q_DECL_CONSTEXPR QDeadlineTimer(ForeverConstant, Qt::TimerType type_ = Qt::CoarseTimer) Q_DECL_NOTHROW + : t1(std::numeric_limits::max()), t2(0), type(type_) {} + explicit QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW; + + void swap(QDeadlineTimer &other) + { qSwap(t1, other.t1); qSwap(t2, other.t2); qSwap(type, other.type); } + + bool isForever() const Q_DECL_NOTHROW; + bool hasExpired() const Q_DECL_NOTHROW; + + Qt::TimerType timerType() const Q_DECL_NOTHROW + { return Qt::TimerType(type & 0xff); } + void setTimerType(Qt::TimerType type); + + qint64 remainingTime() const Q_DECL_NOTHROW; + qint64 remainingTimeNSecs() const Q_DECL_NOTHROW; + void setRemainingTime(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW; + void setPreciseRemainingTime(qint64 secs, qint64 nsecs = 0, + Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW; + + qint64 deadline() const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION; + qint64 deadlineNSecs() const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION; + void setDeadline(qint64 msecs, Qt::TimerType timerType = Qt::CoarseTimer) Q_DECL_NOTHROW; + void setPreciseDeadline(qint64 secs, qint64 nsecs = 0, + Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW; + + static QDeadlineTimer addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION; + static QDeadlineTimer current(Qt::TimerType timerType = Qt::CoarseTimer) Q_DECL_NOTHROW; + + friend bool operator==(QDeadlineTimer d1, QDeadlineTimer d2) + { return d1.t1 == d2.t1 && d1.t2 == d2.t2; } + friend bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2) + { return !(d1 == d2); } + friend bool operator<(QDeadlineTimer d1, QDeadlineTimer d2) + { return d1.t1 < d2.t1 || (d1.t1 == d2.t1 && d1.t2 < d2.t2); } + friend bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2) + { return d1 == d2 || d1 < d2; } + friend bool operator>(QDeadlineTimer d1, QDeadlineTimer d2) + { return d2 < d1; } + friend bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2) + { return !(d1 < d2); } + + friend QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs) + { return QDeadlineTimer::addNSecs(dt, msecs * 1000 * 1000); } + friend QDeadlineTimer operator+(qint64 msecs, QDeadlineTimer dt) + { return dt + msecs; } + friend QDeadlineTimer operator-(QDeadlineTimer dt, qint64 msecs) + { return dt + (-msecs); } + friend qint64 operator-(QDeadlineTimer dt1, QDeadlineTimer dt2) + { return (dt1.deadlineNSecs() - dt2.deadlineNSecs()) / (1000 * 1000); } + QDeadlineTimer &operator+=(qint64 msecs) + { *this = *this + msecs; return *this; } + QDeadlineTimer &operator-=(qint64 msecs) + { *this = *this + (-msecs); return *this; } + +#if QT_HAS_INCLUDE() || defined(Q_QDOC) + template + QDeadlineTimer(std::chrono::time_point deadline_, + Qt::TimerType type_ = Qt::CoarseTimer) : t2(0) + { setDeadline(deadline_, type_); } + template + QDeadlineTimer &operator=(std::chrono::time_point deadline_) + { setDeadline(deadline_); return *this; } + + template + void setDeadline(std::chrono::time_point deadline_, + Qt::TimerType type_ = Qt::CoarseTimer) + { setRemainingTime(deadline_ == deadline_.max() ? Duration::max() : deadline_ - Clock::now(), type_); } + + template + std::chrono::time_point deadline() const + { + auto val = std::chrono::nanoseconds(rawRemainingTimeNSecs()) + Clock::now(); + return std::chrono::time_point_cast(val); + } + + template + QDeadlineTimer(std::chrono::duration remaining, Qt::TimerType type_ = Qt::CoarseTimer) + : t2(0) + { setRemainingTime(remaining, type_); } + + template + QDeadlineTimer &operator=(std::chrono::duration remaining) + { setRemainingTime(remaining); return *this; } + + template + void setRemainingTime(std::chrono::duration remaining, Qt::TimerType type_ = Qt::CoarseTimer) + { + if (remaining == remaining.max()) + *this = QDeadlineTimer(Forever, type_); + else + setPreciseRemainingTime(0, std::chrono::nanoseconds(remaining).count(), type_); + } + + std::chrono::nanoseconds remainingTimeAsDuration() const Q_DECL_NOTHROW + { + if (isForever()) + return std::chrono::nanoseconds::max(); + qint64 nsecs = rawRemainingTimeNSecs(); + if (nsecs <= 0) + return std::chrono::nanoseconds::zero(); + return std::chrono::nanoseconds(nsecs); + } + + template + friend QDeadlineTimer operator+(QDeadlineTimer dt, std::chrono::duration value) + { return QDeadlineTimer::addNSecs(dt, std::chrono::duration_cast(value).count()); } + template + friend QDeadlineTimer operator+(std::chrono::duration value, QDeadlineTimer dt) + { return dt + value; } + template + friend QDeadlineTimer operator+=(QDeadlineTimer &dt, std::chrono::duration value) + { return dt = dt + value; } +#endif + +private: + qint64 t1; + unsigned t2; + unsigned type; + + qint64 rawRemainingTimeNSecs() const Q_DECL_NOTHROW; +}; + +Q_DECLARE_SHARED(QDeadlineTimer) + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QDeadlineTimer) + +#endif // QDEADLINETIMER_H diff --git a/src/corelib/kernel/qdeadlinetimer_p.h b/src/corelib/kernel/qdeadlinetimer_p.h new file mode 100644 index 00000000000..94ded921e1e --- /dev/null +++ b/src/corelib/kernel/qdeadlinetimer_p.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDEADLINETIMER_P_H +#define QDEADLINETIMER_P_H + +#include + +QT_BEGIN_NAMESPACE + +enum { +#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) + // t1 contains seconds and t2 contains nanoseconds + QDeadlineTimerNanosecondsInT2 = 1 +#else + // t1 contains nanoseconds, t2 is always zero + QDeadlineTimerNanosecondsInT2 = 0 +#endif +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/corelib/kernel/qelapsedtimer.cpp b/src/corelib/kernel/qelapsedtimer.cpp index 2eabb4c3a35..4aa9f9bffa3 100644 --- a/src/corelib/kernel/qelapsedtimer.cpp +++ b/src/corelib/kernel/qelapsedtimer.cpp @@ -83,6 +83,9 @@ QT_BEGIN_NAMESPACE \snippet qelapsedtimer/main.cpp 2 + It is often more convenient to use \ref{QDeadlineTimer} in this case, which + counts towards a timeout in the future instead of tracking elapsed time. + \section1 Reference Clocks QElapsedTimer will use the platform's monotonic reference clock in all @@ -120,7 +123,7 @@ QT_BEGIN_NAMESPACE The information on which clocks types may overflow and how to remedy that issue is documented along with the clock types. - \sa QTime, QTimer + \sa QTime, QTimer, QDeadlineTimer */ /*! @@ -255,7 +258,7 @@ bool QElapsedTimer::isValid() const Q_DECL_NOTHROW The value of \a timeout can be -1 to indicate that this timer does not expire, in which case this function will always return false. - \sa elapsed() + \sa elapsed(), QDeadlineTimer */ bool QElapsedTimer::hasExpired(qint64 timeout) const Q_DECL_NOTHROW { diff --git a/src/corelib/kernel/qelapsedtimer_generic.cpp b/src/corelib/kernel/qelapsedtimer_generic.cpp index 8c724247be6..ecd0e7ee2ba 100644 --- a/src/corelib/kernel/qelapsedtimer_generic.cpp +++ b/src/corelib/kernel/qelapsedtimer_generic.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qelapsedtimer.h" +#include "qdeadlinetimer.h" #include "qdatetime.h" QT_BEGIN_NAMESPACE @@ -201,4 +202,12 @@ bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW return v1.t1 < v2.t1; } +QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW +{ + QDeadlineTimer result; + result.t1 = QDateTime::currentMSecsSinceEpoch() * 1000 * 1000; + result.type = timerType; + return result; +} + QT_END_NAMESPACE diff --git a/src/corelib/kernel/qelapsedtimer_mac.cpp b/src/corelib/kernel/qelapsedtimer_mac.cpp index 886e0f41b28..7490693991d 100644 --- a/src/corelib/kernel/qelapsedtimer_mac.cpp +++ b/src/corelib/kernel/qelapsedtimer_mac.cpp @@ -41,6 +41,8 @@ #define _POSIX_C_SOURCE 200809L #include "qelapsedtimer.h" +#include "qdeadlinetimer.h" +#include "qdeadlinetimer_p.h" #include #include #include @@ -50,6 +52,12 @@ QT_BEGIN_NAMESPACE +#ifdef __LP64__ +typedef __int128_t LargeInt; +#else +typedef qint64 LargeInt; +#endif + QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW { return MachAbsoluteTime; @@ -65,13 +73,13 @@ static qint64 absoluteToNSecs(qint64 cpuTime) { if (info.denom == 0) mach_timebase_info(&info); -#ifdef __LP64__ - __uint128_t nsecs = static_cast<__uint128_t>(cpuTime) * info.numer / info.denom; - return static_cast(nsecs); -#else - qint64 nsecs = cpuTime * info.numer / info.denom; + + // don't do multiplication & division if those are equal + // (mathematically it would be the same, but it's computationally expensive) + if (info.numer == info.denom) + return cpuTime; + qint64 nsecs = LargeInt(cpuTime) * info.numer / info.denom; return nsecs; -#endif } static qint64 absoluteToMSecs(qint64 cpuTime) @@ -146,4 +154,13 @@ bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW return v1.t1 < v2.t1; } +QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW +{ + Q_STATIC_ASSERT(!QDeadlineTimerNanosecondsInT2); + QDeadlineTimer result; + result.type = timerType; + result.t1 = absoluteToNSecs(mach_absolute_time()); + return result; +} + QT_END_NAMESPACE diff --git a/src/corelib/kernel/qelapsedtimer_unix.cpp b/src/corelib/kernel/qelapsedtimer_unix.cpp index e2c3ae62808..e166d4e3d22 100644 --- a/src/corelib/kernel/qelapsedtimer_unix.cpp +++ b/src/corelib/kernel/qelapsedtimer_unix.cpp @@ -39,6 +39,8 @@ ****************************************************************************/ #include "qelapsedtimer.h" +#include "qdeadlinetimer.h" +#include "qdeadlinetimer_p.h" #if defined(Q_OS_VXWORKS) #include "qfunctions_vxworks.h" #else @@ -248,4 +250,16 @@ bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW return v1.t1 < v2.t1 || (v1.t1 == v2.t1 && v1.t2 < v2.t2); } +QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW +{ + Q_STATIC_ASSERT(QDeadlineTimerNanosecondsInT2); + QDeadlineTimer result; + qint64 cursec, curnsec; + do_gettime(&cursec, &curnsec); + result.t1 = cursec; + result.t2 = curnsec; + result.type = timerType; + return result; +} + QT_END_NAMESPACE diff --git a/src/corelib/kernel/qelapsedtimer_win.cpp b/src/corelib/kernel/qelapsedtimer_win.cpp index 520126d2621..0c380b2f6ad 100644 --- a/src/corelib/kernel/qelapsedtimer_win.cpp +++ b/src/corelib/kernel/qelapsedtimer_win.cpp @@ -38,6 +38,8 @@ ****************************************************************************/ #include "qelapsedtimer.h" +#include "qdeadlinetimer.h" +#include "qdeadlinetimer_p.h" #include QT_BEGIN_NAMESPACE @@ -76,6 +78,17 @@ static inline qint64 ticksToNanoseconds(qint64 ticks) } } +static inline qint64 nanosecondsToTicks(qint64 nsec) +{ + if (counterFrequency > 0) { + // QueryPerformanceCounter uses an arbitrary frequency + return double(nsec) * counterFrequency / 1000000000.; + } else { + // GetTickCount(64) uses milliseconds + return nsec / 1000000; + } +} + static quint64 getTickCount() { resolveCounterFrequency(); @@ -161,4 +174,13 @@ bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW return (v1.t1 - v2.t1) < 0; } +QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW +{ + Q_STATIC_ASSERT(!QDeadlineTimerNanosecondsInT2); + QDeadlineTimer result; + result.t1 = ticksToNanoseconds(getTickCount()); + result.type = timerType; + return result; +} + QT_END_NAMESPACE diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro index 431d4833391..3fa244d0753 100644 --- a/tests/auto/corelib/kernel/kernel.pro +++ b/tests/auto/corelib/kernel/kernel.pro @@ -1,6 +1,7 @@ TEMPLATE=subdirs SUBDIRS=\ qcoreapplication \ + qdeadlinetimer \ qelapsedtimer \ qeventdispatcher \ qeventloop \ diff --git a/tests/auto/corelib/kernel/qdeadlinetimer/qdeadlinetimer.pro b/tests/auto/corelib/kernel/qdeadlinetimer/qdeadlinetimer.pro new file mode 100644 index 00000000000..12ad7dabc2f --- /dev/null +++ b/tests/auto/corelib/kernel/qdeadlinetimer/qdeadlinetimer.pro @@ -0,0 +1,5 @@ +CONFIG += testcase +TARGET = tst_qdeadlinetimer +QT = core testlib +SOURCES = tst_qdeadlinetimer.cpp + diff --git a/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp b/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp new file mode 100644 index 00000000000..7642604cfed --- /dev/null +++ b/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp @@ -0,0 +1,625 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Intel Corporation. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +#if QT_HAS_INCLUDE() +# include +#endif + +static const int minResolution = 100; // the minimum resolution for the tests + +Q_DECLARE_METATYPE(Qt::TimerType) + +class tst_QDeadlineTimer : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void initTestCase_data(); + void basics(); + void foreverness(); + void current(); + void deadlines(); + void setDeadline(); + void expire(); + void stdchrono(); +}; + +void tst_QDeadlineTimer::initTestCase_data() +{ + qRegisterMetaType(); + QTest::addColumn("timerType"); + QTest::newRow("precise") << Qt::PreciseTimer; + QTest::newRow("coarse") << Qt::CoarseTimer; +} + +void tst_QDeadlineTimer::basics() +{ + QDeadlineTimer deadline; + QCOMPARE(deadline.timerType(), Qt::CoarseTimer); + + QFETCH_GLOBAL(Qt::TimerType, timerType); + deadline = QDeadlineTimer(timerType); + QCOMPARE(deadline.timerType(), timerType); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline, QDeadlineTimer(timerType)); + QVERIFY(!(deadline != QDeadlineTimer(timerType))); + QVERIFY(!(deadline < QDeadlineTimer())); + QVERIFY(deadline <= QDeadlineTimer()); + QVERIFY(deadline >= QDeadlineTimer()); + QVERIFY(!(deadline > QDeadlineTimer())); + QVERIFY(!(deadline < deadline)); + QVERIFY(deadline <= deadline); + QVERIFY(deadline >= deadline); + QVERIFY(!(deadline > deadline)); + + // should have expired, but we may be running too early after boot + QTRY_VERIFY_WITH_TIMEOUT(deadline.hasExpired(), 100); + + QCOMPARE(deadline.remainingTime(), qint64(0)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(0)); + QCOMPARE(deadline.deadline(), qint64(0)); + QCOMPARE(deadline.deadlineNSecs(), qint64(0)); + + deadline.setRemainingTime(0, timerType); + QCOMPARE(deadline.remainingTime(), qint64(0)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(0)); + QVERIFY(deadline.deadline() != 0); + QVERIFY(deadline.deadline() != std::numeric_limits::max()); + QVERIFY(deadline.deadlineNSecs() != 0); + QVERIFY(deadline.deadlineNSecs() != std::numeric_limits::max()); + + deadline.setPreciseRemainingTime(0, 0, timerType); + QCOMPARE(deadline.remainingTime(), qint64(0)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(0)); + QVERIFY(deadline.deadline() != 0); + QVERIFY(deadline.deadline() != std::numeric_limits::max()); + QVERIFY(deadline.deadlineNSecs() != 0); + QVERIFY(deadline.deadlineNSecs() != std::numeric_limits::max()); + + deadline.setDeadline(0, timerType); + QCOMPARE(deadline.remainingTime(), qint64(0)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(0)); + QCOMPARE(deadline.deadline(), qint64(0)); + QCOMPARE(deadline.deadlineNSecs(), qint64(0)); + + deadline.setPreciseDeadline(0, 0, timerType); + QCOMPARE(deadline.remainingTime(), qint64(0)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(0)); + QCOMPARE(deadline.deadline(), qint64(0)); + QCOMPARE(deadline.deadlineNSecs(), qint64(0)); +} + +void tst_QDeadlineTimer::foreverness() +{ + QFETCH_GLOBAL(Qt::TimerType, timerType); + // we don't check whether timerType() is our type since it's possible it detects it's forever + + QDeadlineTimer deadline = QDeadlineTimer::Forever; + QCOMPARE(deadline.timerType(), Qt::CoarseTimer); + QVERIFY(deadline.isForever()); + QVERIFY(!deadline.hasExpired()); + QCOMPARE(deadline.remainingTime(), qint64(-1)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1)); + QCOMPARE(deadline.deadline(), std::numeric_limits::max()); + QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits::max()); + + deadline = QDeadlineTimer(-1, timerType); + QVERIFY(deadline.isForever()); + QVERIFY(!deadline.hasExpired()); + QCOMPARE(deadline.remainingTime(), qint64(-1)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1)); + QCOMPARE(deadline.deadline(), std::numeric_limits::max()); + QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits::max()); + + deadline.setRemainingTime(-1, timerType); + QVERIFY(deadline.isForever()); + QVERIFY(!deadline.hasExpired()); + QCOMPARE(deadline.remainingTime(), qint64(-1)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1)); + QCOMPARE(deadline.deadline(), std::numeric_limits::max()); + QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits::max()); + + deadline.setPreciseRemainingTime(-1, 0, timerType); + QVERIFY(deadline.isForever()); + QVERIFY(!deadline.hasExpired()); + QCOMPARE(deadline.remainingTime(), qint64(-1)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1)); + QCOMPARE(deadline.deadline(), std::numeric_limits::max()); + QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits::max()); + + deadline.setPreciseRemainingTime(-1, -1, timerType); + QVERIFY(deadline.isForever()); + QVERIFY(!deadline.hasExpired()); + QCOMPARE(deadline.remainingTime(), qint64(-1)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1)); + QCOMPARE(deadline.deadline(), std::numeric_limits::max()); + QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits::max()); + + deadline.setDeadline(std::numeric_limits::max(), timerType); + QVERIFY(deadline.isForever()); + QVERIFY(!deadline.hasExpired()); + QCOMPARE(deadline.remainingTime(), qint64(-1)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1)); + QCOMPARE(deadline.deadline(), std::numeric_limits::max()); + QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits::max()); + + deadline.setPreciseDeadline(std::numeric_limits::max(), 0, timerType); + QVERIFY(deadline.isForever()); + QVERIFY(!deadline.hasExpired()); + QCOMPARE(deadline.remainingTime(), qint64(-1)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1)); + QCOMPARE(deadline.deadline(), std::numeric_limits::max()); + QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits::max()); + + QCOMPARE(deadline, deadline); + QVERIFY(!(deadline < deadline)); + QVERIFY(deadline <= deadline); + QVERIFY(deadline >= deadline); + QVERIFY(!(deadline > deadline)); + + // adding to forever must still be forever + QDeadlineTimer deadline2 = deadline + 1; + QVERIFY(deadline2.isForever()); + QVERIFY(!deadline2.hasExpired()); + QCOMPARE(deadline2.remainingTime(), qint64(-1)); + QCOMPARE(deadline2.remainingTimeNSecs(), qint64(-1)); + QCOMPARE(deadline2.deadline(), std::numeric_limits::max()); + QCOMPARE(deadline2.deadlineNSecs(), std::numeric_limits::max()); + QCOMPARE(deadline2.timerType(), deadline.timerType()); + + QCOMPARE(deadline2 - deadline, qint64(0)); + QCOMPARE(deadline2, deadline); + QVERIFY(!(deadline2 < deadline)); + QVERIFY(deadline2 <= deadline); + QVERIFY(deadline2 >= deadline); + QVERIFY(!(deadline2 > deadline)); + + // subtracting from forever is *also* forever + deadline2 = deadline - 1; + QVERIFY(deadline2.isForever()); + QVERIFY(!deadline2.hasExpired()); + QCOMPARE(deadline2.remainingTime(), qint64(-1)); + QCOMPARE(deadline2.remainingTimeNSecs(), qint64(-1)); + QCOMPARE(deadline2.deadline(), std::numeric_limits::max()); + QCOMPARE(deadline2.deadlineNSecs(), std::numeric_limits::max()); + QCOMPARE(deadline2.timerType(), deadline.timerType()); + + QCOMPARE(deadline2 - deadline, qint64(0)); + QCOMPARE(deadline2, deadline); + QVERIFY(!(deadline2 < deadline)); + QVERIFY(deadline2 <= deadline); + QVERIFY(deadline2 >= deadline); + QVERIFY(!(deadline2 > deadline)); + + // compare and order against a default-constructed object + QDeadlineTimer expired; + QVERIFY(!(deadline == expired)); + QVERIFY(deadline != expired); + QVERIFY(!(deadline < expired)); + QVERIFY(!(deadline <= expired)); + QVERIFY(deadline >= expired); + QVERIFY(deadline > expired); +} + +void tst_QDeadlineTimer::current() +{ + QFETCH_GLOBAL(Qt::TimerType, timerType); + auto deadline = QDeadlineTimer::current(timerType); + QVERIFY(deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QCOMPARE(deadline.remainingTime(), qint64(0)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(0)); + QVERIFY(deadline.deadline() != 0); + QVERIFY(deadline.deadline() != std::numeric_limits::max()); + QVERIFY(deadline.deadlineNSecs() != 0); + QVERIFY(deadline.deadlineNSecs() != std::numeric_limits::max()); + + // subtracting from current should be "more expired" + QDeadlineTimer earlierDeadline = deadline - 1; + QVERIFY(earlierDeadline.hasExpired()); + QVERIFY(!earlierDeadline.isForever()); + QCOMPARE(earlierDeadline.timerType(), timerType); + QCOMPARE(earlierDeadline.remainingTime(), qint64(0)); + QCOMPARE(earlierDeadline.remainingTimeNSecs(), qint64(0)); + QVERIFY(earlierDeadline.deadline() != 0); + QVERIFY(earlierDeadline.deadline() != std::numeric_limits::max()); + QVERIFY(earlierDeadline.deadlineNSecs() != 0); + QVERIFY(earlierDeadline.deadlineNSecs() != std::numeric_limits::max()); + QCOMPARE(earlierDeadline.deadline(), deadline.deadline() - 1); + QCOMPARE(earlierDeadline.deadlineNSecs(), deadline.deadlineNSecs() - 1000*1000); + + QCOMPARE(earlierDeadline - deadline, qint64(-1)); + QVERIFY(earlierDeadline != deadline); + QVERIFY(earlierDeadline < deadline); + QVERIFY(earlierDeadline <= deadline); + QVERIFY(!(earlierDeadline >= deadline)); + QVERIFY(!(earlierDeadline > deadline)); +} + +void tst_QDeadlineTimer::deadlines() +{ + QFETCH_GLOBAL(Qt::TimerType, timerType); + + QDeadlineTimer deadline(4 * minResolution, timerType); + QVERIFY(!deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QVERIFY(deadline.remainingTime() > (3 * minResolution)); + QVERIFY(deadline.remainingTime() <= (4 * minResolution)); + QVERIFY(deadline.remainingTimeNSecs() > (3000000 * minResolution)); + QVERIFY(deadline.remainingTimeNSecs() <= (4000000 * minResolution)); + QVERIFY(deadline.deadline() != 0); + QVERIFY(deadline.deadline() != std::numeric_limits::max()); + QVERIFY(deadline.deadlineNSecs() != 0); + QVERIFY(deadline.deadlineNSecs() != std::numeric_limits::max()); + + deadline.setRemainingTime(4 * minResolution, timerType); + QVERIFY(!deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QVERIFY(deadline.remainingTime() > (3 * minResolution)); + QVERIFY(deadline.remainingTime() <= (4 * minResolution)); + QVERIFY(deadline.remainingTimeNSecs() > (3000000 * minResolution)); + QVERIFY(deadline.remainingTimeNSecs() <= (4000000 * minResolution)); + QVERIFY(deadline.deadline() != 0); + QVERIFY(deadline.deadline() != std::numeric_limits::max()); + QVERIFY(deadline.deadlineNSecs() != 0); + QVERIFY(deadline.deadlineNSecs() != std::numeric_limits::max()); + + deadline.setPreciseRemainingTime(0, 4000000 * minResolution, timerType); + QVERIFY(!deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QVERIFY(deadline.remainingTime() > (3 * minResolution)); + QVERIFY(deadline.remainingTime() <= (4 * minResolution)); + QVERIFY(deadline.remainingTimeNSecs() > (3000000 * minResolution)); + QVERIFY(deadline.remainingTimeNSecs() <= (4000000 * minResolution)); + QVERIFY(deadline.deadline() != 0); + QVERIFY(deadline.deadline() != std::numeric_limits::max()); + QVERIFY(deadline.deadlineNSecs() != 0); + QVERIFY(deadline.deadlineNSecs() != std::numeric_limits::max()); + + deadline.setPreciseRemainingTime(1, 0, timerType); // 1 sec + QVERIFY(!deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QVERIFY(deadline.remainingTime() > (1000 - minResolution)); + QVERIFY(deadline.remainingTime() <= 1000); + QVERIFY(deadline.remainingTimeNSecs() > (1000 - minResolution)*1000*1000); + QVERIFY(deadline.remainingTimeNSecs() <= (1000*1000*1000)); + QVERIFY(deadline.deadline() != 0); + QVERIFY(deadline.deadline() != std::numeric_limits::max()); + QVERIFY(deadline.deadlineNSecs() != 0); + QVERIFY(deadline.deadlineNSecs() != std::numeric_limits::max()); + + // adding to a future deadline must still be further in the future + QDeadlineTimer laterDeadline = deadline + 1; + QVERIFY(!laterDeadline.hasExpired()); + QVERIFY(!laterDeadline.isForever()); + QCOMPARE(laterDeadline.timerType(), timerType); + QVERIFY(laterDeadline.remainingTime() > (1000 - minResolution)); + QVERIFY(laterDeadline.remainingTime() <= 1001); + QVERIFY(laterDeadline.remainingTimeNSecs() > (1001 - minResolution)*1000*1000); + QVERIFY(laterDeadline.remainingTimeNSecs() <= (1001*1000*1000)); + QVERIFY(laterDeadline.deadline() != 0); + QVERIFY(laterDeadline.deadline() != std::numeric_limits::max()); + QVERIFY(laterDeadline.deadlineNSecs() != 0); + QVERIFY(laterDeadline.deadlineNSecs() != std::numeric_limits::max()); + QCOMPARE(laterDeadline.deadline(), deadline.deadline() + 1); + QCOMPARE(laterDeadline.deadlineNSecs(), deadline.deadlineNSecs() + 1000*1000); + + QCOMPARE(laterDeadline - deadline, qint64(1)); + QVERIFY(laterDeadline != deadline); + QVERIFY(!(laterDeadline < deadline)); + QVERIFY(!(laterDeadline <= deadline)); + QVERIFY(laterDeadline >= deadline); + QVERIFY(laterDeadline > deadline); + + // compare and order against a default-constructed object + QDeadlineTimer expired; + QVERIFY(!(deadline == expired)); + QVERIFY(deadline != expired); + QVERIFY(!(deadline < expired)); + QVERIFY(!(deadline <= expired)); + QVERIFY(deadline >= expired); + QVERIFY(deadline > expired); + + // compare and order against a forever deadline + QDeadlineTimer forever_(QDeadlineTimer::Forever); + QVERIFY(!(deadline == forever_)); + QVERIFY(deadline != forever_); + QVERIFY(deadline < forever_); + QVERIFY(deadline <= forever_); + QVERIFY(!(deadline >= forever_)); + QVERIFY(!(deadline > forever_)); +} + +void tst_QDeadlineTimer::setDeadline() +{ + QFETCH_GLOBAL(Qt::TimerType, timerType); + auto now = QDeadlineTimer::current(timerType); + QDeadlineTimer deadline; + + deadline.setDeadline(now.deadline(), timerType); + QVERIFY(deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QCOMPARE(deadline.remainingTime(), qint64(0)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(0)); + QCOMPARE(deadline.deadline(), now.deadline()); + // don't check deadlineNSecs! + + deadline.setPreciseDeadline(now.deadlineNSecs() / (1000 * 1000 * 1000), + now.deadlineNSecs() % (1000 * 1000 * 1000), timerType); + QVERIFY(deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QCOMPARE(deadline.remainingTime(), qint64(0)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(0)); + QCOMPARE(deadline.deadline(), now.deadline()); + QCOMPARE(deadline.deadlineNSecs(), now.deadlineNSecs()); + + now = QDeadlineTimer::current(timerType); + deadline.setDeadline(now.deadline() + 4 * minResolution, timerType); + QVERIFY(!deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QVERIFY(deadline.remainingTime() > (3 * minResolution)); + QVERIFY(deadline.remainingTime() <= (4 * minResolution)); + QVERIFY(deadline.remainingTimeNSecs() > (3000000 * minResolution)); + QVERIFY(deadline.remainingTimeNSecs() <= (4000000 * minResolution)); + QCOMPARE(deadline.deadline(), now.deadline() + 4 * minResolution); // yes, it's exact + // don't check deadlineNSecs! + + now = QDeadlineTimer::current(timerType); + qint64 nsec = now.deadlineNSecs() + 4000000 * minResolution; + deadline.setPreciseDeadline(nsec / (1000 * 1000 * 1000), + nsec % (1000 * 1000 * 1000), timerType); + QVERIFY(!deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QVERIFY(deadline.remainingTime() > (3 * minResolution)); + QVERIFY(deadline.remainingTime() <= (4 * minResolution)); + QVERIFY(deadline.remainingTimeNSecs() > (3000000 * minResolution)); + QVERIFY(deadline.remainingTimeNSecs() <= (4000000 * minResolution)); + QCOMPARE(deadline.deadline(), nsec / (1000 * 1000)); + QCOMPARE(deadline.deadlineNSecs(), nsec); +} + +void tst_QDeadlineTimer::expire() +{ + QFETCH_GLOBAL(Qt::TimerType, timerType); + + QDeadlineTimer deadline(minResolution, timerType); + QVERIFY(!deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + + qint64 previousDeadline = deadline.deadlineNSecs(); + + QTest::qSleep(2 * minResolution); + + QCOMPARE(deadline.remainingTime(), qint64(0)); + QCOMPARE(deadline.remainingTimeNSecs(), qint64(0)); + QVERIFY(deadline.deadline() != 0); + QVERIFY(deadline.deadline() != std::numeric_limits::max()); + QVERIFY(deadline.deadlineNSecs() != 0); + QVERIFY(deadline.deadlineNSecs() != std::numeric_limits::max()); + QCOMPARE(deadline.deadlineNSecs(), previousDeadline); +} + +void tst_QDeadlineTimer::stdchrono() +{ +#if !QT_HAS_INCLUDE() + QSKIP("std::chrono not found on this system"); +#else + using namespace std::chrono; + QFETCH_GLOBAL(Qt::TimerType, timerType); + + // create some forevers + QDeadlineTimer deadline = milliseconds::max(); + QVERIFY(deadline.isForever()); + deadline = milliseconds::max(); + QVERIFY(deadline.isForever()); + deadline.setRemainingTime(milliseconds::max(), timerType); + QVERIFY(deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + deadline = nanoseconds::max(); + QVERIFY(deadline.isForever()); + deadline.setRemainingTime(nanoseconds::max(), timerType); + QVERIFY(deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + deadline = hours::max(); + QVERIFY(deadline.isForever()); + deadline.setRemainingTime(hours::max(), timerType); + QVERIFY(deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + + deadline = time_point::max(); + QVERIFY(deadline.isForever()); + deadline.setDeadline(time_point::max(), timerType); + QVERIFY(deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + deadline = time_point::max(); + QVERIFY(deadline.isForever()); + deadline.setDeadline(time_point::max(), timerType); + QVERIFY(deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + + QVERIFY(deadline == time_point::max()); + QVERIFY(deadline == time_point::max()); + QCOMPARE(deadline.remainingTimeAsDuration(), nanoseconds::max()); + + // make it expired + deadline = time_point(); + QVERIFY(deadline.hasExpired()); + deadline.setDeadline(time_point(), timerType); + QVERIFY(deadline.hasExpired()); + QCOMPARE(deadline.timerType(), timerType); + deadline = time_point(); + QVERIFY(deadline.hasExpired()); + deadline.setDeadline(time_point(), timerType); + QVERIFY(deadline.hasExpired()); + QCOMPARE(deadline.timerType(), timerType); + + QCOMPARE(deadline.remainingTimeAsDuration(), nanoseconds::zero()); + + auto steady_before = steady_clock::now(); + auto system_before = system_clock::now(); + + QTest::qSleep(minResolution); + auto now = QDeadlineTimer::current(timerType); + QTest::qSleep(minResolution); + + auto steady_after = steady_clock::now(); + auto system_after = system_clock::now(); + + { + auto diff = duration_cast(steady_after - now.deadline()); + QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count()))); + QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count()))); + QDeadlineTimer dt_after(steady_after, timerType); + QVERIFY2(now < dt_after, + ("now = " + QLocale().toString(now.deadlineNSecs()) + + "; after = " + QLocale().toString(dt_after.deadlineNSecs())).toLatin1()); + + diff = duration_cast(now.deadline() - steady_before); + QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count()))); + QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count()))); + QDeadlineTimer dt_before(steady_before, timerType); + QVERIFY2(now > dt_before, + ("now = " + QLocale().toString(now.deadlineNSecs()) + + "; before = " + QLocale().toString(dt_before.deadlineNSecs())).toLatin1()); + } + { + auto diff = duration_cast(system_after - now.deadline()); + QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count()))); + QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count()))); + QDeadlineTimer dt_after(system_after, timerType); + QVERIFY2(now < dt_after, + ("now = " + QLocale().toString(now.deadlineNSecs()) + + "; after = " + QLocale().toString(dt_after.deadlineNSecs())).toLatin1()); + + diff = duration_cast(now.deadline() - system_before); + QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count()))); + QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count()))); + QDeadlineTimer dt_before(system_before, timerType); + QVERIFY2(now > dt_before, + ("now = " + QLocale().toString(now.deadlineNSecs()) + + "; before = " + QLocale().toString(dt_before.deadlineNSecs())).toLatin1()); + } + + // make it regular + now = QDeadlineTimer::current(timerType); + deadline.setRemainingTime(milliseconds(4 * minResolution), timerType); + QVERIFY(!deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QVERIFY(deadline.remainingTimeAsDuration() > milliseconds(3 * minResolution)); + QVERIFY(deadline.remainingTimeAsDuration() < milliseconds(5 * minResolution)); + QVERIFY(deadline.remainingTimeAsDuration() > nanoseconds(3000000 * minResolution)); + QVERIFY(deadline.remainingTimeAsDuration() < nanoseconds(5000000 * minResolution)); + QVERIFY(deadline.deadline() > (steady_clock::now() + milliseconds(3 * minResolution))); + QVERIFY(deadline.deadline() < (steady_clock::now() + milliseconds(5 * minResolution))); + QVERIFY(deadline.deadline() > (system_clock::now() + milliseconds(3 * minResolution))); + QVERIFY(deadline.deadline() < (system_clock::now() + milliseconds(5 * minResolution))); + if (timerType == Qt::CoarseTimer) { + QVERIFY(deadline > (now + milliseconds(3 * minResolution))); + QVERIFY(deadline < (now + milliseconds(5 * minResolution))); + QVERIFY(deadline > (now + nanoseconds(3000000 * minResolution))); + QVERIFY(deadline < (now + nanoseconds(5000000 * minResolution))); + QVERIFY(deadline > milliseconds(3 * minResolution)); + QVERIFY(deadline < milliseconds(5 * minResolution)); + QVERIFY(deadline > nanoseconds(3000000 * minResolution)); + QVERIFY(deadline < nanoseconds(5000000 * minResolution)); + QVERIFY(deadline >= steady_clock::now()); + QVERIFY(deadline >= system_clock::now()); + } + + now = QDeadlineTimer::current(timerType); + deadline = QDeadlineTimer(seconds(1), timerType); + QVERIFY(!deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QVERIFY(deadline.remainingTimeAsDuration() > (seconds(1) - milliseconds(minResolution))); + QVERIFY(deadline.remainingTimeAsDuration() <= seconds(1)); + QVERIFY(deadline.deadline() > (steady_clock::now() + seconds(1) - milliseconds(minResolution))); + QVERIFY(deadline.deadline() <= (steady_clock::now() + seconds(1) + milliseconds(minResolution))); + QVERIFY(deadline.deadline() > (system_clock::now() + seconds(1) - milliseconds(minResolution))); + QVERIFY(deadline.deadline() <= (system_clock::now() + seconds(1) + milliseconds(minResolution))); + if (timerType == Qt::CoarseTimer) { + QVERIFY(deadline > (seconds(1) - milliseconds(minResolution))); + QVERIFY(deadline <= seconds(1)); + } + + now = QDeadlineTimer::current(timerType); + deadline.setRemainingTime(hours(1), timerType); + QVERIFY(!deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QVERIFY(deadline.remainingTimeAsDuration() > (hours(1) - milliseconds(minResolution))); + QVERIFY(deadline.remainingTimeAsDuration() <= hours(1)); + QVERIFY(deadline.deadline() > (steady_clock::now() + hours(1) - milliseconds(minResolution))); + QVERIFY(deadline.deadline() <= (steady_clock::now() + hours(1) + milliseconds(minResolution))); + QVERIFY(deadline.deadline() > (system_clock::now() + hours(1) - milliseconds(minResolution))); + QVERIFY(deadline.deadline() <= (system_clock::now() + hours(1) + milliseconds(minResolution))); + + now = QDeadlineTimer::current(timerType); + deadline.setDeadline(system_clock::now() + seconds(1), timerType); + QVERIFY(!deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QVERIFY(deadline.remainingTimeAsDuration() > (seconds(1) - milliseconds(minResolution))); + QVERIFY(deadline.remainingTimeAsDuration() <= seconds(1)); + QVERIFY(deadline.deadline() > (steady_clock::now() + seconds(1) - milliseconds(minResolution))); + QVERIFY(deadline.deadline() <= (steady_clock::now() + seconds(1) + milliseconds(minResolution))); + QVERIFY(deadline.deadline() > (system_clock::now() + seconds(1) - milliseconds(minResolution))); + QVERIFY(deadline.deadline() <= (system_clock::now() + seconds(1) + milliseconds(minResolution))); + + now = QDeadlineTimer::current(timerType); + deadline.setDeadline(steady_clock::now() + seconds(1), timerType); + QVERIFY(!deadline.hasExpired()); + QVERIFY(!deadline.isForever()); + QCOMPARE(deadline.timerType(), timerType); + QVERIFY(deadline.remainingTimeAsDuration() > (seconds(1) - milliseconds(minResolution))); + QVERIFY(deadline.remainingTimeAsDuration() <= seconds(1)); + QVERIFY(deadline.deadline() > (steady_clock::now() + seconds(1) - milliseconds(minResolution))); + QVERIFY(deadline.deadline() <= (steady_clock::now() + seconds(1) + milliseconds(minResolution))); + QVERIFY(deadline.deadline() > (system_clock::now() + seconds(1) - milliseconds(minResolution))); + QVERIFY(deadline.deadline() <= (system_clock::now() + seconds(1) + milliseconds(minResolution))); +#endif +} + +QTEST_MAIN(tst_QDeadlineTimer) + +#include "tst_qdeadlinetimer.moc" From bdc16cce7972cdd0bd02b58077a8dd465036632c Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 15 Aug 2016 08:44:54 +0200 Subject: [PATCH 165/236] HTTP/2 - fix QT_NO_SSL build Recently enabled cleartext fails to build with QT_NO_SSL - fix test and QNAM. Change-Id: I467edab8e4eb5113715ad2d3b3022e0d8c027de8 Reviewed-by: Simon Hausmann --- src/network/access/qhttpnetworkconnection.cpp | 13 ++++------ .../access/qhttpnetworkconnectionchannel.cpp | 26 +++++++++---------- .../access/qhttpnetworkconnectionchannel_p.h | 2 +- tests/auto/network/access/http2/http2srv.cpp | 3 ++- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 09cea8e7697..74fc23957cf 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -86,7 +86,7 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &host , channelCount((type == QHttpNetworkConnection::ConnectionTypeSPDY || type == QHttpNetworkConnection::ConnectionTypeHTTP2) ? 1 : defaultHttpChannelCount) #else -, channelCount(defaultHttpChannelCount) +, channelCount(type == QHttpNetworkConnection::ConnectionTypeHTTP2 ? 1 : defaultHttpChannelCount) #endif // QT_NO_SSL #ifndef QT_NO_NETWORKPROXY , networkProxy(QNetworkProxy::NoProxy) @@ -619,13 +619,11 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor break; } } -#ifndef QT_NO_SSL - else { // SPDY + else { // SPDY, HTTP/2 if (!pair.second->d_func()->requestIsPrepared) prepareRequest(pair); channels[0].spdyRequestsToSend.insertMulti(request.priority(), pair); } -#endif // QT_NO_SSL // For Happy Eyeballs the networkLayerState is set to Unknown // untill we have started the first connection attempt. So no @@ -1013,9 +1011,9 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() } break; } - case QHttpNetworkConnection::ConnectionTypeSPDY: - case QHttpNetworkConnection::ConnectionTypeHTTP2: { -#ifndef QT_NO_SSL + case QHttpNetworkConnection::ConnectionTypeHTTP2: + case QHttpNetworkConnection::ConnectionTypeSPDY: { + if (channels[0].spdyRequestsToSend.isEmpty()) return; @@ -1027,7 +1025,6 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() if (channels[0].socket && channels[0].socket->state() == QAbstractSocket::ConnectedState && !channels[0].pendingEncrypt) channels[0].sendRequest(); -#endif // QT_NO_SSL break; } } diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 3317b9e5b92..ee155bdbed9 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -1039,6 +1039,19 @@ void QHttpNetworkConnectionChannel::_q_uploadDataReadyRead() sendRequest(); } +void QHttpNetworkConnectionChannel::emitFinishedWithError(QNetworkReply::NetworkError error, + const char *message) +{ + if (reply) + emit reply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message)); + QList spdyPairs = spdyRequestsToSend.values(); + for (int a = 0; a < spdyPairs.count(); ++a) { + QHttpNetworkReply *currentReply = spdyPairs.at(a).second; + Q_ASSERT(currentReply); + emit currentReply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message)); + } +} + #ifndef QT_NO_SSL void QHttpNetworkConnectionChannel::_q_encrypted() { @@ -1113,19 +1126,6 @@ void QHttpNetworkConnectionChannel::requeueSpdyRequests() spdyRequestsToSend.clear(); } -void QHttpNetworkConnectionChannel::emitFinishedWithError(QNetworkReply::NetworkError error, - const char *message) -{ - if (reply) - emit reply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message)); - QList spdyPairs = spdyRequestsToSend.values(); - for (int a = 0; a < spdyPairs.count(); ++a) { - QHttpNetworkReply *currentReply = spdyPairs.at(a).second; - Q_ASSERT(currentReply); - emit currentReply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message)); - } -} - void QHttpNetworkConnectionChannel::_q_sslErrors(const QList &errors) { if (!socket) diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h index 48f10d62862..61aea9d35d2 100644 --- a/src/network/access/qhttpnetworkconnectionchannel_p.h +++ b/src/network/access/qhttpnetworkconnectionchannel_p.h @@ -133,9 +133,9 @@ public: void ignoreSslErrors(const QList &errors); void setSslConfiguration(const QSslConfiguration &config); void requeueSpdyRequests(); // when we wanted SPDY but got HTTP +#endif // to emit the signal for all in-flight replies: void emitFinishedWithError(QNetworkReply::NetworkError error, const char *message); -#endif #ifndef QT_NO_BEARERMANAGEMENT QSharedPointer networkSession; #endif diff --git a/tests/auto/network/access/http2/http2srv.cpp b/tests/auto/network/access/http2/http2srv.cpp index 480fe3467e4..9bc7c388751 100644 --- a/tests/auto/network/access/http2/http2srv.cpp +++ b/tests/auto/network/access/http2/http2srv.cpp @@ -35,10 +35,11 @@ #ifndef QT_NO_SSL #include +#include #include #endif -#include +#include #include #include From a5e89005445ac8ca18ac046eaf55fe2230e47cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 23 Jun 2016 12:04:48 +0200 Subject: [PATCH 166/236] Cocoa: Make qt_mac_toCGImageMask be self contained Remove qt_mac_deleteImage and qt_mac_toCGImageMask which are not used elsewhere. Change-Id: Idd3177d4c521eea318b58dc664efe6907896d022 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 8601e222ec4..6c6bc3e4ebf 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -111,23 +111,13 @@ CGImageRef qt_mac_toCGImage(const QImage &inImage) return inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied).toCGImage(); } -static void qt_mac_deleteImage(void *image, const void *, size_t) -{ - delete static_cast(image); -} - -// Creates a CGDataProvider with the data from the given image. -// The data provider retains a copy of the image. -CGDataProviderRef qt_mac_CGDataProvider(const QImage &image) -{ - return CGDataProviderCreateWithData(new QImage(image), image.bits(), - image.byteCount(), qt_mac_deleteImage); -} - - CGImageRef qt_mac_toCGImageMask(const QImage &image) { - QCFType dataProvider = qt_mac_CGDataProvider(image); + static const auto deleter = [](void *image, const void *, size_t) { delete static_cast(image); }; + QCFType dataProvider = + CGDataProviderCreateWithData(new QImage(image), image.bits(), + image.byteCount(), deleter); + return CGImageMaskCreate(image.width(), image.height(), 8, image.depth(), image.bytesPerLine(), dataProvider, NULL, false); } From 6cc02ce6c85d3dbd49a55060bd21a8359884786f Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 15 Aug 2016 14:42:27 +0200 Subject: [PATCH 167/236] Fix qmldir copying in debug and release builds on Windows In a parallel build we may end up copying the qmldir file at the same time, which doesn't work on Windows due to file locking. Apply the same guard for the copying condition as in commit 770a0c91f3fadcdb132d9eb96d085aafbe1bacd0. Change-Id: Ia34395e8654acf192b94e7ea6d0137730e4ea027 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qml_module.prf | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf index fb006efb654..6b08ea3a1a7 100644 --- a/mkspecs/features/qml_module.prf +++ b/mkspecs/features/qml_module.prf @@ -46,11 +46,13 @@ else: qmldir.files = $$qmldir_file qmldir.path = $$instbase/$$TARGETPATH INSTALLS += qmldir -!prefix_build { - COPIES += qmldir -} else { - # For non-installed static builds, qmlimportscanner needs qmldir file in build dir - qmldir2build.files = $$qmldir_file - qmldir2build.path = $$DESTDIR - COPIES += qmldir2build +!debug_and_release|!build_all|CONFIG(release, debug|release) { + !prefix_build { + COPIES += qmldir + } else { + # For non-installed static builds, qmlimportscanner needs qmldir file in build dir + qmldir2build.files = $$qmldir_file + qmldir2build.path = $$DESTDIR + COPIES += qmldir2build + } } From 2e2b32a9ab459f6618d02e4b454c75a787172def Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 13 Aug 2016 17:17:56 +0200 Subject: [PATCH 168/236] QGtk3Dialog::show(): add missing null-check to avoid warnings Or else QObject::connect() warns about 'invalid null parameter' when showing parentless dialogs. Task-number: QTBUG-55298 Change-Id: I39b1dfc81e5da0c793c86cff763f946db15c13ae Reviewed-by: Dmitry Shachnev Reviewed-by: Shawn Rutledge --- src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp index a21b4d8a65e..ced5fe7086c 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp @@ -117,8 +117,10 @@ void QGtk3Dialog::exec() bool QGtk3Dialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) { - connect(parent, &QWindow::destroyed, this, &QGtk3Dialog::onParentWindowDestroyed, - Qt::UniqueConnection); + if (parent) { + connect(parent, &QWindow::destroyed, this, &QGtk3Dialog::onParentWindowDestroyed, + Qt::UniqueConnection); + } setParent(parent); setFlags(flags); setModality(modality); From 8dc45d5b7cd9637f28b2d872a834266b991bf434 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 27 Jul 2016 12:03:17 +0100 Subject: [PATCH 169/236] Deprecate Q(Persistent)ModelIndex::child MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to how invalid model indices are handled in Qt, child() is unsuitable for general purpose usage. In particular you can never get a top level item in the model because the root model index by definition hasn't got a pointer to the model it belongs. That makes child() useless for anything but tree models (and even there you'd need to special case your code anyhow). [ChangeLog][QtCore][QModelIndex] QModelIndex::child has been deprecated due to its lack of generality. Use model->index(row, column, index) instead. [ChangeLog][QtCore][QPersistentModelIndex] QPersistentModelIndex::child has been deprecated due to its lack of generality. Use model->index(row, column, index) instead. Change-Id: Ice73c17133aaf71355fa2af1eacfe64da01bd456 Reviewed-by: Thorbjørn Lund Martsum Reviewed-by: David Faure --- src/corelib/itemmodels/qabstractitemmodel.cpp | 20 ++++++++++++++----- src/corelib/itemmodels/qabstractitemmodel.h | 10 ++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 54ea45782d1..7fdf107383e 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -364,7 +364,7 @@ quintptr QPersistentModelIndex::internalId() const Returns the parent QModelIndex for this persistent index, or an invalid QModelIndex if it has no parent. - \sa child(), sibling(), model() + \sa sibling(), model() */ QModelIndex QPersistentModelIndex::parent() const { @@ -377,7 +377,7 @@ QModelIndex QPersistentModelIndex::parent() const Returns the sibling at \a row and \a column or an invalid QModelIndex if there is no sibling at this position. - \sa parent(), child() + \sa parent() */ QModelIndex QPersistentModelIndex::sibling(int row, int column) const @@ -387,7 +387,12 @@ QModelIndex QPersistentModelIndex::sibling(int row, int column) const return QModelIndex(); } +#if QT_DEPRECATED_SINCE(5, 8) /*! + \obsolete + + Use QAbstractItemModel::index() instead. + Returns the child of the model index that is stored in the given \a row and \a column. @@ -397,9 +402,10 @@ QModelIndex QPersistentModelIndex::sibling(int row, int column) const QModelIndex QPersistentModelIndex::child(int row, int column) const { if (d) - return d->index.child(row, column); + return d->index.model()->index(row, column, d->index); return QModelIndex(); } +#endif /*! Returns the data for the given \a role for the item referred to by the @@ -1099,12 +1105,16 @@ void QAbstractItemModel::resetInternalData() Returns the sibling at \a row and \a column. If there is no sibling at this position, an invalid QModelIndex is returned. - \sa parent(), child() + \sa parent() */ /*! \fn QModelIndex QModelIndex::child(int row, int column) const + \obsolete + + Use QAbstractItemModel::index() instead. + Returns the child of the model index that is stored in the given \a row and \a column. @@ -1153,7 +1163,7 @@ void QAbstractItemModel::resetInternalData() Returns the parent of the model index, or QModelIndex() if it has no parent. - \sa child(), sibling(), model() + \sa sibling(), model() */ /*! diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h index 0820626452c..907ba096762 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.h +++ b/src/corelib/itemmodels/qabstractitemmodel.h @@ -63,7 +63,9 @@ public: inline void *internalPointer() const Q_DECL_NOTHROW { return reinterpret_cast(i); } inline QModelIndex parent() const; inline QModelIndex sibling(int row, int column) const; - inline QModelIndex child(int row, int column) const; +#if QT_DEPRECATED_SINCE(5, 8) + QT_DEPRECATED_X("Use QAbstractItemModel::index") inline QModelIndex child(int row, int column) const; +#endif inline QVariant data(int role = Qt::DisplayRole) const; inline Qt::ItemFlags flags() const; Q_DECL_CONSTEXPR inline const QAbstractItemModel *model() const Q_DECL_NOTHROW { return m; } @@ -128,7 +130,9 @@ public: quintptr internalId() const; QModelIndex parent() const; QModelIndex sibling(int row, int column) const; - QModelIndex child(int row, int column) const; +#if QT_DEPRECATED_SINCE(5, 8) + QT_DEPRECATED_X("Use QAbstractItemModel::index") QModelIndex child(int row, int column) const; +#endif QVariant data(int role = Qt::DisplayRole) const; Qt::ItemFlags flags() const; const QAbstractItemModel *model() const; @@ -419,8 +423,10 @@ inline QModelIndex QModelIndex::parent() const inline QModelIndex QModelIndex::sibling(int arow, int acolumn) const { return m ? (r == arow && c == acolumn) ? *this : m->sibling(arow, acolumn, *this) : QModelIndex(); } +#if QT_DEPRECATED_SINCE(5, 8) inline QModelIndex QModelIndex::child(int arow, int acolumn) const { return m ? m->index(arow, acolumn, *this) : QModelIndex(); } +#endif inline QVariant QModelIndex::data(int arole) const { return m ? m->data(*this, arole) : QVariant(); } From ff00b2efbd359b1241dfdc4caf325d8f4b7e6118 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 16 Aug 2016 09:03:31 +0200 Subject: [PATCH 170/236] Add " We mean it" comment to qdeadlinetimer_p.h Fix warning: QtCore: WARNING: qtbase/src/corelib/kernel/qdeadlinetimer_p.h does not have the "We mean it." warning Amends change 12eacc3bab00f23d187a295b35e4a0d283ba85f4 Change-Id: Ibb8fd25cee0249380996ae271200055e131d359b Reviewed-by: Lars Knoll --- src/corelib/kernel/qdeadlinetimer_p.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/corelib/kernel/qdeadlinetimer_p.h b/src/corelib/kernel/qdeadlinetimer_p.h index 94ded921e1e..46e12de6c1b 100644 --- a/src/corelib/kernel/qdeadlinetimer_p.h +++ b/src/corelib/kernel/qdeadlinetimer_p.h @@ -40,6 +40,17 @@ #ifndef QDEADLINETIMER_P_H #define QDEADLINETIMER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE From 8617ce5c881c7913e144153494b15d60ca0c0e83 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Mon, 11 Jul 2016 16:08:00 +0300 Subject: [PATCH 171/236] Use QStringRef() more, exploiting its new ::chop() Change-Id: Id2201639be604b9a32b2dc5d21e675a961bee477 Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/corelib/io/qurl.cpp | 22 +++++++++++++++------- src/gui/painting/qpagesize.cpp | 2 +- src/gui/text/qcssparser.cpp | 20 ++++++++++++-------- src/gui/text/qzip.cpp | 10 ++++++---- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 9cf1be58d82..42a742213b2 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -833,7 +833,7 @@ recodeFromUser(const QString &input, const ushort *actions, int from, int to) // appendXXXX functions: copy from the internal form to the external, user form. // the internal value is stored in its PrettyDecoded form, so that case is easy. -static inline void appendToUser(QString &appendTo, const QString &value, QUrl::FormattingOptions options, +static inline void appendToUser(QString &appendTo, const QStringRef &value, QUrl::FormattingOptions options, const ushort *actions) { if (options == QUrl::PrettyDecoded) { @@ -841,10 +841,17 @@ static inline void appendToUser(QString &appendTo, const QString &value, QUrl::F return; } - if (!qt_urlRecode(appendTo, value.constData(), value.constEnd(), options, actions)) + if (!qt_urlRecode(appendTo, value.data(), value.end(), options, actions)) appendTo += value; } +static inline void appendToUser(QString &appendTo, const QString &value, QUrl::FormattingOptions options, + const ushort *actions) +{ + appendToUser(appendTo, QStringRef(&value), options, actions); +} + + inline void QUrlPrivate::appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const { if ((options & QUrl::RemoveUserInfo) != QUrl::RemoveUserInfo) { @@ -924,21 +931,22 @@ inline void QUrlPrivate::appendPath(QString &appendTo, QUrl::FormattingOptions o if (options & QUrl::NormalizePathSegments) { thePath = qt_normalizePathSegments(path, false); } + + QStringRef thePathRef(&thePath); if (options & QUrl::RemoveFilename) { const int slash = path.lastIndexOf(QLatin1Char('/')); if (slash == -1) return; - thePath = path.left(slash+1); + thePathRef = path.leftRef(slash + 1); } // check if we need to remove trailing slashes if (options & QUrl::StripTrailingSlash) { - while (thePath.length() > 1 && thePath.endsWith(QLatin1Char('/'))) - thePath.chop(1); + while (thePathRef.length() > 1 && thePathRef.endsWith(QLatin1Char('/'))) + thePathRef.chop(1); } - appendToUser(appendTo, thePath, options, + appendToUser(appendTo, thePathRef, options, appendingTo == FullUrl || options & QUrl::EncodeDelimiters ? pathInUrl : pathInIsolation); - } inline void QUrlPrivate::appendFragment(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp index f53285d9cb3..8831d60d48f 100644 --- a/src/gui/painting/qpagesize.cpp +++ b/src/gui/painting/qpagesize.cpp @@ -400,7 +400,7 @@ static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match { if (ppdKey.isEmpty()) return QPageSize::Custom; - QString key = ppdKey; + QStringRef key(&ppdKey); // Remove any Rotated or Tranverse modifiers if (key.endsWith(QLatin1String("Rotated"))) key.chop(7); diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 72c5d5ff330..8894e4884bf 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -403,8 +403,8 @@ ValueExtractor::ValueExtractor(const QVector &decls, const QPalette LengthData ValueExtractor::lengthValue(const Value& v) { - QString s = v.variant.toString(); - s.reserve(s.length()); + const QString str = v.variant.toString(); + QStringRef s(&str); LengthData data; data.unit = LengthData::None; if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)) @@ -1442,11 +1442,13 @@ bool Declaration::realValue(qreal *real, const char *unit) const const Value &v = d->values.at(0); if (unit && v.type != Value::Length) return false; - QString s = v.variant.toString(); + const QString str = v.variant.toString(); + QStringRef s(&str); if (unit) { - if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive)) + const QLatin1String unitStr(unit); + if (!s.endsWith(unitStr, Qt::CaseInsensitive)) return false; - s.chop(qstrlen(unit)); + s.chop(unitStr.size()); } bool ok = false; qreal val = s.toDouble(&ok); @@ -1459,11 +1461,13 @@ static bool intValueHelper(const QCss::Value &v, int *i, const char *unit) { if (unit && v.type != Value::Length) return false; - QString s = v.variant.toString(); + const QString str = v.variant.toString(); + QStringRef s(&str); if (unit) { - if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive)) + const QLatin1String unitStr(unit); + if (!s.endsWith(unitStr, Qt::CaseInsensitive)) return false; - s.chop(qstrlen(unit)); + s.chop(unitStr.size()); } bool ok = false; int val = s.toInt(&ok); diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp index 7cb89543ba4..b68c36fd9ee 100644 --- a/src/gui/text/qzip.cpp +++ b/src/gui/text/qzip.cpp @@ -498,11 +498,13 @@ QZipReader::FileInfo QZipPrivate::fillFileInfo(int index) const // fix the file path, if broken (convert separators, eat leading and trailing ones) fileInfo.filePath = QDir::fromNativeSeparators(fileInfo.filePath); - while (!fileInfo.filePath.isEmpty() && (fileInfo.filePath.at(0) == QLatin1Char('.') || fileInfo.filePath.at(0) == QLatin1Char('/'))) - fileInfo.filePath = fileInfo.filePath.mid(1); - while (!fileInfo.filePath.isEmpty() && fileInfo.filePath.at(fileInfo.filePath.size() - 1) == QLatin1Char('/')) - fileInfo.filePath.chop(1); + QStringRef filePathRef(&fileInfo.filePath); + while (filePathRef.startsWith(QLatin1Char('.')) || filePathRef.startsWith(QLatin1Char('/'))) + filePathRef = filePathRef.mid(1); + while (filePathRef.endsWith(QLatin1Char('/'))) + filePathRef.chop(1); + fileInfo.filePath = filePathRef.toString(); return fileInfo; } From dee35b5a78b67faed6c33d9839efb698914a9d4b Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Mon, 15 Aug 2016 13:09:39 -0700 Subject: [PATCH 172/236] xcodebuild.mk: explicitly specify the Xcode project to build This fixes the examples build on UIKit platforms in examples/dbus/pingpong where there are two Xcode projects and the build therefore cannot disambiguate between the two. Change-Id: Ic8b808c1ddf3565bb9861a487eab6854ec177184 Reviewed-by: Oswald Buddenhagen Reviewed-by: Gabriel de Dietrich Reviewed-by: Jake Petroules --- mkspecs/features/uikit/xcodebuild.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/uikit/xcodebuild.mk b/mkspecs/features/uikit/xcodebuild.mk index 5cbad608044..48cc85d3921 100644 --- a/mkspecs/features/uikit/xcodebuild.mk +++ b/mkspecs/features/uikit/xcodebuild.mk @@ -83,7 +83,7 @@ DESTINATION_MESSAGE = "Running $(call tolower,$(CONFIGURATION)) $(ACTION) \ xcodebuild-%: @$(if $(DESTINATION_NAME), echo $(DESTINATION_MESSAGE),) - xcodebuild $(ACTION) -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,) + xcodebuild $(ACTION) -project $(TARGET).xcodeproj -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,) xcodebuild-check-device_%: DESTINATION_ID=$(lastword $(subst _, ,$@)) From e708d63e1868942e0a71b15323e836621b7d0c21 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Mon, 15 Aug 2016 13:10:09 -0700 Subject: [PATCH 173/236] Don't build the complexpingpong example on UIKit platforms This example uses QProcess which is not available on UIKit platforms. Change-Id: I126d20369ccf307579a60956de7769e92e17548a Reviewed-by: Oswald Buddenhagen --- examples/dbus/dbus.pro | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/dbus/dbus.pro b/examples/dbus/dbus.pro index 083e442dfbf..afeb1de0d58 100644 --- a/examples/dbus/dbus.pro +++ b/examples/dbus/dbus.pro @@ -2,8 +2,9 @@ requires(qtHaveModule(dbus)) TEMPLATE = subdirs SUBDIRS = listnames \ - pingpong \ - complexpingpong + pingpong + +!uikit: SUBDIRS += complexpingpong qtHaveModule(widgets) { SUBDIRS += chat \ From f1f767da922d4ba09c96a21789f8f470f9b5edf6 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Mon, 15 Aug 2016 13:15:07 -0700 Subject: [PATCH 174/236] Don't build the tests which require helpers on UIKit platforms These tests use helpers, which are not supported on UIKit platforms. Change-Id: I51447754dba2cd2547be05c3767e4ff3b6b5a671 Reviewed-by: Oswald Buddenhagen --- tests/auto/corelib/kernel/kernel.pro | 2 +- tests/auto/gui/kernel/kernel.pro | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro index 3fa244d0753..97c303fdd64 100644 --- a/tests/auto/corelib/kernel/kernel.pro +++ b/tests/auto/corelib/kernel/kernel.pro @@ -40,4 +40,4 @@ SUBDIRS=\ # This test is only applicable on Windows !win32*|winrt: SUBDIRS -= qwineventnotifier -android|uikit: SUBDIRS -= qsharedmemory qsystemsemaphore +android|uikit: SUBDIRS -= qclipboard qobject qsharedmemory qsystemsemaphore diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro index 317d8c1ff92..62a888d6857 100644 --- a/tests/auto/gui/kernel/kernel.pro +++ b/tests/auto/gui/kernel/kernel.pro @@ -35,3 +35,5 @@ win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop qguieventloop !contains(QT_CONFIG, opengl(es2)?): SUBDIRS -= qopenglwindow + +uikit: SUBDIRS -= qclipboard From 5264ddf1e051d3dc2ac2dfb8756226f2c876ab7a Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Mon, 15 Aug 2016 18:50:09 -0700 Subject: [PATCH 175/236] xcodebuild.mk: forward INSTALL_ROOT from make to xcodebuild This allows overriding the INSTALL_ROOT with the Xcode generator. Change-Id: Ifb894bdbf9764918f76428fb32d9af68914853f6 Reviewed-by: Oswald Buddenhagen Reviewed-by: Gabriel de Dietrich Reviewed-by: Jake Petroules --- mkspecs/features/uikit/xcodebuild.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/uikit/xcodebuild.mk b/mkspecs/features/uikit/xcodebuild.mk index 48cc85d3921..b8674947fe3 100644 --- a/mkspecs/features/uikit/xcodebuild.mk +++ b/mkspecs/features/uikit/xcodebuild.mk @@ -83,7 +83,7 @@ DESTINATION_MESSAGE = "Running $(call tolower,$(CONFIGURATION)) $(ACTION) \ xcodebuild-%: @$(if $(DESTINATION_NAME), echo $(DESTINATION_MESSAGE),) - xcodebuild $(ACTION) -project $(TARGET).xcodeproj -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,) + xcodebuild $(ACTION) -project $(TARGET).xcodeproj -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,) $(if $(INSTALL_ROOT), DSTROOT=$(INSTALL_ROOT),) xcodebuild-check-device_%: DESTINATION_ID=$(lastword $(subst _, ,$@)) From 02a03e52f7456009818ec5c3a403242768d4fcf0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 5 Aug 2016 09:05:29 +0200 Subject: [PATCH 176/236] QCocoaFileIconEngine: Add icon size 256 Change-Id: Ib36025f802404f74f6ce5494f3858dfe0e283004 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoatheme.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 3a3d634f5ae..cb8ffee5565 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -287,7 +287,8 @@ public: const qreal devicePixelRatio = qGuiApp->devicePixelRatio(); const int sizes[] = { qRound(16 * devicePixelRatio), qRound(32 * devicePixelRatio), - qRound(64 * devicePixelRatio), qRound(128 * devicePixelRatio) + qRound(64 * devicePixelRatio), qRound(128 * devicePixelRatio), + qRound(256 * devicePixelRatio) }; return QAbstractFileIconEngine::toSizeList(sizes, sizes + sizeof(sizes) / sizeof(sizes[0])); } From 3c5b9977cde8ede3377fc5c53faaf19c258256a6 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 17 Aug 2016 12:27:31 +0200 Subject: [PATCH 177/236] HTTP/2 - do not set END_HEADERS if we have CONTINUATIONs Setting END_HEADERS flag on a HEADERS frame means we do not have CONTINUATION frame(s). So do NOT set it too early, only if we fit into a single frame. Change-Id: I891a2db227cee59e4eacfe7c2f18b431cd85fe47 Reviewed-by: Edward Welbourne --- src/network/access/http2/http2frames.cpp | 1 + src/network/access/qhttp2protocolhandler.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/access/http2/http2frames.cpp b/src/network/access/http2/http2frames.cpp index 95f00dd2861..763d1bb90f0 100644 --- a/src/network/access/http2/http2frames.cpp +++ b/src/network/access/http2/http2frames.cpp @@ -478,6 +478,7 @@ bool FrameWriter::writeHEADERS(QAbstractSocket &socket, quint32 sizeLimit) sizeLimit = quint32(maxPayloadSize); if (quint32(frameBuffer.size() - frameHeaderSize) <= sizeLimit) { + addFlag(FrameFlag::END_HEADERS); updatePayloadSize(); return write(socket); } diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp index f50224f64af..a8de6987413 100644 --- a/src/network/access/qhttp2protocolhandler.cpp +++ b/src/network/access/qhttp2protocolhandler.cpp @@ -328,7 +328,7 @@ bool QHttp2ProtocolHandler::sendHEADERS(Stream &stream) { using namespace HPack; - outboundFrame.start(FrameType::HEADERS, FrameFlag::PRIORITY | FrameFlag::END_HEADERS, + outboundFrame.start(FrameType::HEADERS, FrameFlag::PRIORITY, stream.streamID); if (!stream.data()) { From 2e4e73d8d3cb0c366ef530541b9ea4d58c85dc77 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 17 Aug 2016 12:44:16 +0200 Subject: [PATCH 178/236] HTTP/2 - fix invalid read (auto-test) Since headersFrame is a reference to a vector's element, clearing this vector before accessing headersFrame.flags is not a good idea, must be done later. Change-Id: I80eee0761ac1cad580e979be9371ec7588a694ac Reviewed-by: Edward Welbourne --- tests/auto/network/access/http2/http2srv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/network/access/http2/http2srv.cpp b/tests/auto/network/access/http2/http2srv.cpp index 9bc7c388751..18a41cb2c04 100644 --- a/tests/auto/network/access/http2/http2srv.cpp +++ b/tests/auto/network/access/http2/http2srv.cpp @@ -625,12 +625,12 @@ void Http2Server::processRequest() return; } - continuedRequest.clear(); // Actually, if needed, we can do a comparison here. activeRequests[streamID] = decoder.decodedHeader(); if (headersFrame.flags.testFlag(FrameFlag::END_STREAM)) emit receivedRequest(streamID); // else - we're waiting for incoming DATA frames ... + continuedRequest.clear(); } QT_END_NAMESPACE From 6cb5e4938daee47d430163a964ad5154765efb91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 3 Aug 2016 14:31:32 +0200 Subject: [PATCH 179/236] Remove declaration of QMacNativeWidgetPrivate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The class doesn't exist and should not be forward declared nor declared as private of QMacNativeWidget. Change-Id: I5dd5a12a372c06b6e750b33401a4960a8c884ce6 Reviewed-by: Morten Johan Sørvig --- src/widgets/widgets/qmacnativewidget_mac.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/widgets/widgets/qmacnativewidget_mac.h b/src/widgets/widgets/qmacnativewidget_mac.h index 44e793f1741..84389f16dfe 100644 --- a/src/widgets/widgets/qmacnativewidget_mac.h +++ b/src/widgets/widgets/qmacnativewidget_mac.h @@ -47,7 +47,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSView); QT_BEGIN_NAMESPACE -class QMacNativeWidgetPrivate; class Q_WIDGETS_EXPORT QMacNativeWidget : public QWidget { Q_OBJECT @@ -60,9 +59,6 @@ public: protected: bool event(QEvent *ev); - -private: - Q_DECLARE_PRIVATE(QMacNativeWidget) }; QT_END_NAMESPACE From bc2cee35c3034b4428dd72a1c228aecba0a6b280 Mon Sep 17 00:00:00 2001 From: Milla Pohjanheimo Date: Tue, 28 Jun 2016 12:37:57 +0300 Subject: [PATCH 180/236] Blacklisting tst_QWidget::saveRestoreGeometry test on Ubuntu 16.04 The test is blacklisted already for Ubuntu 14.04, and needs to be blacklisted for Ubuntu 16.04 too. Task-number: QTBUG-46116 Change-Id: Ic321a4fd13e00c653e6c387d8a159832173b2eb3 Reviewed-by: Heikki Halmet --- tests/auto/widgets/kernel/qwidget/BLACKLIST | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 3346fb131ca..6fe6bd2f671 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -3,6 +3,7 @@ ubuntu-14.04 [saveRestoreGeometry] ubuntu-14.04 +ubuntu-16.04 [restoreVersion1Geometry] ubuntu-14.04 osx From 3c6220c4f8893b58af5e68ffaeff5951efe1f331 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 4 Aug 2016 15:46:20 +0200 Subject: [PATCH 181/236] Android selection handles This commits implement the cursor and selection handle in the platform plugin. Task-number: QTBUG-34867 Change-Id: Icb3fd9ddfd9f4152e2004078a92a3d9502e9113c Reviewed-by: BogDan Vatra --- .../qtproject/qt5/android/CursorHandle.java | 205 ++++++++++++++++++ .../qt5/android/QtActivityDelegate.java | 47 ++++ .../org/qtproject/qt5/android/QtNative.java | 21 ++ .../platforms/android/androidjniinput.cpp | 30 ++- .../platforms/android/androidjniinput.h | 3 + .../android/qandroidinputcontext.cpp | 171 +++++++++++++-- .../platforms/android/qandroidinputcontext.h | 12 + 7 files changed, 464 insertions(+), 25 deletions(-) create mode 100644 src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java diff --git a/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java new file mode 100644 index 00000000000..7d26b8fa04b --- /dev/null +++ b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java @@ -0,0 +1,205 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Olivier Goffart +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Android port of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +package org.qtproject.qt5.android; + +import android.content.Context; +import android.os.Bundle; +import android.util.DisplayMetrics; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.LinearLayout; +import android.widget.ImageView; +import android.content.res.TypedArray; +import android.graphics.drawable.Drawable; +import android.view.MotionEvent; +import android.widget.PopupWindow; +import android.app.Activity; +import android.view.ViewTreeObserver; + +/* This view represents one of the handle (selection or cursor handle) */ +class CursorView extends ImageView +{ + private CursorHandle mHandle; + // The coordinare which where clicked + private int m_offsetX; + private int m_offsetY; + + CursorView (Context context, CursorHandle handle) { + super(context); + mHandle = handle; + } + + // Called when the handle was moved programatically , with the delta amount in pixels + public void adjusted(int dx, int dy) { + m_offsetX += dx; + m_offsetY += dy; + } + + @Override + public boolean onTouchEvent(MotionEvent ev) { + switch (ev.getActionMasked()) { + case MotionEvent.ACTION_DOWN: { + m_offsetX = Math.round(ev.getRawX()); + m_offsetY = Math.round(ev.getRawY()); + break; + } + + case MotionEvent.ACTION_MOVE: { + mHandle.updatePosition(Math.round(ev.getRawX()) - m_offsetX, + Math.round(ev.getRawY()) - m_offsetY); + break; + } + + case MotionEvent.ACTION_UP: + break; + + case MotionEvent.ACTION_CANCEL: + break; + } + return true; + } + +} + +// Helper class that manages a cursor or selection handle +public class CursorHandle implements ViewTreeObserver.OnPreDrawListener +{ + private View m_layout = null; + private CursorView m_cursorView = null; + private PopupWindow m_popup = null; + private int m_id; + private int m_attr; + private Activity m_activity; + private int m_posX; + private int m_posY; + private int m_lastX; + private int m_lastY; + int tolerance; + + public CursorHandle(Activity activity, View layout, int id, int attr) { + m_activity = activity; + m_id = id; + m_attr = attr; + m_layout = layout; + DisplayMetrics metrics = new DisplayMetrics(); + activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); + tolerance = Math.round(2 * metrics.density); + m_lastX = m_lastY = -1 - tolerance; + } + + private boolean initOverlay(){ + if (m_popup == null){ + + Context context = m_layout.getContext(); + int[] attrs = {m_attr}; + TypedArray a = context.getTheme().obtainStyledAttributes(attrs); + Drawable drawable = a.getDrawable(0); + + m_cursorView = new CursorView(context, this); + m_cursorView.setImageDrawable(drawable); + // m_layout.addView(m_cursorView); + + m_popup = new PopupWindow(context, null, android.R.attr.textSelectHandleWindowStyle); + m_popup.setSplitTouchEnabled(true); + m_popup.setClippingEnabled(false); + m_popup.setContentView(m_cursorView); + m_popup.setWidth(drawable.getIntrinsicWidth()); + m_popup.setHeight(drawable.getIntrinsicHeight()); + + m_layout.getViewTreeObserver().addOnPreDrawListener(this); + } + return true; + } + + // Show the handle at a given position (or move it if it is already shown) + public void setPosition(final int x, final int y){ + initOverlay(); + + final int[] location = new int[2]; + m_layout.getLocationOnScreen(location); + + int x2 = x + location[0]; + int y2 = y + location[1]; + + if (m_id == QtNative.IdCursorHandle) { + x2 -= m_cursorView.getWidth() / 2 ; + } else if (m_id == QtNative.IdLeftHandle) { + x2 -= m_cursorView.getWidth() * 3 / 4; + } else if (m_id == QtNative.IdRightHandle) { + x2 -= m_cursorView.getWidth() / 4; + } + + if (m_popup.isShowing()) { + m_popup.update(x2, y2, -1, -1); + m_cursorView.adjusted(x - m_posX, y - m_posY); + } else { + m_popup.showAtLocation(m_layout, 0, x2, y2); + } + + m_posX = x; + m_posY = y; + } + + public void hide() { + if (m_popup != null) { + m_popup.dismiss(); + } + } + + // The handle was dragged by a given relative position + public void updatePosition(int x, int y) { + if (Math.abs(m_lastX - x) > tolerance || Math.abs(m_lastY - y) > tolerance) { + QtNative.handleLocationChanged(m_id, x + m_posX, y + m_posY); + m_lastX = x; + m_lastY = y; + } + } + + @Override + public boolean onPreDraw() { + // This hook is called when the view location is changed + // For example if the keyboard appears. + // Adjust the position of the handle accordingly + if (m_popup != null && m_popup.isShowing()) + setPosition(m_posX, m_posY); + + return true; + } +} 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 656dbdda45b..55de75e9910 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -2,6 +2,7 @@ ** ** Copyright (C) 2014 BogDan Vatra ** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2016 Olivier Goffart ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Android port of the Qt Toolkit. @@ -143,6 +144,9 @@ public class QtActivityDelegate private int m_portraitKeyboardHeight = 0; private int m_landscapeKeyboardHeight = 0; private int m_probeKeyboardHeightDelay = 50; // ms + private CursorHandle m_cursorHandle; + private CursorHandle m_leftSelectionHandle; + private CursorHandle m_rightSelectionHandle; public void setFullScreen(boolean enterFullScreen) { @@ -470,6 +474,49 @@ public class QtActivityDelegate m_imm.updateSelection(m_editText, selStart, selEnd, candidatesStart, candidatesEnd); } + // Values coming from QAndroidInputContext::CursorHandleShowMode + private static final int CursorHandleNotShown = 0; + private static final int CursorHandleShowNormal = 1; + private static final int CursorHandleShowSelection = 2; + + /* called from the C++ code when the position of the cursor or selection handles needs to + be adjusted + + mode is one of QAndroidInputContext::CursorHandleShowMode) + */ + public void updateHandles(int mode, int x1, int y1, int x2, int y2) + { + if (mode == CursorHandleNotShown) { + if (m_cursorHandle != null) + m_cursorHandle.hide(); + if (m_rightSelectionHandle != null) { + m_rightSelectionHandle.hide(); + m_leftSelectionHandle.hide(); + } + } else if (mode == CursorHandleShowNormal) { + if (m_cursorHandle == null) { + m_cursorHandle = new CursorHandle(m_activity, m_layout, QtNative.IdCursorHandle, + android.R.attr.textSelectHandle); + } + m_cursorHandle.setPosition(x1, y1); + if (m_rightSelectionHandle != null) { + m_rightSelectionHandle.hide(); + m_leftSelectionHandle.hide(); + } + } else if (mode == CursorHandleShowSelection) { + if (m_rightSelectionHandle == null) { + m_leftSelectionHandle = new CursorHandle(m_activity, m_layout, QtNative.IdLeftHandle, + android.R.attr.textSelectHandleLeft); + m_rightSelectionHandle = new CursorHandle(m_activity, m_layout, QtNative.IdRightHandle, + android.R.attr.textSelectHandleRight); + } + m_leftSelectionHandle.setPosition(x1,y1); + m_rightSelectionHandle.setPosition(x2,y2); + if (m_cursorHandle != null) + m_cursorHandle.hide(); + } + } + public boolean loadApplication(Activity activity, ClassLoader classLoader, Bundle loaderParams) { /// check parameters integrity diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index 04b8e6a06f7..6f4b0503d5e 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -492,6 +492,20 @@ public class QtNative }); } + private static void updateHandles(final int mode, + final int x1, + final int y1, + final int x2, + final int y2) + { + runAction(new Runnable() { + @Override + public void run() { + m_activityDelegate.updateHandles(mode, x1, y1, x2, y2); + } + }); + } + private static void showSoftwareKeyboard(final int x, final int y, final int width, @@ -777,6 +791,13 @@ public class QtNative public static native void keyboardGeometryChanged(int x, int y, int width, int height); // keyboard methods + // handle methods + public static final int IdCursorHandle = 1; + public static final int IdLeftHandle = 2; + public static final int IdRightHandle = 3; + public static native void handleLocationChanged(int id, int x, int y); + // handle methods + // dispatch events methods public static native boolean dispatchGenericMotionEvent(MotionEvent ev); public static native boolean dispatchKeyEvent(KeyEvent event); diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index 5be128a0c5a..62140c98169 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -1,7 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2012 BogDan Vatra -** Contact: https://www.qt.io/licensing/ +** Copyright (C) 2016 Olivier Goffart +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** @@ -120,6 +121,12 @@ namespace QtAndroidInput return m_softwareKeyboardRect; } + void updateHandles(int mode, QPoint cursor, QPoint anchor) + { + QJNIObjectPrivate::callStaticMethod(applicationClass(), "updateHandles", "(IIIII)V", + mode, cursor.x(), cursor.y(), anchor.x(), + anchor.y()); + } static void mouseDown(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint x, jint y) { @@ -225,6 +232,12 @@ namespace QtAndroidInput double(dw*size), double(dh*size)); m_touchPoints.push_back(touchPoint); + + if (state == Qt::TouchPointPressed) { + QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext(); + if (inputContext && qGuiApp) + QMetaObject::invokeMethod(inputContext, "touchDown", Q_ARG(int, x), Q_ARG(int, y)); + } } static void touchEnd(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint /*action*/) @@ -786,6 +799,18 @@ namespace QtAndroidInput #endif } + static void handleLocationChanged(JNIEnv */*env*/, jobject /*thiz*/, int id, int x, int y) + { +#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL + qDebug() << "@@@ handleLocationChanged" << id << x << y; +#endif + QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext(); + if (inputContext && qGuiApp) + QMetaObject::invokeMethod(inputContext, "handleLocationChanged", + Q_ARG(int, id), Q_ARG(int, x), Q_ARG(int, y)); + + } + static JNINativeMethod methods[] = { {"touchBegin","(I)V",(void*)touchBegin}, {"touchAdd","(IIIZIIFF)V",(void*)touchAdd}, @@ -799,7 +824,8 @@ namespace QtAndroidInput {"keyDown", "(IIIZ)V", (void *)keyDown}, {"keyUp", "(IIIZ)V", (void *)keyUp}, {"keyboardVisibilityChanged", "(Z)V", (void *)keyboardVisibilityChanged}, - {"keyboardGeometryChanged", "(IIII)V", (void *)keyboardGeometryChanged} + {"keyboardGeometryChanged", "(IIII)V", (void *)keyboardGeometryChanged}, + {"handleLocationChanged", "(III)V", (void *)handleLocationChanged} }; bool registerNatives(JNIEnv *env) diff --git a/src/plugins/platforms/android/androidjniinput.h b/src/plugins/platforms/android/androidjniinput.h index 682abde098a..f9d2f1a2a7d 100644 --- a/src/plugins/platforms/android/androidjniinput.h +++ b/src/plugins/platforms/android/androidjniinput.h @@ -56,6 +56,9 @@ namespace QtAndroidInput void updateSelection(int selStart, int selEnd, int candidatesStart, int candidatesEnd); // Software keyboard support + // cursor/selection handles + void updateHandles(int handleCount, QPoint cursor = QPoint(), QPoint anchor = QPoint()); + bool registerNatives(JNIEnv *env); } diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index 125a03469fb..c64e80479c5 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -2,6 +2,7 @@ ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2012 BogDan Vatra +** Copyright (C) 2016 Olivier Goffart ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -342,9 +343,28 @@ static JNINativeMethod methods[] = { {"updateCursorPosition", "()Z", (void *)updateCursorPosition} }; +static QRect inputItemRectangle() +{ + QRectF itemRect = qGuiApp->inputMethod()->inputItemRectangle(); + QRect rect = qGuiApp->inputMethod()->inputItemTransform().mapRect(itemRect).toRect(); + QWindow *window = qGuiApp->focusWindow(); + if (window) + rect = QRect(window->mapToGlobal(rect.topLeft()), rect.size()); + double pixelDensity = window + ? QHighDpiScaling::factor(window) + : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); + if (pixelDensity != 1.0) { + rect.setX(rect.x() * pixelDensity); + rect.setY(rect.y() * pixelDensity); + rect.setWidth(rect.width() * pixelDensity); + rect.setHeight(rect.height() * pixelDensity); + } + return rect; +} QAndroidInputContext::QAndroidInputContext() - : QPlatformInputContext(), m_composingTextStart(-1), m_blockUpdateSelection(false), m_batchEditNestingLevel(0), m_focusObject(0) + : QPlatformInputContext(), m_composingTextStart(-1), m_blockUpdateSelection(false), + m_cursorHandleShown(CursorHandleNotShown), m_batchEditNestingLevel(0), m_focusObject(0) { jclass clazz = QJNIEnvironmentPrivate::findClass(QtNativeInputConnectionClassName); if (Q_UNLIKELY(!clazz)) { @@ -415,6 +435,9 @@ QAndroidInputContext::QAndroidInputContext() qRegisterMetaType("QInputMethodEvent*"); qRegisterMetaType("QInputMethodQueryEvent*"); m_androidInputContext = this; + + QObject::connect(QGuiApplication::inputMethod(), &QInputMethod::cursorRectangleChanged, + this, &QAndroidInputContext::updateSelectionHandles); } QAndroidInputContext::~QAndroidInputContext() @@ -452,6 +475,7 @@ void QAndroidInputContext::reset() { clear(); m_batchEditNestingLevel = 0; + m_cursorHandleShown = QAndroidInputContext::CursorHandleNotShown; if (qGuiApp->focusObject()) { QSharedPointer query = focusObjectInputMethodQueryThreadSafe(Qt::ImEnabled); if (!query.isNull() && query->value(Qt::ImEnabled).toBool()) { @@ -500,6 +524,103 @@ void QAndroidInputContext::updateCursorPosition() } } +void QAndroidInputContext::updateSelectionHandles() +{ + auto im = qGuiApp->inputMethod(); + if (!m_focusObject || (m_cursorHandleShown == CursorHandleNotShown)) { + // Hide the handles + QtAndroidInput::updateHandles(0); + return; + } + QWindow *window = qGuiApp->focusWindow(); + double pixelDensity = window + ? QHighDpiScaling::factor(window) + : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); + + QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImAnchorPosition | Qt::ImEnabled); + QCoreApplication::sendEvent(m_focusObject, &query); + int cpos = query.value(Qt::ImCursorPosition).toInt(); + int anchor = query.value(Qt::ImAnchorPosition).toInt(); + + if (cpos == anchor || im->anchorRectangle().isNull()) { + if (!query.value(Qt::ImEnabled).toBool()) { + QtAndroidInput::updateHandles(0); + return; + } + + auto curRect = im->cursorRectangle(); + QPoint cursorPoint(curRect.center().x(), curRect.bottom()); + QtAndroidInput::updateHandles(m_cursorHandleShown, cursorPoint * pixelDensity); + return; + } + + auto leftRect = im->cursorRectangle(); + auto rightRect = im->anchorRectangle(); + if (cpos > anchor) + std::swap(leftRect, rightRect); + + QPoint leftPoint(leftRect.bottomLeft().toPoint() * pixelDensity); + QPoint righPoint(rightRect.bottomRight().toPoint() * pixelDensity); + QtAndroidInput::updateHandles(CursorHandleShowSelection, leftPoint, righPoint); +} + +/* + Called from Java when a cursor/selection handle was dragged to a new position + + handleId of 1 means the cursor handle, 2 means the left handle, 3 means the right handle + */ +void QAndroidInputContext::handleLocationChanged(int handleId, int x, int y) +{ + auto im = qGuiApp->inputMethod(); + auto leftRect = im->cursorRectangle(); + // The handle is down of the cursor, but we want the position in the middle. + QWindow *window = qGuiApp->focusWindow(); + double pixelDensity = window + ? QHighDpiScaling::factor(window) + : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); + QPoint point(x / pixelDensity, y / pixelDensity); + y -= leftRect.width() / 2; + if (handleId == 1) { + setSelectionOnFocusObject(point, point); + return; + } + + QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImAnchorPosition); + QCoreApplication::sendEvent(m_focusObject, &query); + int cpos = query.value(Qt::ImCursorPosition).toInt(); + int anchor = query.value(Qt::ImAnchorPosition).toInt(); + + auto rightRect = im->anchorRectangle(); + if (cpos > anchor) + std::swap(leftRect, rightRect); + + if (handleId == 2) { + QPoint rightPoint(rightRect.center().toPoint()); + setSelectionOnFocusObject(point, rightPoint); + } else if (handleId == 3) { + QPoint leftPoint(leftRect.center().toPoint()); + setSelectionOnFocusObject(leftPoint, point); + } +} + +void QAndroidInputContext::touchDown(int x, int y) +{ + if (m_focusObject && inputItemRectangle().contains(x, y) && !m_cursorHandleShown) { + // If the user touch the input rectangle, we can show the cursor handle + m_cursorHandleShown = QAndroidInputContext::CursorHandleShowNormal; + updateSelectionHandles(); + } +} + +void QAndroidInputContext::keyDown() +{ + if (m_cursorHandleShown) { + // When the user enter text on the keyboard, we hide the cursor handle + m_cursorHandleShown = QAndroidInputContext::CursorHandleNotShown; + updateSelectionHandles(); + } +} + void QAndroidInputContext::update(Qt::InputMethodQueries queries) { QSharedPointer query = focusObjectInputMethodQueryThreadSafe(queries); @@ -543,22 +664,11 @@ void QAndroidInputContext::showInputPanel() m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged(int,int)), this, SLOT(updateCursorPosition())); else m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged()), this, SLOT(updateCursorPosition())); - QRectF itemRect = qGuiApp->inputMethod()->inputItemRectangle(); - QRect rect = qGuiApp->inputMethod()->inputItemTransform().mapRect(itemRect).toRect(); - QWindow *window = qGuiApp->focusWindow(); - if (window) - rect = QRect(window->mapToGlobal(rect.topLeft()), rect.size()); - double pixelDensity = window ? QHighDpiScaling::factor(window) - : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); - - QtAndroidInput::showSoftwareKeyboard(rect.left() * pixelDensity, - rect.top() * pixelDensity, - rect.width() * pixelDensity, - rect.height() * pixelDensity, + QRect rect = inputItemRectangle(); + QtAndroidInput::showSoftwareKeyboard(rect.left(), rect.top(), rect.width(), rect.height(), query->value(Qt::ImHints).toUInt(), - query->value(Qt::ImEnterKeyType).toUInt() - ); + query->value(Qt::ImEnterKeyType).toUInt()); } void QAndroidInputContext::showInputPanelLater(Qt::ApplicationState state) @@ -601,6 +711,7 @@ void QAndroidInputContext::setFocusObject(QObject *object) reset(); } QPlatformInputContext::setFocusObject(object); + updateSelectionHandles(); } jboolean QAndroidInputContext::beginBatchEdit() @@ -858,6 +969,8 @@ jboolean QAndroidInputContext::setComposingText(const QString &text, jint newCur QInputMethodEvent event(m_composingText, attributes); sendInputMethodEventThreadSafe(&event); + QMetaObject::invokeMethod(this, "keyDown"); + updateCursorPosition(); return JNI_TRUE; @@ -979,20 +1092,21 @@ jboolean QAndroidInputContext::setSelection(jint start, jint end) jboolean QAndroidInputContext::selectAll() { -#warning TODO - return JNI_FALSE; + sendShortcut(QKeySequence::SelectAll); + return JNI_TRUE; } jboolean QAndroidInputContext::cut() { -#warning TODO - return JNI_FALSE; + m_cursorHandleShown = CursorHandleNotShown; + sendShortcut(QKeySequence::Cut); + return JNI_TRUE; } jboolean QAndroidInputContext::copy() { -#warning TODO - return JNI_FALSE; + sendShortcut(QKeySequence::Copy); + return JNI_TRUE; } jboolean QAndroidInputContext::copyURL() @@ -1003,10 +1117,21 @@ jboolean QAndroidInputContext::copyURL() jboolean QAndroidInputContext::paste() { -#warning TODO - return JNI_FALSE; + m_cursorHandleShown = CursorHandleNotShown; + sendShortcut(QKeySequence::Paste); + return JNI_TRUE; } +void QAndroidInputContext::sendShortcut(const QKeySequence &sequence) +{ + for (int i = 0; i < sequence.count(); ++i) { + const int keys = sequence[i]; + Qt::Key key = Qt::Key(keys & ~Qt::KeyboardModifierMask); + Qt::KeyboardModifiers mod = Qt::KeyboardModifiers(keys & Qt::KeyboardModifierMask); + QGuiApplication::postEvent(m_focusObject, new QKeyEvent(QEvent::KeyPress, key, mod)); + QGuiApplication::postEvent(m_focusObject, new QKeyEvent(QEvent::KeyRelease, key, mod)); + } +} Q_INVOKABLE QVariant QAndroidInputContext::queryFocusObjectUnsafe(Qt::InputMethodQuery query, QVariant argument) { diff --git a/src/plugins/platforms/android/qandroidinputcontext.h b/src/plugins/platforms/android/qandroidinputcontext.h index 5ab85dcab0c..c7b2b907b72 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.h +++ b/src/plugins/platforms/android/qandroidinputcontext.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 BogDan Vatra +** Copyright (C) 2016 Olivier Goffart ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. @@ -94,6 +95,7 @@ public: bool isComposing() const; void clear(); void setFocusObject(QObject *object); + void sendShortcut(const QKeySequence &); //---------------// jboolean beginBatchEdit(); @@ -117,6 +119,10 @@ public: public slots: void updateCursorPosition(); + void updateSelectionHandles(); + void handleLocationChanged(int handleId, int x, int y); + void touchDown(int x, int y); + void keyDown(); private slots: void showInputPanelLater(Qt::ApplicationState); @@ -138,6 +144,12 @@ private: int m_composingCursor; QMetaObject::Connection m_updateCursorPosConnection; bool m_blockUpdateSelection; + enum CursorHandleShowMode { + CursorHandleNotShown, + CursorHandleShowNormal = 1, + CursorHandleShowSelection = 2 + }; + CursorHandleShowMode m_cursorHandleShown; int m_batchEditNestingLevel; QObject *m_focusObject; }; From 3bf0c14a2626d76b5b2d557bba280c98f0a71b95 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 18 Aug 2016 12:01:11 +0200 Subject: [PATCH 182/236] Darwin: Fix clang LTO builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit llvm-ar is not shipped as part of Xcode. Use libtool instead, just like Xcode does. Change-Id: Ic9c5e16c826c0d42979556f78d2cf6415542ef93 Reviewed-by: Morten Johan Sørvig --- mkspecs/common/clang-mac.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkspecs/common/clang-mac.conf b/mkspecs/common/clang-mac.conf index c616e20b6e9..274fd73d002 100644 --- a/mkspecs/common/clang-mac.conf +++ b/mkspecs/common/clang-mac.conf @@ -8,3 +8,4 @@ QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvm.clang.1_0 QMAKE_CXXFLAGS += -stdlib=libc++ QMAKE_LFLAGS += -stdlib=libc++ +QMAKE_AR_LTCG = libtool -static -o From 0b93d1a10a0d52ea7f5598508b7bf9a20f1d16ec Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 16 Aug 2016 10:14:27 +0200 Subject: [PATCH 183/236] remove spurious QT_CONFIG -= opengl it's not quite clear what the purpose of this is supposed to be, especially given that the prf is loaded way after anyone would have examined QT_CONFIG. Change-Id: Ia49377c952902fed4084178c7f857e1acd11ad03 Reviewed-by: Lars Knoll --- mkspecs/features/win32/opengl.prf | 1 - 1 file changed, 1 deletion(-) diff --git a/mkspecs/features/win32/opengl.prf b/mkspecs/features/win32/opengl.prf index c26ab62f50f..67e7e70ad99 100644 --- a/mkspecs/features/win32/opengl.prf +++ b/mkspecs/features/win32/opengl.prf @@ -14,7 +14,6 @@ contains(QT_CONFIG, opengles2) { } DEFINES += QT_OPENGL_ES_2 QT_OPENGL_ES_2_ANGLE contains(QT_CONFIG, static): DEFINES += QT_OPENGL_ES_2_ANGLE_STATIC GL_APICALL= EGLAPI= - QT_CONFIG -= opengl } else { !contains(QT_CONFIG, dynamicgl) { QMAKE_LIBS += $$QMAKE_LIBS_OPENGL From 81f54e5dd8b460f5896153a5045e77f68218dd1b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 6 Jul 2016 13:14:58 +0200 Subject: [PATCH 184/236] Remove some dead code from the configures Done-with: Oswald Buddenhagen Change-Id: If725ae0abee4d636ac8775c53e34ab138d360905 Reviewed-by: Oswald Buddenhagen --- configure | 12 ---- tools/configure/configureapp.cpp | 102 ------------------------------- tools/configure/configureapp.h | 14 ----- tools/configure/environment.cpp | 63 ------------------- tools/configure/environment.h | 2 - tools/configure/main.cpp | 1 - 6 files changed, 194 deletions(-) diff --git a/configure b/configure index d6879a3272d..a51a377c0cf 100755 --- a/configure +++ b/configure @@ -394,10 +394,8 @@ BUILD_ON_MAC=no if [ -d /System/Library/Frameworks/Carbon.framework ]; then BUILD_ON_MAC=yes fi -HOST_DIRLIST_SEP=":" DEV_NULL=/dev/null if [ "$OSTYPE" = "msys" ]; then - HOST_DIRLIST_SEP=";" DEV_NULL=/tmp/empty-file echo "" > $DEV_NULL relpath=`(cd "$relpath"; pwd -W)` @@ -1910,7 +1908,6 @@ config.input.extra_features = $CFG_FEATURES config.input.qt_edition = $Edition config.input.qt_licheck = $Licheck config.input.qt_release_date = $ReleaseDate -config.input.sysroot = $CFG_SYSROOT EOF # create a clean qmodule/qconfig.pri for running the tests @@ -1965,10 +1962,6 @@ if [ "$OPT_VERBOSE" = "yes" ]; then echo fi -sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'` -PROCS=1 -EXEC="" - rm -f "$QMAKE_VARS_FILE" 2>/dev/null #------------------------------------------------------------------------------- @@ -2010,11 +2003,6 @@ fi'` chmod +x "$outpath/config.status" fi -if [ -n "$RPATH_MESSAGE" ]; then - echo - echo "$RPATH_MESSAGE" -fi - if [ -n "$PREFIX_COMPLAINTS" ]; then echo echo "$PREFIX_COMPLAINTS" diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index ccfc067c43e..55ddaa34e99 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -92,11 +92,6 @@ Configure::Configure(int& argc, char** argv) : verbose(0) outputWidth = 79; int i; - /* - ** Set up the initial state, the default - */ - dictionary[ "CONFIGCMD" ] = argv[ 0 ]; - for (i = 1; i < argc; i++) configCmdLine += argv[ i ]; @@ -138,7 +133,6 @@ Configure::Configure(int& argc, char** argv) : verbose(0) } dictionary[ "BUILD_QMAKE" ] = "yes"; - dictionary[ "QMAKE_INTERNAL" ] = "no"; dictionary[ "WIDGETS" ] = "yes"; dictionary[ "GUI" ] = "yes"; dictionary[ "RTTI" ] = "yes"; @@ -155,7 +149,6 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "AVX512" ] = "auto"; dictionary[ "SYNCQT" ] = "auto"; dictionary[ "WMF_BACKEND" ] = "no"; - dictionary[ "WMSDK" ] = "auto"; dictionary[ "QML_DEBUG" ] = "yes"; dictionary[ "PLUGIN_MANIFESTS" ] = "no"; dictionary[ "DIRECTWRITE" ] = "auto"; @@ -330,23 +323,6 @@ QString Configure::formatPaths(const QStringList &paths) return ret; } -// We could use QDir::homePath() + "/.qt-license", but -// that will only look in the first of $HOME,$USERPROFILE -// or $HOMEDRIVE$HOMEPATH. So, here we try'em all to be -// more forgiving for the end user.. -QString Configure::firstLicensePath() -{ - QStringList allPaths; - allPaths << "./.qt-license" - << QString::fromLocal8Bit(getenv("HOME")) + "/.qt-license" - << QString::fromLocal8Bit(getenv("USERPROFILE")) + "/.qt-license" - << QString::fromLocal8Bit(getenv("HOMEDRIVE")) + QString::fromLocal8Bit(getenv("HOMEPATH")) + "/.qt-license"; - for (int i = 0; i< allPaths.count(); ++i) - if (QFile::exists(allPaths.at(i))) - return allPaths.at(i); - return QString(); -} - // #### somehow I get a compiler error about vc++ reaching the nesting limit without // undefining the ansi for scoping. #ifdef for @@ -855,9 +831,6 @@ void Configure::parseCmdLine() if (!continueElse[0]) { } - else if (configCmdLine.at(i) == "-internal") - dictionary[ "QMAKE_INTERNAL" ] = "yes"; - else if (configCmdLine.at(i) == "-no-syncqt") dictionary[ "SYNCQT" ] = "no"; @@ -1360,10 +1333,6 @@ void Configure::parseCmdLine() saveCmdLine(); } -void Configure::validateArgs() -{ -} - // Output helper functions --------------------------------[ Start ]- /*! Determines the length of a string token. @@ -1493,9 +1462,6 @@ void Configure::applySpecSpecifics() //TODO dictionary[ "STYLE_WINDOWSXP" ] = "no"; dictionary[ "STYLE_WINDOWSVISTA" ] = "no"; - dictionary[ "KBD_DRIVERS" ] = "tty"; - dictionary[ "GFX_DRIVERS" ] = "linuxfb"; - dictionary[ "MOUSE_DRIVERS" ] = "pc linuxtp"; dictionary[ "OPENGL" ] = "no"; dictionary[ "DBUS"] = "no"; dictionary[ "QT_INOTIFY" ] = "no"; @@ -1507,7 +1473,6 @@ void Configure::applySpecSpecifics() dictionary[ "FONT_CONFIG" ] = "auto"; dictionary[ "ANGLE" ] = "no"; - dictionary["DECORATIONS"] = "default windows styled"; } else if (platform() == QNX) { dictionary[ "REDUCE_EXPORTS" ] = "yes"; dictionary["STACK_PROTECTOR_STRONG"] = "auto"; @@ -2077,8 +2042,6 @@ bool Configure::checkAvailability(const QString &part) else if (part == "INCREDIBUILD_XGE") { available = !QStandardPaths::findExecutable(QStringLiteral("BuildConsole.exe")).isEmpty() && !QStandardPaths::findExecutable(QStringLiteral("xgConsole.exe")).isEmpty(); - } else if (part == "WMSDK") { - available = findFile("wmsdk.h"); } else if (part == "WMF_BACKEND") { available = findFile("mfapi.h") && findFile("mf.lib"); } else if (part == "DIRECTWRITE") { @@ -2255,8 +2218,6 @@ void Configure::autoDetection() dictionary["QML_DEBUG"] = dictionary["QML"] == "yes" ? "yes" : "no"; if (dictionary["WMF_BACKEND"] == "auto") dictionary["WMF_BACKEND"] = checkAvailability("WMF_BACKEND") ? "yes" : "no"; - if (dictionary["WMSDK"] == "auto") - dictionary["WMSDK"] = checkAvailability("WMSDK") ? "yes" : "no"; // Detection of IncrediBuild buildconsole if (dictionary["INCREDIBUILD_XGE"] == "auto") @@ -2382,14 +2343,6 @@ bool Configure::verifyConfiguration() << "Oracle driver, as the current build will most likely fail." << endl; prompt = true; } - if (0 != dictionary["ARM_FPU_TYPE"].size()) { - QStringList l= QStringList() - << "softvfp" - << "softvfp+vfpv2" - << "vfpv2"; - if (!(l.contains(dictionary["ARM_FPU_TYPE"]))) - cout << QString("WARNING: Using unsupported fpu flag: %1").arg(dictionary["ARM_FPU_TYPE"]) << endl; - } if (dictionary["DIRECTWRITE"] == "yes" && !checkAvailability("DIRECTWRITE")) { cout << "WARNING: To be able to compile the DirectWrite font engine you will" << endl << "need the Microsoft DirectWrite and Microsoft Direct2D development" << endl @@ -2821,8 +2774,6 @@ void Configure::generateOutputVars() qmakeVars += QString("sql-drivers += ") + qmakeSql.join(' '); if (!qmakeStyles.isEmpty()) qmakeVars += QString("styles += ") + qmakeStyles.join(' '); - if (!qmakeStylePlugins.isEmpty()) - qmakeVars += QString("style-plugins += ") + qmakeStylePlugins.join(' '); if (!dictionary[ "QMAKESPEC" ].length()) { cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl @@ -2866,16 +2817,6 @@ void Configure::generateCachefile() if (dictionary["QT_XKBCOMMON"] == "no") moduleStream << "DEFINES += QT_NO_XKBCOMMON" << endl; - // embedded - if (!dictionary["KBD_DRIVERS"].isEmpty()) - moduleStream << "kbd-drivers += "<< dictionary["KBD_DRIVERS"]<= 3) { - QString keyword = (*it++); - QString operation = (*it++); - QString value = (*it++); - - if (keyword == "TEMPLATE") { - if (value == "lib") - return Lib; - else if (value == "subdirs") - return Subdirs; - } - } - // read next line - buffer = proFile.readLine(1024); - } - proFile.close(); - } - // Default to app handling - return App; -} - bool Configure::showLicense(QString orgLicenseFile) { if (dictionary["LICENSE_CONFIRMED"] == "yes") { @@ -4313,7 +4212,6 @@ QString Configure::qpaPlatformName() const int Configure::platform() const { - const QString qMakeSpec = dictionary.value("QMAKESPEC"); const QString xQMakeSpec = dictionary.value("XQMAKESPEC"); if ((xQMakeSpec.startsWith("winphone") || xQMakeSpec.startsWith("winrt"))) diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index 3469b89fc1a..eaf871ecb73 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -43,7 +43,6 @@ public: ~Configure(); void parseCmdLine(); - void validateArgs(); bool displayHelp(); QString defaultTo(const QString &option); @@ -64,20 +63,12 @@ public: void generateQDevicePri(); void prepareConfigTests(); void showSummary(); - QString firstLicensePath(); bool showLicense(QString licenseFile); void readLicense(); QString addDefine(QString def); - enum ProjectType { - App, - Lib, - Subdirs - }; - - ProjectType projectType( const QString& proFileName ); bool isDone(); bool isOk(); @@ -98,21 +89,16 @@ private: QStringList buildParts; QStringList nobuildParts; QStringList skipModules; - QStringList licensedModules; - QStringList allSqlDrivers; QStringList disabledModules; QStringList enabledModules; QStringList modules; -// QStringList sqlDrivers; QStringList configCmdLine; QStringList qmakeConfig; QStringList qtConfig; QStringList qmakeSql; - QStringList qmakeSqlPlugins; QStringList qmakeStyles; - QStringList qmakeStylePlugins; QStringList qmakeVars; QStringList qmakeDefines; diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 5189883901c..dfcc3220654 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -431,69 +431,6 @@ QString Environment::execute(const QString &command, int *returnCode) return output; } -/*! - Copies the \a srcDir contents into \a destDir. - - Returns true if copying was successful. -*/ -bool Environment::cpdir(const QString &srcDir, const QString &destDir) -{ - QString cleanSrcName = QDir::cleanPath(srcDir); - QString cleanDstName = QDir::cleanPath(destDir); - -#ifdef CONFIGURE_DEBUG_CP_DIR - qDebug() << "Attempt to cpdir " << cleanSrcName << "->" << cleanDstName; -#endif - if(!QFile::exists(cleanDstName) && !QDir().mkpath(cleanDstName)) { - qDebug() << "cpdir: Failure to create " << cleanDstName; - return false; - } - - bool result = true; - QDir dir = QDir(cleanSrcName); - QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot); - for (int i = 0; result && (i < allEntries.count()); ++i) { - QFileInfo entry = allEntries.at(i); - bool intermediate = true; - if (entry.isDir()) { - intermediate = cpdir(QString("%1/%2").arg(cleanSrcName).arg(entry.fileName()), - QString("%1/%2").arg(cleanDstName).arg(entry.fileName())); - } else { - QString destFile = QString("%1/%2").arg(cleanDstName).arg(entry.fileName()); -#ifdef CONFIGURE_DEBUG_CP_DIR - qDebug() << "About to cp (file)" << entry.absoluteFilePath() << "->" << destFile; -#endif - QFile::remove(destFile); - intermediate = QFile::copy(entry.absoluteFilePath(), destFile); - SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL); - } - if (!intermediate) { - qDebug() << "cpdir: Failure for " << entry.fileName() << entry.isDir(); - result = false; - } - } - return result; -} - -bool Environment::rmdir(const QString &name) -{ - bool result = true; - QString cleanName = QDir::cleanPath(name); - - QDir dir = QDir(cleanName); - QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot); - for (int i = 0; result && (i < allEntries.count()); ++i) { - QFileInfo entry = allEntries.at(i); - if (entry.isDir()) { - result &= rmdir(entry.absoluteFilePath()); - } else { - result &= QFile::remove(entry.absoluteFilePath()); - } - } - result &= dir.rmdir(cleanName); - return result; -} - static QStringList splitPathList(const QString &path) { #if defined(Q_OS_WIN) diff --git a/tools/configure/environment.h b/tools/configure/environment.h index 893e33c76f4..12646b6d886 100644 --- a/tools/configure/environment.h +++ b/tools/configure/environment.h @@ -55,8 +55,6 @@ public: static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv); static QString execute(const QString &command, int *returnCode = 0); - static bool cpdir(const QString &srcDir, const QString &destDir); - static bool rmdir(const QString &name); static QString findFileInPaths(const QString &fileName, const QStringList &paths); static QStringList path(); diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp index d4f654150e3..4d887023b4f 100644 --- a/tools/configure/main.cpp +++ b/tools/configure/main.cpp @@ -42,7 +42,6 @@ int runConfigure( int argc, char** argv ) return 3; app.parseCmdLine(); - app.validateArgs(); if (!app.isOk()) return 3; if( app.displayHelp() ) From 734e0c636e9efe67d5c6941563a1d7aae07bbfe1 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 7 Jul 2016 16:53:13 +0200 Subject: [PATCH 185/236] Remove the [-no]-qmake command line argument in configure.exe Qt will not build with -no-qmake. Change-Id: I0fb5995d53fd3d6e4e5bd956929ce43432fb526d Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- tools/configure/configureapp.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 55ddaa34e99..b2775063b4b 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -132,7 +132,6 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "QMAKESPEC_FROM" ] = "env"; } - dictionary[ "BUILD_QMAKE" ] = "yes"; dictionary[ "WIDGETS" ] = "yes"; dictionary[ "GUI" ] = "yes"; dictionary[ "RTTI" ] = "yes"; @@ -834,11 +833,6 @@ void Configure::parseCmdLine() else if (configCmdLine.at(i) == "-no-syncqt") dictionary[ "SYNCQT" ] = "no"; - else if (configCmdLine.at(i) == "-no-qmake") - dictionary[ "BUILD_QMAKE" ] = "no"; - else if (configCmdLine.at(i) == "-qmake") - dictionary[ "BUILD_QMAKE" ] = "yes"; - else if (configCmdLine.at(i) == "-qtnamespace") { ++i; if (i == argCount) @@ -1748,8 +1742,6 @@ bool Configure::displayHelp() desc("PLUGIN_MANIFESTS", "no", "-no-plugin-manifests", "Do not embed manifests in plugins."); desc("PLUGIN_MANIFESTS", "yes", "-plugin-manifests", "Embed manifests in plugins.\n"); - desc("BUILD_QMAKE", "no", "-no-qmake", "Do not compile qmake."); - desc("BUILD_QMAKE", "yes", "-qmake", "Compile qmake.\n"); desc( "-qreal [double|float]", "typedef qreal to the specified type. The default is double.\n" "Note that changing this flag affects binary compatibility.\n"); @@ -3827,7 +3819,7 @@ void Configure::generateQConfigCpp() void Configure::buildQmake() { - if (dictionary[ "BUILD_QMAKE" ] == "yes") { + { QStringList args; // Build qmake From f99f28de319218faecf1b8c73d67ac7781554d06 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 21 Jul 2016 17:08:14 +0200 Subject: [PATCH 186/236] remove the [-no]-native-gestures options from configure.exe the code which they control is dead (due to not having been adjusted to Q_WS_WIN disappearing). Change-Id: I4b939e10d33b9da3a5642f303a84f297549ba522 Reviewed-by: Lars Knoll --- tools/configure/configureapp.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index b2775063b4b..3a3794ee21c 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -284,7 +284,6 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "INCREDIBUILD_XGE" ] = "auto"; dictionary[ "LTCG" ] = "no"; - dictionary[ "NATIVE_GESTURES" ] = "yes"; dictionary[ "MSVC_MP" ] = "no"; if (dictionary["QMAKESPEC"].startsWith("win32-g++")) { @@ -675,10 +674,6 @@ void Configure::parseCmdLine() dictionary[ "INCREDIBUILD_XGE" ] = "no"; else if (configCmdLine.at(i) == "-incredibuild-xge") dictionary[ "INCREDIBUILD_XGE" ] = "yes"; - else if (configCmdLine.at(i) == "-native-gestures") - dictionary[ "NATIVE_GESTURES" ] = "yes"; - else if (configCmdLine.at(i) == "-no-native-gestures") - dictionary[ "NATIVE_GESTURES" ] = "no"; // Others --------------------------------------------------- else if (configCmdLine.at(i) == "-widgets") dictionary[ "WIDGETS" ] = "yes"; @@ -1796,8 +1791,6 @@ bool Configure::displayHelp() desc("STYLE_WINDOWSXP", "auto", "", " windowsxp", ' '); desc("STYLE_WINDOWSVISTA", "auto", "", " windowsvista", ' '); desc("STYLE_FUSION", "yes", "", " fusion", ' '); - desc("NATIVE_GESTURES", "no", "-no-native-gestures", "Do not use native gestures on Windows 7."); - desc("NATIVE_GESTURES", "yes", "-native-gestures", "Use native gestures on Windows 7.\n"); desc("MSVC_MP", "no", "-no-mp", "Do not use multiple processors for compiling with MSVC"); desc("MSVC_MP", "yes", "-mp", "Use multiple processors for compiling with MSVC (-MP).\n"); @@ -2643,9 +2636,6 @@ void Configure::generateOutputVars() if (dictionary["DIRECT2D"] == "yes") qtConfig += "direct2d"; - if (dictionary[ "NATIVE_GESTURES" ] == "yes") - qtConfig += "native-gestures"; - if (dictionary["NIS"] == "yes") qtConfig += "nis"; @@ -3305,7 +3295,6 @@ void Configure::generateConfigfiles() if (dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS"; if (dictionary["FREETYPE"] == "no") qconfigList += "QT_NO_FREETYPE"; if (dictionary["HARFBUZZ"] == "no") qconfigList += "QT_NO_HARFBUZZ"; - if (dictionary["NATIVE_GESTURES"] == "no") qconfigList += "QT_NO_NATIVE_GESTURES"; if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES"; if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES_2"; From 492d7d14fc813a858fa98ae048137a6b45155db0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Aug 2016 13:04:24 +0200 Subject: [PATCH 187/236] improve handling of test commands which produce output never use $$system() directly, but instead use qtRunLoggedCommand() with a newly introduced out parameter. that way we can print the command's raw output, which should help debugging configure problems. additionally, we now consistently check the exit code of all executed commands, which should avoid confusing followup errors. note that as a side effect some calls now use $$system()'s 'lines' mode instead of the bizarre default splitting mode. this has no impact on any of the cases, which is why it is basically a negligible style change at this point. however, qtLog() gained support for arguments with more than one element to accommodate this. Change-Id: I40d907e27de32dfec8d6086ce7d93fc4be18241f Reviewed-by: Lars Knoll --- configure.pri | 25 +++++++++++++------------ mkspecs/features/configure_base.prf | 8 ++++++-- mkspecs/features/qt_configure.prf | 10 +++++----- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/configure.pri b/configure.pri index ac2a7e7bb44..20eb120d330 100644 --- a/configure.pri +++ b/configure.pri @@ -86,7 +86,7 @@ defineTest(qtConfTest_architecture) { defineTest(qtConfTest_avx_test_apple_clang) { !*g++*:!*-clang*: return(true) - compiler = $$system("$$QMAKE_CXX --version") + qtRunLoggedCommand("$$QMAKE_CXX --version", compiler)|return(false) contains(compiler, "Apple clang version [23]") { # Some clang versions produce internal compiler errors compiling Qt AVX code return(false) @@ -99,7 +99,7 @@ defineTest(qtConfTest_gnumake) { make = $$qtConfFindInPath("gmake") isEmpty(make): make = $$qtConfFindInPath("make") !isEmpty(make) { - version = $$system("$$make -v", blob) + qtRunLoggedCommand("$$make -v", version)|return(false) contains(version, "^GNU Make.*"): return(true) } return(false) @@ -146,8 +146,8 @@ defineTest(qtConfTest_detectPkgConfig) { pkgConfigLibdir = $$sysroot/usr/lib/pkgconfig:$$sysroot/usr/share/pkgconfig gcc { - gccMachineDump = $$system("$$QMAKE_CXX -dumpmachine") - !isEmpty(gccMachineDump): \ + qtRunLoggedCommand("$$QMAKE_CXX -dumpmachine", gccMachineDump): \ + !isEmpty(gccMachineDump): \ pkgConfigLibdir = "$$pkgConfigLibdir:$$sysroot/usr/lib/$$gccMachineDump/pkgconfig" } @@ -245,7 +245,7 @@ defineTest(qtConfTest_openssl) { defineTest(qtConfTest_checkCompiler) { contains(QMAKE_CXX, ".*clang.*") { - versionstr = "$$system($$QMAKE_CXX -v 2>&1)" + qtRunLoggedCommand("$$QMAKE_CXX -v 2>&1", versionstr)|return(false) contains(versionstr, "^Apple (clang|LLVM) version .*") { $${1}.compilerDescription = "Apple Clang" $${1}.compilerId = "apple_clang" @@ -258,13 +258,14 @@ defineTest(qtConfTest_checkCompiler) { return(false) } } else: contains(QMAKE_CXX, ".*g\\+\\+.*") { + qtRunLoggedCommand("$$QMAKE_CXX -dumpversion", version)|return(false) $${1}.compilerDescription = "GCC" $${1}.compilerId = "gcc" - $${1}.compilerVersion = $$system($$QMAKE_CXX -dumpversion) + $${1}.compilerVersion = $$version } else: contains(QMAKE_CXX, ".*icpc" ) { + qtRunLoggedCommand("$$QMAKE_CXX -v", version)|return(false) $${1}.compilerDescription = "ICC" $${1}.compilerId = "icc" - version = "$$system($$QMAKE_CXX -v)" $${1}.compilerVersion = $$replace(version, "icpc version ([0-9.]+).*", "\\1") } else: msvc { $${1}.compilerDescription = "MSVC" @@ -292,13 +293,13 @@ defineTest(qtConfTest_psqlCompile) { isEmpty(pg_config): \ pg_config = $$qtConfFindInPath("pg_config") !win32:!isEmpty(pg_config) { - libdir = $$system("$$pg_config --libdir", lines) + qtRunLoggedCommand("$$pg_config --libdir", libdir)|return(false) + qtRunLoggedCommand("$$pg_config --includedir", includedir)|return(false) libdir -= $$QMAKE_DEFAULT_LIBDIRS libs = !isEmpty(libdir): libs += "-L$$libdir" libs += "-lpq" $${1}.libs = "$$val_escape(libs)" - includedir = $$system("$$pg_config --includedir", lines) includedir -= $$QMAKE_DEFAULT_INCDIRS $${1}.includedir = "$$val_escape(includedir)" !isEmpty(includedir): \ @@ -322,20 +323,20 @@ defineTest(qtConfTest_mysqlCompile) { isEmpty(mysql_config): \ mysql_config = $$qtConfFindInPath("mysql_config") !isEmpty(mysql_config) { - version = $$system("$$mysql_config --version") + qtRunLoggedCommand("$$mysql_config --version", version)|return(false) version = $$split(version, '.') version = $$first(version) isEmpty(version)|lessThan(version, 4): return(false)] # query is either --libs or --libs_r query = $$eval($${1}.query) - libs = $$system("$$mysql_config $$query", lines) + qtRunLoggedCommand("$$mysql_config $$query", libs)|return(false) + qtRunLoggedCommand("$$mysql_config --include", includedir)|return(false) eval(libs = $$libs) libs = $$filterLibraryPath($$libs) # -rdynamic should not be returned by mysql_config, but is on RHEL 6.6 libs -= -rdynamic $${1}.libs = "$$val_escape(libs)" - includedir = $$system("$$mysql_config --include", lines) eval(includedir = $$includedir) includedir ~= s/^-I//g includedir -= $$QMAKE_DEFAULT_INCDIRS diff --git a/mkspecs/features/configure_base.prf b/mkspecs/features/configure_base.prf index f62142f84d5..08edba4b1ce 100644 --- a/mkspecs/features/configure_base.prf +++ b/mkspecs/features/configure_base.prf @@ -26,14 +26,18 @@ isEmpty(QMAKE_CONFIG_VERBOSE): QMAKE_CONFIG_VERBOSE = false defineTest(qtLog) { write_file($$QMAKE_CONFIG_LOG, 1, append) - $$QMAKE_CONFIG_VERBOSE: log("$$1$$escape_expand(\\n)") + $$QMAKE_CONFIG_VERBOSE: for (l, 1): log("$$l$$escape_expand(\\n)") } defineTest(qtRunLoggedCommand) { qtLog("+ $$1") - output = $$system("( $$1 ) 2>&1", blob, result) + output = $$system("( $$1 ) 2>&1", lines, result) qtLog($$output) + !isEmpty(2) { + $$2 = $$output + export($$2) + } !equals(result, 0): return(false) return(true) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 7a289f7b949..a0e5b1a772f 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -331,13 +331,13 @@ defineTest(qtConfTest_pkgConfig) { !qtConfPkgConfigPackageExists($$pkg_config, $$args): \ return(false) - $${1}.libs = $$system("$$pkg_config --libs $$args", lines) - $${1}.cflags = $$system("$$pkg_config --cflags $$args", lines) - includes = $$system("$$pkg_config --cflags-only-I $$args", lines) + qtRunLoggedCommand("$$pkg_config --modversion $$args", version)|return(false) + qtRunLoggedCommand("$$pkg_config --libs $$args", $${1}.libs)|return(false) + qtRunLoggedCommand("$$pkg_config --cflags $$args", $${1}.cflags)|return(false) + qtRunLoggedCommand("$$pkg_config --cflags-only-I $$args", includes)|return(false) eval(includes = $$includes) includes ~= s/^-I//g $${1}.includedir = "$$val_escape(includes)" - version = $$system("$$pkg_config --modversion $$args") $${1}.version = $$first(version) export($${1}.libs) export($${1}.cflags) @@ -356,7 +356,7 @@ defineTest(qtConfTest_getPkgConfigVariable) { return(false) variable = $$eval($${1}.pkg-config-variable) - $${1}.value = $$system("$$pkg_config --variable=$$variable $$args") + qtRunLoggedCommand("$$pkg_config --variable=$$variable $$args", $${1}.value)|return(false) export($${1}.value) return(true) } From d175f799cafb78237e0eae55294c3cd9d6cbd9bc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 13 Aug 2016 22:37:15 +0200 Subject: [PATCH 188/236] don't implicitly test for kms in egldevice test any more having compound tests is messy, and we already have a separate test for that anyway. the kms test itself gains a fallback library, as that's what both the egldevice test did and the actual projects using kms do. Change-Id: I4544b64de86d58d6c6449bc0ad9095acaf144056 Reviewed-by: Lars Knoll --- config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp | 10 ---------- config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro | 6 ------ config.tests/qpa/kms/kms.pro | 8 ++++++-- configure.json | 2 +- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp index a2d69905e57..fa3e9d33f7e 100644 --- a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp +++ b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp @@ -37,23 +37,13 @@ ** ****************************************************************************/ -// Test both EGLDevice/Output/Stream and DRM as we only use them in combination. -// -// Other KMS/DRM tests relying on pkgconfig for libdrm are not suitable since -// some systems do not use pkgconfig for the graphics stuff. - -#include -#include #include #include -#include -#include int main(int, char **) { EGLDeviceEXT device = 0; EGLStreamKHR stream = 0; EGLOutputLayerEXT layer = 0; - drmModeCrtcPtr currentMode = drmModeGetCrtc(0, 0); return EGL_DRM_CRTC_EXT; } diff --git a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro index d0945465a05..0bb8c66cb1a 100644 --- a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro +++ b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro @@ -6,10 +6,4 @@ for(p, QMAKE_LIBDIR_EGL) { INCLUDEPATH += $$QMAKE_INCDIR_EGL LIBS += $$QMAKE_LIBS_EGL -CONFIG += link_pkgconfig -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += libdrm -} else { - LIBS += -ldrm -} CONFIG -= qt diff --git a/config.tests/qpa/kms/kms.pro b/config.tests/qpa/kms/kms.pro index 5147bc82da3..ff6b1f62998 100644 --- a/config.tests/qpa/kms/kms.pro +++ b/config.tests/qpa/kms/kms.pro @@ -1,4 +1,8 @@ SOURCES = kms.cpp -CONFIG += link_pkgconfig -PKGCONFIG += libdrm +!contains(QT_CONFIG, no-pkg-config) { + CONFIG += link_pkgconfig + PKGCONFIG += libdrm +} else { + LIBS += -ldrm +} CONFIG -= qt diff --git a/configure.json b/configure.json index f2b0df292d7..ad8e4cf32fa 100644 --- a/configure.json +++ b/configure.json @@ -1863,7 +1863,7 @@ }, "eglfs_egldevice": { "description": "EGLFS EGLDevice", - "condition": "features.eglfs && tests.egl-egldevice", + "condition": "features.eglfs && tests.egl-egldevice && features.kms", "output": [ "publicQtConfig" ] }, "eglfs_gbm": { From 4b8dd9c846223402d181555f56a0146a2d7b86f8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 16 Aug 2016 21:02:01 +0200 Subject: [PATCH 189/236] fix name of stack-protector-strong feature dashes, not underscores. Change-Id: I51db3a5475ebf8dfe85e447baffafba225476967 Reviewed-by: Lars Knoll --- configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.json b/configure.json index ad8e4cf32fa..df4180636f4 100644 --- a/configure.json +++ b/configure.json @@ -1513,7 +1513,7 @@ "condition": "tests.syslog", "output": [ "privateConfig" ] }, - "stack_protector_strong": { + "stack-protector-strong": { "description": "stack protection", "condition": "config.qnx && tests.stack_protector", "output": [ "publicQtConfig" ] From c0cc5052097c723d0331a7619d686af9eb93d33c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 15 Aug 2016 14:40:52 +0200 Subject: [PATCH 190/236] rewrite library handling in configure so far, each library was distributed over a test and (optionally) a 'library' output of a feature. this was conceptually messy and limiting. so instead, turn libraries into a category of their own. libraries now support multiple properly separated sources, which makes overriding them a lot saner. sources can be conditional to accommodate platform differences. as an immediate consequence, move (almost) all library references from the config test projects to the json file. a few tests were excluded, because they are doing somewhat magic things that should not be handled in this bulk change: - freetype: .pri file shared with actual source code - clock-gettime: -lrt is conditional, and there is a .pri file which is shared with actual source code - ipc_posix: -lrt & -lpthread conditional - iconv: -liconv conditional the multi-source mechanism is used to make a variety of tests work on windows, where the library name differs from unix (and sometimes between build configurations). some tests still needed minor adjustments to actually work. on the way, fix up disagreements between manually specified libraries and pkg-config lines (affecting several xcb-related tests). Change-Id: Ic8c58556fa0cf8f981d386b13ea34b4431b127c5 Reviewed-by: Lars Knoll --- config.tests/common/libproxy/libproxy.pro | 1 - config.tests/mac/corewlan/corewlan.pro | 1 - config.tests/qpa/direct2d/direct2d.pro | 1 - config.tests/qpa/egl-x11/egl-x11.pro | 9 - config.tests/qpa/egl/egl.pro | 7 - config.tests/qpa/eglfs-brcm/eglfs-brcm.pro | 8 - .../qpa/eglfs-egldevice/eglfs-egldevice.pro | 6 - .../qpa/eglfs-mali-2/eglfs-mali-2.pro | 2 - config.tests/qpa/eglfs-mali/eglfs-mali.pro | 2 - config.tests/qpa/eglfs-viv/eglfs-viv.pro | 7 - config.tests/qpa/gbm/gbm.pro | 2 - config.tests/qpa/kms/kms.pro | 6 - config.tests/qpa/mirclient/mirclient.pro | 2 - .../qpa/wayland-server/wayland-server.pro | 2 - config.tests/qpa/xcb-glx/xcb-glx.pro | 3 - config.tests/qpa/xcb-render/xcb-render.pro | 3 - config.tests/qpa/xcb-syslibs/xcb-syslibs.pro | 3 - config.tests/qpa/xcb-xkb/xcb-xkb.pro | 3 - config.tests/qpa/xcb-xlib/xcb-xlib.pro | 3 - config.tests/qpa/xcb/xcb.pro | 3 - config.tests/unix/alsa/alsa.pro | 1 - config.tests/unix/cups/cups.pro | 1 - config.tests/unix/db2/db2.pro | 1 - config.tests/unix/dbus/dbus.pro | 6 + .../doubleconversion/doubleconversion.pro | 1 - config.tests/unix/fontconfig/fontconfig.pro | 1 - config.tests/unix/freetype/freetype.pro | 1 - config.tests/unix/getaddrinfo/getaddrinfo.pro | 1 - config.tests/unix/getifaddrs/getifaddrs.pro | 1 - .../unix/gnu-libiconv/gnu-libiconv.pro | 1 - config.tests/unix/gstreamer/gstreamer.pro | 18 - config.tests/unix/harfbuzz/harfbuzz.pro | 1 - config.tests/unix/ibase/ibase.pro | 1 - config.tests/unix/icu/icu.pro | 6 +- config.tests/unix/iodbc/iodbc.cpp | 46 - config.tests/unix/iodbc/iodbc.pro | 3 - config.tests/unix/ipv6ifname/ipv6ifname.pro | 1 - config.tests/unix/journald/journald.pro | 7 - config.tests/unix/lgmon/lgmon.pro | 1 - config.tests/unix/libdl/libdl.pro | 2 - config.tests/unix/libinput/libinput.pro | 2 - config.tests/unix/libjpeg/libjpeg.pro | 1 - config.tests/unix/libpng/libpng.pro | 6 - config.tests/unix/libudev/libudev.pro | 2 - config.tests/unix/mtdev/mtdev.pro | 3 - config.tests/unix/mysql/mysql.cpp | 3 + config.tests/unix/mysql/mysql.pro | 1 - config.tests/unix/mysql_r/mysql_r.pro | 3 - config.tests/unix/oci/oci.pro | 1 - config.tests/unix/odbc/odbc.cpp | 4 +- config.tests/unix/odbc/odbc.pro | 2 - .../unix/opengldesktop/opengldesktop.pro | 6 - config.tests/unix/opengles2/opengles2.pro | 7 +- config.tests/unix/opengles3/opengles3.pro | 7 +- config.tests/unix/opengles31/opengles31.pro | 6 - config.tests/unix/pcre/pcre.pro | 1 - config.tests/unix/pps/pps.pro | 1 - config.tests/unix/psql/psql.pro | 1 - config.tests/unix/pulseaudio/pulseaudio.pro | 1 - config.tests/unix/qqnx_imf/qqnx_imf.pro | 1 - config.tests/unix/sctp/sctp.pro | 1 - config.tests/unix/slog2/slog2.pro | 1 - config.tests/unix/sqlite2/sqlite2.pro | 1 - config.tests/unix/tds/tds.pro | 1 - config.tests/unix/tslib/tslib.pro | 1 - config.tests/unix/zlib/zlib.pro | 1 - config.tests/win/directwrite/directwrite.pro | 1 - .../win/directwrite2/directwrite2.pro | 1 - config.tests/x11/opengl/opengl.cpp | 47 - config.tests/x11/opengl/opengl.pro | 11 - config.tests/x11/xinput2/xinput2.pro | 1 - config.tests/x11/xrender/xrender.pro | 1 - configure.json | 1172 +++++++++-------- configure.pri | 54 +- mkspecs/features/qt_configure.prf | 271 +++- 75 files changed, 910 insertions(+), 889 deletions(-) delete mode 100644 config.tests/unix/iodbc/iodbc.cpp delete mode 100644 config.tests/unix/iodbc/iodbc.pro delete mode 100644 config.tests/unix/libdl/libdl.pro delete mode 100644 config.tests/unix/mysql_r/mysql_r.pro delete mode 100644 config.tests/x11/opengl/opengl.cpp delete mode 100644 config.tests/x11/opengl/opengl.pro diff --git a/config.tests/common/libproxy/libproxy.pro b/config.tests/common/libproxy/libproxy.pro index 51de2021ffe..e3183d99e72 100644 --- a/config.tests/common/libproxy/libproxy.pro +++ b/config.tests/common/libproxy/libproxy.pro @@ -1,4 +1,3 @@ SOURCES = libproxy.cpp CONFIG -= qt dylib mac:CONFIG -= app_bundle -LIBS += -lproxy diff --git a/config.tests/mac/corewlan/corewlan.pro b/config.tests/mac/corewlan/corewlan.pro index 8db0c8c1e7c..97e864f4769 100644 --- a/config.tests/mac/corewlan/corewlan.pro +++ b/config.tests/mac/corewlan/corewlan.pro @@ -1,3 +1,2 @@ OBJECTIVE_SOURCES = corewlantest.mm -LIBS += -framework CoreWLAN -framework Foundation CONFIG -= qt diff --git a/config.tests/qpa/direct2d/direct2d.pro b/config.tests/qpa/direct2d/direct2d.pro index ab62a1da5c3..98527b12a75 100644 --- a/config.tests/qpa/direct2d/direct2d.pro +++ b/config.tests/qpa/direct2d/direct2d.pro @@ -1,4 +1,3 @@ SOURCES = direct2d.cpp -LIBS += -ld2d1 -ldwrite -ld3d11 CONFIG -= qt CONFIG += console diff --git a/config.tests/qpa/egl-x11/egl-x11.pro b/config.tests/qpa/egl-x11/egl-x11.pro index aceb03dd783..fd8479ba354 100644 --- a/config.tests/qpa/egl-x11/egl-x11.pro +++ b/config.tests/qpa/egl-x11/egl-x11.pro @@ -1,12 +1,3 @@ SOURCES = egl-x11.cpp -for(p, QMAKE_LIBDIR_EGL) { - LIBS += -L$$p -} - -!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL -!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL - CONFIG -= qt - -LIBS += -lxcb -lX11 -lX11-xcb diff --git a/config.tests/qpa/egl/egl.pro b/config.tests/qpa/egl/egl.pro index b5396dab155..2c4ae07e647 100644 --- a/config.tests/qpa/egl/egl.pro +++ b/config.tests/qpa/egl/egl.pro @@ -1,10 +1,3 @@ SOURCES = egl.cpp -for(p, QMAKE_LIBDIR_EGL) { - LIBS += -L$$p -} - -!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL -!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL - CONFIG -= qt diff --git a/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro b/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro index d8b1c3ec7e1..d4afa460f7c 100644 --- a/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro +++ b/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro @@ -1,11 +1,3 @@ SOURCES = eglfs-brcm.cpp CONFIG -= qt - -INCLUDEPATH += $$QMAKE_INCDIR_EGL - -for(p, QMAKE_LIBDIR_EGL) { - LIBS += -L$$p -} - -LIBS += -lEGL -lGLESv2 -lbcm_host diff --git a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro index 0bb8c66cb1a..2f20d993f5b 100644 --- a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro +++ b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro @@ -1,9 +1,3 @@ SOURCES = eglfs-egldevice.cpp -for(p, QMAKE_LIBDIR_EGL) { - LIBS += -L$$p -} - -INCLUDEPATH += $$QMAKE_INCDIR_EGL -LIBS += $$QMAKE_LIBS_EGL CONFIG -= qt diff --git a/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.pro b/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.pro index 85bcf6484a2..de6f85f20f6 100644 --- a/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.pro +++ b/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.pro @@ -1,5 +1,3 @@ SOURCES = eglfs-mali-2.cpp CONFIG -= qt - -LIBS += -lEGL -lGLESv2 diff --git a/config.tests/qpa/eglfs-mali/eglfs-mali.pro b/config.tests/qpa/eglfs-mali/eglfs-mali.pro index 132918c4bc7..80f82828425 100644 --- a/config.tests/qpa/eglfs-mali/eglfs-mali.pro +++ b/config.tests/qpa/eglfs-mali/eglfs-mali.pro @@ -1,5 +1,3 @@ SOURCES = eglfs-mali.cpp CONFIG -= qt - -LIBS += -lEGL -lGLESv2 diff --git a/config.tests/qpa/eglfs-viv/eglfs-viv.pro b/config.tests/qpa/eglfs-viv/eglfs-viv.pro index 1617ee38ad1..2c3dc5cb01a 100644 --- a/config.tests/qpa/eglfs-viv/eglfs-viv.pro +++ b/config.tests/qpa/eglfs-viv/eglfs-viv.pro @@ -5,10 +5,3 @@ integrity { DEFINES += LINUX=1 EGL_API_FB=1 } CONFIG -= qt - -for(p, QMAKE_LIBDIR_OPENGL_EGL) { - exists($$p):LIBS += -L$$p -} - -!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL -!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL diff --git a/config.tests/qpa/gbm/gbm.pro b/config.tests/qpa/gbm/gbm.pro index 19177062a87..1c08eb4e67f 100644 --- a/config.tests/qpa/gbm/gbm.pro +++ b/config.tests/qpa/gbm/gbm.pro @@ -1,4 +1,2 @@ SOURCES = gbm.cpp -CONFIG += link_pkgconfig -PKGCONFIG += gbm CONFIG -= qt diff --git a/config.tests/qpa/kms/kms.pro b/config.tests/qpa/kms/kms.pro index ff6b1f62998..c8239143086 100644 --- a/config.tests/qpa/kms/kms.pro +++ b/config.tests/qpa/kms/kms.pro @@ -1,8 +1,2 @@ SOURCES = kms.cpp -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += libdrm -} else { - LIBS += -ldrm -} CONFIG -= qt diff --git a/config.tests/qpa/mirclient/mirclient.pro b/config.tests/qpa/mirclient/mirclient.pro index b397c2d08a9..3e87194e4e0 100644 --- a/config.tests/qpa/mirclient/mirclient.pro +++ b/config.tests/qpa/mirclient/mirclient.pro @@ -1,4 +1,2 @@ SOURCES = mirclient.cpp -CONFIG += link_pkgconfig -PKGCONFIG += egl mirclient ubuntu-platform-api CONFIG -= qt diff --git a/config.tests/qpa/wayland-server/wayland-server.pro b/config.tests/qpa/wayland-server/wayland-server.pro index c07740d20ff..969bc542bb7 100644 --- a/config.tests/qpa/wayland-server/wayland-server.pro +++ b/config.tests/qpa/wayland-server/wayland-server.pro @@ -1,5 +1,3 @@ SOURCES = wl.cpp CONFIG -= qt -CONFIG += link_pkgconfig -PKGCONFIG += wayland-server diff --git a/config.tests/qpa/xcb-glx/xcb-glx.pro b/config.tests/qpa/xcb-glx/xcb-glx.pro index d7fd1d72083..8086e3a3885 100644 --- a/config.tests/qpa/xcb-glx/xcb-glx.pro +++ b/config.tests/qpa/xcb-glx/xcb-glx.pro @@ -1,5 +1,2 @@ SOURCES = xcb-glx.cpp CONFIG -= qt - -LIBS += -lxcb -lxcb-glx - diff --git a/config.tests/qpa/xcb-render/xcb-render.pro b/config.tests/qpa/xcb-render/xcb-render.pro index 3248b66a67a..7555fa9b61a 100644 --- a/config.tests/qpa/xcb-render/xcb-render.pro +++ b/config.tests/qpa/xcb-render/xcb-render.pro @@ -1,5 +1,2 @@ SOURCES = xcb-render.cpp CONFIG -= qt - -LIBS += -lxcb -lxcb-render -lxcb-render-util - diff --git a/config.tests/qpa/xcb-syslibs/xcb-syslibs.pro b/config.tests/qpa/xcb-syslibs/xcb-syslibs.pro index 23eedb03a77..6363ae90eeb 100644 --- a/config.tests/qpa/xcb-syslibs/xcb-syslibs.pro +++ b/config.tests/qpa/xcb-syslibs/xcb-syslibs.pro @@ -1,5 +1,2 @@ SOURCES = xcb.cpp CONFIG -= qt - -LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-randr - diff --git a/config.tests/qpa/xcb-xkb/xcb-xkb.pro b/config.tests/qpa/xcb-xkb/xcb-xkb.pro index a684a869d32..804be7b894e 100644 --- a/config.tests/qpa/xcb-xkb/xcb-xkb.pro +++ b/config.tests/qpa/xcb-xkb/xcb-xkb.pro @@ -1,5 +1,2 @@ SOURCES = xcb-xkb.cpp CONFIG -= qt - -LIBS += -lxcb -lxcb-xkb - diff --git a/config.tests/qpa/xcb-xlib/xcb-xlib.pro b/config.tests/qpa/xcb-xlib/xcb-xlib.pro index 03250b44803..0e98a00fd01 100644 --- a/config.tests/qpa/xcb-xlib/xcb-xlib.pro +++ b/config.tests/qpa/xcb-xlib/xcb-xlib.pro @@ -1,5 +1,2 @@ SOURCES = xcb-xlib.cpp CONFIG -= qt - -LIBS += -lxcb -lX11 -lX11-xcb - diff --git a/config.tests/qpa/xcb/xcb.pro b/config.tests/qpa/xcb/xcb.pro index a48fdbd15f2..6363ae90eeb 100644 --- a/config.tests/qpa/xcb/xcb.pro +++ b/config.tests/qpa/xcb/xcb.pro @@ -1,5 +1,2 @@ SOURCES = xcb.cpp CONFIG -= qt - -LIBS += -lxcb - diff --git a/config.tests/unix/alsa/alsa.pro b/config.tests/unix/alsa/alsa.pro index 6d5d55bcfd3..211e9bc8998 100644 --- a/config.tests/unix/alsa/alsa.pro +++ b/config.tests/unix/alsa/alsa.pro @@ -1,3 +1,2 @@ SOURCES = alsatest.cpp -LIBS+=-lasound CONFIG -= qt dylib diff --git a/config.tests/unix/cups/cups.pro b/config.tests/unix/cups/cups.pro index 3f8ca99d0f2..d19ce7d9a68 100644 --- a/config.tests/unix/cups/cups.pro +++ b/config.tests/unix/cups/cups.pro @@ -1,3 +1,2 @@ SOURCES = cups.cpp CONFIG -= qt dylib -LIBS += -lcups diff --git a/config.tests/unix/db2/db2.pro b/config.tests/unix/db2/db2.pro index b7316051f95..ef233fc1842 100644 --- a/config.tests/unix/db2/db2.pro +++ b/config.tests/unix/db2/db2.pro @@ -1,3 +1,2 @@ SOURCES = db2.cpp CONFIG -= qt dylib -LIBS += -ldb2 diff --git a/config.tests/unix/dbus/dbus.pro b/config.tests/unix/dbus/dbus.pro index c2a01ea2693..f9d793b8679 100644 --- a/config.tests/unix/dbus/dbus.pro +++ b/config.tests/unix/dbus/dbus.pro @@ -1,2 +1,8 @@ SOURCES = dbus.cpp CONFIG -= qt + +CONFIG += build_all +CONFIG(debug, debug|release): \ + LIBS += $$LIBS_DEBUG +else: \ + LIBS += $$LIBS_RELEASE diff --git a/config.tests/unix/doubleconversion/doubleconversion.pro b/config.tests/unix/doubleconversion/doubleconversion.pro index ae435b92936..8253d0c2a55 100644 --- a/config.tests/unix/doubleconversion/doubleconversion.pro +++ b/config.tests/unix/doubleconversion/doubleconversion.pro @@ -1,4 +1,3 @@ SOURCES = doubleconversion.cpp CONFIG -= qt CONFIG += console -LIBS += -ldouble-conversion diff --git a/config.tests/unix/fontconfig/fontconfig.pro b/config.tests/unix/fontconfig/fontconfig.pro index 83607740355..82dcfc80a09 100644 --- a/config.tests/unix/fontconfig/fontconfig.pro +++ b/config.tests/unix/fontconfig/fontconfig.pro @@ -1,4 +1,3 @@ SOURCES = fontconfig.cpp CONFIG -= qt -LIBS += -lfreetype -lfontconfig include(../../unix/freetype/freetype.pri) diff --git a/config.tests/unix/freetype/freetype.pro b/config.tests/unix/freetype/freetype.pro index c0cc02d5640..1a9f06909a7 100644 --- a/config.tests/unix/freetype/freetype.pro +++ b/config.tests/unix/freetype/freetype.pro @@ -1,4 +1,3 @@ SOURCES = freetype.cpp CONFIG -= qt -LIBS += -lfreetype include(freetype.pri) diff --git a/config.tests/unix/getaddrinfo/getaddrinfo.pro b/config.tests/unix/getaddrinfo/getaddrinfo.pro index cc739118fa4..18e40971e52 100644 --- a/config.tests/unix/getaddrinfo/getaddrinfo.pro +++ b/config.tests/unix/getaddrinfo/getaddrinfo.pro @@ -1,3 +1,2 @@ SOURCES = getaddrinfotest.cpp CONFIG -= qt dylib -LIBS += $$QMAKE_LIBS_NETWORK diff --git a/config.tests/unix/getifaddrs/getifaddrs.pro b/config.tests/unix/getifaddrs/getifaddrs.pro index 14a89f87b86..db2956a338d 100644 --- a/config.tests/unix/getifaddrs/getifaddrs.pro +++ b/config.tests/unix/getifaddrs/getifaddrs.pro @@ -1,4 +1,3 @@ SOURCES = getifaddrs.cpp CONFIG -= qt QT = -LIBS += $$QMAKE_LIBS_NETWORK diff --git a/config.tests/unix/gnu-libiconv/gnu-libiconv.pro b/config.tests/unix/gnu-libiconv/gnu-libiconv.pro index 1ecf94390a0..4008f882eb3 100644 --- a/config.tests/unix/gnu-libiconv/gnu-libiconv.pro +++ b/config.tests/unix/gnu-libiconv/gnu-libiconv.pro @@ -1,3 +1,2 @@ SOURCES = gnu-libiconv.cpp CONFIG -= qt dylib -LIBS += -liconv diff --git a/config.tests/unix/gstreamer/gstreamer.pro b/config.tests/unix/gstreamer/gstreamer.pro index a5e158fa210..7b6fbb4d756 100644 --- a/config.tests/unix/gstreamer/gstreamer.pro +++ b/config.tests/unix/gstreamer/gstreamer.pro @@ -1,22 +1,4 @@ SOURCES += gstreamer.cpp -CONFIG += link_pkgconfig - -gst-0.10 { - PKGCONFIG_PRIVATE += \ - gstreamer-0.10 \ - gstreamer-base-0.10 \ - gstreamer-audio-0.10 \ - gstreamer-video-0.10 \ - gstreamer-pbutils-0.10 -} else:gst-1.0 { - PKGCONFIG_PRIVATE += \ - gstreamer-1.0 \ - gstreamer-base-1.0 \ - gstreamer-audio-1.0 \ - gstreamer-video-1.0 \ - gstreamer-pbutils-1.0 -} - CONFIG -= qt diff --git a/config.tests/unix/harfbuzz/harfbuzz.pro b/config.tests/unix/harfbuzz/harfbuzz.pro index 32edd6e358b..71a7c355cb5 100644 --- a/config.tests/unix/harfbuzz/harfbuzz.pro +++ b/config.tests/unix/harfbuzz/harfbuzz.pro @@ -1,3 +1,2 @@ SOURCES = harfbuzz.cpp CONFIG -= qt dylib -LIBS += -lharfbuzz diff --git a/config.tests/unix/ibase/ibase.pro b/config.tests/unix/ibase/ibase.pro index 58787851e1f..8c47f66954c 100644 --- a/config.tests/unix/ibase/ibase.pro +++ b/config.tests/unix/ibase/ibase.pro @@ -1,3 +1,2 @@ SOURCES = ibase.cpp CONFIG -= qt dylib -LIBS += -lgds diff --git a/config.tests/unix/icu/icu.pro b/config.tests/unix/icu/icu.pro index f92d7cdfb85..eeed0eaff3e 100644 --- a/config.tests/unix/icu/icu.pro +++ b/config.tests/unix/icu/icu.pro @@ -2,4 +2,8 @@ SOURCES = icu.cpp CONFIG += console CONFIG -= qt dylib -include($$PWD/../../../src/3rdparty/icu_dependency.pri) +CONFIG += build_all +CONFIG(debug, debug|release): \ + LIBS += $$LIBS_DEBUG +else: \ + LIBS += $$LIBS_RELEASE diff --git a/config.tests/unix/iodbc/iodbc.cpp b/config.tests/unix/iodbc/iodbc.cpp deleted file mode 100644 index 3ce12390c2a..00000000000 --- a/config.tests/unix/iodbc/iodbc.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -int main(int, char **) -{ - return 0; -} diff --git a/config.tests/unix/iodbc/iodbc.pro b/config.tests/unix/iodbc/iodbc.pro deleted file mode 100644 index 68a0bd0ef4b..00000000000 --- a/config.tests/unix/iodbc/iodbc.pro +++ /dev/null @@ -1,3 +0,0 @@ -SOURCES = iodbc.cpp -CONFIG -= qt dylib -LIBS += -liodbc diff --git a/config.tests/unix/ipv6ifname/ipv6ifname.pro b/config.tests/unix/ipv6ifname/ipv6ifname.pro index 88203a782c1..7574dce180c 100644 --- a/config.tests/unix/ipv6ifname/ipv6ifname.pro +++ b/config.tests/unix/ipv6ifname/ipv6ifname.pro @@ -1,4 +1,3 @@ SOURCES = ipv6ifname.cpp CONFIG -= qt QT = -LIBS += $$QMAKE_LIBS_NETWORK diff --git a/config.tests/unix/journald/journald.pro b/config.tests/unix/journald/journald.pro index ea765642e6e..deb28ae97fa 100644 --- a/config.tests/unix/journald/journald.pro +++ b/config.tests/unix/journald/journald.pro @@ -1,10 +1,3 @@ SOURCES = journald.c -CONFIG += link_pkgconfig - -packagesExist(libsystemd): \ - PKGCONFIG_PRIVATE += libsystemd -else: \ - PKGCONFIG_PRIVATE += libsystemd-journal - CONFIG -= qt diff --git a/config.tests/unix/lgmon/lgmon.pro b/config.tests/unix/lgmon/lgmon.pro index 7bd094dc86c..33633b19f8b 100644 --- a/config.tests/unix/lgmon/lgmon.pro +++ b/config.tests/unix/lgmon/lgmon.pro @@ -1,3 +1,2 @@ SOURCES = lgmon.cpp CONFIG -= qt -LIBS += -llgmon diff --git a/config.tests/unix/libdl/libdl.pro b/config.tests/unix/libdl/libdl.pro deleted file mode 100644 index 4016395d35d..00000000000 --- a/config.tests/unix/libdl/libdl.pro +++ /dev/null @@ -1,2 +0,0 @@ -include(../dlopen/dlopen.pro) -LIBS += -ldl diff --git a/config.tests/unix/libinput/libinput.pro b/config.tests/unix/libinput/libinput.pro index 150119c504b..941a0b73ef2 100644 --- a/config.tests/unix/libinput/libinput.pro +++ b/config.tests/unix/libinput/libinput.pro @@ -1,4 +1,2 @@ SOURCES = libinput.cpp CONFIG -= qt -LIBS += $$QMAKE_LIBS_LIBINPUT -INCLUDEPATH += $$QMAKE_INCDIR_LIBINPUT diff --git a/config.tests/unix/libjpeg/libjpeg.pro b/config.tests/unix/libjpeg/libjpeg.pro index 01329a11fef..173249c634d 100644 --- a/config.tests/unix/libjpeg/libjpeg.pro +++ b/config.tests/unix/libjpeg/libjpeg.pro @@ -1,3 +1,2 @@ SOURCES = libjpeg.cpp CONFIG -= qt dylib -LIBS += -ljpeg diff --git a/config.tests/unix/libpng/libpng.pro b/config.tests/unix/libpng/libpng.pro index cdca43171cc..72e5e77b065 100644 --- a/config.tests/unix/libpng/libpng.pro +++ b/config.tests/unix/libpng/libpng.pro @@ -1,8 +1,2 @@ SOURCES = libpng.cpp CONFIG -= qt dylib -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += libpng -} else { - LIBS += -lpng -} diff --git a/config.tests/unix/libudev/libudev.pro b/config.tests/unix/libudev/libudev.pro index 28b8980e2e3..b557e7b17b2 100644 --- a/config.tests/unix/libudev/libudev.pro +++ b/config.tests/unix/libudev/libudev.pro @@ -1,4 +1,2 @@ SOURCES = libudev.cpp CONFIG -= qt -LIBS += $$QMAKE_LIBS_LIBUDEV -INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV diff --git a/config.tests/unix/mtdev/mtdev.pro b/config.tests/unix/mtdev/mtdev.pro index 4c7f76c89f5..14111c6dc64 100644 --- a/config.tests/unix/mtdev/mtdev.pro +++ b/config.tests/unix/mtdev/mtdev.pro @@ -1,6 +1,3 @@ SOURCES = mtdev.cpp -CONFIG += link_pkgconfig -PKGCONFIG_PRIVATE += mtdev - CONFIG -= qt diff --git a/config.tests/unix/mysql/mysql.cpp b/config.tests/unix/mysql/mysql.cpp index 697148cbcbb..3f83cb1e686 100644 --- a/config.tests/unix/mysql/mysql.cpp +++ b/config.tests/unix/mysql/mysql.cpp @@ -36,6 +36,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) +#include +#endif #include "mysql.h" diff --git a/config.tests/unix/mysql/mysql.pro b/config.tests/unix/mysql/mysql.pro index 06d1880f082..745f9ee0fb3 100644 --- a/config.tests/unix/mysql/mysql.pro +++ b/config.tests/unix/mysql/mysql.pro @@ -1,3 +1,2 @@ SOURCES = mysql.cpp CONFIG -= qt dylib -LIBS += -lmysqlclient diff --git a/config.tests/unix/mysql_r/mysql_r.pro b/config.tests/unix/mysql_r/mysql_r.pro deleted file mode 100644 index 096da69487a..00000000000 --- a/config.tests/unix/mysql_r/mysql_r.pro +++ /dev/null @@ -1,3 +0,0 @@ -SOURCES = ../mysql/mysql.cpp -CONFIG -= qt dylib -LIBS += -lmysqlclient_r diff --git a/config.tests/unix/oci/oci.pro b/config.tests/unix/oci/oci.pro index 3ffda1ddd7e..c9aec08ee0b 100644 --- a/config.tests/unix/oci/oci.pro +++ b/config.tests/unix/oci/oci.pro @@ -1,3 +1,2 @@ SOURCES = oci.cpp CONFIG -= qt dylib -LIBS += -lclntsh diff --git a/config.tests/unix/odbc/odbc.cpp b/config.tests/unix/odbc/odbc.cpp index f4a52f9dac1..fc36f121c48 100644 --- a/config.tests/unix/odbc/odbc.cpp +++ b/config.tests/unix/odbc/odbc.cpp @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#ifdef __MINGW32__ +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) #include #endif #include @@ -45,5 +45,7 @@ int main(int, char **) { + SQLHANDLE env; + SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); return 0; } diff --git a/config.tests/unix/odbc/odbc.pro b/config.tests/unix/odbc/odbc.pro index 70f3b668dab..6c72dc7b1ce 100644 --- a/config.tests/unix/odbc/odbc.pro +++ b/config.tests/unix/odbc/odbc.pro @@ -1,4 +1,2 @@ SOURCES = odbc.cpp CONFIG -= qt dylib -mingw:LIBS += -lodbc32 -else:LIBS += -lodbc diff --git a/config.tests/unix/opengldesktop/opengldesktop.pro b/config.tests/unix/opengldesktop/opengldesktop.pro index c3e700c50aa..22c0be247d9 100644 --- a/config.tests/unix/opengldesktop/opengldesktop.pro +++ b/config.tests/unix/opengldesktop/opengldesktop.pro @@ -1,11 +1,5 @@ SOURCES = opengldesktop.cpp -INCLUDEPATH += $$QMAKE_INCDIR_OPENGL - -for(p, QMAKE_LIBDIR_OPENGL) { - exists($$p):LIBS += -L$$p -} CONFIG -= qt -LIBS += $$QMAKE_LIBS_OPENGL mac:DEFINES += Q_OS_MAC diff --git a/config.tests/unix/opengles2/opengles2.pro b/config.tests/unix/opengles2/opengles2.pro index da30b453c65..c84563f62ea 100644 --- a/config.tests/unix/opengles2/opengles2.pro +++ b/config.tests/unix/opengles2/opengles2.pro @@ -1,12 +1,7 @@ SOURCES = opengles2.cpp -INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2 - -for(p, QMAKE_LIBDIR_OPENGL_ES2) { - LIBS += -L$$p -} CONFIG -= qt -LIBS += $$QMAKE_LIBS_OPENGL_ES2 + mac { DEFINES += BUILD_ON_MAC } diff --git a/config.tests/unix/opengles3/opengles3.pro b/config.tests/unix/opengles3/opengles3.pro index 720985f14db..956a3bc1027 100644 --- a/config.tests/unix/opengles3/opengles3.pro +++ b/config.tests/unix/opengles3/opengles3.pro @@ -3,14 +3,9 @@ # the library. SOURCES = opengles3.cpp -INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2 - -for(p, QMAKE_LIBDIR_OPENGL_ES2) { - LIBS += -L$$p -} CONFIG -= qt -LIBS += $$QMAKE_LIBS_OPENGL_ES2 + mac { DEFINES += BUILD_ON_MAC } diff --git a/config.tests/unix/opengles31/opengles31.pro b/config.tests/unix/opengles31/opengles31.pro index 225180e1c69..7895be9efc2 100644 --- a/config.tests/unix/opengles31/opengles31.pro +++ b/config.tests/unix/opengles31/opengles31.pro @@ -3,11 +3,5 @@ # the library. SOURCES = opengles31.cpp -INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2 - -for(p, QMAKE_LIBDIR_OPENGL_ES2) { - LIBS += -L$$p -} CONFIG -= qt -LIBS += $$QMAKE_LIBS_OPENGL_ES2 diff --git a/config.tests/unix/pcre/pcre.pro b/config.tests/unix/pcre/pcre.pro index 7b8bfc65453..a47e6d1e967 100644 --- a/config.tests/unix/pcre/pcre.pro +++ b/config.tests/unix/pcre/pcre.pro @@ -1,3 +1,2 @@ SOURCES = pcre.cpp CONFIG -= qt dylib -LIBS += -lpcre16 diff --git a/config.tests/unix/pps/pps.pro b/config.tests/unix/pps/pps.pro index 21bdeedbfbc..af9b339f97d 100644 --- a/config.tests/unix/pps/pps.pro +++ b/config.tests/unix/pps/pps.pro @@ -1,3 +1,2 @@ SOURCES = pps.cpp CONFIG -= qt -LIBS += -lpps diff --git a/config.tests/unix/psql/psql.pro b/config.tests/unix/psql/psql.pro index d0f3761bfb1..dae7375be56 100644 --- a/config.tests/unix/psql/psql.pro +++ b/config.tests/unix/psql/psql.pro @@ -1,3 +1,2 @@ SOURCES = psql.cpp CONFIG -= qt dylib -LIBS *= -lpq diff --git a/config.tests/unix/pulseaudio/pulseaudio.pro b/config.tests/unix/pulseaudio/pulseaudio.pro index d75b16f41ef..5e36c0aa81c 100644 --- a/config.tests/unix/pulseaudio/pulseaudio.pro +++ b/config.tests/unix/pulseaudio/pulseaudio.pro @@ -1,3 +1,2 @@ SOURCES = pulseaudio.cpp CONFIG -= qt -LIBS += diff --git a/config.tests/unix/qqnx_imf/qqnx_imf.pro b/config.tests/unix/qqnx_imf/qqnx_imf.pro index c51adb65ad4..e1a2d9cecb3 100644 --- a/config.tests/unix/qqnx_imf/qqnx_imf.pro +++ b/config.tests/unix/qqnx_imf/qqnx_imf.pro @@ -1,3 +1,2 @@ SOURCES = qqnx_imf.cpp CONFIG -= qt -LIBS += -linput_client diff --git a/config.tests/unix/sctp/sctp.pro b/config.tests/unix/sctp/sctp.pro index edcc0a444a8..2138254732c 100644 --- a/config.tests/unix/sctp/sctp.pro +++ b/config.tests/unix/sctp/sctp.pro @@ -1,4 +1,3 @@ SOURCES = sctp.cpp CONFIG -= qt QT = -LIBS += $$QMAKE_LIBS_NETWORK diff --git a/config.tests/unix/slog2/slog2.pro b/config.tests/unix/slog2/slog2.pro index e65460bb948..269a88a3831 100644 --- a/config.tests/unix/slog2/slog2.pro +++ b/config.tests/unix/slog2/slog2.pro @@ -1,3 +1,2 @@ SOURCES = slog2.cpp CONFIG -= qt -LIBS += -lslog2 diff --git a/config.tests/unix/sqlite2/sqlite2.pro b/config.tests/unix/sqlite2/sqlite2.pro index 7e69fdf2f32..b1252721dc0 100644 --- a/config.tests/unix/sqlite2/sqlite2.pro +++ b/config.tests/unix/sqlite2/sqlite2.pro @@ -1,3 +1,2 @@ SOURCES = sqlite2.cpp CONFIG -= qt dylib -LIBS += -lsqlite diff --git a/config.tests/unix/tds/tds.pro b/config.tests/unix/tds/tds.pro index 6712779d589..f60fc0a6022 100644 --- a/config.tests/unix/tds/tds.pro +++ b/config.tests/unix/tds/tds.pro @@ -1,3 +1,2 @@ SOURCES = tds.cpp CONFIG -= qt dylib -LIBS += -lsybdb diff --git a/config.tests/unix/tslib/tslib.pro b/config.tests/unix/tslib/tslib.pro index 1191120b890..6fc652dd96a 100644 --- a/config.tests/unix/tslib/tslib.pro +++ b/config.tests/unix/tslib/tslib.pro @@ -1,3 +1,2 @@ SOURCES = tslib.cpp CONFIG -= qt -LIBS += -lts diff --git a/config.tests/unix/zlib/zlib.pro b/config.tests/unix/zlib/zlib.pro index d9bd03e5df3..6a6b3246112 100644 --- a/config.tests/unix/zlib/zlib.pro +++ b/config.tests/unix/zlib/zlib.pro @@ -1,3 +1,2 @@ SOURCES = zlib.cpp CONFIG -= qt dylib -LIBS += -lz diff --git a/config.tests/win/directwrite/directwrite.pro b/config.tests/win/directwrite/directwrite.pro index 9a4612ca119..88ff6ee2b86 100644 --- a/config.tests/win/directwrite/directwrite.pro +++ b/config.tests/win/directwrite/directwrite.pro @@ -1,4 +1,3 @@ SOURCES = directwrite.cpp -LIBS += -ldwrite CONFIG -= qt CONFIG += console diff --git a/config.tests/win/directwrite2/directwrite2.pro b/config.tests/win/directwrite2/directwrite2.pro index ec37247017a..5d6fe24a4b6 100644 --- a/config.tests/win/directwrite2/directwrite2.pro +++ b/config.tests/win/directwrite2/directwrite2.pro @@ -1,4 +1,3 @@ SOURCES = directwrite2.cpp -LIBS += -ldwrite CONFIG -= qt CONFIG += console diff --git a/config.tests/x11/opengl/opengl.cpp b/config.tests/x11/opengl/opengl.cpp deleted file mode 100644 index e73c46b9e6e..00000000000 --- a/config.tests/x11/opengl/opengl.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -int main(int, char **) -{ - GLuint x; - x = 0; - return 0; -} diff --git a/config.tests/x11/opengl/opengl.pro b/config.tests/x11/opengl/opengl.pro deleted file mode 100644 index d6814f1bd56..00000000000 --- a/config.tests/x11/opengl/opengl.pro +++ /dev/null @@ -1,11 +0,0 @@ -SOURCES = opengl.cpp -CONFIG += x11 -INCLUDEPATH += $$QMAKE_INCDIR_OPENGL - -for(p, QMAKE_LIBDIR_OPENGL) { - exists($$p):LIBS += -L$$p -} - -CONFIG -= qt -mingw:LIBS += -lopengl32 -else:LIBS += -lGL diff --git a/config.tests/x11/xinput2/xinput2.pro b/config.tests/x11/xinput2/xinput2.pro index ae8819b3d1f..4788f0e14b8 100644 --- a/config.tests/x11/xinput2/xinput2.pro +++ b/config.tests/x11/xinput2/xinput2.pro @@ -1,4 +1,3 @@ CONFIG += x11 CONFIG -= qt -LIBS += -lXi SOURCES = xinput2.cpp diff --git a/config.tests/x11/xrender/xrender.pro b/config.tests/x11/xrender/xrender.pro index e7786420fa0..ab5c5efa773 100644 --- a/config.tests/x11/xrender/xrender.pro +++ b/config.tests/x11/xrender/xrender.pro @@ -1,4 +1,3 @@ SOURCES = xrender.cpp CONFIG += x11 CONFIG -= qt -LIBS += -lXrender diff --git a/configure.json b/configure.json index df4180636f4..56fda6200cb 100644 --- a/configure.json +++ b/configure.json @@ -201,6 +201,547 @@ }, + "libraries": { + "libatomic": { + "description": "64 bit atomics in libatomic", + "export": "", + "test": "common/atomic64", + "sources": [ + "-latomic" + ] + }, + "libdl": { + "description": "dlopen() in libdl", + "export": "", + "test": "unix/dlopen", + "sources": [ + "-ldl" + ] + }, + "doubleconversion": { + "description": "DoubleConversion", + "export": "", + "test": "unix/doubleconversion", + "sources": [ + "-ldouble-conversion" + ] + }, + "pcre": { + "description": "PCRE", + "export": "", + "test": "unix/pcre", + "sources": [ + "-lpcre16" + ] + }, + "zlib": { + "description": "zlib", + "test": "unix/zlib", + "export": "", + "sources": [ + { "libs": "-lzdll", "condition": "config.msvc" }, + { "libs": "-lz", "condition": "!config.msvc" } + ] + }, + "gnu_iconv": { + "description": "GNU libiconv", + "export": "", + "test": "unix/gnu-libiconv", + "sources": [ + "-liconv" + ] + }, + "icu": { + "description": "ICU", + "export": "", + "test": "unix/icu", + "sources": [ + { + "builds": { + "debug": "-lsicuind -lsicuucd -lsicudtd", + "release": "-lsicuin -lsicuuc -lsicudt" + }, + "condition": "config.win32 && !features.shared" + }, + { "libs": "-licuin -licuuc -licudt", "condition": "config.win32 && features.shared" }, + { "libs": "-licui18n -licuuc -licudata", "condition": "!config.win32" } + ] + }, + "network": { + "export": "", + "sources": [ + { "type": "makeSpec", "spec": "NETWORK" } + ] + }, + "corewlan": { + "description": "CoreWLan", + "export": "", + "test": "mac/corewlan", + "sources": [ + "-framework CoreWLAN -framework Foundation" + ] + }, + "openssl": { + "description": "OpenSSL Libraries", + "export": "", + "sources": [ + { "type": "openssl" }, + { "libs": "-lssleay32 -llibeay32", "condition": "config.win32 && features.shared" }, + { "libs": "-lssl -lcrypto", "condition": "!config.win32" } + ] + }, + "libproxy": { + "description": "libproxy", + "export": "", + "test": "common/libproxy", + "sources": [ + "-lproxy" + ] + }, + "glib": { + "description": "GLib", + "test": "unix/glib", + "sources": [ + { "type": "pkgConfig", "args": "glib-2.0 gthread-2.0" } + ] + }, + "gtk3": { + "description": "GTK+", + "sources": [ + { "type": "pkgConfig", "args": "gtk+-3.0" } + ] + }, + "cups": { + "description": "CUPS", + "export": "", + "test": "unix/cups", + "sources": [ + "-lcups" + ] + }, + "libjpeg": { + "description": "libjpeg", + "export": "", + "test": "unix/libjpeg", + "sources": [ + { "libs": "-llibjpeg", "condition": "config.msvc" }, + { "libs": "-ljpeg", "condition": "!config.msvc" } + ] + }, + "libpng": { + "description": "libpng", + "export": "", + "test": "unix/libpng", + "sources": [ + { "type": "pkgConfig", "args": "libpng" }, + { "libs": "-llibpng", "condition": "config.msvc" }, + { "libs": "-lpng", "condition": "!config.msvc" } + ] + }, + "alsa": { + "description": "ALSA", + "export": "", + "test": "unix/alsa", + "sources": [ + "-lasound" + ] + }, + "pulseaudio": { + "description": "PulseAudio >= 0.9.10", + "test": "unix/pulseaudio", + "sources": [ + { "type": "pkgConfig", "args": "libpulse >= 0.9.10 libpulse-mainloop-glib" } + ] + }, + "gstreamer_1_0": { + "description": "GStreamer 1.0", + "export": "", + "test": "unix/gstreamer", + "sources": [ + { "type": "pkgConfig", + "args": "gstreamer-1.0 gstreamer-base-1.0 gstreamer-audio-1.0 gstreamer-video-1.0 gstreamer-pbutils-1.0" } + ] + }, + "gstreamer_0_10": { + "description": "GStreamer 0.10", + "export": "", + "test": "unix/gstreamer", + "sources": [ + { "type": "pkgConfig", + "args": "gstreamer-0.10 gstreamer-base-0.10 gstreamer-audio-0.10 gstreamer-video-0.10 gstreamer-pbutils-0.10" } + ] + }, + "freetype": { + "description": "FreeType", + "export": "", + "test": "unix/freetype", + "sources": [ + "-lfreetype" + ] + }, + "fontconfig": { + "description": "Fontconfig", + "test": "unix/fontconfig", + "sources": [ + { "type": "pkgConfig", "args": "fontconfig freetype2" }, + "-lfontconfig -lfreetype" + ] + }, + "harfbuzz": { + "description": "HarfBuzz", + "export": "", + "test": "unix/harfbuzz", + "sources": [ + "-lharfbuzz" + ] + }, + "dbus": { + "description": "D-Bus >= 1.2", + "test": "unix/dbus", + "sources": [ + { "type": "pkgConfig", "args": "dbus-1 >= 1.2" }, + { + "libs": "", + "builds": { + "debug": "-ldbus-1d", + "release": "-ldbus-1" + }, + "condition": "config.win32" + }, + { "libs": "-ldbus-1", "condition": "!config.win32" } + ] + }, + "host_dbus": { + "description": "D-Bus >= 1.2 (host)", + "export": "", + "sources": [ + { "type": "pkgConfig", "host": true, "args": "dbus-1 >= 1.2" } + ] + }, + "libinput": { + "description": "libinput", + "test": "unix/libinput", + "sources": [ + { "type": "pkgConfig", "args": "libinput" } + ] + }, + "mtdev": { + "description": "mtdev", + "export": "", + "test": "unix/mtdev", + "sources": [ + { "type": "pkgConfig", "args": "mtdev" } + ] + }, + "tslib": { + "description": "tslib", + "export": "", + "test": "unix/tslib", + "sources": [ + "-lts" + ] + }, + "libudev": { + "description": "udev", + "test": "unix/libudev", + "sources": [ + { "type": "pkgConfig", "args": "libudev" }, + "-ludev" + ] + }, + "xkbcommon": { + "description": "xkbcommon", + "export": "xkbcommon_evdev", + "test": "unix/xkbcommon", + "sources": [ + { "type": "pkgConfig", "args": "xkbcommon" } + ] + }, + "xkbcommon_x11": { + "description": "xkbcommon-x11 >= 0.4.1", + "export": "xkbcommon", + "sources": [ + { "type": "pkgConfig", "args": "xkbcommon xkbcommon-x11 >= 0.4.1" } + ] + }, + "xinput2": { + "description": "Xinput2", + "test": "x11/xinput2", + "sources": [ + { "type": "pkgConfig", "args": "xi" }, + "-lXi" + ] + }, + "xrender": { + "description": "XRender", + "export": "", + "test": "x11/xrender", + "sources": [ + "-lXrender" + ] + }, + "xcb": { + "description": "XCB >= 1.5 (core)", + "test": "qpa/xcb", + "sources": [ + { "type": "pkgConfig", "args": "xcb >= 1.5" }, + "-lxcb" + ] + }, + "xcb_syslibs": { + "description": "XCB (secondary)", + "export": "", + "test": "qpa/xcb-syslibs", + "sources": [ + { "type": "pkgConfig", + "args": "xcb xcb-shm xcb-sync xcb-xfixes xcb-randr xcb-image xcb-keysyms xcb-icccm xcb-shape" }, + "-lxcb -lxcb-shm -lxcb-sync -lxcb-xfixes -lxcb-randr -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-shape" + ] + }, + "xcb_xlib": { + "description": "XCB Xlib", + "export": "", + "test": "qpa/xcb-xlib", + "sources": [ + { "type": "pkgConfig", "args": "X11-xcb x11 xcb" }, + "-lxcb -lX11 -lX11-xcb" + ] + }, + "xcb_xkb": { + "description": "XCB XKB >= 1.10", + "export": "", + "test": "qpa/xcb-xkb", + "sources": [ + { "type": "pkgConfig", "args": "xcb-xkb >= 1.10 xcb" }, + "-lxcb-xkb -lxcb" + ] + }, + "xcb_render": { + "description": "XCB XRender", + "test": "qpa/xcb-render", + "sources": [ + { "type": "pkgConfig", "args": "xcb-renderutil xcb-render xcb" }, + "-lxcb-render-util -lxcb-render -lxcb" + ] + }, + "xcb_glx": { + "description": "XCB GLX", + "test": "qpa/xcb-glx", + "sources": [ + { "type": "pkgConfig", "args": "xcb-glx xcb" }, + "-lxcb-glx -lxcb" + ] + }, + "x11sm": { + "description": "X11 session management", + "export": "", + "sources": [ + { "type": "pkgConfig", "args": "sm ice" } + ] + }, + "opengl": { + "description": "Desktop OpenGL", + "test": "unix/opengldesktop", + "sources": [ + { "type": "pkgConfig", "args": "gl" }, + { "type": "makeSpec", "spec": "OPENGL" } + ] + }, + "opengl_es2": { + "description": "OpenGL ES 2.0", + "test": "unix/opengles2", + "sources": [ + { "type": "pkgConfig", "args": "glesv2" }, + { "type": "makeSpec", "spec": "OPENGL_ES2" } + ] + }, + "egl": { + "description": "EGL", + "test": "qpa/egl", + "sources": [ + { "type": "pkgConfig", "args": "egl" }, + { "type": "makeSpec", "spec": "EGL" } + ] + }, + "bcm_host": { + "export": "", + "sources": [ + "-lbcm_host" + ] + }, + "gbm": { + "description": "GBM", + "export": "", + "test": "qpa/gbm", + "sources": [ + { "type": "pkgConfig", "args": "gbm" } + ] + }, + "drm": { + "description": "KMS", + "export": "", + "test": "qpa/kms", + "sources": [ + { "type": "pkgConfig", "args": "libdrm" }, + "-ldrm" + ] + }, + "wayland_server": { + "description": "Wayland Server", + "export": "", + "test": "qpa/wayland-server", + "sources": [ + { "type": "pkgConfig", "args": "wayland-server" } + ] + }, + "directfb": { + "description": "DirectFB", + "test": "qpa/directfb", + "sources": [ + { "type": "pkgConfig", "args": "directfb" } + ] + }, + "mirclient": { + "description": "Mir client libraries", + "export": "", + "test": "qpa/mirclient", + "sources": [ + { "type": "pkgConfig", "args": "egl mirclient ubuntu-platform-api" } + ] + }, + "directwrite": { + "description": "DirectWrite", + "export": "", + "test": "win/directwrite", + "sources": [ + "-ldwrite" + ] + }, + "journald": { + "description": "journald", + "test": "unix/journald", + "export": "", + "sources": [ + { "type": "pkgConfig", "args": "libsystemd" }, + { "type": "pkgConfig", "args": "libsystemd-journal" } + ] + }, + "slog2": { + "description": "slog2", + "test": "unix/slog2", + "export": "", + "sources": [ + "-lslog2" + ] + }, + "imf": { + "description": "IMF", + "export": "", + "test": "unix/qqnx_imf", + "sources": [ + "-linput_client" + ] + }, + "pps": { + "description": "PPS", + "export": "", + "test": "unix/pps", + "sources": [ + "-lpps" + ] + }, + "lgmon": { + "description": "lgmon", + "test": "unix/lgmon", + "export": "", + "sources": [ + "-llgmon" + ] + }, + "db2": { + "description": "DB2 (IBM)", + "export": "", + "test": "unix/db2", + "sources": [ + { "libs": "-ldb2cli", "condition": "config.win32" }, + { "libs": "-ldb2", "condition": "!config.win32" } + ] + }, + "ibase": { + "description": "InterBase", + "export": "", + "test": "unix/ibase", + "sources": [ + { "libs": "-lgds32_ms", "condition": "config.win32" }, + { "libs": "-lgds", "condition": "!config.win32" } + ] + }, + "mysql": { + "description": "MySQL", + "test": "unix/mysql", + "sources": [ + { "type": "mysqlConfig", "query": "--libs_r" }, + { "type": "mysqlConfig", "query": "--libs" }, + { "libs": "-lmysqlclient_r", "condition": "!config.win32" }, + { "libs": "-llibmysql", "condition": "config.win32" }, + { "libs": "-lmysqlclient", "condition": "!config.win32" } + ] + }, + "psql": { + "description": "PostgreSQL", + "test": "unix/psql", + "sources": [ + { "type": "psqlConfig" }, + { "type": "psqlEnv", "libs": "-llibpq -lws2_32 -ladvapi32", "condition": "config.win32" }, + { "type": "psqlEnv", "libs": "-lpq", "condition": "!config.win32" } + ] + }, + "tds": { + "description": "TDS (Sybase)", + "test": "unix/tds", + "sources": [ + { "type": "sybaseEnv", "libs": "-lNTWDBLIB", "condition": "config.win32" }, + { "type": "sybaseEnv", "libs": "-lsybdb", "condition": "!config.win32" } + ] + }, + "oci": { + "description": "OCI (Oracle)", + "export": "", + "test": "unix/oci", + "sources": [ + { "libs": "-loci", "condition": "config.win32" }, + { "libs": "-lclntsh", "condition": "!config.win32" } + ] + }, + "odbc": { + "description": "ODBC", + "test": "unix/odbc", + "sources": [ + { "libs": "-lodbc32", "condition": "config.win32" }, + { "libs": "-liodbc", "condition": "config.darwin" }, + { "libs": "-lodbc", "condition": "!config.win32 && !config.darwin" } + ] + }, + "sqlite2": { + "description": "SQLite (version 2)", + "export": "", + "test": "unix/sqlite2", + "sources": [ + "-lsqlite" + ] + }, + "sqlite3": { + "description": "SQLite (version 3)", + "export": "sqlite", + "test": "unix/sqlite", + "sources": [ + { "type": "pkgConfig", "args": "sqlite3" }, + { "libs": "-lsqlite3", "condition": "config.win32" }, + { "libs": "-lsqlite3 -lz", "condition": "!config.win32" } + ] + } + }, + "tests": { "architecture": { "description": "target architecture", @@ -289,11 +830,6 @@ "type": "compile", "test": "unix/dlopen" }, - "libdl": { - "description": "dlopen() in libdl", - "type": "compile", - "test": "unix/libdl" - }, "separate_debug_info": { "description": "separate debug information support", "type": "compile", @@ -304,12 +840,6 @@ "type": "compile", "test": "common/atomic64" }, - "atomic64_libatomic": { - "description": "64 bit atomics in libatomic", - "type": "compile", - "test": "common/atomic64", - "libs": "-latomic" - }, "atomicfptr": { "description": "working std::atomic for function pointers", "type": "compile", @@ -433,11 +963,6 @@ "type": "compile", "test": "unix/clock-monotonic" }, - "alsa": { - "description": "ALSA", - "type": "compile", - "test": "unix/alsa" - }, "evdev": { "description": "evdev", "type": "compile", @@ -448,20 +973,17 @@ "type": "compile", "test": "unix/eventfd" }, - "gbm": { - "description": "GBM", - "type": "compile", - "test": "qpa/gbm" - }, "getaddrinfo": { "description": "getaddrinfo()", "type": "compile", - "test": "unix/getaddrinfo" + "test": "unix/getaddrinfo", + "use": "network" }, "getifaddrs": { "description": "getifaddrs()", "type": "compile", - "test": "unix/getifaddrs" + "test": "unix/getifaddrs", + "use": "network" }, "inotify": { "description": "inotify", @@ -471,38 +993,19 @@ "ipv6ifname": { "description": "IPv6 ifname", "type": "compile", - "test": "unix/ipv6ifname" - }, - "libproxy": { - "description": "libproxy", - "type": "compile", - "test": "common/libproxy" + "test": "unix/ipv6ifname", + "use": "network" }, "linuxfb": { "description": "LinuxFB", "type": "compile", "test": "qpa/linuxfb" }, - "kms": { - "description": "KMS", - "type": "compile", - "test": "qpa/kms" - }, - "mirclient": { - "description": "Mir client libraries", - "type": "compile", - "test": "qpa/mirclient" - }, "mremap": { "description": "mremap()", "type": "compile", "test": "unix/mremap" }, - "mtdev": { - "description": "mtdev", - "type": "compile", - "test": "unix/mtdev" - }, "journald": { "description": "journald", "type": "compile", @@ -523,26 +1026,6 @@ "type": "compilerSupportsFlag", "test": "-fstack-protector-strong" }, - "slog2": { - "description": "slog2", - "type": "compile", - "test": "unix/slog2" - }, - "imf": { - "description": "IMF", - "type": "compile", - "test": "unix/qqnx_imf" - }, - "pps": { - "description": "PPS", - "type": "compile", - "test": "unix/pps" - }, - "lgmon": { - "description": "lgmon", - "type": "compile", - "test": "unix/lgmon" - }, "ipc_sysv": { "description": "SysV IPC", "type": "compile", @@ -553,11 +1036,6 @@ "type": "compile", "test": "unix/ipc_posix" }, - "tslib": { - "description": "tslib", - "type": "compile", - "test": "unix/tslib" - }, "ppoll": { "description": "ppoll()", "type": "compile", @@ -578,67 +1056,16 @@ "type": "compile", "test": "unix/cloexec" }, - "corewlan": { - "description": "CoreWLan", - "type": "compile", - "test": "mac/corewlan" - }, "openssl": { "description": "OpenSSL", "type": "compile", "test": "unix/openssl" }, - "openssl-libs": { - "description": "OpenSSL Libraries", - "type": "openssl", - "libs": "-lssl -lcrypto" - }, "sctp": { "description": "SCTP support", "type": "compile", - "test": "unix/sctp" - }, - "icu": { - "description": "ICU", - "type": "compile", - "test": "unix/icu" - }, - "glib": { - "description": "GLib", - "type": "compile", - "test": "unix/glib", - "pkg-config-args": "glib-2.0 gthread-2.0" - }, - "gtk": { - "description": "GTK+", - "type": "pkgConfig", - "pkg-config-args": "gtk+-3.0" - }, - "pulseaudio": { - "description": "PulseAudio >= 0.9.10", - "type": "compile", - "test": "unix/pulseaudio", - "pkg-config-args": "libpulse >= 0.9.10 libpulse-mainloop-glib" - }, - "cups": { - "description": "CUPS", - "type": "compile", - "test": "unix/cups" - }, - "libjpeg": { - "description": "libjpeg", - "type": "compile", - "test": "unix/libjpeg" - }, - "libpng": { - "description": "libpng", - "type": "compile", - "test": "unix/libpng" - }, - "zlib": { - "description": "zlib", - "type": "compile", - "test": "unix/zlib" + "test": "unix/sctp", + "use": "network" }, "posix-iconv": { "description": "POSIX iconv", @@ -650,196 +1077,52 @@ "type": "compile", "test": "unix/sun-libiconv" }, - "gnu-iconv": { - "description": "GNU libiconv", - "type": "compile", - "test": "unix/gnu-libiconv" - }, - "freetype": { - "description": "FreeType", - "type": "compile", - "test": "unix/freetype" - }, - "fontconfig": { - "description": "Fontconfig", - "type": "compile", - "test": "unix/fontconfig", - "pkg-config-args": "fontconfig freetype2", - "libs": "-lfontconfig -lfreetype" - }, - "harfbuzz": { - "description": "HarfBuzz", - "type": "compile", - "test": "unix/harfbuzz" - }, - "dbus": { - "description": "D-Bus >= 1.2", - "type": "compile", - "test": "unix/dbus", - "pkg-config-args": "dbus-1 >= 1.2" - }, - "host-dbus": { - "description": "D-Bus >= 1.2 (host)", - "type": "pkgConfig", - "host": true, - "pkg-config-args": "dbus-1 >= 1.2" - }, - "directfb": { - "description": "DirectFB", - "type": "compile", - "test": "qpa/directfb", - "pkg-config-args": "directfb" - }, - "egl": { - "description": "EGL", - "type": "compile", - "test": "qpa/egl", - "pkg-config-args": "egl" - }, "egl-x11": { "description": "EGL on X11", "type": "compile", "test": "qpa/egl-x11", - "pkg-config-args": "egl" + "use": "egl xcb_xlib" }, "egl-brcm": { "description": "Broadcom EGL (Rasberry Pi)", "type": "compile", "test": "qpa/eglfs-brcm", - "pkg-config-args": "egl" + "use": "egl bcm_host" }, "egl-egldevice": { "description": "EGLDevice", "type": "compile", - "test": "qpa/eglfs-egldevice" + "test": "qpa/eglfs-egldevice", + "use": "egl" }, "egl-mali": { "description": "Mali EGL", "type": "compile", - "test": "qpa/eglfs-mali" + "test": "qpa/eglfs-mali", + "use": "egl" }, "egl-mali-2": { "description": "Mali 2 EGL", "type": "compile", - "test": "qpa/eglfs-mali-2" + "test": "qpa/eglfs-mali-2", + "use": "egl" }, "egl-viv": { "description": "i.Mx6 EGL", "type": "compile", - "test": "qpa/eglfs-viv" - }, - "wayland-server": { - "description": "Wayland Server", - "type": "compile", - "test": "qpa/wayland-server" - }, - "libinput": { - "description": "libinput", - "type": "compile", - "test": "unix/libinput", - "pkg-config-args": "libinput" - }, - "libudev": { - "description": "udev", - "type": "compile", - "test": "unix/libudev", - "pkg-config-args": "libudev" - }, - "xkbcommon": { - "description": "xkbcommon", - "type": "compile", - "test": "unix/xkbcommon", - "pkg-config-args": "xkbcommon" - }, - "xkbcommon-x11": { - "description": "xkbcommon-x11 >= 0.4.1", - "type": "pkgConfig", - "pkg-config-args": "xkbcommon xkbcommon-x11 >= 0.4.1" - }, - "xinput2": { - "description": "Xinput2", - "type": "compile", - "test": "x11/xinput2", - "pkg-config-args": "xi" - }, - "doubleconversion": { - "description": "DoubleConversion", - "type": "compile", - "test": "unix/doubleconversion" + "test": "qpa/eglfs-viv", + "use": "egl" }, "xlocalescanprint": { "description": "xlocale.h (or equivalents)", "type": "compile", "test": "common/xlocalescanprint" }, - "pcre": { - "description": "PCRE", - "type": "compile", - "test": "unix/pcre" - }, - "gstreamer-1_0": { - "description": "GStreamer 1.0", - "type": "compile", - "test": "unix/gstreamer", - "args": "-config gst-1.0" - }, - "gstreamer-0_10": { - "description": "GStreamer 0.10", - "type": "compile", - "test": "unix/gstreamer", - "args": "-config gst-0.10" - }, - "xcb": { - "description": "XCB >= 1.5 (core)", - "type": "compile", - "test": "qpa/xcb", - "pkg-config-args": "xcb >= 1.5" - }, - "xcb-syslibs": { - "description": "XCB (secondary)", - "type": "compile", - "test": "qpa/xcb-syslibs", - "pkg-config-args": "xcb xcb-shm xcb-sync xcb-xfixes xcb-randr xcb-image xcb-keysyms xcb-icccm xcb-shape" - }, - "xcb-xkb": { - "description": "XCB XKB >= 1.10", - "type": "compile", - "test": "qpa/xcb-xkb", - "pkg-config-args": "xcb-xkb >= 1.10" - }, - "xcb-render": { - "description": "XCB XRender", - "type": "compile", - "test": "qpa/xcb-render", - "pkg-config-args": "xcb" - }, - "xcb-glx": { - "description": "XCB GLX", - "type": "compile", - "test": "qpa/xcb-glx", - "pkg-config-args": "xcb" - }, - "xcb-xlib": { - "description": "XCB Xlib", - "type": "compile", - "test": "qpa/xcb-xlib", - "pkg-config-args": "xcb" - }, - "x11-sm": { - "description": "X11 session management", - "type": "pkgConfig", - "pkg-config-args": "sm ice" - }, "xlib": { "description": "XLib", "type": "compile", "test": "x11/xlib" }, - "xrender": { - "description": "XRender", - "type": "compile", - "test": "x11/xrender" - }, "x11prefix": { "description": "X11 prefix", "type": "getPkgConfigVariable", @@ -855,105 +1138,23 @@ "pkg-config-variable": "xkb_base", "log": "value" }, - "opengl-desktop": { - "description": "Desktop OpenGL", - "type": "compile", - "test": "unix/opengldesktop", - "pkg-config-args": "gl" - }, - "opengl-mingw": { - "description": "Desktop OpenGL", - "type": "compile", - "test": "x11/opengl" - }, - "opengles2": { - "description": "OpenGL ES 2.0", - "type": "compile", - "test": "unix/opengles2", - "pkg-config-args": "glesv2" - }, "opengles3": { "description": "OpenGL ES 3.0", "type": "compile", "test": "unix/opengles3", - "pkg-config-args": "glesv2" + "use": "opengl_es2" }, "opengles31": { "description": "OpenGL ES 3.1", "type": "compile", "test": "unix/opengles31", - "pkg-config-args": "glesv2" - }, - "db2": { - "description": "DB2 (IBM)", - "type": "compile", - "test": "unix/db2" - }, - "ibase": { - "description": "InterBase", - "type": "compile", - "test": "unix/ibase" - }, - "mysql": { - "description": "MySQL", - "type": "mysqlCompile", - "test": "unix/mysql", - "query": "--libs" - }, - "mysql_r": { - "description": "MySQL (threadsafe)", - "type": "mysqlCompile", - "test": "unix/mysql_r", - "query": "--libs_r" - }, - "oci": { - "description": "OCI (Oracle)", - "type": "compile", - "test": "unix/oci" - }, - "odbc": { - "description": "ODBC", - "type": "compile", - "test": "unix/odbc", - "libs": "-lodbc" - }, - "iodbc": { - "description": "iODBC", - "type": "compile", - "test": "unix/iodbc", - "libs": "-liodbc" - }, - "psql": { - "description": "PostgreSQL", - "type": "psqlCompile", - "test": "unix/psql" - }, - "sqlite2": { - "description": "SQLite (version 2)", - "type": "compile", - "test": "unix/sqlite2" - }, - "sqlite": { - "description": "SQLite (version 3)", - "type": "compile", - "test": "unix/sqlite", - "pkg-config-args": "sqlite3", - "libs": "-lsqlite3 -lz" - }, - "tds": { - "description": "TDS (Sybase)", - "type": "tdsCompile", - "test": "unix/tds" - }, - "directwrite": { - "description": "DirectWrite", - "type": "compile", - "test": "win/directwrite" + "use": "opengl_es2" }, "directwrite2": { "description": "DirectWrite 2", "type": "compile", - "test": "win/directwrite2" + "test": "win/directwrite2", + "use": "directwrite" }, "qpa_default_platform": { "description": "default QPA platform", @@ -1232,21 +1433,20 @@ }, "dlopen": { "description": "dlopen()", - "condition": "tests.dlopen || tests.libdl", + "condition": "tests.dlopen || libs.libdl", "output": [ { "type": "define", "negative": true, "name": "QT_NO_DYNAMIC_LIBRARY" } ] }, "libdl": { "description": "dlopen() in libdl", - "condition": "!tests.dlopen && tests.libdl", + "condition": "!tests.dlopen && libs.libdl", "output": [ { "type": "privateConfig", "negative": true } ] }, "std-atomic64": { "description": "64 bit atomic operations", - "condition": "tests.atomic64 || tests.atomic64_libatomic", + "condition": "tests.atomic64 || libs.libatomic", "output": [ { "type": "define", "negative": true, "name": "QT_NO_STD_ATOMIC64" }, - { "type": "privateConfig", "name": "atomic64-libatomic", - "condition": "!tests.atomic64 && tests.atomic64_libatomic" } + { "type": "privateConfig", "name": "atomic64-libatomic", "condition": "!tests.atomic64" } ] }, "sse2": { @@ -1413,7 +1613,7 @@ }, "alsa": { "description": "ALSA", - "condition": "tests.alsa", + "condition": "libs.alsa", "output": [ "feature" ] }, "evdev": { @@ -1428,7 +1628,7 @@ }, "gbm": { "description": "GBM", - "condition": "tests.gbm", + "condition": "libs.gbm", "output": [ "publicQtConfig" ] }, "getaddrinfo": { @@ -1454,7 +1654,7 @@ "libproxy": { "description": "libproxy", "autoDetect": false, - "condition": "tests.libproxy", + "condition": "libs.libproxy", "output": [ "feature" ] }, "linuxfb": { @@ -1465,11 +1665,8 @@ "directfb": { "description": "DirectFB", "autoDetect": false, - "condition": "tests.directfb", - "output": [ - "publicQtConfig", - { "type": "library", "test": "directfb" } - ] + "condition": "libs.directfb", + "output": [ "publicQtConfig" ] }, "integrityfb": { "description": "INTEGRITY framebuffer", @@ -1478,12 +1675,12 @@ }, "kms": { "description": "KMS", - "condition": "tests.kms", + "condition": "libs.drm", "output": [ "publicQtConfig" ] }, "mirclient": { "description": "Mir client", - "condition": "tests.mirclient", + "condition": "libs.mirclient", "output": [ "publicQtConfig" ] }, "mremap": { @@ -1493,13 +1690,13 @@ }, "mtdev": { "description": "mtdev", - "condition": "tests.mtdev", + "condition": "libs.mtdev", "output": [ "privateFeature" ] }, "journald": { "description": "journald", "autoDetect": false, - "condition": "tests.journald", + "condition": "libs.journald", "output": [ "privateConfig" ] }, "posix_fallocate": { @@ -1520,26 +1717,26 @@ }, "slog2": { "description": "slog2", - "condition": "tests.slog2", + "condition": "libs.slog2", "emitIf": "config.qnx", "output": [ "privateConfig" ] }, "qqnx_imf": { "description": "IMF", "emitIf": "config.qnx", - "condition": "tests.imf", + "condition": "libs.imf", "output": [ "privateConfig" ] }, "qqnx_pps": { "description": "PPS", "emitIf": "config.qnx", - "condition": "tests.pps", + "condition": "libs.pps", "output": [ "privateConfig" ] }, "lgmon": { "description": "lgmon", "emitIf": "config.qnx", - "condition": "tests.lgmon", + "condition": "libs.lgmon", "output": [ "privateConfig" ] }, "poll_ppoll": { @@ -1590,12 +1787,12 @@ }, "tslib": { "description": "tslib", - "condition": "tests.tslib", + "condition": "libs.tslib", "output": [ "privateFeature" ] }, "corewlan": { "description": "CoreWLan", - "condition": "tests.corewlan", + "condition": "libs.corewlan", "emitIf": "config.darwin", "output": [ "feature" ] }, @@ -1622,10 +1819,10 @@ "description": " Qt directly linked to OpenSSL", "enable": "input.openssl == 'linked'", "disable": "input.openssl != 'linked'", - "condition": "features.openssl && tests.openssl-libs", + "condition": "features.openssl && libs.openssl", "output": [ "publicQtConfig", - { "type": "varAssign", "name": "OPENSSL_LIBS", "value": "tests.openssl-libs.libs", "eval": "true" }, + { "type": "varAssign", "name": "OPENSSL_LIBS", "value": "libs.openssl.libs", "eval": "true" }, { "type": "define", "name": "QT_LINKED_OPENSSL" } ] }, @@ -1652,38 +1849,29 @@ }, "glib": { "description": "GLib", - "condition": "tests.glib", - "output": [ - "feature", - { "type": "library", "test": "glib" } - ] + "condition": "libs.glib", + "output": [ "feature" ] }, "gtk3": { "description": "GTK+", "autoDetect": "!config.darwin", - "condition": "features.glib && tests.gtk", - "output": [ - "publicQtConfig", - { "type": "library", "test": "gtk" } - ] + "condition": "features.glib && libs.gtk3", + "output": [ "publicQtConfig" ] }, "icu": { "description": "ICU", "autoDetect": "!config.win32", - "condition": "tests.icu", + "condition": "libs.icu", "output": [ "publicQtConfig" ] }, "pulseaudio": { "description": "PulseAudio", - "condition": "tests.pulseaudio", - "output": [ - "feature", - { "type": "library", "test": "pulseaudio" } - ] + "condition": "libs.pulseaudio", + "output": [ "feature" ] }, "cups": { "description": "CUPS", - "condition": "tests.cups", + "condition": "libs.cups", "output": [ "feature" ] }, "jpeg": { @@ -1698,7 +1886,7 @@ "description": " Using system libjpeg", "disable": "input.libjpeg == 'qt'", "enable": "input.libjpeg == 'system'", - "condition": "features.jpeg && tests.libjpeg", + "condition": "features.jpeg && libs.libjpeg", "output": [ "publicQtConfig" ] }, "gif": { @@ -1720,12 +1908,12 @@ "description": " Using system libpng", "disable": "input.libpng == 'qt'", "enable": "input.libpng == 'system'", - "condition": "features.png && tests.libpng", + "condition": "features.png && libs.libpng", "output": [ "publicQtConfig" ] }, "system-zlib": { "description": "Using system zlib", - "condition": "config.darwin || tests.zlib", + "condition": "config.darwin || libs.zlib", "output": [ "publicQtConfig" ] }, "iconv": { @@ -1750,7 +1938,7 @@ "description": "GNU iconv", "enable": "input.iconv == 'gnu'", "disable": "input.iconv == 'posix' || input.iconv == 'sun' || input.iconv == 'no'", - "condition": "!config.win32 && !features.posix-libiconv && !features.sun-libiconv && tests.gnu-iconv", + "condition": "!config.win32 && !features.posix-libiconv && !features.sun-libiconv && libs.gnu_iconv", "output": [ "publicQtConfig" ] }, "freetype": { @@ -1762,16 +1950,13 @@ "enable": "input.freetype == 'system'", "disable": "input.freetype == 'qt'", "autoDetect": "!config.win32", - "condition": "features.freetype && tests.freetype", + "condition": "features.freetype && libs.freetype", "output": [ "publicQtConfig" ] }, "fontconfig": { "description": "Fontconfig", - "condition": "features.system-freetype && tests.fontconfig", - "output": [ - "feature", - { "type": "library", "test": "fontconfig" } - ] + "condition": "features.system-freetype && libs.fontconfig", + "output": [ "feature" ] }, "harfbuzz": { "description": "HarfBuzz", @@ -1782,7 +1967,7 @@ "enable": "input.harfbuzz == 'system'", "disable": "input.harfbuzz == 'qt'", "autoDetect": "!config.darwin", - "condition": "features.harfbuzz && tests.harfbuzz", + "condition": "features.harfbuzz && libs.harfbuzz", "output": [ "publicQtConfig" ] }, "concurrent": { @@ -1798,17 +1983,14 @@ "description": "Qt D-Bus directly linked to libdbus", "enable": "input.dbus == 'linked'", "disable": "input.dbus == 'runtime'", - "condition": "features.dbus && tests.dbus", - "output": [ - "publicQtConfig", - { "type": "library", "name": "dbus", "test": "dbus" } - ] + "condition": "features.dbus && libs.dbus", + "output": [ "publicQtConfig" ] }, "host-dbus": { "description": "Qt D-Bus (Host)", "autoDetect": "!config.android", - "condition": "tests.host-dbus", - "output": [ { "type": "varAppend", "name": "QT_HOST_CFLAGS_DBUS", "value": "tests.host-dbus.cflags", "eval": "true" } ] + "condition": "libs.host_dbus", + "output": [ { "type": "varAppend", "name": "QT_HOST_CFLAGS_DBUS", "value": "libs.host_dbus.cflags", "eval": "true" } ] }, "skip_modules": { "output": [ { "type": "varAssign", "name": "QT_SKIP_MODULES", "value": "tests.skip_modules.value" } ] @@ -1839,11 +2021,8 @@ }, "egl": { "description": "EGL", - "condition": "features.opengl && tests.egl", - "output": [ - "feature", - { "type": "library", "test": "egl" } - ] + "condition": "features.opengl && libs.egl", + "output": [ "feature" ] }, "egl_x11": { "description": "EGL on X11", @@ -1883,43 +2062,31 @@ }, "eglfs_viv_wl": { "description": "EGLFS i.Mx6 Wayland", - "condition": "features.eglfs_viv && tests.wayland-server", + "condition": "features.eglfs_viv && libs.wayland_server", "output": [ "publicQtConfig" ] }, "libudev": { "description": "udev", - "condition": "tests.libudev", - "output": [ - "privateFeature", - { "type": "library", "test": "libudev" } - ] + "condition": "libs.libudev", + "output": [ "privateFeature" ] }, "libinput": { "description": "libinput", - "condition": "features.libudev && tests.libinput", - "output": [ - "privateFeature", - { "type": "library", "test": "libinput" } - ] + "condition": "features.libudev && libs.libinput", + "output": [ "privateFeature" ] }, "xkbcommon-evdev": { "description": "xkbcommon-evdev", - "condition": "tests.xkbcommon", - "output": [ - "publicQtConfig", - { "type": "library", "test": "xkbcommon" } - ] + "condition": "libs.xkbcommon", + "output": [ "publicQtConfig" ] }, "xkbcommon-system": { "description": "Using system-provided xkbcommon", "emitIf": "features.xcb", "enable": "input.xkbcommon == 'system'", "disable": "input.xkbcommon == 'qt' || input.xkbcommon == 'no'", - "condition": "tests.xkbcommon-x11", - "output": [ - { "type": "publicQtConfig", "negative": true, "name": "xkbcommon-qt" }, - { "type": "library", "name": "xkbcommon", "test": "xkbcommon-x11" } - ] + "condition": "libs.xkbcommon_x11", + "output": [ { "type": "publicQtConfig", "negative": true, "name": "xkbcommon-qt" } ] }, "xkb-config-root": { "description": "XKB config root", @@ -1929,11 +2096,8 @@ }, "xinput2": { "description": "Xinput2", - "condition": "tests.xinput2", - "output": [ - "publicQtConfig", - { "type": "library", "test": "xinput2" } - ] + "condition": "libs.xinput2", + "output": [ "publicQtConfig" ] }, "doubleconversion": { "description": "DoubleConversion", @@ -1943,40 +2107,38 @@ "description": " Using system DoubleConversion", "enable": "input.doubleconversion == 'system'", "disable": "input.doubleconversion == 'qt'", - "condition": "features.doubleconversion && tests.doubleconversion", + "condition": "features.doubleconversion && libs.doubleconversion", "output": [ "publicQtConfig" ] }, "system-pcre": { "description": "Using system PCRE", "disable": "input.pcre == 'qt'", "enable": "input.pcre == 'system'", - "condition": "tests.pcre", + "condition": "libs.pcre", "output": [ { "type": "privateConfig", "negative": true, "name": "pcre" } ] }, "gstreamer-1_0": { "description": "GStreamer 1.0", "disable": "input.gstreamer == '0.10' || input.gstreamer == 'no'", "enable": "input.gstreamer == '1.0'", - "condition": "tests.gstreamer-1_0", + "condition": "libs.gstreamer_1_0", "output": [ { "type": "publicQtConfig", "name": "gstreamer-1.0" } ] }, "gstreamer-0_10": { "description": "GStreamer 0.10", "disable": "input.gstreamer == 'no'", "enable": "input.gstreamer == '0.10'", - "condition": "!features.gstreamer-1_0 && tests.gstreamer-0_10", + "condition": "!features.gstreamer-1_0 && libs.gstreamer_0_10", "output": [ { "type": "publicQtConfig", "name": "gstreamer-0.10" } ] }, "xcb": { "description": "XCB", "autoDetect": "!config.darwin", - "condition": "tests.xcb", + "condition": "libs.xcb", "output": [ "publicQtConfig", { "type": "publicQtConfig", "name": "xcb-qt", "condition": "!features.system-xcb" }, - { "type": "publicQtConfig", "name": "xcb-plugin" }, - { "type": "library", "test": "xcb", "condition": "!features.system-xcb" }, - { "type": "library", "test": "xcb-syslibs", "condition": "features.system-xcb" } + { "type": "publicQtConfig", "name": "xcb-plugin" } ] }, "system-xcb": { @@ -1984,45 +2146,36 @@ "enable": "input.xcb == 'system' || input.xcb == 'yes'", "disable": "input.xcb == 'qt' || input.xcb == 'no'", "autoDetect": "!config.darwin", - "condition": "tests.xcb && tests.xcb-syslibs" + "condition": "libs.xcb && libs.xcb_syslibs" }, "xcb-render": { "description": "XCB render", "emitIf": "features.system-xcb", - "condition": "tests.xcb-render", - "output": [ - "publicQtConfig", - { "type": "library", "test": "xcb-render" } - ] + "condition": "libs.xcb_render", + "output": [ "publicQtConfig" ] }, "xcb-glx": { "description": "XCB GLX", "emitIf": "features.xcb", - "condition": "tests.xcb-glx", - "output": [ - "publicQtConfig", - { "type": "library", "test": "xcb-glx" } - ] + "condition": "libs.xcb_glx", + "output": [ "publicQtConfig" ] }, "xcb-xlib": { "description": "XCB Xlib", "emitIf": "features.xcb", - "condition": "tests.xcb-xlib", + "condition": "libs.xcb_xlib", "output": [ "publicQtConfig" ] }, "xcb-sm": { "description": "xcb-sm", "emitIf": "features.xcb", - "condition": "features.sessionmanager && tests.x11-sm", + "condition": "features.sessionmanager && libs.x11sm", "output": [ "publicQtConfig" ] }, "xkb": { "description": "XCB XKB", - "condition": "features.system-xcb && tests.xcb-xkb", - "output": [ - "privateFeature", - { "type": "library", "test": "xcb-xkb" } - ] + "condition": "features.system-xcb && libs.xcb_xkb", + "output": [ "privateFeature" ] }, "xlib": { "description": "XLib", @@ -2031,7 +2184,7 @@ }, "xrender": { "description": "Xrender", - "condition": "tests.xrender", + "condition": "libs.xrender", "output": [ "feature" ] }, "x11-prefix": { @@ -2043,12 +2196,11 @@ "description": "OpenGL ES 2.0", "enable": "input.opengl == 'es2'", "disable": "input.opengl == 'desktop' || input.opengl == 'no'", - "condition": "!features.opengl-desktop && tests.opengles2", + "condition": "!features.opengl-desktop && libs.opengl_es2", "output": [ "publicQtConfig", { "type": "define", "name": "QT_OPENGL_ES" }, - { "type": "define", "name": "QT_OPENGL_ES_2" }, - { "type": "library", "name": "OPENGL_ES2", "test": "opengles2" } + { "type": "define", "name": "QT_OPENGL_ES_2" } ] }, "opengles3": { @@ -2065,8 +2217,7 @@ "description": "Desktop OpenGL", "enable": "input.opengl == 'desktop'", "disable": "input.opengl == 'es2' || input.opengl == 'no'", - "condition": "(config.win32 && tests.opengl-mingw) || (!config.win32 && tests.opengl-desktop)", - "output": [ { "type": "library", "name": "OPENGL", "test": "opengl-desktop", "condition": "!config.win32" } ] + "condition": "libs.opengl" }, "opengl": { "description": "OpenGL", @@ -2075,53 +2226,42 @@ }, "db2": { "description": "DB2 (IBM)", - "condition": "tests.db2", + "condition": "libs.db2", "output": [ "sqldriver" ] }, "ibase": { "description": "InterBase", - "condition": "tests.ibase", + "condition": "libs.ibase", "output": [ "sqldriver" ] }, "mysql": { "description": "MySql", - "condition": "tests.mysql", - "output": [ - "sqldriver", - { "type": "library", "test": "mysql", "condition": "!features.use_libmysqlclient_r" }, - { "type": "library", "test": "mysql_r", "condition": "features.use_libmysqlclient_r" } - ] + "condition": "libs.mysql", + "output": [ "sqldriver" ] }, "use_libmysqlclient_r": { "description": "MySql (threadsafe)", - "condition": "features.mysql && tests.mysql_r", + "condition": "features.mysql && (libs.mysql.source == 0 || libs.mysql.source == 2)", "output": [ "privateConfig" ] }, "oci": { "description": "OCI (Oracle)", - "condition": "tests.oci", + "condition": "libs.oci", "output": [ "sqldriver" ] }, "odbc": { "description": "ODBC", - "condition": "(!config.darwin && tests.odbc) || tests.iodbc", - "output": [ - "sqldriver", - { "type": "library", "test": "odbc", "condition": "!config.darwin && tests.odbc" }, - { "type": "library", "test": "iodbc", "condition": "config.darwin || !tests.odbc" } - ] + "condition": "libs.odbc", + "output": [ "sqldriver" ] }, "psql": { "description": "PostgreSQL", - "condition": "tests.psql", - "output": [ - "sqldriver", - { "type": "library", "test": "psql" } - ] + "condition": "libs.psql", + "output": [ "sqldriver" ] }, "sqlite2": { "description": "SQLite2", - "condition": "tests.sqlite2", + "condition": "libs.sqlite2", "output": [ "sqldriver" ] }, "sqlite": { @@ -2131,19 +2271,13 @@ "system-sqlite": { "description": " Using system provided SQLite", "autoDetect": false, - "condition": "features.sqlite && tests.sqlite", - "output": [ - "publicQtConfig", - { "type": "library", "test": "sqlite" } - ] + "condition": "features.sqlite && libs.sqlite3", + "output": [ "publicQtConfig" ] }, "tds": { "description": "TDS (Sybase)", - "condition": "tests.tds", - "output": [ - "sqldriver", - { "type": "library", "test": "tds" } - ] + "condition": "libs.tds", + "output": [ "sqldriver" ] }, "fusion-style": { "description": "Fusion Style", @@ -2184,7 +2318,7 @@ "directwrite": { "description": "DirectWrite", "emitIf": "config.win32", - "condition": "tests.directwrite", + "condition": "libs.directwrite", "output": [ "publicQtConfig" ] }, "directwrite2": { @@ -2293,7 +2427,7 @@ XKB configuration data. This is required for keyboard input support." }, { "type": "note", - "condition": "features.openssl-linked && tests.openssl-libs.showNote", + "condition": "features.openssl-linked && libs.openssl.source != 0", "message": "When linking against OpenSSL, you can override the default library names through OPENSSL_LIBS. For example: diff --git a/configure.pri b/configure.pri index 20eb120d330..021b0013eeb 100644 --- a/configure.pri +++ b/configure.pri @@ -228,19 +228,14 @@ defineTest(qtConfTest_buildParts) { return(true) } -defineTest(qtConfTest_openssl) { +defineTest(qtConfLibrary_openssl) { libs = $$getenv("OPENSSL_LIBS") - !isEmpty(libs) { $${1}.libs = $$libs export($${1}.libs) + return(true) } - - $${1}.showNote = false - isEmpty(libs): $${1}.showNote = true - export($${1}.showNote) - - return(true) + return(false) } defineTest(qtConfTest_checkCompiler) { @@ -288,7 +283,7 @@ defineReplace(filterLibraryPath) { return($$str) } -defineTest(qtConfTest_psqlCompile) { +defineTest(qtConfLibrary_psqlConfig) { pg_config = $$config.input.psql_config isEmpty(pg_config): \ pg_config = $$qtConfFindInPath("pg_config") @@ -304,21 +299,25 @@ defineTest(qtConfTest_psqlCompile) { $${1}.includedir = "$$val_escape(includedir)" !isEmpty(includedir): \ $${1}.cflags = "-I$$val_escape(includedir)" + export($${1}.libs) + export($${1}.includedir) + export($${1}.cflags) + return(true) } - - # Respect PSQL_LIBS if set - PSQL_LIBS = $$getenv(PSQL_LIBS) - !isEmpty($$PSQL_LIBS): $${1}.libs = $$PSQL_LIBS - - export($${1}.libs) - export($${1}.includedir) - export($${1}.cflags) - - qtConfTest_compile($${1}): return(true) return(false) } -defineTest(qtConfTest_mysqlCompile) { +defineTest(qtConfLibrary_psqlEnv) { + # Respect PSQL_LIBS if set + PSQL_LIBS = $$getenv(PSQL_LIBS) + !isEmpty(PSQL_LIBS) { + $${1}.libs = $$PSQL_LIBS + export($${1}.libs) + } + return(true) +} + +defineTest(qtConfLibrary_mysqlConfig) { mysql_config = $$config.input.mysql_config isEmpty(mysql_config): \ mysql_config = $$qtConfFindInPath("mysql_config") @@ -346,23 +345,22 @@ defineTest(qtConfTest_mysqlCompile) { export($${1}.libs) export($${1}.includedir) export($${1}.cflags) + return(true) } - - qtConfTest_compile($${1}): return(true) return(false) } -defineTest(qtConfTest_tdsCompile) { +defineTest(qtConfLibrary_sybaseEnv) { libs = sybase = $$getenv(SYBASE) !isEmpty(sybase): \ libs += "-L$${sybase}/lib" libs += $$getenv(SYBASE_LIBS) - $${1}.libs = "$$val_escape(libs)" - export($${1}.libs) - - qtConfTest_compile($${1}): return(true) - return(false) + !isEmpty(libs) { + $${1}.libs = "$$val_escape(libs)" + export($${1}.libs) + } + return(true) } diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index a0e5b1a772f..4846079fb19 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -322,11 +322,75 @@ defineReplace(qtConfPrepareArgs) { return($$args) } -defineTest(qtConfTest_pkgConfig) { +defineTest(qtConfSetupLibraries) { + for (l, config.libraries._KEYS_) { + lpfx = config.libraries.$${l} + # 'export' may be omitted, in which case it falls back to the library's name + !defined($${lpfx}.export, var) { + $${lpfx}.export = $$l + export($${lpfx}.export) + } + isEmpty($${lpfx}.sources._KEYS_): \ + error("Library $$l defines no sources") + for (s, $${lpfx}.sources._KEYS_) { + spfx = $${lpfx}.sources.$${s} + # link back to parent object + $${spfx}.library = $$l + export($${spfx}.library) + # a plain string is transformed into a structure + isEmpty($${spfx}._KEYS_) { + $${spfx}.libs = $$eval($${spfx}) + export($${spfx}.libs) + } + # if the type is missing (implicitly in the case of plain strings), assume 'inline' + isEmpty($${spfx}.type) { + $${spfx}.type = inline + export($${spfx}.type) + } + } + } +} + +# the library is specified inline in a 'libs' field. +# this source type cannot fail. +defineTest(qtConfLibrary_inline) { + lib = $$eval($${1}.library) + !defined($${1}.libs, var): \ + error("'inline' source in library '$$lib' does not specify 'libs'.") + return(true) +} + +# the library is provided by the qmake spec. +# this source type cannot fail. +defineTest(qtConfLibrary_makeSpec) { + spec = $$eval($${1}.spec) + isEmpty(spec): \ + error("makeSpec source in library '$$eval($${1}.library)' does not specify 'spec'.") + + $${1}.includedir = "$$val_escape(QMAKE_INCDIR_$$spec)" + export($${1}.includedir) + $${1}.cflags = "$$val_escape(QMAKE_CFLAGS_$$spec)" + export($${1}.cflags) + libs = + for (l, QMAKE_LIBDIR_$$spec): \ + libs += -L$$l + libs += $$eval(QMAKE_LIBS_$$spec) + $${1}.libs = "$$val_escape(libs)" + export($${1}.libs) + + # the library definition is always in scope, so no point in exporting it. + $${1}.export = false + export($${1}.export) + + return(true) +} + +# the library is found via pkg-config. +defineTest(qtConfLibrary_pkgConfig) { pkg_config = $$qtConfPkgConfig($$eval($${1}.host)) isEmpty(pkg_config): \ return(false) - args = $$qtConfPrepareArgs($$eval($${1}.pkg-config-args)) + args = $$qtConfPrepareArgs($$eval($${1}.args)) !qtConfPkgConfigPackageExists($$pkg_config, $$args): \ return(false) @@ -361,14 +425,117 @@ defineTest(qtConfTest_getPkgConfigVariable) { return(true) } +defineReplace(qtConfLibraryArgs) { + qmake_args = + libs = $$eval($${1}.libs) + !isEmpty(libs): \ + qmake_args += $$system_quote(LIBS += $$libs) + for (b, $${1}.builds._KEYS_): \ + qmake_args += $$system_quote(LIBS_$$upper($$b) += $$eval($${1}.builds.$${b})) + includedir = $$eval($${1}.includedir) + !isEmpty(includedir): \ + qmake_args += $$system_quote(INCLUDEPATH *= $$includedir) + return($$qmake_args) +} + +defineTest(qtConfExportLibrary) { + isEmpty(2): return() + !$$qtConfEvaluate($$eval($${1}.export)): return() + + output = privatePro + + eval(libs = $$eval($${1}.libs)) + eval(cflags = $$eval($${1}.cflags)) + eval(includes = $$eval($${1}.includedir)) + version = $$split($${1}.version, '.') + + NAME = $$upper($$2) + !isEmpty(libs): qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs) + for (b, $${1}.builds._KEYS_): \ + qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), \ + $$eval($${1}.builds.$${b})) + !isEmpty(cflags): qtConfOutputVar(assign, $$output, QMAKE_CFLAGS_$$NAME, $$cflags) + !isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes) + !isEmpty(version) { + qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_MAJOR, $$member(version, 0)) + qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_MINOR, $$member(version, 1)) + qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_PATCH, $$member(version, 2)) + } + export(config.output.$${output}) +} + +defineTest(qtConfHandleLibrary) { + lpfx = config.libraries.$$1 + defined($${lpfx}.result, var): return() + + qtLogTestIntro($${lpfx}) + msg = "looking for library $${1}" + write_file($$QMAKE_CONFIG_LOG, msg, append) + + result = false + for (s, $${lpfx}.sources._KEYS_) { + qtLog("Trying source $$s of library $${1}.") + spfx = $${lpfx}.sources.$${s} + + t = $$eval($${spfx}.type) + call = qtConfLibrary_$$t + !defined($$call, test): \ + error("Library $${1} source $${s} has unknown type '$$t'") + + !$$qtConfEvaluate($$eval($${spfx}.condition)) { + qtLog("Source $$s of library $$1 failed condition.") + next() + } + + !$${call}($$spfx) { + qtLog("Source $$s of library $$1 produced no result.") + next() + } + + # if the library defines a test, use it to verify the source. + !isEmpty($${lpfx}.test) { + $${lpfx}.literal_args = $$qtConfLibraryArgs($$spfx) + $${lpfx}.host = $$eval($${spfx}.host) + !qtConfTest_compile($$lpfx) { + qtLog("Source $$s of library $$1 failed verification.") + next() + } + } + + # immediately output the library as well. + qtConfExportLibrary($${spfx}, $$eval($${lpfx}.export)) + + $${lpfx}.source = $$s + export($${lpfx}.source) + result = true + break() + } + + qtLogTestResult($${lpfx}, $$result) + + $${lpfx}.result = $$result + export($${lpfx}.result) +} + +defineTest(qtConfTestPrepare_compile) { + for (u, $$list($$eval($${1}.use))) { + !contains(config.libraries._KEYS_, $$u): \ + error("Test $$1 tries to use undeclared library '$$u'") + qtConfHandleLibrary($$u) + lpfx = config.libraries.$${u} + isEmpty($${lpfx}.source): \ + return(false) + $${1}.literal_args += $$qtConfLibraryArgs($${lpfx}.sources.$$eval($${lpfx}.source)) + } + export($${1}.literal_args) + return(true) +} + defineTest(qtConfTest_compile) { test = $$eval($${1}.test) host = $$eval($${1}.host) isEmpty(host): host = false - # get package config information - qtConfTest_pkgConfig($${1}) - test_dir = $$QMAKE_CONFIG_TESTS_DIR/$$test test_out_dir = $$shadowed($$test_dir) !isEmpty($${1}.pro): \ @@ -416,14 +583,6 @@ defineTest(qtConfTest_compile) { qmake_args += $$EXTRA_QMAKE_ARGS } - libs = $$eval($${1}.libs) - !isEmpty(libs): \ - qmake_args += "\"LIBS += $$libs\"" - - includedir = $$eval($${1}.includedir) - !isEmpty(includedir): \ - qmake_args += "\"INCLUDEPATH *= $$includedir\"" - # Clean up after previous run exists($$test_out_dir/Makefile): \ QMAKE_MAKE = "$$QMAKE_MAKE clean && $$QMAKE_MAKE" @@ -431,7 +590,7 @@ defineTest(qtConfTest_compile) { mkpath($$test_out_dir)|error() # add possible command line args - qmake_args += $$qtConfPrepareArgs($$eval($${1}.args)) + qmake_args += $$qtConfPrepareArgs($$eval($${1}.args)) $$eval($${1}.literal_args) qtRunLoggedCommand("$$test_cmd_base $$qmake_args $$system_quote($$test_dir)") { qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE"): \ @@ -445,7 +604,19 @@ defineTest(logn) { log("$${1}$$escape_expand(\\n)") } +defineTest(qtLogTestIntro) { + description = $$eval($${1}.description) + isEmpty(description): return() + + msg = "Checking for $${description}... " + log($$msg) + $$QMAKE_CONFIG_VERBOSE: log("$$escape_expand(\\n)") + write_file($$QMAKE_CONFIG_LOG, msg, append) +} + defineTest(qtLogTestResult) { + isEmpty($${1}.description): return() + !isEmpty($${1}.log) { field = $$eval($${1}.log) log_msg = $$eval($${1}.$$field) @@ -472,27 +643,27 @@ defineTest(qtRunSingleTest) { tpfx = config.tests.$${1} defined($${tpfx}.result, var): \ return() + result = true type = $$eval($${tpfx}.type) call = "qtConfTest_$$type" !defined($$call, test): \ error("Configure test $${1} refers to nonexistent type $$type") - description = $$eval($${tpfx}.description) - !isEmpty(description) { - msg = "checking for $${description}... " - log($$msg) - $$QMAKE_CONFIG_VERBOSE: log("$$escape_expand(\\n)") + preCall = "qtConfTestPrepare_$$type" + defined($$preCall, test): \ + !$${preCall}($${tpfx}): result = false + + $$result { + qtLogTestIntro($${tpfx}) + msg = "executing config test $${1}" write_file($$QMAKE_CONFIG_LOG, msg, append) + + !$${call}($${tpfx}): result = false + + qtLogTestResult($${tpfx}, $$result) } - msg = "executing config test $${1}" - write_file($$QMAKE_CONFIG_LOG, msg, append) - - result = false - $${call}($${tpfx}): result = true - - !isEmpty(description): qtLogTestResult($${tpfx}, $$result) $${tpfx}.result = $$result export($${tpfx}.result) } @@ -537,6 +708,19 @@ defineReplace(qtConfEvaluateSingleExpression) { error("Unknown test object $${test} in expression '$${1}'.") qtRunSingleTest($$test) result = $$eval(config.tests.$${test}.$${var}) + } else: contains(e, "^libs\..*") { + !qt_conf_tests_allowed: \ + error("Expression '$${1}' refers to a library, which is not allowed at this stage of configuring.") + lib = $$section(e, ".", 1, 1) + var = $$section(e, ".", 2, -1) + isEmpty(var): \ + var = result + !contains(config.libraries._KEYS_, $$lib): \ + error("Unknown library object $${lib} in expression '$${1}'.") + qtConfHandleLibrary($$lib) + !defined(config.libraries.$${lib}.$${var}, var): \ + var = sources.$$eval(config.libraries.$${lib}.$${source}).$$var + result = $$eval(config.libraries.$${lib}.$${var}) } else: contains(e, "^features\..*") { feature = $$section(e, ".", 1, 1) var = $$section(e, ".", 2, -1) @@ -1067,39 +1251,6 @@ defineTest(qtConfOutput_privateFeature) { } } - -defineTest(qtConfOutput_library) { - !$${2}: return() - - output = privatePro - name = "$$eval($${1}.name)" - isEmpty(name): \ - name = $$eval($${1}.feature) - NAME = $$upper($$replace(name, [-.], _)) - - test = $$eval($${1}.test) - isEmpty(test): \ - error("Output type 'library' used in feature '$$eval($${1}.feature)' without a 'test' entry.") - lookup = "config.tests.$$test" - isEmpty($${lookup}._KEYS_): \ - error("Output type 'library' used in feature '$$eval($${1}.feature)' refers to undefined test '$$test'.") - - eval(libs = $$eval($${lookup}.libs)) - eval(cflags = $$eval($${lookup}.cflags)) - eval(includes = $$eval($${lookup}.includedir)) - version = $$split($${lookup}.version, '.') - - !isEmpty(libs): qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs) - !isEmpty(cflags): qtConfOutputVar(assign, $$output, QMAKE_CFLAGS_$$NAME, $$cflags) - !isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes) - !isEmpty(version) { - qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_MAJOR, $$first(version)) - qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_MINOR, $$member(version, 1)) - qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_PATCH, $$member(version, 2)) - } - export(config.output.$${output}) -} - defineTest(qtConfProcessOneOutput) { feature = $${1} fpfx = config.features.$${feature} @@ -1163,6 +1314,8 @@ defineTest(qtConfigure) { !parseJson(configure_data, config): \ error("Invalid or non-existent file $${1}.") + qtConfSetupLibraries() + qtConfParseCommandLine() # do early checks, mainly to validate the command line From c8b46d3989ded1368d40e487a141b3cfb3d968ba Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 12 Aug 2016 10:14:51 +0200 Subject: [PATCH 191/236] Implement proper dependencies for configuration tests Some test types (like the compile tests) require that other features have been checked before, so that the compile test sets up the right environment. Implement this through a 'testTypeDependencies' section in the json file that explicitly encodes those dependencies for certain test types. This replaces the 'priority' field in the feature list. Done-with: Oswald Buddenhagen Change-Id: I70e7c67a4f2c971149bcac090cecbbe9cfff3f57 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- configure.json | 32 +++++++----- mkspecs/features/qt_configure.prf | 81 +++++++++++++++++++++++-------- 2 files changed, 81 insertions(+), 32 deletions(-) diff --git a/configure.json b/configure.json index 56fda6200cb..b3749a6abff 100644 --- a/configure.json +++ b/configure.json @@ -742,6 +742,20 @@ } }, + "testTypeDependencies": { + "linkerSupportsFlag": [ "use_gold_linker" ], + "compile": [ "shared", "use_gold_linker", "compiler-flags", "gcc-sysroot" ], + "detectPkgConfig": [ "cross_compile" ], + "library": [ "pkg-config" ], + "getPkgConfigVariable": [ "pkg-config" ], + "neon": [ "architecture" ] + }, + + "testTypeAliases": { + "compile": [ "library", "architecture" ], + "getPkgConfigVariable": [ "xkbConfigRoot" ] + }, + "tests": { "architecture": { "description": "target architecture", @@ -1173,8 +1187,7 @@ "publicConfig", { "type": "publicQtConfig", "negative": true, "name": "static" }, { "type": "publicConfig", "negative": true, "name": "static" } - ], - "priority": -3 + ] }, "cross_compile": { "description": "Cross compiling", @@ -1187,24 +1200,20 @@ "output": [ { "type": "publicConfig", "name": "c++11" } ] }, "compiler-flags": { - "output": [ "compilerFlags" ], - "priority": -3 + "output": [ "compilerFlags" ] }, "gcc-sysroot": { "output": [ "gccSysroot" ], - "condition": "input.sysroot != ''", - "priority": -3 + "condition": "input.sysroot != ''" }, "use_gold_linker": { "description": "Using gold linker", "condition": "tests.use_gold_linker", - "output": [ "privateConfig", "useGoldLinker" ], - "priority": -2 + "output": [ "privateConfig", "useGoldLinker" ] }, "architecture": { "description": "Architecture", - "output": [ "architecture" ], - "priority": -1 + "output": [ "architecture" ] }, "pkg-config": { "description": "Using pkg-config", @@ -1213,8 +1222,7 @@ "output": [ { "type": "publicQtConfig", "negative": true }, "pkgConfig" - ], - "priority": -1 + ] }, "developer-build": { diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 4846079fb19..0cb5c53fbe3 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -468,6 +468,8 @@ defineTest(qtConfHandleLibrary) { lpfx = config.libraries.$$1 defined($${lpfx}.result, var): return() + qtConfEnsureTestTypeDeps("library") + qtLogTestIntro($${lpfx}) msg = "looking for library $${1}" write_file($$QMAKE_CONFIG_LOG, msg, append) @@ -517,6 +519,11 @@ defineTest(qtConfHandleLibrary) { export($${lpfx}.result) } +# This is a fake test type for the test dependency system. +defineTest(qtConfTest_library) { + error("The test type 'library' may not be instantiated.") +} + defineTest(qtConfTestPrepare_compile) { for (u, $$list($$eval($${1}.use))) { !contains(config.libraries._KEYS_, $$u): \ @@ -639,6 +646,54 @@ defineTest(qtConfIsBoolean) { return(false) } +defineTest(qtConfSetupTestTypeDeps) { + for (tt, config.testTypeDependencies._KEYS_) { + !defined(qtConfTest_$${tt}, test): \ + error("Declaring dependency for undefined test type '$$tt'.") + for (f, config.testTypeDependencies.$${tt}._KEYS_) { + feature = $$eval(config.testTypeDependencies.$${tt}.$${f}) + isEmpty(config.features.$${feature}._KEYS_): \ + error("Test type '$$tt' depends on undefined feature '$$feature'.") + } + } + # Test type aliasing means that one test type's callback is called by + # another test type's callback. Put differently, one callback forwards + # the call to another one. The former representation is more natural + # (and concise) to write, while the latter is more efficient to process. + # Hence, this function inverts the mapping. + for (tt, config.testTypeAliases._KEYS_) { + !defined(qtConfTest_$${tt}, test): \ + error("Aliasing undefined test type '$$tt'.") + for (tta, config.testTypeAliases.$${tt}._KEYS_) { + type = $$eval(config.testTypeAliases.$${tt}.$${tta}) + !defined(qtConfTest_$${type}, test): \ + error("Aliasing '$$tt' to undefined test type '$$type'.") + config.testTypeForwards.$${type} += $$tt + export(config.testTypeForwards.$${type}) + } + } +} + +defineTest(qtConfEnsureTestTypeDeps) { + depsn = config.testTypeDependencies.$${1}._KEYS_ + !isEmpty($$depsn) { + for (dep, $$depsn) { + feature = $$eval(config.testTypeDependencies.$${1}.$${dep}) + !qtConfCheckFeature($$feature): \ + error("Test type '$$1' depends on non-emitted feature $${feature}.") + } + $$depsn = + export($$depsn) + } + fwdsn = config.testTypeForwards.$${1} + !isEmpty($$fwdsn) { + for (fwd, $$fwdsn): \ + qtConfEnsureTestTypeDeps($$fwd) + $$fwdsn = + export($$fwdsn) + } +} + defineTest(qtRunSingleTest) { tpfx = config.tests.$${1} defined($${tpfx}.result, var): \ @@ -650,6 +705,8 @@ defineTest(qtRunSingleTest) { !defined($$call, test): \ error("Configure test $${1} refers to nonexistent type $$type") + qtConfEnsureTestTypeDeps($$type) + preCall = "qtConfTestPrepare_$$type" defined($$preCall, test): \ !$${preCall}($${tpfx}): result = false @@ -738,6 +795,8 @@ defineReplace(qtConfEvaluateSingleExpression) { } else: contains(e, "^arch\..*") { var = $$replace(e, "^arch\.", "") result = false + isEmpty(QT_ARCH): \ + qtConfCheckFeature(architecture) contains(QT_ARCH, $$var): result = true } else: contains(e, "^input\..*") { result = $$eval(config.$$e) @@ -903,27 +962,8 @@ defineTest(qtConfCheckFeature) { defineTest(qtConfProcessFeatures) { - priorities = 0 for (feature, config.features._KEYS_): \ - priorities += $$eval(config.features.$${feature}.priority) - priorities = $$unique(priorities) - - for (p, priorities): \ - opriorities += $$format_number($$num_add($$p, 10000), width=5 zeropad) - opriorities = $$sorted(opriorities) - - priorities = - for (op, opriorities): \ - priorities += $$num_add($$op, -10000) - - for (priority, priorities) { - for (feature, config.features._KEYS_) { - p = $$eval(config.features.$${feature}.priority) - isEmpty(p): p = 0 - equals(p, $$priority): \ - qtConfCheckFeature($$feature) - } - } + qtConfCheckFeature($$feature) } # @@ -1315,6 +1355,7 @@ defineTest(qtConfigure) { error("Invalid or non-existent file $${1}.") qtConfSetupLibraries() + qtConfSetupTestTypeDeps() qtConfParseCommandLine() From 27b03be893be0b50e031cc3588caed081030a977 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 5 Aug 2016 17:54:26 +0200 Subject: [PATCH 192/236] Add support for locating headers and libs in qt_configure So far we only had support for locating executables. Also support locating header files and libraries. Change-Id: Ib2a83e8338d2da975204089d84c608061a081f29 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qt_configure.prf | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 0cb5c53fbe3..674f59044c8 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -275,15 +275,19 @@ defineTest(qtConfTest_linkerSupportsFlag) { return($$qtConfToolchainSupportsFlag($$LFLAGS "-Wl,$$flag")) } -defineReplace(qtConfFindInPath) { - ensurePathEnv() - for (dir, QMAKE_PATH_ENV) { +defineReplace(qtConfFindInPathList) { + for (dir, 2) { exists("$$dir/$${1}"): \ return("$$dir/$${1}") } return() } +defineReplace(qtConfFindInPath) { + ensurePathEnv() + return($$qtConfFindInPathList($$1, $$QMAKE_PATH_ENV)) +} + defineReplace(qtConfPkgConfigEnv) { env = !isEmpty(PKG_CONFIG_SYSROOT_DIR): env = "$${SETENV_PFX}PKG_CONFIG_SYSROOT_DIR=$${PKG_CONFIG_SYSROOT_DIR}$${SETENV_SFX} " @@ -607,6 +611,27 @@ defineTest(qtConfTest_compile) { return(false) } +defineTest(qtConfTest_files) { + for(i, $${1}.files._KEYS_) { + f = $$eval($${1}.files.$${i}) + qtLog("Searching for file $${f}.") + contains(f, ".*\.h") { + file = $$qtConfFindInPathList($$f, $$EXTRA_INCLUDEPATH $$QMAKE_DEFAULT_INCDIRS) + } else: contains(f, ".*\.(lib|so|a)") { + file = $$qtConfFindInPathList($$f, $$EXTRA_LIBDIR $$QMAKE_DEFAULT_LIBDIRS) + } else { + # assume we're looking for an executable + file = $$qtConfFindInPath($$f) + } + isEmpty(file) { + qtLog(" Not found."); + return(false) + } + qtLog(" Found at $${file}.") + } + return(true) +} + defineTest(logn) { log("$${1}$$escape_expand(\\n)") } From 98ddf9262e356178ddcf26b72e375c99cec16b79 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 27 Jun 2016 16:45:03 +0200 Subject: [PATCH 193/236] Revamp configure system for widget styles Add [-no]-style-foo command line options for all widget styles, bringing this closer in line with configure.exe. Add proper platform dependencies and a configure test for the required uxtheme.h header on Windows. Clean up and simplify styles.pri. Don't let configure.exe define QT_NO_STYLE_* any more, as styles.pri does that locally anyway. Change-Id: I81341f887a65b4e45e77380974eb79743acfad77 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- configure.json | 32 ++++++++++++++++++++++---------- configure.pri | 2 +- src/widgets/styles/styles.pri | 14 -------------- tools/configure/configureapp.cpp | 6 ------ 4 files changed, 23 insertions(+), 31 deletions(-) diff --git a/configure.json b/configure.json index b3749a6abff..0d8c73a6392 100644 --- a/configure.json +++ b/configure.json @@ -169,6 +169,12 @@ "ssse3": "boolean", "static": { "type": "enum", "name": "shared", "values": { "yes": "no", "no": "yes" } }, "strip": "boolean", + "style-windows": "boolean", + "style-windowsxp": "boolean", + "style-windowsvista": "boolean", + "style-fusion": "boolean", + "style-mac": "boolean", + "style-android": "boolean", "syslog": "boolean", "sysroot": "string", "system-proxies": "boolean", @@ -1170,6 +1176,11 @@ "test": "win/directwrite2", "use": "directwrite" }, + "uxtheme": { + "description": "uxtheme.h", + "type": "files", + "files": [ "uxtheme.h" ] + }, "qpa_default_platform": { "description": "default QPA platform", "type": "qpaDefaultPlatform", @@ -2287,36 +2298,37 @@ "condition": "libs.tds", "output": [ "sqldriver" ] }, - "fusion-style": { + "style-fusion": { "description": "Fusion Style", "output": [ "styles" ] }, - "mac-style": { + "style-mac": { "description": "Mac Style", + "condition": "config.osx", "output": [ "styles" ] }, - "windows-style": { + "style-windows": { "description": "Windows Style", "output": [ "styles" ] }, - "windowsxp-style": { + "style-windowsxp": { "description": "Windows XP Style", - "condition": "config.win32", + "condition": "features.style-windows && config.win32 && !config.winrt && tests.uxtheme", "output": [ "styles" ] }, - "windowsvista-style": { + "style-windowsvista": { "description": "Windows Vista Style", - "condition": "config.win32", + "condition": "features.style-windowsxp", "output": [ "styles" ] }, - "android-style": { + "style-android": { "description": "Android Style", - "condition": "config.android", + "autoDetect": "config.android", "output": [ "styles" ] }, "android-style-assets": { "description": "Android Style Assets", - "condition": "features.android-style", + "condition": "features.style-android", "output": [ "privateConfig" ] }, "audio-backend": { diff --git a/configure.pri b/configure.pri index 021b0013eeb..cc120c12d11 100644 --- a/configure.pri +++ b/configure.pri @@ -449,7 +449,7 @@ defineTest(qtConfOutput_architecture) { defineTest(qtConfOutput_styles) { !$${2}: return() - style = $$replace($${1}.feature, "-style", "") + style = $$replace($${1}.feature, "style-", "") qtConfOutputVar(append, "privatePro", "styles", $$style) } diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri index 1805e4a8aff..7b9497172c7 100644 --- a/src/widgets/styles/styles.pri +++ b/src/widgets/styles/styles.pri @@ -35,12 +35,6 @@ SOURCES += \ RESOURCES += styles/qstyle.qrc -contains( styles, all ) { - styles = fusion mac windows windowsxp windowsvista -} - -!macx:styles -= mac - contains( styles, mac ) { HEADERS += \ styles/qmacstyle_mac_p.h \ @@ -55,10 +49,6 @@ contains( styles, windowsvista ) { HEADERS += styles/qwindowsvistastyle_p.h HEADERS += styles/qwindowsvistastyle_p_p.h SOURCES += styles/qwindowsvistastyle.cpp - !contains( styles, windowsxp ) { - message( windowsvista requires windowsxp ) - styles += windowsxp - } } else { DEFINES += QT_NO_STYLE_WINDOWSVISTA } @@ -67,10 +57,6 @@ contains( styles, windowsxp ) { HEADERS += styles/qwindowsxpstyle_p.h HEADERS += styles/qwindowsxpstyle_p_p.h SOURCES += styles/qwindowsxpstyle.cpp - !contains( styles, windows ) { - message( windowsxp requires windows ) - styles += windows - } } else { DEFINES += QT_NO_STYLE_WINDOWSXP } diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 3a3794ee21c..c611de60605 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3277,12 +3277,6 @@ void Configure::generateConfigfiles() tmpStream << endl << "// Compile time features" << endl; QStringList qconfigList; - if (dictionary["STYLE_WINDOWS"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWS"; - if (dictionary["STYLE_FUSION"] != "yes") qconfigList += "QT_NO_STYLE_FUSION"; - if (dictionary["STYLE_WINDOWSXP"] != "yes" && dictionary["STYLE_WINDOWSVISTA"] != "yes") - qconfigList += "QT_NO_STYLE_WINDOWSXP"; - if (dictionary["STYLE_WINDOWSVISTA"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSVISTA"; - if (dictionary["PNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_PNG"; if (dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY"; From 9172143f52757c29fbcf1a5f30d5ca25c52efb81 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 10 Aug 2016 12:34:24 +0200 Subject: [PATCH 194/236] Add configure.exe-like FOO_LIBS=bar style command line options Add the command line options supported by the windows version of configure and respect them when running our configure tests. Done-with: Oswald Buddenhagen Change-Id: I1206d60a177e251540d34d232c73c930847564b3 Reviewed-by: Lars Knoll --- config_help.txt | 10 ++++- configure.json | 17 +++++++- mkspecs/features/qt_configure.prf | 66 +++++++++++++++++++++++++++++-- 3 files changed, 87 insertions(+), 6 deletions(-) diff --git a/config_help.txt b/config_help.txt index 85277afd3b7..c19f19f2f00 100644 --- a/config_help.txt +++ b/config_help.txt @@ -1,4 +1,8 @@ -Usage: configure [options] +Usage: configure [options] [assignments] + +Configure understands variable assignments like VAR=value on the command line. +These override any values possibly obtained from pkg-config. The variables +are mentioned in the descriptions of the options they relate to. Top-level installation directories: -prefix ...... The deployment directory, as seen on the target device. @@ -161,6 +165,7 @@ Component selection: -no-dbus ............. Do not build the Qt D-Bus module [default on Android] -dbus-linked ......... Build Qt D-Bus and link to libdbus-1 [auto] -dbus-runtime ........ Build Qt D-Bus and dynamically load libdbus-1 [no] + DBUS_PATH= DBUS_HOST_PATH= -feature- ... Enable . The available features are described in src/corelib/global/qfeatures.txt. [all enabled] -accessibility ....... Enable accessibility support [yes] @@ -182,6 +187,7 @@ Core options: -pps ................. Enable PPS support [auto] (QNX only) -pcre ................ Select used libpcre3 [system/qt] -zlib ................ Select used zlib [system/qt] + ZLIB_LIBS= Logging backends: -journald .......... Enable journald support [no] @@ -194,6 +200,7 @@ Network options: -no-openssl .......... Do not use OpenSSL [default on Apple] -openssl-linked ...... Use OpenSSL and link to libssl [no] -openssl-runtime ..... Use OpenSSL and dynamically load libssl [auto] + OPENSSL_PATH= OPENSSL_LIBS= -securetransport ..... Use SecureTransport [auto] (Apple only) -sctp ................ Enable SCTP support [no] @@ -256,6 +263,7 @@ Database options: -sql- ........ Enable SQL plugin. Supported drivers: db2 ibase mysql oci odbc psql sqlite2 sqlite tds [all auto] + MYSQL_PATH= PSQL_LIBS= SYBASE= SYBASE_LIBS= -sqlite .............. Select used sqlite3 [system/qt] Multimedia options: diff --git a/configure.json b/configure.json index 0d8c73a6392..29cbacc89d7 100644 --- a/configure.json +++ b/configure.json @@ -6,6 +6,17 @@ }, "commandline": { + "assignments": { + "DBUS_HOST_PATH": "host_dbus.prefix", + "DBUS_PATH": "dbus.prefix", + "MYSQL_PATH": "mysql.prefix", + "OPENSSL_LIBS": "openssl.libs", + "OPENSSL_PATH": "openssl.prefix", + "PSQL_LIBS": "psql.libs", + "SYBASE": "tds.prefix", + "SYBASE_LIBS": "tds.libs", + "ZLIB_LIBS": "zlib.libs" + }, "options": { "prefix": "string", "hostprefix": "string", @@ -421,7 +432,8 @@ "description": "D-Bus >= 1.2 (host)", "export": "", "sources": [ - { "type": "pkgConfig", "host": true, "args": "dbus-1 >= 1.2" } + { "type": "pkgConfig", "host": true, "args": "dbus-1 >= 1.2" }, + { "libs": "", "comment": "placeholder for DBUS_HOST_PATH" } ] }, "libinput": { @@ -2447,7 +2459,8 @@ XKB configuration data. This is required for keyboard input support." }, { "type": "note", - "condition": "features.openssl-linked && libs.openssl.source != 0", + "condition": "features.openssl-linked && libs.openssl.source != 0 + && input.openssl.prefix == '' && input.openssl.libs == ''", "message": "When linking against OpenSSL, you can override the default library names through OPENSSL_LIBS. For example: diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 674f59044c8..3d7b0ed9d25 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -123,6 +123,7 @@ defineTest(qtConfCommandline_string) { val = $${2} isEmpty(val): val = $$qtConfGetNextCommandlineArg() + # Note: Arguments which are variable assignments are legit here. contains(val, "^-.*")|isEmpty(val) { qtConfAddError("No value supplied to command line option '$$opt'.") return() @@ -139,7 +140,7 @@ defineTest(qtConfCommandline_optionalString) { val = $${2} isEmpty(val) { v = $$qtConfPeekNextCommandlineArg() - contains(v, "^-.*")|isEmpty(v): \ + contains(v, "^-.*|[A-Z_]+=.*")|isEmpty(v): \ val = "yes" else: \ val = $$qtConfGetNextCommandlineArg() @@ -157,7 +158,7 @@ defineTest(qtConfCommandline_addString) { val = $${2} isEmpty(val): val = $$qtConfGetNextCommandlineArg() - contains(val, "^-.*")|isEmpty(val) { + contains(val, "^-.*|[A-Z_]+=.*")|isEmpty(val) { qtConfAddError("No value supplied to command line option '$$opt'.") return() } @@ -189,6 +190,19 @@ defineTest(qtConfParseCommandLine) { next() } + contains(c, "([A-Z_]+)=(.*)") { + opt = $$replace(c, "^([A-Z_]+)=(.*)", "\\1") + val = $$replace(c, "^([A-Z_]+)=(.*)", "\\2") + var = $$eval(config.commandline.assignments.$${opt}) + isEmpty(var) { + qtConfAddError("Assigning unknown variable '$$opt' on command line.") + return() + } + config.input.$$var = $$val + export(config.input.$$var) + next() + } + # parse out opt and val contains(c, "^--?enable-(.*)") { opt = $$replace(c, "^--?enable-(.*)", "\\1") @@ -353,14 +367,60 @@ defineTest(qtConfSetupLibraries) { } } } + + # reverse mapping for assignments on command line. + for (a, config.commandline.assignments._KEYS_) { + apfx = config.commandline.assignments.$${a} + ra = config.commandline.rev_assignments.$$eval($$apfx) + $$ra = $$a + export($$ra) + } } # the library is specified inline in a 'libs' field. -# this source type cannot fail. +# overrides from the command line are accepted. defineTest(qtConfLibrary_inline) { lib = $$eval($${1}.library) !defined($${1}.libs, var): \ error("'inline' source in library '$$lib' does not specify 'libs'.") + + # direct libs. overwrites inline libs. + defined(config.input.$${lib}.libs, var) { + $${1}.libs = $$eval(config.input.$${lib}.libs) + export($${1}.libs) + } + + # build-specific direct libs. overwrites inline libs. + vars = + any = false + all = true + for (b, $${1}.builds._KEYS_) { + iv = $${lib}.libs.$${b} + vars += $$eval(config.commandline.rev_assignments.$${iv}) + defined(config.input.$${iv}, var) { + $${1}.builds.$${b}.libs = $$eval(config.input.$${iv}) + export($${1}.builds.$${b}.libs) + any = true + } else { + all = false + } + } + $$any:!$$all { + qtConfAddError("Either none or all of $$join(vars, ", ", [, ]) must be specified.") + return(false) + } + + # prefix. prepends to (possibly overwritten) inline libs. + prefix = $$val_escape(config.input.$${lib}.prefix) + !isEmpty(prefix) { + $${1}.includedir = $$prefix/include + export($${1}.includedir) + $${1}.cflags = -I$$prefix/include + export($${1}.cflags) + $${1}.libs = "-L$$prefix/lib $$eval($${1}.libs)" + export($${1}.libs) + } + return(true) } From fd3e12e7a6c71a244650415a86e98d910a011ebe Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jul 2016 13:58:53 +0200 Subject: [PATCH 195/236] replace mechanism to override variables from the mkspecs it is sometimes desirable to override values from the mkspec without modifying (or wrapping) the spec itself. linux distributors do this on a regular basis. so far, we'd pick up CFLAGS, etc. from the environment, in a somewhat autoconf-like fashion. however, over time, this approach proved problematic: the concept doesn't mix particularly well with mkspecs to start with, is unexpected (and therefore causes frustration), and doesn't mix well with cross-building (at least the way it was realized). ironically, it was implemented this way (quite a while ago) upon my explicit request ... the new mechanism uses explicit variable manipulations on the configure command line, just like qmake itself understands. as it happens, this is again quite similar to autoconf-generated configure scripts. however, this time around we don't pretend to be actually autoconf-like, so we also don't try to map any variable names (some of which have different semantics anyway). this commit also eliminates the last use of the QMakeVar() function, so delete it and the underlying infrastructure. Task-number: QTBUG-32530 Task-number: QTBUG-42962 Change-Id: Id31a6b80e1add08ca21f5b178614bda530d12374 Reviewed-by: Lars Knoll --- config_help.txt | 3 ++ configure | 66 +------------------------------ configure.json | 7 +++- configure.pri | 29 +++++++++++--- mkspecs/features/qt_configure.prf | 13 ++++++ 5 files changed, 46 insertions(+), 72 deletions(-) diff --git a/config_help.txt b/config_help.txt index c19f19f2f00..ece2195afb1 100644 --- a/config_help.txt +++ b/config_help.txt @@ -4,6 +4,9 @@ Configure understands variable assignments like VAR=value on the command line. These override any values possibly obtained from pkg-config. The variables are mentioned in the descriptions of the options they relate to. +It is also possible to manipulate any QMAKE_* variable, to amend the values +from the mkspec for the build of Qt itself, e.g., QMAKE_CXXFLAGS+=-g3. + Top-level installation directories: -prefix ...... The deployment directory, as seen on the target device. [/usr/local/Qt-$QT_VERSION, $PWD if -developer-build] diff --git a/configure b/configure index a51a377c0cf..6a425232e5f 100755 --- a/configure +++ b/configure @@ -92,11 +92,9 @@ $i" done # initialize global variables -QMAKE_VARS_FILE=.qmake.vars DEVICE_VARS_FILE=.device.vars HOST_VARS_FILE=.host.vars -:> "$QMAKE_VARS_FILE" :> "$DEVICE_VARS_FILE" :> "$HOST_VARS_FILE" @@ -124,29 +122,6 @@ makeabs() echo "$RES" | sed 's,//,/,g; s,/$,,' } -# Adds a new qmake variable to the cache -# Usage: QMakeVar mode varname contents -# where mode is one of: set, add, del -QMakeVar() -{ - case "$1" in - set) - eq="=" - ;; - add) - eq="+=" - ;; - del) - eq="-=" - ;; - *) - echo >&2 "BUG: wrong command to QMakeVar: $1" - ;; - esac - - echo "$2" "$eq" "$3" >> "$QMAKE_VARS_FILE" -} - # Helper function for getQMakeConf. It parses include statements in # qmake.conf and prints out the expanded file expandQMakeConf() @@ -445,32 +420,10 @@ fi # initalize variables #------------------------------------------------------------------------------- -SYSTEM_VARIABLES="AR RANLIB STRIP OBJDUMP LD CC CXX CFLAGS CXXFLAGS LDFLAGS" -for varname in $SYSTEM_VARIABLES; do - qmakevarname="${varname}" - qmakecmdargs="" - # use LDFLAGS for autoconf compat, but qmake uses QMAKE_LFLAGS - if [ "${varname}" = "LDFLAGS" ]; then - qmakevarname="LFLAGS" - elif [ "${varname}" = "LD" ]; then - qmakevarname="LINK" - elif [ "${varname}" = "AR" ]; then - # QMAKE_AR needs to be set to "/path/to/ar cqs" but the - # environment variable will be set to the command only so we - # need to append " cqs" for autoconf compatibility - qmakecmdargs=" cqs" - fi - cmd=`echo \ -'if [ -n "\$'${varname}'" ]; then - QMakeVar set QMAKE_'${qmakevarname}' "\$'${varname}${qmakecmdargs}'" -fi'` - eval "$cmd" -done - # Use CC/CXX to run config.tests mkdir -p "$outpath/config.tests" rm -f "$outpath/config.tests/.qmake.cache" -cp "$QMAKE_VARS_FILE" "$outpath/config.tests/.qmake.cache" +: > "$outpath/config.tests/.qmake.cache" # QTDIR may be set and point to an old or system-wide Qt installation unset QTDIR @@ -1956,14 +1909,6 @@ else echo fi -if [ "$OPT_VERBOSE" = "yes" ]; then - echo $ECHO_N "qmake vars .......... $ECHO_C" - cat "$QMAKE_VARS_FILE" | tr '\n' ' ' - echo -fi - -rm -f "$QMAKE_VARS_FILE" 2>/dev/null - #------------------------------------------------------------------------------- # build makefiles based on the configuration #------------------------------------------------------------------------------- @@ -1986,15 +1931,6 @@ rm -f "$QMAKE_VARS_FILE" 2>/dev/null if [ `basename $0` != "config.status" ]; then CONFIG_STATUS="$relpath/$relconf$OPT_CMDLINE" - # add the system variables - for varname in $SYSTEM_VARIABLES; do - cmd=`echo \ -'if [ -n "\$'${varname}'" ]; then - CONFIG_STATUS="'${varname}'='"'\\\$${varname}'"' \$CONFIG_STATUS" -fi'` - eval "$cmd" - done - echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license" [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status" diff --git a/configure.json b/configure.json index 29cbacc89d7..2b56279b278 100644 --- a/configure.json +++ b/configure.json @@ -17,6 +17,7 @@ "SYBASE_LIBS": "tds.libs", "ZLIB_LIBS": "zlib.libs" }, + "custom": "qmakeArgs", "options": { "prefix": "string", "hostprefix": "string", @@ -762,7 +763,7 @@ "testTypeDependencies": { "linkerSupportsFlag": [ "use_gold_linker" ], - "compile": [ "shared", "use_gold_linker", "compiler-flags", "gcc-sysroot" ], + "compile": [ "shared", "use_gold_linker", "compiler-flags", "gcc-sysroot", "qmakeargs" ], "detectPkgConfig": [ "cross_compile" ], "library": [ "pkg-config" ], "getPkgConfigVariable": [ "pkg-config" ], @@ -1229,6 +1230,10 @@ "output": [ "gccSysroot" ], "condition": "input.sysroot != ''" }, + "qmakeargs": { + "output": [ "qmakeArgs" ], + "condition": "input.qmakeArgs != ''" + }, "use_gold_linker": { "description": "Using gold linker", "condition": "tests.use_gold_linker", diff --git a/configure.pri b/configure.pri index cc120c12d11..0e785349d71 100644 --- a/configure.pri +++ b/configure.pri @@ -1,5 +1,14 @@ # custom command line handling +defineTest(qtConfCommandline_qmakeArgs) { + contains(1, QMAKE_[A-Z_]+ *[-+]?=.*) { + config.input.qmakeArgs += $$1 + export(config.input.qmakeArgs) + return(true) + } + return(false) +} + defineTest(qtConfCommandline_cxxstd) { arg = $${1} val = $${2} @@ -560,11 +569,6 @@ defineTest(qtConfOutput_extraFeatures) { } -defineTest(qtConfOutputPostProcess_privatePro) { - config.output.privatePro += $$cat($$OUT_PWD/.qmake.vars, lines) - export(config.output.privatePro) -} - defineTest(qtConfOutput_compilerFlags) { # this output also exports the variables locally, so that subsequent compiler tests can use them @@ -610,7 +614,7 @@ defineTest(qtConfOutput_gccSysroot) { # This variable also needs to be exported immediately, so the compilation tests # can pick it up. - EXTRA_QMAKE_ARGS = \ + EXTRA_QMAKE_ARGS += \ "\"QMAKE_CFLAGS += --sysroot=$$config.input.sysroot\"" \ "\"QMAKE_CXXFLAGS += --sysroot=$$config.input.sysroot\"" \ "\"QMAKE_LFLAGS += --sysroot=$$config.input.sysroot\"" @@ -626,6 +630,19 @@ defineTest(qtConfOutput_gccSysroot) { export(config.output.publicPro) } +defineTest(qtConfOutput_qmakeArgs) { + !$${2}: return() + + config.output.privatePro = "!host_build {" + for (a, config.input.qmakeArgs) { + config.output.privatePro += " $$a" + EXTRA_QMAKE_ARGS += $$system_quote($$a) + } + config.output.privatePro += "}" + export(EXTRA_QMAKE_ARGS) + export(config.output.privatePro) +} + defineTest(qtConfOutputPostProcess_publicPro) { qt_version = $$[QT_VERSION] output = \ diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 3d7b0ed9d25..0255a19fe9b 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -174,6 +174,14 @@ defineTest(qtConfCommandline_addString) { } defineTest(qtConfParseCommandLine) { + custom = $$config.commandline.custom + customCall = + !isEmpty(custom) { + customCall = qtConfCommandline_$$custom + !defined($$customCall, test): \ + error("Custom command line callback '$$custom' is undefined.") + } + for (ever) { c = $$qtConfGetNextCommandlineArg() isEmpty(c): break() @@ -190,6 +198,11 @@ defineTest(qtConfParseCommandLine) { next() } + !isEmpty(customCall) { + $${customCall}($$c): \ + next() + } + contains(c, "([A-Z_]+)=(.*)") { opt = $$replace(c, "^([A-Z_]+)=(.*)", "\\1") val = $$replace(c, "^([A-Z_]+)=(.*)", "\\2") From 672c0b3721201dcc5c41868b4c67976dc57d5e81 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jul 2016 14:41:09 +0200 Subject: [PATCH 196/236] unify configure command line saving with configure.exe that is, save it to config.opt and recall it when -redo is used (and do not write it again in this case). a trivial config.status is still created, as having it is very convenient when shadow-building. Task-number: QTBUG-38792 Change-Id: I5e9f7374d6bfc60c427cbfd5e9b3e68bfcaae9f2 Reviewed-by: Lars Knoll --- config_help.txt | 3 +++ configure | 51 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/config_help.txt b/config_help.txt index ece2195afb1..2b3e25e1f1d 100644 --- a/config_help.txt +++ b/config_help.txt @@ -55,6 +55,9 @@ Configure meta: -help, -h ............ Display this help screen -verbose, -v ......... Print verbose messages during configuration -continue ............ Continue configure despite errors + -redo ................ Re-configure with previously used options. + Additional options may be passed, but will not be + saved for later use by -redo. Build options: diff --git a/configure b/configure index 6a425232e5f..bd5a0fac8de 100755 --- a/configure +++ b/configure @@ -80,16 +80,45 @@ if [ x"$1" = x"-top-level" ]; then shift fi -# later cache the command line in config.status -OPT_CMDLINE= +CFG_REDO=no +OPT_CMDLINE= # excluding -verbose (for config.opt) +QMAKE_CMDLINE= # including -verbose (for actual parsing) +set -f # suppress globbing in for loop +SAVED_IFS=$IFS +IFS=' +' for i in "$@"; do + case $i in + -redo|--redo) + if ! test -f config.opt; then + echo >&2 "No config.opt present - cannot redo configuration." + exit 1 + fi + for a in `cat config.opt`; do + OPT_CMDLINE="$OPT_CMDLINE +$a" + QMAKE_CMDLINE="$QMAKE_CMDLINE +$a" + done + CFG_REDO=yes # suppress repeated config.opt writeout + continue + ;; + -v|-verbose|--verbose|-no-v|-no-verbose|--no-verbose) + ;; + *) + OPT_CMDLINE="$OPT_CMDLINE +$i" + ;; + esac QMAKE_CMDLINE="$QMAKE_CMDLINE $i" - if [ "x$i" != "x-v" ]; then - [ -z "${i##* *}" ] && i="'$i'" - OPT_CMDLINE="$OPT_CMDLINE $i" - fi done +set -- +for i in $QMAKE_CMDLINE; do + set -- "$@" "$i" +done +set +f +IFS=$SAVED_IFS # initialize global variables DEVICE_VARS_FILE=.device.vars @@ -1928,14 +1957,16 @@ fi #------------------------------------------------------------------------------- # finally save the executed command to another script #------------------------------------------------------------------------------- -if [ `basename $0` != "config.status" ]; then - CONFIG_STATUS="$relpath/$relconf$OPT_CMDLINE" +if [ $CFG_REDO = no ]; then + echo "$OPT_CMDLINE" | grep '\-confirm\-license' >/dev/null 2>&1 || OPT_CMDLINE="$OPT_CMDLINE +-confirm-license" - echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license" + # skip first line, as it's always empty due to unconditional field separation + echo "$OPT_CMDLINE" | tail -n +2 > "$outpath/config.opt" [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status" echo "#!/bin/sh" > "$outpath/config.status" - echo "$CONFIG_STATUS \"\$@\"" >> "$outpath/config.status" + echo "$relpath/$relconf -redo \"\$@\"" >> "$outpath/config.status" chmod +x "$outpath/config.status" fi From 6a90c9a8e547a377f17d67db7072c19a163db95c Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 15 Aug 2016 21:14:18 +0200 Subject: [PATCH 197/236] Handle windows line endings and tabs in json config files Change-Id: I154629d862977dde5232db3bb2597474b6053ffd Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qt_configure.prf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 0255a19fe9b..c87c65289e7 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -826,6 +826,8 @@ defineTest(qtRunSingleTest) { defineReplace(qtConfEvaluate) { isEmpty(1): return(true) + 1 ~= s/$$escape_expand(\\t)/ /g + 1 ~= s/$$escape_expand(\\r)//g 1 ~= s/$$escape_expand(\\n) */ /g expr = $${1} expr ~= s/&&/ && /g From c027cffbef6cb317a5a09e1785398c046f0a6395 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Aug 2016 12:40:03 +0200 Subject: [PATCH 198/236] make the windows configure also use config_help.txt specifically, make configure.bat dump the text file (which got some windows-specific adjustments). incidentally, this change removes the need for including a pre-built configure.exe into our source packages. Change-Id: Ib3515c113f3602767554fe1493df226551a7bf10 Reviewed-by: Lars Knoll --- config_help.txt | 41 ++- configure.bat | 25 +- tools/configure/configureapp.cpp | 418 +------------------------------ tools/configure/configureapp.h | 4 - tools/configure/main.cpp | 2 - 5 files changed, 53 insertions(+), 437 deletions(-) diff --git a/config_help.txt b/config_help.txt index 2b3e25e1f1d..9cd70672b09 100644 --- a/config_help.txt +++ b/config_help.txt @@ -6,6 +6,7 @@ are mentioned in the descriptions of the options they relate to. It is also possible to manipulate any QMAKE_* variable, to amend the values from the mkspec for the build of Qt itself, e.g., QMAKE_CXXFLAGS+=-g3. +(Unix/MSys configure only) Top-level installation directories: -prefix ...... The deployment directory, as seen on the target device. @@ -96,6 +97,8 @@ Build options: Instrument with the specified compiler sanitizer. -c++std .... Select C++ standard [c++1z/c++14/c++11] + (Not supported with MSVC) + -rtti ................ Build with Runtime Type Information [yes] (MSVC only) -sse2 ................ Use SSE2 instructions [auto] -sse3/-ssse3/-sse4.1/-sse4.2/-avx/-avx2/-avx512 @@ -115,11 +118,17 @@ Build options: dynamic libraries and frameworks. [auto] -reduce-exports ...... Reduce amount of exported symbols [auto] - -reduce-relocations .. Reduce amount of relocations [auto] + -reduce-relocations .. Reduce amount of relocations [auto] (Unix only) + + -plugin-manifests .... Embed manifests into plugins [no] (Windows only) + -static-runtime ...... With -static, use static runtime [no] (Windows only) -pch ................. Use precompiled headers [auto] -ltcg ................ Use Link Time Code Generation [no] -use-gold-linker ..... Use the GNU gold linker [auto] + -incredibuild-xge .... Use the IncrediBuild XGE [no] (Windows only) + -make-tool .... Use to build qmake [nmake] (Windows only) + -mp .................. Use multiple processors for compilation (MSVC only) -warnings-are-errors . Treat warnings as errors [no; yes if -developer-build] -silent .............. Reduce the build output so that warnings and errors @@ -130,7 +139,7 @@ Build environment: -sysroot ....... Set as the target sysroot -gcc-sysroot ......... With -sysroot, pass --sysroot to the compiler [yes] - -pkg-config .......... Use pkg-config [auto] + -pkg-config .......... Use pkg-config [auto] (Unix only) -D .......... Pass additional preprocessor define -I .......... Pass additional include path @@ -168,7 +177,8 @@ Component selection: -compile-examples .... When unset, install only the sources of examples [yes] -gui ................. Build the Qt GUI module and dependencies [yes] -widgets ............. Build the Qt Widgets module and dependencies [yes] - -no-dbus ............. Do not build the Qt D-Bus module [default on Android] + -no-dbus ............. Do not build the Qt D-Bus module + [default on Android and Windows] -dbus-linked ......... Build Qt D-Bus and link to libdbus-1 [auto] -dbus-runtime ........ Build Qt D-Bus and dynamically load libdbus-1 [no] DBUS_PATH= DBUS_HOST_PATH= @@ -185,10 +195,10 @@ Core options: -doubleconversion .... Select used double conversion library [system/qt/no] No implies use of sscanf_l and snprintf_l (imprecise). - -glib ................ Enable Glib support [auto] + -glib ................ Enable Glib support [no; auto on Unix] -eventfd ............. Enable eventfd support -inotify ............. Enable inotify support - -iconv ............... Enable iconv(3) support [posix/sun/gnu/no] + -iconv ............... Enable iconv(3) support [posix/sun/gnu/no] (Unix only) -icu ................. Enable ICU support [auto] -pps ................. Enable PPS support [auto] (QNX only) -pcre ................ Select used libpcre3 [system/qt] @@ -196,17 +206,18 @@ Core options: ZLIB_LIBS= Logging backends: - -journald .......... Enable journald support [no] - -syslog ............ Enable syslog support [no] + -journald .......... Enable journald support [no] (Unix only) + -syslog ............ Enable syslog support [no] (Unix only) -slog2 ............. Enable slog2 support [auto] (QNX only) Network options: -ssl ................. Enable either SSL support method [auto] - -no-openssl .......... Do not use OpenSSL [default on Apple] + -no-openssl .......... Do not use OpenSSL [default on Apple and WinRT] -openssl-linked ...... Use OpenSSL and link to libssl [no] -openssl-runtime ..... Use OpenSSL and dynamically load libssl [auto] - OPENSSL_PATH= OPENSSL_LIBS= + OPENSSL_PATH= OPENSSL_LIBS=, and on Windows also + OPENSSL_LIBS_DEBUG= OPENSSL_LIBS_RELEASE= -securetransport ..... Use SecureTransport [auto] (Apple only) -sctp ................ Enable SCTP support [no] @@ -216,9 +227,9 @@ Network options: Gui, printing, widget options: - -cups ................ Enable CUPS support [auto] + -cups ................ Enable CUPS support [auto] (Unix only) - -fontconfig .......... Enable Fontconfig support [auto] + -fontconfig .......... Enable Fontconfig support [auto] (Unix only) -freetype ............ Select used FreeType [system/qt/no] -harfbuzz ............ Select used HarfBuzz-NG [system/qt/no] (Not auto-detected on Apple and Windows) @@ -229,15 +240,18 @@ Gui, printing, widget options: -no-opengl ........... Disable OpenGL support -opengl ........ Enable OpenGL support. Supported APIs: - es2 (default on Windows), desktop (default on Unix) + es2 (default on Windows), desktop (default on Unix), + dynamic (Windows only) -opengles3 ........... Enable OpenGL ES 3.x support instead of ES 2.x [auto] + -angle ............... Use bundled ANGLE to support OpenGL ES 2.0 [auto] + (Windows only) -qpa .......... Select default QPA backend (e.g., xcb, cocoa, windows) -xcb-xlib............. Enable Xcb-Xlib support [auto] Platform backends: -directfb .......... Enable DirectFB support [no] (Unix only) - -eglfs ............. Enable EGLFS support [auto; no on Android] + -eglfs ............. Enable EGLFS support [auto; no on Android and Windows] -gbm ............... Enable backends for GBM [auto] (Linux only) -kms ............... Enable backends for KMS [auto] (Linux only) -linuxfb ........... Enable Linux Framebuffer support [auto] (Linux only) @@ -279,3 +293,4 @@ Multimedia options: -no-gstreamer ........ Disable support for GStreamer -gstreamer [version] . Enable GStreamer support [auto] With no parameter, 1.0 is tried first, then 0.10. + -wmf-backend ......... Enable WMF support [no] (Windows only) diff --git a/configure.bat b/configure.bat index 5c01890116d..4fcf254a59d 100644 --- a/configure.bat +++ b/configure.bat @@ -28,9 +28,26 @@ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @echo off +setlocal ENABLEEXTENSIONS +set ARGS=%* set QTSRC=%~dp0 set QTDIR=%CD% +:doargs + if "%~1" == "" goto doneargs + + if "%~1" == "/?" goto help + if "%~1" == "-?" goto help + if /i "%~1" == "/h" goto help + if /i "%~1" == "-h" goto help + if /i "%~1" == "/help" goto help + if /i "%~1" == "-help" goto help + if /i "%~1" == "--help" goto help + + shift + goto doargs +:doneargs + if not exist %QTSRC%.gitignore goto sconf echo Please wait while bootstrapping configure ... @@ -114,9 +131,13 @@ if errorlevel 1 (cd ..\.. & exit /b 1) cd ..\.. :conf -configure.exe -srcdir %QTSRC% %* +configure.exe -srcdir %QTSRC% %ARGS% +goto exit + +:help +type %QTSRC%config_help.txt goto exit :sconf -%QTSRC%configure.exe %* +%QTSRC%configure.exe %ARGS% :exit diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index c611de60605..059d2b15e77 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -365,12 +365,8 @@ void Configure::parseCmdLine() for (; i outputWidth)) // Wrap at outputWidth - { - printf("\n"); - linePos = 0; - firstLine = false; - if (*nextToken == '\n') - ++nextToken; - continue; - } - if (!firstLine && linePos < wrapIndent) { // Indent to wrapIndent - printf("%*s", wrapIndent , ""); - linePos = wrapIndent; - if (*nextToken == ' ') { - ++nextToken; - continue; - } - } - printf("%.*s", nextTokenLen, nextToken); - linePos += nextTokenLen; - nextToken += nextTokenLen; - } -} - -/*! - Prints out an option with its description wrapped at the - description starting point. If \a skipIndent is true, the - indentation to the option is not outputted (used by marked option - version of desc()). Extra spaces between option and its - description is filled with\a fillChar, if there's available - space. -*/ -void Configure::desc(const char *option, const char *description, bool skipIndent, char fillChar) -{ - if (!skipIndent) - printf("%*s", optionIndent, ""); - - int remaining = descIndent - optionIndent - int(strlen(option)); - int wrapIndent = descIndent + qMax(0, 1 - remaining); - printf("%s", option); - - if (remaining > 2) { - printf(" "); // Space in front - for (int i = remaining; i > 2; --i) - printf("%c", fillChar); // Fill, if available space - } - printf(" "); // Space between option and description - - desc(description, wrapIndent, wrapIndent); - printf("\n"); -} - -/*! - Same as above, except it also marks an option with an '*', if - the option is default action. -*/ -void Configure::desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar) -{ - const QString markedAs = dictionary.value(mark_option); - if (markedAs == "auto" && markedAs == mark) // both "auto", always => + - printf(" + "); - else if (markedAs == "auto") // setting marked as "auto" and option is default => + - printf(" %c " , (defaultTo(mark_option) == QLatin1String(mark))? '+' : ' '); - else if (QLatin1String(mark) == "auto" && markedAs != "no") // description marked as "auto" and option is available => + - printf(" %c " , checkAvailability(mark_option) ? '+' : ' '); - else // None are "auto", (markedAs == mark) => * - printf(" %c " , markedAs == QLatin1String(mark) ? '*' : ' '); - - desc(option, description, true, fillChar); -} - /*! Modifies the default configuration based on given -platform option. Eg. switches to different default styles for Windows CE. @@ -1493,314 +1387,6 @@ void Configure::applySpecSpecifics() } } -// Output helper functions ---------------------------------[ Stop ]- - - -bool Configure::displayHelp() -{ - if (dictionary[ "HELP" ] == "yes") { - desc("Usage: configure [options]\n\n", 0, 7); - - desc("Installation options:\n\n"); - - desc("These are optional, but you may specify install directories.\n\n", 0, 1); - - desc( "-prefix ", "The deployment directory, as seen on the target device.\n" - "(default %CD%)\n"); - - desc( "-extprefix ", "The installation directory, as seen on the host machine.\n" - "(default SYSROOT/PREFIX)\n"); - - desc( "-hostprefix [dir]", "The installation directory for build tools running on the\n" - "host machine. If [dir] is not given, the current build\n" - "directory will be used. (default EXTPREFIX)\n"); - - desc("You may use these to change the layout of the install. Note that all directories\n" - "except -sysconfdir should be located under -prefix/-hostprefix:\n\n"); - - desc( "-bindir ", "User executables will be installed to \n(default PREFIX/bin)"); - desc( "-libdir ", "Libraries will be installed to \n(default PREFIX/lib)"); - desc( "-headerdir ", "Headers will be installed to \n(default PREFIX/include)"); - desc( "-archdatadir ", "Architecture-dependent data used by Qt will be installed to \n(default PREFIX)"); - desc( "-libexecdir ", "Program executables will be installed to \n(default ARCHDATADIR/bin)"); - desc( "-plugindir ", "Plugins will be installed to \n(default ARCHDATADIR/plugins)"); - desc( "-importdir ", "Imports for QML1 will be installed to \n(default ARCHDATADIR/imports)"); - desc( "-qmldir ", "Imports for QML2 will be installed to \n(default ARCHDATADIR/qml)"); - desc( "-datadir ", "Data used by Qt programs will be installed to \n(default PREFIX)"); - desc( "-docdir ", "Documentation will be installed to \n(default DATADIR/doc)"); - desc( "-translationdir ", "Translations of Qt programs will be installed to \n(default DATADIR/translations)"); - desc( "-examplesdir ", "Examples will be installed to \n(default PREFIX/examples)"); - desc( "-testsdir ", "Tests will be installed to \n(default PREFIX/tests)\n"); - - desc( "-hostbindir ", "Host executables will be installed to \n(default HOSTPREFIX/bin)"); - desc( "-hostlibdir ", "Host libraries will be installed to \n(default HOSTPREFIX/lib)"); - desc( "-hostdatadir ", "Data used by qmake will be installed to \n(default HOSTPREFIX)"); - - desc("\nConfigure options:\n\n"); - - desc(" The defaults (*) are usually acceptable. A plus (+) denotes a default value" - " that needs to be evaluated. If the evaluation succeeds, the feature is" - " included. Here is a short explanation of each option:\n\n", 0, 1); - - desc("BUILD", "release","-release", "Compile and link Qt with debugging turned off."); - desc("BUILD", "debug", "-debug", "Compile and link Qt with debugging turned on."); - desc("BUILDALL", "yes", "-debug-and-release", "Compile and link two Qt libraries, with and without debugging turned on.\n"); - - desc("FORCEDEBUGINFO", "yes","-force-debug-info", "Create symbol files for release builds."); - desc("SEPARATE_DEBUG_INFO", "yes","-separate-debug-info", "Strip debug information into a separate file.\n"); - - desc("BUILDDEV", "yes", "-developer-build", "Compile and link Qt with Qt developer options (including auto-tests exporting)\n"); - - desc("RELEASE_TOOLS", "yes", "-optimized-tools", "Build optimized host tools even in debug build."); - desc("RELEASE_TOOLS", "no", "-no-optimized-tools", "Do not build optimized host tools even in debug build.\n"); - - desc("OPENSOURCE", "opensource", "-opensource", "Compile and link the Open-Source Edition of Qt."); - desc("COMMERCIAL", "commercial", "-commercial", "Compile and link the Commercial Edition of Qt.\n"); - - desc( "-c++std ", "Compile Qt with C++ standard edition (c++11, c++14, c++1z)\n" - "Default: highest supported. This option is not supported for MSVC.\n"); - - desc("USE_GOLD_LINKER", "yes", "-use-gold-linker", "Link using the GNU gold linker (gcc only)."); - desc("USE_GOLD_LINKER", "no", "-no-use-gold-linker", "Do not link using the GNU gold linker.\n"); - - desc("ENABLE_NEW_DTAGS", "yes", "-enable-new-dtags", "Use new DTAGS for RPATH (Linux only)."); - desc("ENABLE_NEW_DTAGS", "no", "-disable-new-dtags", "Do not use new DTAGS for RPATH.\n"); - - desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries."); - desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n"); - - desc("STATIC_RUNTIME", "no", "-static-runtime","Statically link the C/C++ runtime library.\n"); - - desc("LTCG", "yes", "-ltcg", "Use Link Time Code Generation. (Release builds only)"); - desc("LTCG", "no", "-no-ltcg", "Do not use Link Time Code Generation.\n"); - - desc( "-make ", "Add part to the list of parts to be built at make time"); - for (int i=0; i", "Exclude part from the list of parts to be built.\n"); - - desc( "-skip ", "Exclude an entire module from the build.\n"); - - desc( "-no-compile-examples", "Install only the sources of examples.\n"); - - desc("WIDGETS", "no", "-no-widgets", "Disable Qt Widgets module.\n"); - desc("GUI", "no", "-no-gui", "Disable Qt GUI module.\n"); - - desc("ACCESSIBILITY", "no", "-no-accessibility", "Disable accessibility support.\n"); - desc( "", "Disabling accessibility is not recommended, as it will break QStyle\n" - "and may break other internal parts of Qt.\n" - "With this switch you create a source incompatible version of Qt,\n" - "which is unsupported.\n"); - desc("ACCESSIBILITY", "yes", "-accessibility", "Enable accessibility support.\n"); - - desc( "-no-sql-", "Disable SQL entirely, by default none are turned on."); - desc( "-qt-sql-", "Enable a SQL in the Qt Library."); - desc( "-plugin-sql-", "Enable SQL as a plugin to be linked to at run time.\n" - "Available values for :"); - desc("SQL_MYSQL", "auto", "", " mysql", ' '); - desc("SQL_PSQL", "auto", "", " psql", ' '); - desc("SQL_OCI", "auto", "", " oci", ' '); - desc("SQL_ODBC", "auto", "", " odbc", ' '); - desc("SQL_TDS", "auto", "", " tds", ' '); - desc("SQL_DB2", "auto", "", " db2", ' '); - desc("SQL_SQLITE", "auto", "", " sqlite", ' '); - desc("SQL_SQLITE2", "auto", "", " sqlite2", ' '); - desc("SQL_IBASE", "auto", "", " ibase", ' '); - desc( "", "(drivers marked with a '+' have been detected as available on this system)\n", false, ' '); - - desc( "-system-sqlite", "Use sqlite from the operating system.\n"); - - desc("OPENGL", "no","-no-opengl", "Do not support OpenGL."); - desc("OPENGL", "no","-opengl ", "Enable OpenGL support with specified API version.\n" - "Available values for :"); - desc("", "no", "", " desktop - Enable support for Desktop OpenGL", ' '); - desc("", "no", "", " dynamic - Enable support for dynamically loaded OpenGL (either desktop or ES)", ' '); - desc("OPENGL_ES_2", "yes", "", " es2 - Enable support for OpenGL ES 2.0\n", ' '); - - desc( "-force-asserts", "Activate asserts in release mode.\n"); - desc( "-platform ", "The operating system and compiler you are building on.\n(default %QMAKESPEC%)\n"); - desc( "-xplatform ", "The operating system and compiler you are cross compiling to.\n"); - desc( "", "See the README file for a list of supported operating systems and compilers.\n", false, ' '); - - desc( "-sysroot ", "Sets as the target compiler's and qmake's sysroot and also sets pkg-config paths."); - desc( "-no-gcc-sysroot", "When using -sysroot, it disables the passing of --sysroot to the compiler.\n"); - - desc( "-qconfig ", "Use src/corelib/global/qconfig-.h rather than the\n" - "default 'full'.\n"); - - desc("NIS", "no", "-no-nis", "Do not compile NIS support."); - desc("NIS", "yes", "-nis", "Compile NIS support.\n"); - - desc("QT_ICONV", "disable", "-no-iconv", "Do not enable support for iconv(3)."); - desc("QT_ICONV", "yes", "-iconv", "Enable support for iconv(3)."); - desc("QT_ICONV", "yes", "-sun-iconv", "Enable support for iconv(3) using sun-iconv."); - desc("QT_ICONV", "yes", "-gnu-iconv", "Enable support for iconv(3) using gnu-libiconv.\n"); - - desc("QT_EVDEV", "no", "-no-evdev", "Do not enable support for evdev."); - desc("QT_EVDEV", "yes", "-evdev", "Enable support for evdev."); - - desc("QT_MTDEV", "no", "-no-mtdev", "Do not enable support for mtdev."); - desc("QT_MTDEV", "yes", "-mtdev", "Enable support for mtdev."); - - desc("QT_INOTIFY", "yes", "-inotify", "Explicitly enable Qt inotify(7) support."); - desc("QT_INOTIFY", "no", "-no-inotify", "Explicitly disable Qt inotify(7) support.\n"); - - desc("QT_EVENTFD", "yes", "-eventfd", "Enable eventfd(7) support in the UNIX event loop."); - desc("QT_EVENTFD", "no", "-no-eventfd", "Disable eventfd(7) support in the UNIX event loop.\n"); - - desc("POSIX_IPC", "yes", "-posix-ipc", "Enable POSIX IPC.\n"); - - desc("QT_GLIB", "yes", "-glib", "Compile Glib support.\n"); - - desc("QT_INSTALL_SETTINGS", "auto", "-sysconfdir ", "Settings used by Qt programs will be looked for in\n.\n"); - - desc("SYSTEM_PROXIES", "yes", "-system-proxies", "Use system network proxies by default."); - desc("SYSTEM_PROXIES", "no", "-no-system-proxies", "Do not use system network proxies by default.\n"); - - desc("SCTP", "yes", "-sctp", "Compile SCTP support."); - desc("SCTP", "no", "-no-sctp", "Do not compile SCTP network protocol support.\n"); - - desc("WERROR", "yes", "-warnings-are-errors", "Make warnings be treated as errors."); - desc("WERROR", "no", "-no-warnings-are-errors","Make warnings be treated normally."); - - desc( "-qtnamespace ", "Wraps all Qt library code in 'namespace name {...}'."); - desc( "-qtlibinfix ", "Renames all Qt* libs to Qt*.\n"); - desc( "-D ", "Add an explicit define to the preprocessor."); - desc( "-I ", "Add an explicit include path."); - desc( "-L ", "Add an explicit library path."); - - desc("PCH", "no", "-no-pch", "Do not use precompiled header support."); - desc("PCH", "yes", "-pch", "Use precopmiled header support.\n"); - - desc( "-help, -h, -?", "Display this information.\n"); - - // 3rd party stuff options go below here -------------------------------------------------------------------------------- - desc("Third Party Libraries:\n\n"); - - desc("SYSTEM_ZLIB", "no", "-qt-zlib", "Use the zlib bundled with Qt."); - desc("SYSTEM_ZLIB", "yes", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n"); - - desc("PCRE", "qt", "-qt-pcre", "Use the PCRE library bundled with Qt."); - desc("PCRE", "system", "-system-pcre", "Use the PCRE library from the operating system.\nSee http://pcre.org/\n"); - - desc("ICU", "yes", "-icu", "Use the ICU library."); - desc("ICU", "no", "-no-icu", "Do not use the ICU library.\nSee http://site.icu-project.org/\n"); - - desc("GIF", "no", "-no-gif", "Do not compile GIF reading support.\n"); - - desc("LIBPNG", "no", "-no-libpng", "Do not compile PNG support."); - desc("LIBPNG", "qt", "-qt-libpng", "Use the libpng bundled with Qt."); - desc("LIBPNG", "system","-system-libpng", "Use libpng from the operating system.\nSee http://www.libpng.org/pub/png\n"); - - desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile JPEG support."); - desc("LIBJPEG", "qt", "-qt-libjpeg", "Use the libjpeg bundled with Qt."); - desc("LIBJPEG", "system","-system-libjpeg", "Use libjpeg from the operating system.\nSee http://www.ijg.org\n"); - - desc("DOUBLECONVERSION", "no", "-no-doubleconversion", "Use sscanf_l and snprintf_l for (imprecise) double conversion."); - desc("DOUBLECONVERSION", "qt", "-qt-doubleconversion", "Use the libdouble-conversion bundled with Qt."); - desc("DOUBLECONVERSION", "system", "-system-doubleconversion", "Use the libdouble-conversion provided by the system."); - - desc("FREETYPE", "no", "-no-freetype", "Do not compile in Freetype2 support."); - desc("FREETYPE", "yes", "-qt-freetype", "Use the libfreetype bundled with Qt."); - desc("FREETYPE", "system","-system-freetype", "Use the libfreetype provided by the system.\n"); - - desc("FONT_CONFIG", "yes", "-fontconfig", "Build with FontConfig support."); - desc("FONT_CONFIG", "no", "-no-fontconfig", "Do not build with FontConfig support.\n"); - - desc("HARFBUZZ", "no", "-no-harfbuzz", "Do not compile in HarfBuzz-NG support."); - desc("HARFBUZZ", "qt", "-qt-harfbuzz", "Use HarfBuzz-NG bundled with Qt to do text shaping.\n" - "It can still be disabled by setting\n" - "the QT_HARFBUZZ environment variable to \"old\"."); - desc("HARFBUZZ", "system","-system-harfbuzz", "Use HarfBuzz-NG from the operating system\n" - "to do text shaping. It can still be disabled\n" - "by setting the QT_HARFBUZZ environment variable to \"old\".\n" - "See http://www.harfbuzz.org\n"); - - if (platform() == QNX) { - desc("SLOG2", "yes", "-slog2", "Compile with slog2 support."); - desc("SLOG2", "no", "-no-slog2", "Do not compile with slog2 support."); - desc("QNX_IMF", "yes", "-imf", "Compile with imf support."); - desc("QNX_IMF", "no", "-no-imf", "Do not compile with imf support."); - desc("PPS", "yes", "-pps", "Compile with PPS support."); - desc("PPS", "no", "-no-pps", "Do not compile with PPS support."); - desc("LGMON", "yes", "-lgmon", "Compile with lgmon support."); - desc("LGMON", "no", "-no-lgmon", "Do not compile with lgmon support.\n"); - } - - desc("ANGLE", "yes", "-angle", "Use the ANGLE implementation of OpenGL ES 2.0."); - desc("ANGLE", "no", "-no-angle", "Do not use ANGLE.\nSee https://chromium.googlesource.com/angle/angle/+/master/README.md\n"); - // Qt\Windows only options go below here -------------------------------------------------------------------------------- - desc("\nQt for Windows only:\n\n"); - - desc("INCREDIBUILD_XGE", "no", "-no-incredibuild-xge", "Do not add IncrediBuild XGE distribution commands to custom build steps."); - desc("INCREDIBUILD_XGE", "yes", "-incredibuild-xge", "Add IncrediBuild XGE distribution commands to custom build steps. This will distribute MOC and UIC steps, and other custom buildsteps which are added to the INCREDIBUILD_XGE variable.\n(The IncrediBuild distribution commands are only added to Visual Studio projects)\n"); - - desc("PLUGIN_MANIFESTS", "no", "-no-plugin-manifests", "Do not embed manifests in plugins."); - desc("PLUGIN_MANIFESTS", "yes", "-plugin-manifests", "Embed manifests in plugins.\n"); - - desc( "-qreal [double|float]", "typedef qreal to the specified type. The default is double.\n" - "Note that changing this flag affects binary compatibility.\n"); - - desc("RTTI", "no", "-no-rtti", "Do not compile runtime type information."); - desc("RTTI", "yes", "-rtti", "Compile runtime type information."); - desc("STRIP", "no", "-no-strip", "Do not strip libraries and executables of debug info when installing."); - desc("STRIP", "yes", "-strip", "Strip libraries and executables of debug info when installing.\n"); - - desc("SSE2", "no", "-no-sse2", "Do not compile with use of SSE2 instructions."); - desc("SSE2", "yes", "-sse2", "Compile with use of SSE2 instructions."); - desc("SSE3", "no", "-no-sse3", "Do not compile with use of SSE3 instructions."); - desc("SSE3", "yes", "-sse3", "Compile with use of SSE3 instructions."); - desc("SSSE3", "no", "-no-ssse3", "Do not compile with use of SSSE3 instructions."); - desc("SSSE3", "yes", "-ssse3", "Compile with use of SSSE3 instructions."); - desc("SSE4_1", "no", "-no-sse4.1", "Do not compile with use of SSE4.1 instructions."); - desc("SSE4_1", "yes", "-sse4.1", "Compile with use of SSE4.1 instructions."); - desc("SSE4_2", "no", "-no-sse4.2", "Do not compile with use of SSE4.2 instructions."); - desc("SSE4_2", "yes", "-sse4.2", "Compile with use of SSE4.2 instructions."); - desc("AVX", "no", "-no-avx", "Do not compile with use of AVX instructions."); - desc("AVX", "yes", "-avx", "Compile with use of AVX instructions."); - desc("AVX2", "no", "-no-avx2", "Do not compile with use of AVX2 instructions."); - desc("AVX2", "yes", "-avx2", "Compile with use of AVX2 instructions.\n"); - desc("AVX512", "no", "-no-avx512", "Do not compile with use of AVX512 instructions."); - desc("AVX512", "yes", "-avx512", "Compile with use of AVX512 instructions.\n"); - desc("SSL", "no", "-no-ssl", "Do not compile support for SSL."); - desc("SSL", "yes", "-ssl", "Enable run-time SSL support."); - desc("OPENSSL", "no", "-no-openssl", "Do not compile support for OpenSSL."); - desc("OPENSSL", "yes", "-openssl", "Enable run-time OpenSSL support."); - desc("OPENSSL", "linked","-openssl-linked", "Enable linked OpenSSL support.\n"); - desc("LIBPROXY", "no", "-no-libproxy", "Do not compile in libproxy support."); - desc("LIBPROXY", "yes", "-libproxy", "Compile in libproxy support (for cross compilation targets).\n"); - desc("DBUS", "no", "-no-dbus", "Do not compile in D-Bus support."); - desc("DBUS", "linked", "-dbus-linked", "Compile in D-Bus support and link to libdbus-1.\n"); - desc("DBUS", "runtime", "-dbus-runtime", "Compile in D-Bus support and load libdbus-1\ndynamically."); - desc("WMF_BACKEND", "no","-no-wmf-backend", "Do not compile in the windows media foundation backend\ninto Qt Multimedia."); - desc("WMF_BACKEND", "yes","-wmf-backend", "Compile in the windows media foundation backend into Qt Multimedia.\n"); - desc("QML_DEBUG", "no", "-no-qml-debug", "Do not build the in-process QML debugging support."); - desc("QML_DEBUG", "yes", "-qml-debug", "Build the in-process QML debugging support.\n"); - desc("DIRECTWRITE", "no", "-no-directwrite", "Do not build support for DirectWrite font rendering."); - desc("DIRECTWRITE", "yes", "-directwrite", "Build support for DirectWrite font rendering.\n"); - - desc("DIRECT2D", "no", "-no-direct2d", "Do not build the Direct2D platform plugin."); - desc("DIRECT2D", "yes", "-direct2d", "Build the Direct2D platform plugin (experimental,\n" - "requires Direct2D availability on target systems,\n" - "e.g. Windows 7 with Platform Update, Windows 8, etc.)\n"); - - desc( "-no-style-