From 4091202cf19ef8ed2901d026e365aaa7a3049d77 Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 30 Dec 2014 14:33:51 +0100 Subject: configure.exe: improve error message by adding the filename. Before: Could not find output file: No such file or directory After: Could not find output file 'arch.exe' or 'arch' in C:/Qt/qt5/qtbase/config.tests/arch : No such file or directory (it turned out that linking in that directory failed because of a wrong %PATH%) Change-Id: I948d7f10f7e82f77a08ac9a8db76d97536c42dd0 Reviewed-by: Thiago Macieira --- tools/configure/configureapp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 2bd94c199e..105a9ef04c 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3172,7 +3172,7 @@ void Configure::detectArch() if (!exe.open(QFile::ReadOnly)) { // no Text, this is binary exe.setFileName("arch"); if (!exe.open(QFile::ReadOnly)) { - cout << "Could not find output file: " << qPrintable(exe.errorString()) << endl; + cout << "Could not find output file '" << qPrintable(arch_exe) << "' or 'arch' in " << qPrintable(newpwd) << " : " << qPrintable(exe.errorString()) << endl; dictionary["DONE"] = "error"; return; } -- cgit v1.2.3 From 190f64aab3fc8bb8e325bf48326c7b09d62b6419 Mon Sep 17 00:00:00 2001 From: Julien Blanc Date: Tue, 18 Mar 2014 11:58:49 +0100 Subject: Added timezone support for datetime fields in PSQL This patch adds correct timezone support in PSQL plugin. Prior to this patch, no timezone support was provided, so only the following case worked : * using local time in both client application and postgresql server * datetime were using second precision This patch tries to take care that postgresql has two different datatypes for date time, respectively : * timestamp with time zone * timestamp without time zone Both are internally stored as UTC values, but are not parsed the same. * timestamp with time zone assumes that there is a time zone information and will parse date time accordingly, and then, convert into UTC before storing them * timestamp without time zone assumes that there is no time zone information and will silently ignore any, unless the datetime is explicitly specified as having a time zone, in case it will convert it into UTC before storing it Both are retrieved as local time values, with the following difference * timestamp with time zone includes the timezone information (2014-02-12 10:20:12+0100 for example) * timestamp without time zone does not include it The patch does the following : * parse the date retrieved by postgresql server using QDateTime functions, which work correctly * always convert the date to UTC before giving it to postgresql * force time zone so that timezone information is taken into account by postgresql * also adds the milliseconds when storing QDateTime values The following configurations are tested to work : * client and server using same timezone, timestamp with or without tz * client and server using different timezone, timestamp with tz The following configuration will *not* work : * client and server using different timezones, timestamp without tz Because data will be converted to local time by the postgresql server, so when returned it will be different from what had been serialized. Prior to this patch, it gave the illusion to work because since TZ information was lost, time was stored as local time from postgresql. Lots of inconsistencies occurred, though, in case client tz changes... I don't expect this to be an issue since having different TZ in server and client and *not* handling this is a broken setup anyway. Almost based on changes proposed by julien.blanc@nmc-company.fr [ChangeLog][QtSql] Added timezone support for datetime fields in PSQL Task-number: QTBUG-36211 Change-Id: I5650a5ef60cb3f14f0ab619825612831c7e90c12 Reviewed-by: Mark Brand --- src/sql/drivers/psql/qsql_psql.cpp | 43 +++++++++------------- tests/auto/sql/kernel/qsqldatabase/tst_databases.h | 2 +- tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 42 +++++++++++++++++++++ 3 files changed, 60 insertions(+), 27 deletions(-) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index e76dcc26a0..4268ea06f6 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -426,11 +426,8 @@ QVariant QPSQLResult::data(int i) #ifndef QT_NO_DATESTRING if (str.isEmpty()) return QVariant(QTime()); - if (str.at(str.length() - 3) == QLatin1Char('+') || str.at(str.length() - 3) == QLatin1Char('-')) - // strip the timezone - // TODO: fix this when timestamp support comes into QDateTime - return QVariant(QTime::fromString(str.left(str.length() - 3), Qt::ISODate)); - return QVariant(QTime::fromString(str, Qt::ISODate)); + else + return QVariant(QTime::fromString(str, Qt::ISODate)); #else return QVariant(str); #endif @@ -438,19 +435,13 @@ QVariant QPSQLResult::data(int i) case QVariant::DateTime: { QString dtval = QString::fromLatin1(val); #ifndef QT_NO_DATESTRING - if (dtval.length() < 10) - return QVariant(QDateTime()); - // remove the timezone - // TODO: fix this when timestamp support comes into QDateTime - if (dtval.at(dtval.length() - 3) == QLatin1Char('+') || dtval.at(dtval.length() - 3) == QLatin1Char('-')) - dtval.chop(3); - // milliseconds are sometimes returned with 2 digits only - if (dtval.at(dtval.length() - 3).isPunct()) - dtval += QLatin1Char('0'); - if (dtval.isEmpty()) + if (dtval.length() < 10) { return QVariant(QDateTime()); - else - return QVariant(QDateTime::fromString(dtval, Qt::ISODate)); + } else { + QChar sign = dtval[dtval.size() - 3]; + if (sign == QLatin1Char('-') || sign == QLatin1Char('+')) dtval += QLatin1String(":00"); + return QVariant(QDateTime::fromString(dtval, Qt::ISODate).toLocalTime()); + } #else return QVariant(dtval); #endif @@ -536,6 +527,11 @@ QSqlRecord QPSQLResult::record() const int precision = PQfmod(d->result, i); switch (ptype) { + case QTIMESTAMPOID: + case QTIMESTAMPTZOID: + precision = 3; + break; + case QNUMERICOID: if (precision != -1) { len = (precision >> 16); @@ -1263,15 +1259,10 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const case QVariant::DateTime: #ifndef QT_NO_DATESTRING if (field.value().toDateTime().isValid()) { - QDate dt = field.value().toDateTime().date(); - QTime tm = field.value().toDateTime().time(); - // msecs need to be right aligned otherwise psql interprets them wrong - r = QLatin1Char('\'') + QString::number(dt.year()) + QLatin1Char('-') - + QString::number(dt.month()).rightJustified(2, QLatin1Char('0')) + QLatin1Char('-') - + QString::number(dt.day()).rightJustified(2, QLatin1Char('0')) + QLatin1Char(' ') - + tm.toString() + QLatin1Char('.') - + QString::number(tm.msec()).rightJustified(3, QLatin1Char('0')) - + QLatin1Char('\''); + // we force the value to be considered with a timezone information, and we force it to be UTC + // this is safe since postgresql stores only the UTC value and not the timezone offset (only used + // while parsing), so we have correct behavior in both case of with timezone and without tz + r = QLatin1String("TIMESTAMP WITH TIME ZONE ") + QLatin1Char('\'') + field.value().toDateTime().toUTC().toString(QLatin1String("yyyy-MM-ddThh:mm:ss.zzz")) + QLatin1Char('Z') + QLatin1Char('\''); } else { r = QLatin1String("NULL"); } diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h index af6dc6b9f4..8b080324d5 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h +++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h @@ -493,7 +493,7 @@ public: { const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db); if (dbType == QSqlDriver::PostgreSQL) - return QLatin1String("timestamp"); + return QLatin1String("timestamptz"); if (dbType == QSqlDriver::Oracle && getOraVersion(db) >= 9) return QLatin1String("timestamp(0)"); return QLatin1String("datetime"); diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index f5d71a75cf..1943b6ec92 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -224,6 +224,9 @@ private slots: void QTBUG_2192_data() { generic_data(); } void QTBUG_2192(); + void QTBUG_36211_data() { generic_data("QPSQL"); } + void QTBUG_36211(); + void sqlite_constraint_data() { generic_data("QSQLITE"); } void sqlite_constraint(); @@ -3558,6 +3561,45 @@ void tst_QSqlQuery::QTBUG_2192() } } +void tst_QSqlQuery::QTBUG_36211() +{ + QFETCH( QString, dbName ); + QSqlDatabase db = QSqlDatabase::database( dbName ); + CHECK_DATABASE( db ); + if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL) { + const QString tableName(qTableName("bug36211", __FILE__, db)); + tst_Databases::safeDropTable( db, tableName ); + + QSqlQuery q(db); + QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (dtwtz timestamptz, dtwotz timestamp)").arg(tableName))); + + QTimeZone l_tzBrazil("BRT"); + QTimeZone l_tzChina("CST"); + QDateTime dt = QDateTime(QDate(2014, 10, 30), QTime(14, 12, 02, 357)); + QVERIFY_SQL(q, prepare("INSERT INTO " + tableName + " (dtwtz, dtwotz) VALUES (:dt, :dt)")); + q.bindValue(":dt", dt); + QVERIFY_SQL(q, exec()); + q.bindValue(":dt", dt.toTimeZone(l_tzBrazil)); + QVERIFY_SQL(q, exec()); + q.bindValue(":dt", dt.toTimeZone(l_tzChina)); + QVERIFY_SQL(q, exec()); + + QVERIFY_SQL(q, exec("SELECT dtwtz, dtwotz FROM " + tableName)); + + for (int i = 0; i < 3; ++i) { + QVERIFY_SQL(q, next()); + + for (int j = 0; j < 2; ++j) { + // Check if retrieved value preserves reported precision + int precision = qMax(0, q.record().field(j).precision()); + int diff = qAbs(q.value(j).toDateTime().msecsTo(dt)); + int keep = qMin(1000, (int)qPow(10.0, precision)); + QVERIFY(diff <= 1000 - keep); + } + } + } +} + void tst_QSqlQuery::oraOCINumber() { QFETCH( QString, dbName ); -- cgit v1.2.3 From a44749855e381a6f856b7b89ecd42aadcc2797bf Mon Sep 17 00:00:00 2001 From: Maximilian Hrabowski Date: Sat, 11 Oct 2014 13:44:28 +0200 Subject: QODBC: fix converted string values empty SQLServer 2012 SQL Server 2012 Native Client (version 11.0.2100.60) or later introduced a change in the behavior of the SQLGetData method when converted string values are involved. In older version a (sometimes wrong) size was returned. Now always SQL_NO_TOTAL is returned which signals to read as much data as available. SQL_NO_TOTAL was handled like SQL_NULL_DATA in the code before which indicates a NULL value so the returned string was empty. See link for more info: http://msdn.microsoft.com/en-us/library/jj219209.aspx Change-Id: Ia0d2296caf593890b301ee1848d1bf3eb8d7b6fe Reviewed-by: Mark Brand --- src/sql/drivers/odbc/qsql_odbc.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index f95fb8868e..2b14809943 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -373,10 +373,20 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni colSize*sizeof(SQLTCHAR), &lengthIndicator); if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) { - if (lengthIndicator == SQL_NULL_DATA || lengthIndicator == SQL_NO_TOTAL) { + if (lengthIndicator == SQL_NULL_DATA) { fieldVal.clear(); break; } + // starting with ODBC Native Client 2012, SQL_NO_TOTAL is returned + // instead of the length (which sometimes was wrong in older versions) + // see link for more info: http://msdn.microsoft.com/en-us/library/jj219209.aspx + // if length indicator equals SQL_NO_TOTAL, indicating that + // more data can be fetched, but size not known, collect data + // and fetch next block + if (lengthIndicator == SQL_NO_TOTAL) { + fieldVal += fromSQLTCHAR(buf, colSize); + continue; + } // if SQL_SUCCESS_WITH_INFO is returned, indicating that // more data can be fetched, the length indicator does NOT // contain the number of bytes returned - it contains the -- cgit v1.2.3 From b60773934dc0231b53e1fde3e5927d969bbf6298 Mon Sep 17 00:00:00 2001 From: Israel Lins Date: Mon, 15 Dec 2014 12:24:42 -0300 Subject: [QDateTime] ISO Time zone designators can be [+-]HH Added support on QDateTime::fromString to read correctly dates on ISO format with Time zone designators at format [+-]HH Change-Id: Ied5c3b7950aee3d0879af0e05398081395c18df5 Reviewed-by: Thiago Macieira Reviewed-by: Mark Brand --- src/corelib/tools/qdatetime.cpp | 9 ++++----- tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp | 8 ++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index f0f6a56755..021eb5ae5d 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -248,7 +248,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset) .arg((qAbs(offset) / 60) % 60, 2, 10, QLatin1Char('0')); } -// Parse offset in [+-]HH[:]MM format +// Parse offset in [+-]HH[[:]MM] format static int fromOffsetString(const QString &offsetString, bool *valid) { *valid = false; @@ -272,7 +272,7 @@ static int fromOffsetString(const QString &offsetString, bool *valid) // Split the hour and minute parts QStringList parts = offsetString.mid(1).split(QLatin1Char(':')); if (parts.count() == 1) { - // [+-]HHMM format + // [+-]HHMM or [+-]HH format parts.append(parts.at(0).mid(2)); parts[0] = parts.at(0).left(2); } @@ -282,7 +282,7 @@ static int fromOffsetString(const QString &offsetString, bool *valid) if (!ok) return 0; - const int minute = parts.at(1).toInt(&ok); + const int minute = (parts.at(1).isEmpty()) ? 0 : parts.at(1).toInt(&ok); if (!ok || minute < 0 || minute > 59) return 0; @@ -4428,8 +4428,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) } else { // the loop below is faster but functionally equal to: // const int signIndex = isoString.indexOf(QRegExp(QStringLiteral("[+-]"))); - const int sizeOfTimeZoneString = 4; - int signIndex = isoString.size() - sizeOfTimeZoneString - 1; + int signIndex = isoString.size() - 1; bool found = false; { const QChar plus = QLatin1Char('+'); diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index 51c3a19d63..ae812bef0e 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -1901,6 +1901,14 @@ void tst_QDateTime::fromStringDateFormat_data() << Qt::ISODate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC); QTest::newRow("ISO +00:00") << QString::fromLatin1("1970-01-01T00:12:34+00:00") << Qt::ISODate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC); + QTest::newRow("ISO -03") << QString::fromLatin1("2014-12-15T12:37:09-03") + << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9), Qt::UTC); + QTest::newRow("ISO zzz-03") << QString::fromLatin1("2014-12-15T12:37:09.745-03") + << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9, 745), Qt::UTC); + QTest::newRow("ISO -3") << QString::fromLatin1("2014-12-15T12:37:09-3") + << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9), Qt::UTC); + QTest::newRow("ISO zzz-3") << QString::fromLatin1("2014-12-15T12:37:09.745-3") + << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9, 745), Qt::UTC); // No time specified - defaults to Qt::LocalTime. QTest::newRow("ISO data3") << QString::fromLatin1("2002-10-01") << Qt::ISODate << QDateTime(QDate(2002, 10, 1), QTime(0, 0, 0, 0), Qt::LocalTime); -- cgit v1.2.3 From 5fefec9136fb2aac73f9e54037d2f6809021f011 Mon Sep 17 00:00:00 2001 From: Israel Lins Date: Sat, 1 Nov 2014 11:29:14 -0300 Subject: Added ROUND test for PostgreSQL The ROUND function for PostgreSQL only accept NUMERIC field as argument Change-Id: I0c3753bfe4167cd47158e21b407cca8771816104 Reviewed-by: Mark Brand --- tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 30 +++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 1943b6ec92..a862ce2094 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -3864,21 +3864,25 @@ void tst_QSqlQuery::aggregateFunctionTypes() QCOMPARE(q.value(0).toDouble(), 2.5); QCOMPARE(q.record().field(0).type(), QVariant::Double); - // PSQL does not have support for the round() function - if (dbType != QSqlDriver::PostgreSQL) { - QVERIFY_SQL(q, exec("SELECT ROUND(id, 1) FROM " + tableName + " WHERE id=1.5")); - QVERIFY(q.next()); - QCOMPARE(q.value(0).toDouble(), 1.5); - QCOMPARE(q.record().field(0).type(), QVariant::Double); + QString field = "id"; - QVERIFY_SQL(q, exec("SELECT ROUND(id, 0) FROM " + tableName + " WHERE id=2.5")); - QVERIFY(q.next()); - if (dbType == QSqlDriver::MySqlServer) - QCOMPARE(q.value(0).toDouble(), 2.0); - else - QCOMPARE(q.value(0).toDouble(), 3.0); - QCOMPARE(q.record().field(0).type(), QVariant::Double); + // PSQL does not have the round() function with real type + if (dbType == QSqlDriver::PostgreSQL) { + field += "::NUMERIC"; } + + QVERIFY_SQL(q, exec("SELECT ROUND(" + field + ", 1) FROM " + tableName + " WHERE id=1.5")); + QVERIFY(q.next()); + QCOMPARE(q.value(0).toDouble(), 1.5); + QCOMPARE(q.record().field(0).type(), QVariant::Double); + + QVERIFY_SQL(q, exec("SELECT ROUND(" + field + ", 0) FROM " + tableName + " WHERE id=2.5")); + QVERIFY(q.next()); + if (dbType == QSqlDriver::MySqlServer) + QCOMPARE(q.value(0).toDouble(), 2.0); + else + QCOMPARE(q.value(0).toDouble(), 3.0); + QCOMPARE(q.record().field(0).type(), QVariant::Double); } { const QString tableName(qTableName("stringFunctions", __FILE__, db)); -- cgit v1.2.3 From 6d3558b4492027f54e6dab702c115a251eb9e9d0 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Jan 2015 18:21:35 -0200 Subject: Autotest: Be nicer when asking the sub-processes to exit Instead of killing them outright (and note that terminate() doesn't work on Windows), ask them nicely to exit on their own. This way, if we run them in valgrind, valgrind gets a chance to print the leak check output and summary. Change-Id: Ib6cc8d4560ff0bf255f94980eb220e97592c00f0 Reviewed-by: Frederik Gladhorn --- .../dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp | 5 +++++ .../qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp | 4 +++- .../dbus/qdbusabstractinterface/qpinger/qpinger.cpp | 5 +++++ .../tst_qdbusabstractinterface.cpp | 17 ++++------------- tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp | 4 ++++ tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp | 4 +++- tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp | 5 +++++ tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp | 5 +++-- 8 files changed, 32 insertions(+), 17 deletions(-) diff --git a/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp index c680d93dab..76e9332d98 100644 --- a/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp +++ b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp @@ -133,6 +133,11 @@ public slots: valueSpy.clear(); } + void quit() + { + qApp->quit(); + } + signals: Q_SCRIPTABLE void syncReceived(const QString &sequence); diff --git a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp index 971c939aad..736ee656f5 100644 --- a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp +++ b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp @@ -521,8 +521,10 @@ void tst_QDBusAbstractAdaptor::initTestCase() void tst_QDBusAbstractAdaptor::cleanupTestCase() { + QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit"); + QDBusConnection::sessionBus().call(msg); + proc.waitForFinished(200); proc.close(); - proc.kill(); } void tst_QDBusAbstractAdaptor::methodCalls_data() diff --git a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp index 49462d388c..900faeb68e 100644 --- a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp +++ b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp @@ -87,6 +87,11 @@ public slots: emit targetObj.complexSignal(reg); } + void quit() + { + qApp->quit(); + } + private slots: void handleConnection(const QDBusConnection& con) { diff --git a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index 0cb29d121b..78b8054344 100644 --- a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -252,19 +252,10 @@ void tst_QDBusAbstractInterface::initTestCase() void tst_QDBusAbstractInterface::cleanupTestCase() { - // Kill peer, resetting the object exported by a separate process -#ifdef Q_OS_WIN - proc.kill(); // non-GUI processes don't respond to QProcess::terminate() -#else - proc.terminate(); -#endif - QVERIFY(proc.waitForFinished() || proc.state() == QProcess::NotRunning); - - // Wait until the service is certainly not registered - QDBusConnection con = QDBusConnection::sessionBus(); - if (con.isConnected()) { - QTRY_VERIFY(!con.interface()->isServiceRegistered(serviceName)); - } + QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit"); + QDBusConnection::sessionBus().call(msg); + proc.waitForFinished(200); + proc.close(); } void tst_QDBusAbstractInterface::init() diff --git a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp index 7a22fe90ad..3ef08ff741 100644 --- a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp +++ b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp @@ -112,6 +112,10 @@ public slots: return obj.m_complexProp; } + void quit() + { + qApp->quit(); + } private slots: void handleConnection(const QDBusConnection& con) diff --git a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp index 04992c9f28..9b2c25bdd5 100644 --- a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp +++ b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp @@ -297,8 +297,10 @@ void tst_QDBusInterface::initTestCase() void tst_QDBusInterface::cleanupTestCase() { + QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit"); + QDBusConnection::sessionBus().call(msg); + proc.waitForFinished(200); proc.close(); - proc.kill(); } void tst_QDBusInterface::notConnected() diff --git a/tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp b/tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp index bb8aab3d21..11cd4f05ce 100644 --- a/tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp +++ b/tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp @@ -49,6 +49,11 @@ public slots: if (!QDBusConnection::sessionBus().send(msg.createReply(msg.arguments()))) exit(1); } + + void quit() + { + qApp->quit(); + } }; int main(int argc, char *argv[]) diff --git a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp index 4d12522a68..0ab03e7dd8 100644 --- a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp +++ b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp @@ -143,9 +143,10 @@ void tst_QDBusMarshall::initTestCase() void tst_QDBusMarshall::cleanupTestCase() { - proc.close(); - proc.terminate(); + QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit"); + QDBusConnection::sessionBus().call(msg); proc.waitForFinished(200); + proc.close(); } int tst_QDBusMarshall::fileDescriptorForTest() -- cgit v1.2.3 From 9b869cfb01556ee361bd8f66b1a1f6bc40134cb7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Jan 2015 18:22:47 -0200 Subject: Autotest: Forward stderr of the sub-processes So we can get the output when running with QDBUS_DEBUG=1. Change-Id: I6a6b8e0d82727c522914fb90a7ce594c86307d8f Reviewed-by: Frederik Gladhorn --- tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp | 1 + tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp | 1 + tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp | 1 - tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp | 1 + tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp | 1 + 5 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp index 736ee656f5..4c6f3c5eee 100644 --- a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp +++ b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp @@ -496,6 +496,7 @@ void tst_QDBusAbstractAdaptor::initTestCase() #else # define EXE "" #endif + proc.setProcessChannelMode(QProcess::ForwardedErrorChannel); proc.start(QFINDTESTDATA("qmyserver/qmyserver" EXE)); QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); QVERIFY(proc.waitForReadyRead()); diff --git a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index 78b8054344..0a8da46046 100644 --- a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -236,6 +236,7 @@ void tst_QDBusAbstractInterface::initTestCase() #else # define EXE "" #endif + proc.setProcessChannelMode(QProcess::ForwardedErrorChannel); proc.start(QFINDTESTDATA("qpinger/qpinger" EXE)); QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); QVERIFY(proc.waitForReadyRead()); diff --git a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp index 3ef08ff741..d3cfaa74b3 100644 --- a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp +++ b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp @@ -88,7 +88,6 @@ public slots: QVariantList callArgs() { - qDebug() << "callArgs" << MyObject::callArgs.count(); return MyObject::callArgs; } diff --git a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp index 9b2c25bdd5..92a44292c3 100644 --- a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp +++ b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp @@ -271,6 +271,7 @@ void tst_QDBusInterface::initTestCase() #else # define EXE "" #endif + proc.setProcessChannelMode(QProcess::ForwardedErrorChannel); proc.start(QFINDTESTDATA("qmyserver/qmyserver" EXE)); QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); QVERIFY(proc.waitForReadyRead()); diff --git a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp index 0ab03e7dd8..0e8ac9b0f3 100644 --- a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp +++ b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp @@ -136,6 +136,7 @@ void tst_QDBusMarshall::initTestCase() #else # define EXE "" #endif + proc.setProcessChannelMode(QProcess::ForwardedErrorChannel); proc.start(QFINDTESTDATA("qpong/qpong" EXE)); QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); QVERIFY(proc.waitForReadyRead()); -- cgit v1.2.3 From 86ca4de8a257611d5811a1cbf9c8b5c9336188e9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Jan 2015 11:20:59 -0200 Subject: Doc: fix the type listed for the functions in QAtomicInteger The "int" was a left over when this was documentation for QAtomicInt. Change-Id: If7b7688982d27cbbd42f080eff7d08344b587f44 Reviewed-by: Richard J. Moore --- src/corelib/thread/qatomic.cpp | 86 ++++++++++++++++++------------------- src/corelib/thread/qatomic.h | 96 +++++++++++++++++++++--------------------- 2 files changed, 91 insertions(+), 91 deletions(-) diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp index 2ac32d5d6b..0f4c8efb03 100644 --- a/src/corelib/thread/qatomic.cpp +++ b/src/corelib/thread/qatomic.cpp @@ -250,7 +250,7 @@ /*! - \fn int QAtomicInteger::load() const + \fn T QAtomicInteger::load() const Atomically loads the value of this QAtomicInteger using relaxed memory ordering. The value is not modified in any way, but note that there's no @@ -260,7 +260,7 @@ */ /*! - \fn int QAtomicInteger::loadAcquire() const + \fn T QAtomicInteger::loadAcquire() const Atomically loads the value of this QAtomicInteger using the "Acquire" memory ordering. The value is not modified in any way, but note that there's no @@ -270,7 +270,7 @@ */ /*! - \fn void QAtomicInteger::store(int newValue) + \fn void QAtomicInteger::store(T newValue) Atomically stores the \a newValue value into this atomic type, using relaxed memory ordering. @@ -279,7 +279,7 @@ */ /*! - \fn void QAtomicInteger::storeRelease(int newValue) + \fn void QAtomicInteger::storeRelease(T newValue) Atomically stores the \a newValue value into this atomic type, using the "Release" memory ordering. @@ -288,7 +288,7 @@ */ /*! - \fn QAtomicInteger::operator int() const + \fn QAtomicInteger::operator T() const \since 5.3 Atomically loads the value of this QAtomicInteger using a sequentially @@ -300,7 +300,7 @@ */ /*! - \fn QAtomicInteger &QAtomicInteger::operator=(int newValue) + \fn QAtomicInteger &QAtomicInteger::operator=(T newValue) \since 5.3 Atomically stores the \a newValue value into this atomic type using a @@ -335,7 +335,7 @@ */ /*! - \fn int QAtomicInteger::operator++() + \fn T QAtomicInteger::operator++() \since 5.3 Atomically pre-increments the value of this QAtomicInteger. Returns the new @@ -348,7 +348,7 @@ */ /*! - \fn int QAtomicInteger::operator++(int) + \fn T QAtomicInteger::operator++(int) \since 5.3 Atomically post-increments the value of this QAtomicInteger. Returns the old @@ -373,7 +373,7 @@ */ /*! - \fn int QAtomicInteger::operator--() + \fn T QAtomicInteger::operator--() \since 5.3 Atomically pre-decrements the value of this QAtomicInteger. Returns the new @@ -386,7 +386,7 @@ */ /*! - \fn int QAtomicInteger::operator--(int) + \fn T QAtomicInteger::operator--(int) \since 5.3 Atomically post-decrements the value of this QAtomicInteger. Returns the old @@ -409,7 +409,7 @@ Returns \c true if atomic test-and-set is wait-free, false otherwise. */ -/*! \fn bool QAtomicInteger::testAndSetRelaxed(int expectedValue, int newValue) +/*! \fn bool QAtomicInteger::testAndSetRelaxed(T expectedValue, T newValue) Atomic test-and-set. @@ -423,7 +423,7 @@ processor to freely reorder memory accesses. */ -/*! \fn bool QAtomicInteger::testAndSetAcquire(int expectedValue, int newValue) +/*! \fn bool QAtomicInteger::testAndSetAcquire(T expectedValue, T newValue) Atomic test-and-set. @@ -438,7 +438,7 @@ be re-ordered before the atomic operation. */ -/*! \fn bool QAtomicInteger::testAndSetRelease(int expectedValue, int newValue) +/*! \fn bool QAtomicInteger::testAndSetRelease(T expectedValue, T newValue) Atomic test-and-set. @@ -453,7 +453,7 @@ re-ordered after the atomic operation. */ -/*! \fn bool QAtomicInteger::testAndSetOrdered(int expectedValue, int newValue) +/*! \fn bool QAtomicInteger::testAndSetOrdered(T expectedValue, T newValue) Atomic test-and-set. @@ -480,7 +480,7 @@ otherwise. */ -/*! \fn int QAtomicInteger::fetchAndStoreRelaxed(int newValue) +/*! \fn T QAtomicInteger::fetchAndStoreRelaxed(T newValue) Atomic fetch-and-store. @@ -492,7 +492,7 @@ processor to freely reorder memory accesses. */ -/*! \fn int QAtomicInteger::fetchAndStoreAcquire(int newValue) +/*! \fn T QAtomicInteger::fetchAndStoreAcquire(T newValue) Atomic fetch-and-store. @@ -505,7 +505,7 @@ be re-ordered before the atomic operation. */ -/*! \fn int QAtomicInteger::fetchAndStoreRelease(int newValue) +/*! \fn T QAtomicInteger::fetchAndStoreRelease(T newValue) Atomic fetch-and-store. @@ -518,7 +518,7 @@ re-ordered after the atomic operation. */ -/*! \fn int QAtomicInteger::fetchAndStoreOrdered(int newValue) +/*! \fn T QAtomicInteger::fetchAndStoreOrdered(T newValue) Atomic fetch-and-store. @@ -543,7 +543,7 @@ otherwise. */ -/*! \fn int QAtomicInteger::fetchAndAddRelaxed(int valueToAdd) +/*! \fn T QAtomicInteger::fetchAndAddRelaxed(T valueToAdd) Atomic fetch-and-add. @@ -557,7 +557,7 @@ \sa operator+=(), fetchAndSubRelaxed() */ -/*! \fn int QAtomicInteger::fetchAndAddAcquire(int valueToAdd) +/*! \fn T QAtomicInteger::fetchAndAddAcquire(T valueToAdd) Atomic fetch-and-add. @@ -572,7 +572,7 @@ \sa operator+=(), fetchAndSubAcquire() */ -/*! \fn int QAtomicInteger::fetchAndAddRelease(int valueToAdd) +/*! \fn T QAtomicInteger::fetchAndAddRelease(T valueToAdd) Atomic fetch-and-add. @@ -587,7 +587,7 @@ \sa operator+=(), fetchAndSubRelease() */ -/*! \fn int QAtomicInteger::fetchAndAddOrdered(int valueToAdd) +/*! \fn T QAtomicInteger::fetchAndAddOrdered(T valueToAdd) Atomic fetch-and-add. @@ -602,7 +602,7 @@ \sa operator+=(), fetchAndSubOrdered() */ -/*! \fn int QAtomicInteger::operator+=(int valueToAdd) +/*! \fn T QAtomicInteger::operator+=(T valueToAdd) \since 5.3 Atomic add-and-fetch. @@ -616,7 +616,7 @@ \sa fetchAndAddOrdered(), operator-=() */ -/*! \fn int QAtomicInteger::fetchAndSubRelaxed(int valueToSub) +/*! \fn T QAtomicInteger::fetchAndSubRelaxed(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -631,7 +631,7 @@ \sa operator-=(), fetchAndAddRelaxed() */ -/*! \fn int QAtomicInteger::fetchAndSubAcquire(int valueToSub) +/*! \fn T QAtomicInteger::fetchAndSubAcquire(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -647,7 +647,7 @@ \sa operator-=(), fetchAndAddAcquire() */ -/*! \fn int QAtomicInteger::fetchAndSubRelease(int valueToSub) +/*! \fn T QAtomicInteger::fetchAndSubRelease(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -663,7 +663,7 @@ \sa operator-=(), fetchAndAddRelease() */ -/*! \fn int QAtomicInteger::fetchAndSubOrdered(int valueToSub) +/*! \fn T QAtomicInteger::fetchAndSubOrdered(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -679,7 +679,7 @@ \sa operator-=(), fetchAndAddOrdered() */ -/*! \fn int QAtomicInteger::operator-=(int valueToSub) +/*! \fn T QAtomicInteger::operator-=(T valueToSub) \since 5.3 Atomic sub-and-fetch. @@ -693,7 +693,7 @@ \sa fetchAndSubOrdered(), operator+=() */ -/*! \fn int QAtomicInteger::fetchAndOrRelaxed(int valueToOr) +/*! \fn T QAtomicInteger::fetchAndOrRelaxed(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -708,7 +708,7 @@ \sa operator|=() */ -/*! \fn int QAtomicInteger::fetchAndOrAcquire(int valueToOr) +/*! \fn T QAtomicInteger::fetchAndOrAcquire(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -724,7 +724,7 @@ \sa operator|=() */ -/*! \fn int QAtomicInteger::fetchAndOrRelease(int valueToOr) +/*! \fn T QAtomicInteger::fetchAndOrRelease(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -740,7 +740,7 @@ \sa operator|=() */ -/*! \fn int QAtomicInteger::fetchAndOrOrdered(int valueToOr) +/*! \fn T QAtomicInteger::fetchAndOrOrdered(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -756,7 +756,7 @@ \sa operator|=() */ -/*! \fn int QAtomicInteger::operator|=(int valueToOr) +/*! \fn T QAtomicInteger::operator|=(T valueToOr) \since 5.3 Atomic or-and-fetch. @@ -770,7 +770,7 @@ \sa fetchAndOrOrdered() */ -/*! \fn int QAtomicInteger::fetchAndXorRelaxed(int valueToXor) +/*! \fn T QAtomicInteger::fetchAndXorRelaxed(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -785,7 +785,7 @@ \sa operator^=() */ -/*! \fn int QAtomicInteger::fetchAndXorAcquire(int valueToXor) +/*! \fn T QAtomicInteger::fetchAndXorAcquire(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -801,7 +801,7 @@ \sa operator^=() */ -/*! \fn int QAtomicInteger::fetchAndXorRelease(int valueToXor) +/*! \fn T QAtomicInteger::fetchAndXorRelease(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -817,7 +817,7 @@ \sa operator^=() */ -/*! \fn int QAtomicInteger::fetchAndXorOrdered(int valueToXor) +/*! \fn T QAtomicInteger::fetchAndXorOrdered(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -833,7 +833,7 @@ \sa operator^=() */ -/*! \fn int QAtomicInteger::operator^=(int valueToXor) +/*! \fn T QAtomicInteger::operator^=(T valueToXor) \since 5.3 Atomic xor-and-fetch. @@ -847,7 +847,7 @@ \sa fetchAndXorOrdered() */ -/*! \fn int QAtomicInteger::fetchAndAndRelaxed(int valueToAnd) +/*! \fn T QAtomicInteger::fetchAndAndRelaxed(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -862,7 +862,7 @@ \sa operator&=() */ -/*! \fn int QAtomicInteger::fetchAndAndAcquire(int valueToAnd) +/*! \fn T QAtomicInteger::fetchAndAndAcquire(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -878,7 +878,7 @@ \sa operator&=() */ -/*! \fn int QAtomicInteger::fetchAndAndRelease(int valueToAnd) +/*! \fn T QAtomicInteger::fetchAndAndRelease(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -894,7 +894,7 @@ \sa operator&=() */ -/*! \fn int QAtomicInteger::fetchAndAndOrdered(int valueToAnd) +/*! \fn T QAtomicInteger::fetchAndAndOrdered(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -910,7 +910,7 @@ \sa operator&=() */ -/*! \fn int QAtomicInteger::operator&=(int valueToAnd) +/*! \fn T QAtomicInteger::operator&=(T valueToAnd) \since 5.3 Atomic add-and-fetch. diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h index 7526cfe0e6..72cb3866a5 100644 --- a/src/corelib/thread/qatomic.h +++ b/src/corelib/thread/qatomic.h @@ -76,13 +76,13 @@ public: } #ifdef Q_QDOC - int load() const; - int loadAcquire() const; - void store(int newValue); - void storeRelease(int newValue); + T load() const; + T loadAcquire() const; + void store(T newValue); + void storeRelease(T newValue); - operator int() const; - QAtomicInteger &operator=(int); + operator T() const; + QAtomicInteger &operator=(T); static Q_DECL_CONSTEXPR bool isReferenceCountingNative(); static Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree(); @@ -93,56 +93,56 @@ public: static Q_DECL_CONSTEXPR bool isTestAndSetNative(); static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree(); - bool testAndSetRelaxed(int expectedValue, int newValue); - bool testAndSetAcquire(int expectedValue, int newValue); - bool testAndSetRelease(int expectedValue, int newValue); - bool testAndSetOrdered(int expectedValue, int newValue); + bool testAndSetRelaxed(T expectedValue, T newValue); + bool testAndSetAcquire(T expectedValue, T newValue); + bool testAndSetRelease(T expectedValue, T newValue); + bool testAndSetOrdered(T expectedValue, T newValue); static Q_DECL_CONSTEXPR bool isFetchAndStoreNative(); static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree(); - int fetchAndStoreRelaxed(int newValue); - int fetchAndStoreAcquire(int newValue); - int fetchAndStoreRelease(int newValue); - int fetchAndStoreOrdered(int newValue); + T fetchAndStoreRelaxed(T newValue); + T fetchAndStoreAcquire(T newValue); + T fetchAndStoreRelease(T newValue); + T fetchAndStoreOrdered(T newValue); static Q_DECL_CONSTEXPR bool isFetchAndAddNative(); static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree(); - int fetchAndAddRelaxed(int valueToAdd); - int fetchAndAddAcquire(int valueToAdd); - int fetchAndAddRelease(int valueToAdd); - int fetchAndAddOrdered(int valueToAdd); - - int fetchAndSubRelaxed(int valueToSub); - int fetchAndSubAcquire(int valueToSub); - int fetchAndSubRelease(int valueToSub); - int fetchAndSubOrdered(int valueToSub); - - int fetchAndOrRelaxed(int valueToOr); - int fetchAndOrAcquire(int valueToOr); - int fetchAndOrRelease(int valueToOr); - int fetchAndOrOrdered(int valueToOr); - - int fetchAndAndRelaxed(int valueToAnd); - int fetchAndAndAcquire(int valueToAnd); - int fetchAndAndRelease(int valueToAnd); - int fetchAndAndOrdered(int valueToAnd); - - int fetchAndXorRelaxed(int valueToXor); - int fetchAndXorAcquire(int valueToXor); - int fetchAndXorRelease(int valueToXor); - int fetchAndXorOrdered(int valueToXor); - - int operator++(); - int operator++(int); - int operator--(); - int operator--(int); - int operator+=(int value); - int operator-=(int value); - int operator|=(int value); - int operator&=(int value); - int operator^=(int value); + T fetchAndAddRelaxed(T valueToAdd); + T fetchAndAddAcquire(T valueToAdd); + T fetchAndAddRelease(T valueToAdd); + T fetchAndAddOrdered(T valueToAdd); + + T fetchAndSubRelaxed(T valueToSub); + T fetchAndSubAcquire(T valueToSub); + T fetchAndSubRelease(T valueToSub); + T fetchAndSubOrdered(T valueToSub); + + T fetchAndOrRelaxed(T valueToOr); + T fetchAndOrAcquire(T valueToOr); + T fetchAndOrRelease(T valueToOr); + T fetchAndOrOrdered(T valueToOr); + + T fetchAndAndRelaxed(T valueToAnd); + T fetchAndAndAcquire(T valueToAnd); + T fetchAndAndRelease(T valueToAnd); + T fetchAndAndOrdered(T valueToAnd); + + T fetchAndXorRelaxed(T valueToXor); + T fetchAndXorAcquire(T valueToXor); + T fetchAndXorRelease(T valueToXor); + T fetchAndXorOrdered(T valueToXor); + + T operator++(); + T operator++(int); + T operator--(); + T operator--(int); + T operator+=(T value); + T operator-=(T value); + T operator|=(T value); + T operator&=(T value); + T operator^=(T value); #endif }; -- cgit v1.2.3 From 350c60b79e720d005a1a554fd177dbda607079cf Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Tue, 30 Dec 2014 19:26:09 +0200 Subject: Link against QMAKE_LIBS_EXECINFO when using backtrace(3). Add a new mkspec variable, QMAKE_LIBS_EXECINFO, for platforms where backtrace(3), backtrace_symbols(3) and others are not in libc, but rather in a separate library -- on the BSDs, this is libexecinfo. Use it in corelib/global/global.pri so that libqt5core links against it and has the proper dependency when necessary. Change-Id: I62ac36c9b3ba7ab0719420cb795087d43ec138a4 Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- mkspecs/freebsd-g++/qmake.conf | 1 + mkspecs/freebsd-g++46/qmake.conf | 1 + mkspecs/unsupported/freebsd-clang/qmake.conf | 1 + src/corelib/global/global.pri | 3 +++ 4 files changed, 6 insertions(+) diff --git a/mkspecs/freebsd-g++/qmake.conf b/mkspecs/freebsd-g++/qmake.conf index 3d2a0e9090..47505fc06a 100644 --- a/mkspecs/freebsd-g++/qmake.conf +++ b/mkspecs/freebsd-g++/qmake.conf @@ -17,6 +17,7 @@ QMAKE_LFLAGS_THREAD = -pthread QMAKE_LIBS = QMAKE_LIBS_DYNLOAD = +QMAKE_LIBS_EXECINFO = -lexecinfo QMAKE_LIBS_X11 = -lXext -lX11 -lm QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_THREAD = diff --git a/mkspecs/freebsd-g++46/qmake.conf b/mkspecs/freebsd-g++46/qmake.conf index b15e689cde..277997ab28 100644 --- a/mkspecs/freebsd-g++46/qmake.conf +++ b/mkspecs/freebsd-g++46/qmake.conf @@ -17,6 +17,7 @@ QMAKE_LFLAGS_THREAD = -pthread QMAKE_LIBS = QMAKE_LIBS_DYNLOAD = +QMAKE_LIBS_EXECINFO = -lexecinfo QMAKE_LIBS_X11 = -lXext -lX11 -lm QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_THREAD = diff --git a/mkspecs/unsupported/freebsd-clang/qmake.conf b/mkspecs/unsupported/freebsd-clang/qmake.conf index 2cfd763688..92b7c47590 100644 --- a/mkspecs/unsupported/freebsd-clang/qmake.conf +++ b/mkspecs/unsupported/freebsd-clang/qmake.conf @@ -18,6 +18,7 @@ QMAKE_LFLAGS_THREAD = -pthread QMAKE_LIBS = QMAKE_LIBS_DYNLOAD = +QMAKE_LIBS_EXECINFO = -lexecinfo QMAKE_LIBS_X11 = -lXext -lX11 -lm QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_THREAD = diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index fb0e7fd708..e0dd9e4f36 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -35,6 +35,9 @@ INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global # Only used on platforms with CONFIG += precompile_header PRECOMPILED_HEADER = global/qt_pch.h +# qlogging.cpp uses backtrace(3), which is in a separate library on the BSDs. +LIBS_PRIVATE += $$QMAKE_LIBS_EXECINFO + linux*:!cross_compile:!static:!*-armcc* { QMAKE_LFLAGS += -Wl,-e,qt_core_boilerplate prog=$$quote(if (/program interpreter: (.*)]/) { print $1; }) -- cgit v1.2.3 From d7fa2d060a58b0e79d7df84a4fc54f44de9b2610 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 16 Oct 2014 20:52:44 +0200 Subject: Fix a memleak in QAssociativeIterable::value() QtMetaTypePrivate::QAssociativeIterableImpl::{find,begin,end}() allocate a new _iterator, so when they're used outside of the ref-counted world of QAssociativeIterable::const_iterator, their lifetime needs to be manually managed. Instead of going to that length, which failed in previous iterations of this patch, implement value() in terms of (new) find() and let find() operate on const_iterator. Because of forwards compatibility between patch releases, use (unexported) friend functions for now with the intention to make them proper member functions come Qt 5.5. Task-number: QTBUG-41469 Change-Id: I43b21eae0c2fc4c182369e669a8b3b457be68885 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qvariant.cpp | 49 +++++++++++++++++++++++++++-------------- src/corelib/kernel/qvariant.h | 6 +++++ 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 2ac1bb11fb..f76201802b 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -3844,6 +3844,13 @@ void QAssociativeIterable::const_iterator::end() m_impl.end(); } +void find(QAssociativeIterable::const_iterator &it, const QVariant &key) +{ + Q_ASSERT(key.userType() == it.m_impl._metaType_id_key); + const QtMetaTypePrivate::VariantData dkey(key.userType(), key.constData(), 0 /*key.flags()*/); + it.m_impl.find(dkey); +} + /*! Returns a QAssociativeIterable::const_iterator for the beginning of the container. This can be used in stl-style iteration. @@ -3870,28 +3877,38 @@ QAssociativeIterable::const_iterator QAssociativeIterable::end() const return it; } +/*! + \internal + + Returns a QAssociativeIterable::const_iterator for the given key \a key + in the container, if the types are convertible. + + If the key is not found, returns end(). + + This can be used in stl-style iteration. + + \sa begin(), end(), value() +*/ +QAssociativeIterable::const_iterator find(const QAssociativeIterable &iterable, const QVariant &key) +{ + QAssociativeIterable::const_iterator it(iterable, new QAtomicInt(0)); + QVariant key_ = key; + if (key_.canConvert(iterable.m_impl._metaType_id_key) && key_.convert(iterable.m_impl._metaType_id_key)) + find(it, key_); + else + it.end(); + return it; +} + /*! Returns the value for the given \a key in the container, if the types are convertible. */ QVariant QAssociativeIterable::value(const QVariant &key) const { - QVariant key_ = key; - if (!key_.canConvert(m_impl._metaType_id_key)) - return QVariant(); - if (!key_.convert(m_impl._metaType_id_key)) + const const_iterator it = find(*this, key); + if (it == end()) return QVariant(); - const QtMetaTypePrivate::VariantData dkey(key_.userType(), key_.constData(), 0 /*key.flags()*/); - QtMetaTypePrivate::QAssociativeIterableImpl impl = m_impl; - impl.find(dkey); - QtMetaTypePrivate::QAssociativeIterableImpl endIt = m_impl; - endIt.end(); - if (impl.equal(endIt)) - return QVariant(); - const QtMetaTypePrivate::VariantData d = impl.getCurrentValue(); - QVariant v(d.metaTypeId, d.data, d.flags); - if (d.metaTypeId == qMetaTypeId()) - return *reinterpret_cast(d.data); - return v; + return *it; } /*! diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 7dce813bb5..90f3e8fbae 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -633,6 +633,9 @@ public: void begin(); void end(); + // ### Qt 5.5: make find() (1st one) a member function + friend void find(const_iterator &it, const QVariant &key); + friend const_iterator find(const QAssociativeIterable &iterable, const QVariant &key); public: ~const_iterator(); const_iterator(const const_iterator &other); @@ -662,6 +665,9 @@ public: const_iterator begin() const; const_iterator end() const; +private: // ### Qt 5.5: make it a public find() member function: + friend const_iterator find(const QAssociativeIterable &iterable, const QVariant &key); +public: QVariant value(const QVariant &key) const; -- cgit v1.2.3 From 4560ce4ec6196d356810e24c4c76c92a5934c304 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 16 Oct 2014 23:40:34 +0200 Subject: tst_QLockFile: simulate a crash better Instead of leaking the QLockFile instance, which causes leak-checkers to emit false positives, simply call exit(), which doesn't run the destructors, yet doesn't lead to leak-checker warnings. Change-Id: Ia61010671e5218ae412e2bcf873e66255a2c5a99 Reviewed-by: David Faure Reviewed-by: Thiago Macieira --- .../io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp index e4b5d9ab8f..5d1a743dd9 100644 --- a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp +++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp @@ -50,10 +50,10 @@ int main(int argc, char *argv[]) option = QString::fromLocal8Bit(argv[2]); if (option == "-crash") { - QLockFile *lockFile = new QLockFile(lockName); - lockFile->lock(); - // leak the lockFile on purpose, so that the lock remains! - return 0; + QLockFile lockFile(lockName); + lockFile.lock(); + // exit on purpose, so that the lock remains! + exit(0); } else if (option == "-busy") { QLockFile lockFile(lockName); lockFile.lock(); -- cgit v1.2.3 From b699ac070c01958cdc6599675f8335377ac45d3a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 24 Dec 2014 17:01:01 -0200 Subject: Don't bind to QHostAddress::Any if we want to do IPv4 multicast ops Linux gracefully allows us to do that and treat the v6 socket as if it were v4. Other OS (notably OS X) aren't so forgiving. Change-Id: I13dd3274be2a4b13e8b1eef93cbc2dd17b648f96 Reviewed-by: Richard J. Moore --- tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 60ac54856c..db09ec4486 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -1062,7 +1062,7 @@ void tst_QUdpSocket::multicastTtlOption_data() QTest::addColumn("expected"); QList addresses; - addresses += QHostAddress(QHostAddress::Any); + addresses += QHostAddress(QHostAddress::AnyIPv4); addresses += QHostAddress(QHostAddress::AnyIPv6); foreach (const QHostAddress &address, addresses) { @@ -1103,7 +1103,7 @@ void tst_QUdpSocket::multicastLoopbackOption_data() QTest::addColumn("expected"); QList addresses; - addresses += QHostAddress(QHostAddress::Any); + addresses += QHostAddress(QHostAddress::AnyIPv4); addresses += QHostAddress(QHostAddress::AnyIPv6); foreach (const QHostAddress &address, addresses) { @@ -1216,7 +1216,7 @@ void tst_QUdpSocket::setMulticastInterface() // bind initializes the socket bool bound = udpSocket.bind((address.protocol() == QAbstractSocket::IPv6Protocol ? QHostAddress(QHostAddress::AnyIPv6) - : QHostAddress(QHostAddress::Any)), + : QHostAddress(QHostAddress::AnyIPv4)), 0); if (!bound) QTest::ignoreMessage(QtWarningMsg, "QUdpSocket::setMulticastInterface() called on a QUdpSocket when not in QUdpSocket::BoundState"); -- cgit v1.2.3 From 38a3158d2fe32dc55c6b6286fac58f782571294a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Fri, 12 Dec 2014 12:33:04 +0000 Subject: Windows: Fix QColorDialog's live updates while picking outside color Microsoft's SetCapture() doesn't work on windows owned by other processes, so instead we use a timer. This is the same approach as used by qttools/src/pixeltool. The mouse move approach however is more elegant and doesn't hammer the CPU with QCursor::pos() calls when idle. For this reason the workaround is Q_OS_WIN only. Task-number: QTBUG-34538 Change-Id: I40a6f7df5bf2a3a29ade8fe4a92f5b5c4ece7efb Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qcolordialog.cpp | 40 ++++++++++++++++++++++++++++++++---- src/widgets/dialogs/qcolordialog.h | 1 + src/widgets/dialogs/qcolordialog_p.h | 12 ++++++++++- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index f04e5b9ea6..882bb999fb 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -57,6 +57,7 @@ #include "qdialogbuttonbox.h" #include "qscreen.h" #include "qcursor.h" +#include "qtimer.h" #include @@ -1577,6 +1578,11 @@ void QColorDialogPrivate::_q_pickScreenColor() #else q->grabMouse(); #endif + +#ifdef Q_OS_WIN + // On Windows mouse tracking doesn't work over other processes's windows + updateTimer->start(30); +#endif q->grabKeyboard(); /* With setMouseTracking(true) the desired color can be more precisedly picked up, * and continuously pushing the mouse button is not necessary. @@ -1600,6 +1606,9 @@ void QColorDialogPrivate::releaseColorPicking() cp->setCrossVisible(true); q->removeEventFilter(colorPickingEventFilter); q->releaseMouse(); +#ifdef Q_OS_WIN + updateTimer->stop(); +#endif q->releaseKeyboard(); q->setMouseTracking(false); lblScreenColorInfo->setText(QLatin1String("\n")); @@ -1782,6 +1791,10 @@ void QColorDialogPrivate::initWidgets() cancel = buttons->addButton(QDialogButtonBox::Cancel); QObject::connect(cancel, SIGNAL(clicked()), q, SLOT(reject())); +#ifdef Q_OS_WIN + updateTimer = new QTimer(q); + QObject::connect(updateTimer, SIGNAL(timeout()), q, SLOT(_q_updateColorPicking())); +#endif retranslateStrings(); } @@ -2196,18 +2209,37 @@ void QColorDialog::changeEvent(QEvent *e) QDialog::changeEvent(e); } -bool QColorDialogPrivate::handleColorPickingMouseMove(QMouseEvent *e) +void QColorDialogPrivate::_q_updateColorPicking() { - // If the cross is visible the grabbed color will be black most of the times - cp->setCrossVisible(!cp->geometry().contains(e->pos())); +#ifndef QT_NO_CURSOR + Q_Q(QColorDialog); + static QPoint lastGlobalPos; + QPoint newGlobalPos = QCursor::pos(); + if (lastGlobalPos == newGlobalPos) + return; + lastGlobalPos = newGlobalPos; - const QPoint globalPos = e->globalPos(); + if (!q->rect().contains(q->mapFromGlobal(newGlobalPos))) // Inside the dialog mouse tracking works, handleColorPickingMouseMove will be called + updateColorPicking(newGlobalPos); +#endif // ! QT_NO_CURSOR +} + +void QColorDialogPrivate::updateColorPicking(const QPoint &globalPos) +{ const QColor color = grabScreenColor(globalPos); // QTBUG-39792, do not change standard, custom color selectors while moving as // otherwise it is not possible to pre-select a custom cell for assignment. setCurrentColor(color, ShowColor); lblScreenColorInfo->setText(QColorDialog::tr("Cursor at %1, %2, color: %3\nPress ESC to cancel") .arg(globalPos.x()).arg(globalPos.y()).arg(color.name())); +} + +bool QColorDialogPrivate::handleColorPickingMouseMove(QMouseEvent *e) +{ + // If the cross is visible the grabbed color will be black most of the times + cp->setCrossVisible(!cp->geometry().contains(e->pos())); + + updateColorPicking(e->globalPos()); return true; } diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h index d23254a2b2..b06da2ab13 100644 --- a/src/widgets/dialogs/qcolordialog.h +++ b/src/widgets/dialogs/qcolordialog.h @@ -116,6 +116,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_newCustom(int, int)) Q_PRIVATE_SLOT(d_func(), void _q_newStandard(int, int)) Q_PRIVATE_SLOT(d_func(), void _q_pickScreenColor()) + Q_PRIVATE_SLOT(d_func(), void _q_updateColorPicking()) friend class QColorShower; }; diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h index af3ebe8925..2b501522f5 100644 --- a/src/widgets/dialogs/qcolordialog_p.h +++ b/src/widgets/dialogs/qcolordialog_p.h @@ -63,6 +63,7 @@ class QVBoxLayout; class QPushButton; class QWellArray; class QColorPickingEventFilter; +class QTimer; class QColorDialogPrivate : public QDialogPrivate { @@ -75,7 +76,11 @@ public: SetColorAll = ShowColor | SelectColor }; - QColorDialogPrivate() : options(new QColorDialogOptions) {} + QColorDialogPrivate() : options(new QColorDialogOptions) +#ifdef Q_OS_WIN + , updateTimer(0) +#endif + {} QPlatformColorDialogHelper *platformColorDialogHelper() const { return static_cast(platformHelper()); } @@ -104,6 +109,8 @@ public: void _q_newCustom(int, int); void _q_newStandard(int, int); void _q_pickScreenColor(); + void _q_updateColorPicking(); + void updateColorPicking(const QPoint &pos); void releaseColorPicking(); bool handleColorPickingMouseMove(QMouseEvent *e); bool handleColorPickingMouseButtonRelease(QMouseEvent *e); @@ -136,6 +143,9 @@ public: QPointer receiverToDisconnectOnClose; QByteArray memberToDisconnectOnClose; +#ifdef Q_OS_WIN + QTimer *updateTimer; +#endif #ifdef Q_WS_MAC void openCocoaColorPanel(const QColor &initial, -- cgit v1.2.3 From 16c32c6dfbca03a46d1a2bb87b6c1c365e6179d5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Sat, 27 Dec 2014 20:36:37 +0100 Subject: JPEG: Fix reading of EXIF orientation. The orientation is unsigned short, read it as such. In JPEG-files created by Ricoh/Pentax cameras, the data is saved in Motorola format. Reading the wrong data size will produce invalid values when converting the byte order. Change-Id: I8f7c5dc5bfc10c02e090d3654aaefa047229a962 Task-number: QTBUG-43563 Reviewed-by: Friedemann Kleint --- src/gui/image/qjpeghandler.cpp | 6 ++-- .../jpeg_exif_orientation_value_6_motorola.jpg | Bin 0 -> 911 bytes tests/auto/gui/image/qimage/tst_qimage.cpp | 33 +++++++++++++++------ 3 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 tests/auto/gui/image/qimage/images/jpeg_exif_orientation_value_6_motorola.jpg diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp index 87992bcced..9cf9947b6c 100644 --- a/src/gui/image/qjpeghandler.cpp +++ b/src/gui/image/qjpeghandler.cpp @@ -826,10 +826,10 @@ static int getExifOrientation(QByteArray &exifData) quint16 tag; quint16 type; quint32 components; - quint32 value; - - stream >> tag >> type >> components >> value; + quint16 value; + quint16 dummy; + stream >> tag >> type >> components >> value >> dummy; if (tag == 0x0112) { // Tag Exif.Image.Orientation if (components !=1) return -1; diff --git a/tests/auto/gui/image/qimage/images/jpeg_exif_orientation_value_6_motorola.jpg b/tests/auto/gui/image/qimage/images/jpeg_exif_orientation_value_6_motorola.jpg new file mode 100644 index 0000000000..0aa164b78b Binary files /dev/null and b/tests/auto/gui/image/qimage/images/jpeg_exif_orientation_value_6_motorola.jpg differ diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index fcee2884d9..1fef747399 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -173,6 +173,7 @@ private slots: void invertPixelsRGB_data(); void invertPixelsRGB(); + void exifOrientation_data(); void exifOrientation(); void cleanupFunctions(); @@ -2626,20 +2627,34 @@ void tst_QImage::invertPixelsRGB() QCOMPARE(qBlue(pixel) >> 4, (255 - 96) >> 4); } +void tst_QImage::exifOrientation_data() +{ + QTest::addColumn("fileName"); + QTest::newRow("Orientation 1, Intel format") << m_prefix + "jpeg_exif_orientation_value_1.jpg"; + QTest::newRow("Orientation 2, Intel format") << m_prefix + "jpeg_exif_orientation_value_2.jpg"; + QTest::newRow("Orientation 3, Intel format") << m_prefix + "jpeg_exif_orientation_value_3.jpg"; + QTest::newRow("Orientation 4, Intel format") << m_prefix + "jpeg_exif_orientation_value_4.jpg"; + QTest::newRow("Orientation 5, Intel format") << m_prefix + "jpeg_exif_orientation_value_5.jpg"; + QTest::newRow("Orientation 6, Intel format") << m_prefix + "jpeg_exif_orientation_value_6.jpg"; + QTest::newRow("Orientation 6, Motorola format") << m_prefix + "jpeg_exif_orientation_value_6_motorola.jpg"; + QTest::newRow("Orientation 7, Intel format") << m_prefix + "jpeg_exif_orientation_value_7.jpg"; + QTest::newRow("Orientation 8, Intel format") << m_prefix + "jpeg_exif_orientation_value_8.jpg"; +} + void tst_QImage::exifOrientation() { - for (unsigned int i = 1; i <= 8; ++i) { - QImage img; - QRgb px; + QFETCH(QString, fileName); - QVERIFY(img.load(m_prefix + QString::fromLatin1("jpeg_exif_orientation_value_%1.jpg").arg(i))); + QImage img; + QRgb px; - px = img.pixel(0, 0); - QVERIFY(qRed(px) > 250 && qGreen(px) < 5 && qBlue(px) < 5); + QVERIFY(img.load(fileName)); - px = img.pixel(img.width() - 1, 0); - QVERIFY(qRed(px) < 5 && qGreen(px) < 5 && qBlue(px) > 250); - } + px = img.pixel(0, 0); + QVERIFY(qRed(px) > 250 && qGreen(px) < 5 && qBlue(px) < 5); + + px = img.pixel(img.width() - 1, 0); + QVERIFY(qRed(px) < 5 && qGreen(px) < 5 && qBlue(px) > 250); } static void cleanupFunction(void* info) -- cgit v1.2.3 From af327273622391d515958a292689c7d3df79abfc Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 19 Dec 2014 18:41:21 +0200 Subject: Android: Check XML output and optionally stop on fail. The failures will be printed in red color. Use -f param to stop on fail. Change-Id: Ife58f9264a9ac859d739842c6d1359acde807ce7 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/android/runtests_androiddeployqt.pl | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/auto/android/runtests_androiddeployqt.pl b/tests/auto/android/runtests_androiddeployqt.pl index fe67257b4b..8e9376da35 100755 --- a/tests/auto/android/runtests_androiddeployqt.pl +++ b/tests/auto/android/runtests_androiddeployqt.pl @@ -40,6 +40,8 @@ use File::Temp 'tempdir'; use File::Path 'remove_tree'; use Getopt::Long; use Pod::Usage; +use XML::Simple; +use Term::ANSIColor; ### default options my @stack = cwd; @@ -53,6 +55,7 @@ my $testsubset = ""; my $man = 0; my $help = 0; my $make_clean = 0; +my $stop_on_fail = 0; my $time_out=400; my $android_toolchain_version = "4.8"; my $host_arch = "linux-x86"; @@ -89,6 +92,7 @@ GetOptions('h|help' => \$help , 'strip=s' => \$strip_tool , 'readelf=s' => \$readelf_tool , 'testcase=s' => \$testcase + , 'f|fail' => sub { $stop_on_fail = 1 } , 'silent' => sub { $silent = 1 } , 'ci' => sub { $ci_use = 1 } , 'uninstall' => sub { $uninstall = 1 } @@ -311,6 +315,37 @@ if ($output =~ m/.*\[ro.build.version.sdk\]: \[(\d+)\]/) $sdk_api=9 if ($sdk_api>9); } +sub checkXMLOutput +{ + print color 'bold red'; + my $fileName = shift; + my $XMLOutput = eval { XMLin($fileName, ForceArray => 1) }; + if (!defined($XMLOutput)) { + print "Can't parse the $fileName file, probably the test crased.\n"; + print color 'reset'; + die "Stopping\n" if $stop_on_fail; + return; + } + my $testName = $XMLOutput->{name}; + my $fail = 0; + while (my($node_key, $node_valule) = each (%{$XMLOutput})) { + next if $node_key ne "TestFunction"; + while (my($function_key, $function_valule) = each (%{$node_valule})) { + while (my($test_key, $test_valule) = each (%{$function_valule})) { + next if $test_key ne "Incident"; + for my $incident (@{$test_valule}) { + if ($incident->{type} ne "pass") { + print "test $testName::$function_key failed $incident->{file}:$incident->{line}\n"; + $fail = 1; + } + } + } + } + } + print color 'reset'; + die "Stopping\n" if $stop_on_fail and $fail; +} + sub startTest { my $testName = shift; @@ -352,6 +387,7 @@ sub startTest sleep(3); system("$adb_tool $device_serial pull /data/data/$packageName/output.xml $output_dir/$output_file.xml") if ($get_xml); + system("$adb_tool $device_serial pull /data/data/$packageName/output.txt $output_dir/$output_file.txt") if ($get_txt); if ($get_txt){ print "Tesresults for $packageName:\n"; @@ -359,6 +395,8 @@ sub startTest print_output("$output_dir/$output_file.txt", $packageName, $insignificance); } system("$adb_tool $device_serial uninstall $packageName") if ($uninstall); + + checkXMLOutput("$output_dir/$output_file.xml") if ($get_xml); return 1; } @@ -439,6 +477,9 @@ runtests.pl [options] =head1 OPTIONS =over 8 +=item B<-f --fail> + +Stop the script when test fails. Default 0 =item B<-s --serial = serial> -- cgit v1.2.3 From 75f05781240671f3dcf3ae49a547e72e4282d2f0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 19 Dec 2014 15:01:38 +0100 Subject: Android: Fix QTranslator tests Bundle test data in qrc on Android. Extract it, as the tests expect to find it in the file system. Change-Id: I251eca3c23141a608b1cbac5ee0b7164c068f9b4 Reviewed-by: BogDan Vatra --- .../corelib/kernel/qtranslator/android_testdata.qrc | 7 +++++++ .../auto/corelib/kernel/qtranslator/qtranslator.pro | 4 +++- .../corelib/kernel/qtranslator/tst_qtranslator.cpp | 20 ++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 tests/auto/corelib/kernel/qtranslator/android_testdata.qrc diff --git a/tests/auto/corelib/kernel/qtranslator/android_testdata.qrc b/tests/auto/corelib/kernel/qtranslator/android_testdata.qrc new file mode 100644 index 0000000000..b33995ef21 --- /dev/null +++ b/tests/auto/corelib/kernel/qtranslator/android_testdata.qrc @@ -0,0 +1,7 @@ + + + hellotr_la.qm + msgfmt_from_po.qm + dependencies_la.qm + + diff --git a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro index 41c3dea924..e588f44370 100644 --- a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro +++ b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro @@ -4,4 +4,6 @@ QT = core testlib SOURCES = tst_qtranslator.cpp RESOURCES += qtranslator.qrc -TESTDATA += hellotr_la.qm msgfmt_from_po.qm +android:!android-no-sdk: RESOURCES += android_testdata.qrc +else: TESTDATA += hellotr_la.qm msgfmt_from_po.qm + diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp index 802d649496..077da6fce8 100644 --- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp @@ -68,6 +68,26 @@ tst_QTranslator::tst_QTranslator() void tst_QTranslator::initTestCase() { +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QString sourceDir(":/android_testdata/"); + QDirIterator it(sourceDir, QDirIterator::Subdirectories); + while (it.hasNext()) { + it.next(); + + QFileInfo sourceFileInfo = it.fileInfo(); + if (!sourceFileInfo.isDir()) { + QFileInfo destinationFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/') + sourceFileInfo.filePath().mid(sourceDir.length())); + + if (!destinationFileInfo.exists()) { + QVERIFY(QDir().mkpath(destinationFileInfo.path())); + QVERIFY(QFile::copy(sourceFileInfo.filePath(), destinationFileInfo.filePath())); + } + } + } + + QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); +#endif + // chdir into the directory containing our testdata, // to make the code simpler (load testdata via relative paths) QString testdata_dir = QFileInfo(QFINDTESTDATA("hellotr_la.qm")).absolutePath(); -- cgit v1.2.3 From 6a4704cc64648896e556bc385eba995b59fcd6ca Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 5 Jan 2015 10:25:27 +0100 Subject: Android: Fix QByteArray test Include test data in qrc so it can be found on Android. Change-Id: Iaca8422120f1ef842aafeb0cc209cb9fdd70f05f Reviewed-by: BogDan Vatra --- tests/auto/corelib/tools/qbytearray/android_testdata.qrc | 5 +++++ tests/auto/corelib/tools/qbytearray/qbytearray.pro | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 tests/auto/corelib/tools/qbytearray/android_testdata.qrc diff --git a/tests/auto/corelib/tools/qbytearray/android_testdata.qrc b/tests/auto/corelib/tools/qbytearray/android_testdata.qrc new file mode 100644 index 0000000000..5d42f0f627 --- /dev/null +++ b/tests/auto/corelib/tools/qbytearray/android_testdata.qrc @@ -0,0 +1,5 @@ + + + rfc3252.txt + + diff --git a/tests/auto/corelib/tools/qbytearray/qbytearray.pro b/tests/auto/corelib/tools/qbytearray/qbytearray.pro index 8d2efce0be..22104f817f 100644 --- a/tests/auto/corelib/tools/qbytearray/qbytearray.pro +++ b/tests/auto/corelib/tools/qbytearray/qbytearray.pro @@ -10,3 +10,8 @@ mac { OBJECTIVE_SOURCES += tst_qbytearray_mac.mm LIBS += -framework Foundation } + +android: !android-no-sdk { + RESOURCES += \ + android_testdata.qrc +} -- cgit v1.2.3 From 463835b3067594ff2ad3f10a3909ae1a1dec3d13 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 5 Jan 2015 10:46:36 +0100 Subject: Android: Fix QChar test Include test data in qrc when building on Android. Change-Id: Id80623324788dac21bd5ddbeef8108f54d6bc8f7 Reviewed-by: BogDan Vatra --- tests/auto/corelib/tools/qchar/qchar.pro | 5 +++++ tests/auto/corelib/tools/qchar/testdata.qrc | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 tests/auto/corelib/tools/qchar/testdata.qrc diff --git a/tests/auto/corelib/tools/qchar/qchar.pro b/tests/auto/corelib/tools/qchar/qchar.pro index 0738abad3a..a72f16fa49 100644 --- a/tests/auto/corelib/tools/qchar/qchar.pro +++ b/tests/auto/corelib/tools/qchar/qchar.pro @@ -5,3 +5,8 @@ SOURCES = tst_qchar.cpp TESTDATA += data/NormalizationTest.txt DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/corelib/tools/qchar/testdata.qrc b/tests/auto/corelib/tools/qchar/testdata.qrc new file mode 100644 index 0000000000..7b3fb2461c --- /dev/null +++ b/tests/auto/corelib/tools/qchar/testdata.qrc @@ -0,0 +1,5 @@ + + + data/NormalizationTest.txt + + -- cgit v1.2.3 From 4613e1d2c13025beadf0fd3acaa0a05842307b36 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 5 Jan 2015 11:03:46 +0100 Subject: Android: Fix QCollator test On Android the POSIX implementation of QCollator is used, and this does not support setting other locales than the default. Change-Id: I25d23949341fc555e8be4f6836ae68cc8813cc46 Reviewed-by: BogDan Vatra --- tests/auto/corelib/tools/qcollator/tst_qcollator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp index f55e2eac42..96c7064d23 100644 --- a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp +++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp @@ -170,6 +170,11 @@ void tst_QCollator::compare() QCollator collator(locale); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + if (collator.locale() != QLocale()) + QSKIP("Posix implementation of collation only supports default locale"); +#endif + if (numericMode) collator.setNumericMode(true); -- cgit v1.2.3 From 8057ce61d0b2015d47985db50b959ef0a8a2e2c0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 5 Jan 2015 12:02:29 +0100 Subject: Android: Fix QCommandLineParser test Skip the tests that require building and deploying an external command line application, since that's not how we do things on Android, and it's really not very relevant for that platform. Change-Id: I2c1985687e25fb0cf124b1d57c8ba60e37d2ff96 Reviewed-by: BogDan Vatra --- .../corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index 7062d4cad9..ff9b63703c 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -472,6 +472,10 @@ void tst_QCommandLineParser::testVersionOption() #ifdef Q_OS_WINCE QSKIP("Reading and writing to a process is not supported on Qt/CE"); #endif +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Deploying executable applications to file system on Android not supported."); +#endif + QCoreApplication app(empty_argc, empty_argv); QProcess process; process.start("testhelper/qcommandlineparser_test_helper", QStringList() << "0" << "--version"); @@ -537,6 +541,9 @@ void tst_QCommandLineParser::testHelpOption() #ifdef Q_OS_WINCE QSKIP("Reading and writing to a process is not supported on Qt/CE"); #endif +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Deploying executable applications to file system on Android not supported."); +#endif QFETCH(QCommandLineParser::SingleDashWordOptionMode, parsingMode); QFETCH(QString, expectedHelpOutput); @@ -581,6 +588,8 @@ void tst_QCommandLineParser::testQuoteEscaping() { #ifdef QT_NO_PROCESS QSKIP("This test requires QProcess support"); +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Deploying executable applications to file system on Android not supported."); #else QCoreApplication app(empty_argc, empty_argv); QProcess process; -- cgit v1.2.3 From ce40b8b7ef1c7b3c8355233825265f2d49dc4ddd Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 5 Jan 2015 12:15:24 +0100 Subject: Android: Fix QCryptographicHash test Include test data in qrc when building on Android. Change-Id: I611ca24fe8764eb709b6ce27e814840ea919d4f1 Reviewed-by: BogDan Vatra --- tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro | 5 +++++ tests/auto/corelib/tools/qcryptographichash/testdata.qrc | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 tests/auto/corelib/tools/qcryptographichash/testdata.qrc diff --git a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro index f7725ab188..941a068f8e 100644 --- a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro +++ b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro @@ -5,3 +5,8 @@ SOURCES = tst_qcryptographichash.cpp TESTDATA += data/* DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/corelib/tools/qcryptographichash/testdata.qrc b/tests/auto/corelib/tools/qcryptographichash/testdata.qrc new file mode 100644 index 0000000000..8f7bcea63c --- /dev/null +++ b/tests/auto/corelib/tools/qcryptographichash/testdata.qrc @@ -0,0 +1,6 @@ + + + data/2c1517dad3678f03917f15849b052fd5.md5 + data/d41d8cd98f00b204e9800998ecf8427e.md5 + + -- cgit v1.2.3 From f2c247921db9b65ed07c69c57ded07f46292509f Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 6 Jan 2015 09:46:38 +0100 Subject: windeployqt: add clean step to toplevel makefile Currently you could only invoke windeployqt for debug and release builds, but not windeployqt_clean resulting in artifacts after the clean step. Change-Id: I3a93e4909a017f3594cc5b0c2249ed25b777c008 Reviewed-by: Oliver Wolff Reviewed-by: Andrew Knight --- mkspecs/features/win32/windeployqt.prf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/win32/windeployqt.prf b/mkspecs/features/win32/windeployqt.prf index 22253f6299..fb5b2c4234 100644 --- a/mkspecs/features/win32/windeployqt.prf +++ b/mkspecs/features/win32/windeployqt.prf @@ -15,5 +15,6 @@ build_pass { QMAKE_DISTCLEAN += $$WINDEPLOYQT_OUTPUT } else { windeployqt.CONFIG += recursive + windeployqt_clean.CONFIG += recursive } -QMAKE_EXTRA_TARGETS += windeployqt +QMAKE_EXTRA_TARGETS += windeployqt windeployqt_clean -- cgit v1.2.3 From f3e9f11265bc6715d4d1c6e2d734fad923b10d05 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Jan 2015 17:45:09 -0200 Subject: Fix change-of-sign warnings with ICC qlocale_p.h(427): error #68: integer conversion resulted in a change of sign We hadn't enabled Q_COMPILER_CONSTEXPR for ICC. Change-Id: Ie7e3070b9f8f2cf512d2745001312865e698596b Reviewed-by: Olivier Goffart Reviewed-by: Marc Mutz --- src/corelib/tools/qlocale_p.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index c5e62027c4..4e3022478a 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -418,9 +418,9 @@ Q_STATIC_ASSERT(!ascii_isspace('\0')); Q_STATIC_ASSERT(!ascii_isspace('\a')); Q_STATIC_ASSERT(!ascii_isspace('a')); Q_STATIC_ASSERT(!ascii_isspace('\177')); -Q_STATIC_ASSERT(!ascii_isspace('\200')); -Q_STATIC_ASSERT(!ascii_isspace('\xA0')); -Q_STATIC_ASSERT(!ascii_isspace('\377')); +Q_STATIC_ASSERT(!ascii_isspace(uchar('\200'))); +Q_STATIC_ASSERT(!ascii_isspace(uchar('\xA0'))); +Q_STATIC_ASSERT(!ascii_isspace(uchar('\377'))); #endif QT_END_NAMESPACE -- cgit v1.2.3 From 01fc82e3574614762d2ce061dd45ce4995c79e7f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Jan 2015 17:45:30 -0200 Subject: Re-enable constexpr for ICC 15 The bug noted in d88e4edcd548e5bb024e75016c5a3449d103bd8d appears to be resolved. Change-Id: Id20906ff83f74bd16267d44bf447626b81187e71 Reviewed-by: Olivier Goffart Reviewed-by: Marc Mutz --- src/corelib/global/qcompilerdetection.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 5f8ca5c7cc..36ba57a0ff 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -553,6 +553,7 @@ # define Q_COMPILER_UNRESTRICTED_UNIONS # endif # if __INTEL_COMPILER >= 1500 +# define Q_COMPILER_CONSTEXPR # define Q_COMPILER_ALIGNAS # define Q_COMPILER_ALIGNOF # define Q_COMPILER_INHERITING_CONSTRUCTORS -- cgit v1.2.3 From aa83bacb14dac06eb7226c8c688f37eeecec15d4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Jan 2015 19:56:06 -0200 Subject: Autotest: fix a race condition in verifying a peer D-Bus connected On the unit test side, everything is sequential: we first ask for the connection, verify that it is connected, then ask the remote side via the session bus if it is connected. Unfortunately, the remote site may handle things in a different order: it may handle the incoming function call to "isConnected" before doing accept(2) on the listening socket. So, instead, make the local side block until the connection is received on the other side. On the remote, we don't block, instead we use the feature of delayed replies. Change-Id: Ie386938b8b39dd94a9d7e5913668125fb4a3c7da Reviewed-by: Alex Blasche --- .../dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp | 18 ++++++++++++++++-- .../qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp | 5 ++--- .../dbus/qdbusabstractinterface/qpinger/qpinger.cpp | 17 +++++++++++++++-- .../tst_qdbusabstractinterface.cpp | 5 ++--- tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp | 17 +++++++++++++++-- tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp | 4 ++-- 6 files changed, 52 insertions(+), 14 deletions(-) diff --git a/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp index 76e9332d98..2f39857d2d 100644 --- a/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp +++ b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp @@ -72,9 +72,17 @@ public slots: return QDBusServer::address(); } - bool isConnected() const + void waitForConnected() { - return m_conn.isConnected(); + if (callPendingReply.type() != QDBusMessage::InvalidMessage) { + sendErrorReply(QDBusError::NotSupported, "One call already pending!"); + return; + } + if (m_conn.isConnected()) + return; + // not connected, we'll reply later + setDelayedReply(true); + callPendingReply = message(); } Q_NOREPLY void requestSync(const QString &seq) @@ -146,10 +154,16 @@ private slots: { m_conn = con; con.registerObject(objectPath, this, QDBusConnection::ExportScriptableSignals); + + if (callPendingReply.type() != QDBusMessage::InvalidMessage) { + QDBusConnection::sessionBus().send(callPendingReply.createReply()); + callPendingReply = QDBusMessage(); + } } private: QDBusConnection m_conn; + QDBusMessage callPendingReply; MyObject* obj; }; diff --git a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp index 4c6f3c5eee..b7ecdef16e 100644 --- a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp +++ b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp @@ -514,10 +514,9 @@ void tst_QDBusAbstractAdaptor::initTestCase() QDBusConnection peercon = QDBusConnection::connectToPeer(address, "peer"); QVERIFY(peercon.isConnected()); - QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "isConnected"); + QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "waitForConnected"); QDBusMessage rpl2 = QDBusConnection::sessionBus().call(req2); - QVERIFY(rpl2.type() == QDBusMessage::ReplyMessage); - QVERIFY(rpl2.arguments().at(0).toBool()); + QVERIFY2(rpl2.type() == QDBusMessage::ReplyMessage, rpl2.errorMessage().toLatin1()); } void tst_QDBusAbstractAdaptor::cleanupTestCase() diff --git a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp index 900faeb68e..e681d06102 100644 --- a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp +++ b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp @@ -59,9 +59,17 @@ public slots: return QDBusServer::address(); } - bool isConnected() const + void waitForConnected() { - return m_conn.isConnected(); + if (callPendingReply.type() != QDBusMessage::InvalidMessage) { + sendErrorReply(QDBusError::NotSupported, "One call already pending!"); + return; + } + if (m_conn.isConnected()) + return; + // not connected, we'll reply later + setDelayedReply(true); + callPendingReply = message(); } void reset() @@ -97,11 +105,16 @@ private slots: { m_conn = con; m_conn.registerObject("/", &targetObj, QDBusConnection::ExportScriptableContents); + if (callPendingReply.type() != QDBusMessage::InvalidMessage) { + QDBusConnection::sessionBus().send(callPendingReply.createReply()); + callPendingReply = QDBusMessage(); + } } private: Interface targetObj; QDBusConnection m_conn; + QDBusMessage callPendingReply; }; int main(int argc, char *argv[]) diff --git a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index 0a8da46046..0b33f9b1cf 100644 --- a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -268,10 +268,9 @@ void tst_QDBusAbstractInterface::init() QDBusConnection peercon = QDBusConnection::connectToPeer(peerAddress, "peer"); QVERIFY(peercon.isConnected()); - QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "isConnected"); + QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "waitForConnected"); QDBusMessage rpl2 = con.call(req2); - QVERIFY(rpl2.type() == QDBusMessage::ReplyMessage); - QVERIFY(rpl2.arguments().at(0).toBool()); + QVERIFY2(rpl2.type() == QDBusMessage::ReplyMessage, rpl2.errorMessage().toLatin1()); } void tst_QDBusAbstractInterface::cleanup() diff --git a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp index d3cfaa74b3..8da9068541 100644 --- a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp +++ b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp @@ -63,9 +63,17 @@ public slots: return QDBusServer::address(); } - bool isConnected() const + void waitForConnected() { - return m_conn.isConnected(); + if (callPendingReply.type() != QDBusMessage::InvalidMessage) { + sendErrorReply(QDBusError::NotSupported, "One call already pending!"); + return; + } + if (m_conn.isConnected()) + return; + // not connected, we'll reply later + setDelayedReply(true); + callPendingReply = message(); } void emitSignal(const QString &interface, const QString &name, const QString &arg) @@ -123,10 +131,15 @@ private slots: m_conn.registerObject("/", &obj, QDBusConnection::ExportAllProperties | QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllInvokables); + if (callPendingReply.type() != QDBusMessage::InvalidMessage) { + QDBusConnection::sessionBus().send(callPendingReply.createReply()); + callPendingReply = QDBusMessage(); + } } private: QDBusConnection m_conn; + QDBusMessage callPendingReply; MyObject obj; }; diff --git a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp index 92a44292c3..fce5868980 100644 --- a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp +++ b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp @@ -290,10 +290,10 @@ void tst_QDBusInterface::initTestCase() QDBusConnection peercon = QDBusConnection::connectToPeer(address, "peer"); QVERIFY(peercon.isConnected()); - QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "isConnected"); + QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "waitForConnected"); QDBusMessage rpl2 = con.call(req2); QVERIFY(rpl2.type() == QDBusMessage::ReplyMessage); - QVERIFY(rpl2.arguments().at(0).toBool()); + QVERIFY2(rpl2.type() == QDBusMessage::ReplyMessage, rpl2.errorMessage().toLatin1()); } void tst_QDBusInterface::cleanupTestCase() -- cgit v1.2.3 From 624ee454ec58074c1156b8a82f48ba83279c44fa Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 11 Dec 2014 13:58:52 -0800 Subject: Make QDBusConnection and QDBusServer return an error on default objects The error of "Not connected". This incidentally solves a crash when QDBusServer().lastError() is called but libdbus-1 couldn't be found. Change-Id: Id93f447d00c0aa6660d4528c4bbce5998d9186a8 Reviewed-by: Alex Blasche --- src/dbus/qdbusconnection.cpp | 2 +- src/dbus/qdbusserver.cpp | 2 +- tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 1a56f53a63..a46df16ac5 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -959,7 +959,7 @@ bool QDBusConnection::isConnected() const */ QDBusError QDBusConnection::lastError() const { - return d ? d->lastError : QDBusError(); + return d ? d->lastError : QDBusError(QDBusError::Disconnected, QStringLiteral("Not connected.")); } /*! diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp index 54b38ee848..b2c76a8750 100644 --- a/src/dbus/qdbusserver.cpp +++ b/src/dbus/qdbusserver.cpp @@ -129,7 +129,7 @@ bool QDBusServer::isConnected() const */ QDBusError QDBusServer::lastError() const { - return d->lastError; + return d ? d->lastError : QDBusError(QDBusError::Disconnected, QStringLiteral("Not connected.")); } /*! diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp index 7e6e742e28..df6fb9e9bc 100644 --- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp +++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp @@ -246,7 +246,7 @@ void tst_QDBusConnection::connectToBus() QDBusConnection con2("foo"); QVERIFY(!con2.isConnected()); - QVERIFY(!con2.lastError().isValid()); + QVERIFY(con2.lastError().isValid()); con2 = con; QVERIFY(con.isConnected()); @@ -274,7 +274,7 @@ void tst_QDBusConnection::connectToBus() { QDBusConnection con("bubu"); QVERIFY(!con.isConnected()); - QVERIFY(!con.lastError().isValid()); + QVERIFY(con.lastError().isValid()); } QByteArray address = qgetenv("DBUS_SESSION_BUS_ADDRESS"); @@ -314,7 +314,7 @@ void tst_QDBusConnection::connectToPeer() QDBusConnection con2("foo"); QVERIFY(!con2.isConnected()); - QVERIFY(!con2.lastError().isValid()); + QVERIFY(con2.lastError().isValid()); con2 = con; QVERIFY(con.isConnected()); @@ -342,7 +342,7 @@ void tst_QDBusConnection::connectToPeer() { QDBusConnection con("bubu"); QVERIFY(!con.isConnected()); - QVERIFY(!con.lastError().isValid()); + QVERIFY(con.lastError().isValid()); } } -- cgit v1.2.3 From 2bdcea9d31d07c32e085a5194873c735e519855d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 12 Dec 2014 15:20:58 +0100 Subject: iOS: Remove QIOSKeyboardListener self-change assert/guard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We're fairly confident self won't change in that case, and the assert was causing warnings in release builds. Change-Id: I4a826579bb4cedef8423e8d43cb370e1f3b80407 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosinputcontext.mm | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index 76c02d939f..bbfc03667e 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -75,9 +75,7 @@ static QUIView *focusView() - (id)initWithQIOSInputContext:(QIOSInputContext *)context { - id originalSelf = self; if (self = [super initWithTarget:self action:@selector(gestureStateChanged:)]) { - Q_ASSERT(self == originalSelf); m_context = context; -- cgit v1.2.3 From 9d9b785259103ebed616bd59a3b3f2fd6cb95019 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Dec 2014 15:59:23 -0800 Subject: Give ICC-as-Clang a Q_CC_CLANG version number too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Give it version number 3.5 for current compatibility. Change-Id: Ia023d29b3b3946f8642a0550279ae63cbb803fc5 Reviewed-by: Tor Arne Vestbø --- src/corelib/global/qcompilerdetection.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 36ba57a0ff..3f813e163b 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -145,6 +145,10 @@ # if defined(__INTEL_COMPILER) /* Intel C++ also masquerades as GCC */ # define Q_CC_INTEL (__INTEL_COMPILER) +# ifdef __clang__ +/* Intel C++ masquerades as Clang masquerading as GCC */ +# define Q_CC_CLANG 305 +# endif # define Q_ASSUME_IMPL(expr) __assume(expr) # define Q_UNREACHABLE_IMPL() __builtin_unreachable() # if __INTEL_COMPILER >= 1300 && !defined(__APPLE__) -- cgit v1.2.3 From acf80b9a2b913e898ed4c4ed14d4ea79401484fe Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 19 Dec 2014 12:04:03 -0800 Subject: Fix build error with Intel Compiler 15 on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the constructor is inline, the generated code needs access to the vtable, which gets emitted with the first virtual function (in QtGui), but somehow icl.exe can't find it in debug. Looking at the .obj files it generates and comparing to MSVC, it seems that: - both generate and export the inline constructor from Qt5Guid.dll - MSVC will call that constructor from qoffscreenintegration.obj - icl.exe will inline the constructor and requires a symbol not exported from Qt5Guid.dll I can't explain why (probably a compiler bug). Change-Id: I0ab9c078ae4fc794826025d68d364124c7247e80 Reviewed-by: Jørgen Lind --- src/gui/kernel/qplatformservices.cpp | 3 +++ src/gui/kernel/qplatformservices.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/gui/kernel/qplatformservices.cpp b/src/gui/kernel/qplatformservices.cpp index e11a1858f6..2188920c86 100644 --- a/src/gui/kernel/qplatformservices.cpp +++ b/src/gui/kernel/qplatformservices.cpp @@ -49,6 +49,9 @@ QT_BEGIN_NAMESPACE \brief The QPlatformServices provides the backend for desktop-related functionality. */ +QPlatformServices::QPlatformServices() +{ } + bool QPlatformServices::openUrl(const QUrl &url) { qWarning("This plugin does not support QPlatformServices::openUrl() for '%s'.", diff --git a/src/gui/kernel/qplatformservices.h b/src/gui/kernel/qplatformservices.h index 00a87d51f5..005748d18c 100644 --- a/src/gui/kernel/qplatformservices.h +++ b/src/gui/kernel/qplatformservices.h @@ -52,6 +52,7 @@ class QUrl; class Q_GUI_EXPORT QPlatformServices { public: + QPlatformServices(); virtual ~QPlatformServices() { } virtual bool openUrl(const QUrl &url); -- cgit v1.2.3 From a457bf3ff73627aa2c95f0482a838b14fd3233a0 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sat, 3 Jan 2015 19:06:38 +0200 Subject: Doc: Fixed date format doc bug in QDateTime/Qt namespace MM stands for month, SS is invalid mostly cherry picked from Qt4 commit 670f460fab6a386407c07281cf6417ccf6430970. Task-number: QTBUG-12236 Change-Id: I7af4be655d2d10f1befa1366abb48225c60d31dc Reviewed-by: Thiago Macieira --- src/corelib/global/qnamespace.qdoc | 2 +- src/corelib/tools/qdatetime.cpp | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 04055a3308..9e9a357272 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -592,7 +592,7 @@ string, "ddd MMM d yyyy". See QDate::toString() for more information. \value ISODate \l{ISO 8601} extended format: either \c{YYYY-MM-DD} for dates or - \c{YYYY-MM-DDTHH:MM:SS}, \c{YYYY-MM-DDTHH:MM:SSTZD} (e.g., 1997-07-16T19:20:30+01:00) + \c{YYYY-MM-DDTHH:mm:ss}, \c{YYYY-MM-DDTHH:mm:ssTZD} (e.g., 1997-07-16T19:20:30+01:00) for combined dates and times. \value SystemLocaleShortDate The \l{QLocale::ShortFormat}{short format} used diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 021eb5ae5d..d52dea8d4f 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -182,7 +182,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc int minOffset = 0; bool positiveOffset = false; - // Matches "Wdy, DD Mon YYYY HH:MM:SS ±hhmm" (Wdy, being optional) + // Matches "Wdy, DD Mon YYYY HH:mm:ss ±hhmm" (Wdy, being optional) QRegExp rex(QStringLiteral("^(?:[A-Z][a-z]+,)?[ \\t]*(\\d{1,2})[ \\t]+([A-Z][a-z]+)[ \\t]+(\\d\\d\\d\\d)(?:[ \\t]+(\\d\\d):(\\d\\d)(?::(\\d\\d))?)?[ \\t]*(?:([+-])(\\d\\d)(\\d\\d))?")); if (s.indexOf(rex) == 0) { if (dd) { @@ -203,7 +203,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc if (utcOffset) *utcOffset = ((hourOffset * 60 + minOffset) * (positiveOffset ? 60 : -60)); } else { - // Matches "Wdy Mon DD HH:MM:SS YYYY" + // Matches "Wdy Mon DD HH:mm:ss YYYY" QRegExp rex(QStringLiteral("^[A-Z][a-z]+[ \\t]+([A-Z][a-z]+)[ \\t]+(\\d\\d)(?:[ \\t]+(\\d\\d):(\\d\\d):(\\d\\d))?[ \\t]+(\\d\\d\\d\\d)[ \\t]*(?:([+-])(\\d\\d)(\\d\\d))?")); if (s.indexOf(rex) == 0) { if (dd) { @@ -233,7 +233,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc } #endif // QT_NO_DATESTRING -// Return offset in [+-]HH:MM format +// Return offset in [+-]HH:mm format // Qt::ISODate puts : between the hours and minutes, but Qt:TextDate does not static QString toOffsetString(Qt::DateFormat format, int offset) { @@ -248,7 +248,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset) .arg((qAbs(offset) / 60) % 60, 2, 10, QLatin1Char('0')); } -// Parse offset in [+-]HH[[:]MM] format +// Parse offset in [+-]HH[[:]mm] format static int fromOffsetString(const QString &offsetString, bool *valid) { *valid = false; @@ -272,7 +272,7 @@ static int fromOffsetString(const QString &offsetString, bool *valid) // Split the hour and minute parts QStringList parts = offsetString.mid(1).split(QLatin1Char(':')); if (parts.count() == 1) { - // [+-]HHMM or [+-]HH format + // [+-]HHmm or [+-]HH format parts.append(parts.at(0).mid(2)); parts[0] = parts.at(0).left(2); } @@ -1598,12 +1598,12 @@ int QTime::msec() const Returns the time as a string. The \a format parameter determines the format of the string. - If \a format is Qt::TextDate, the string format is HH:MM:SS; + If \a format is Qt::TextDate, the string format is HH:mm:ss; e.g. 1 second before midnight would be "23:59:59". If \a format is Qt::ISODate, the string format corresponds to the ISO 8601 extended specification for representations of dates, - which is also HH:MM:SS. + which is also HH:mm:ss. If the \a format is Qt::SystemLocaleShortDate or Qt::SystemLocaleLongDate, the string format depends on the locale @@ -1925,13 +1925,13 @@ static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format, int msec = 0; if (size == 5) { - // HH:MM format + // HH:mm format second = 0; msec = 0; } else if (string.at(5) == QLatin1Char(',') || string.at(5) == QLatin1Char('.')) { if (format == Qt::TextDate) return QTime(); - // ISODate HH:MM.SSSSSS format + // ISODate HH:mm.ssssss format // We only want 5 digits worth of fraction of minute. This follows the existing // behavior that determines how milliseconds are read; 4 millisecond digits are // read and then rounded to 3. If we read at most 5 digits for fraction of minute, @@ -1951,7 +1951,7 @@ static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format, second = secondNoMs; msec = qMin(qRound(secondFraction * 1000.0), 999); } else { - // HH:MM:SS or HH:MM:SS.sssss + // HH:mm:ss or HH:mm:ss.zzz second = string.mid(6, 2).toInt(&ok); if (!ok) return QTime(); @@ -3535,7 +3535,7 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC) If the \a format is Qt::ISODate, the string format corresponds to the ISO 8601 extended specification for representations of - dates and times, taking the form YYYY-MM-DDTHH:MM:SS[Z|[+|-]HH:MM], + dates and times, taking the form YYYY-MM-DDTHH:mm:ss[Z|[+|-]HH:mm], depending on the timeSpec() of the QDateTime. If the timeSpec() is Qt::UTC, Z will be appended to the string; if the timeSpec() is Qt::OffsetFromUTC, the offset in hours and minutes from UTC will @@ -4421,7 +4421,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) isoString = isoString.right(isoString.length() - 11); int offset = 0; - // Check end of string for Time Zone definition, either Z for UTC or [+-]HH:MM for Offset + // Check end of string for Time Zone definition, either Z for UTC or [+-]HH:mm for Offset if (isoString.endsWith(QLatin1Char('Z'))) { spec = Qt::UTC; isoString = isoString.left(isoString.size() - 1); -- cgit v1.2.3 From 182bb7c3d0afdcc4c49958bb1bef3760680cdc5d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 9 Dec 2014 14:42:50 +0100 Subject: Fix build on Linux when dbus headers cannot be found When CFG_DBUS != "no", we enable the build of linuxaccessibility in src/platformsupport, which requires QT += dbus to work. When no dbus headers are found, CFG_DBUS is set to runtime, which means we'll enable a11y but "dbus" will not end up in qconfig.pri and therefore src/dbus is not built at all (and not before platformsupport). Therefore the build in platformsupport breaks. So even if CFG_DBUS is set to "runtime" we need to make sure that dbus appears in qconfig.pri. Task-number: QTBUG-43205 Change-Id: Ibbe5e66552226cdcc1ce16fb83556406f3bb0e09 Reviewed-by: Thiago Macieira --- configure | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/configure b/configure index acbfb17c64..a461541e36 100755 --- a/configure +++ b/configure @@ -1871,10 +1871,8 @@ while [ "$#" -gt 0 ]; do fi ;; dbus) - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ]; then + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ] || [ "$VAL" = "runtime" ]; then CFG_DBUS="$VAL" - elif [ "$VAL" = "runtime" ]; then - CFG_DBUS="yes" else UNKNOWN_OPT=yes fi @@ -5780,8 +5778,8 @@ fi [ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv" [ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv" [ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib" -[ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus" -[ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked" +[ "$CFG_DBUS" != "no" ] && QT_CONFIG="$QT_CONFIG dbus" +[ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus-linked" [ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl" [ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked" [ "$CFG_XCB" != "no" ] && QT_CONFIG="$QT_CONFIG xcb" @@ -6559,7 +6557,7 @@ fi # Qt modules echo echo "Qt modules and options:" -report_support " Qt D-Bus ..............." "$CFG_DBUS" yes "loading dbus-1 at runtime" linked "linked to dbus-1" +report_support " Qt D-Bus ..............." "$CFG_DBUS" runtime "loading dbus-1 at runtime" linked "linked to dbus-1" report_support " Qt Concurrent .........." "$CFG_CONCURRENT" report_support " Qt GUI ................." "$CFG_GUI" report_support " Qt Widgets ............." "$CFG_WIDGETS" -- cgit v1.2.3 From 12d32b017d9ff31332933eae28a3f7b46b9d3e49 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 9 Dec 2014 15:03:04 -0800 Subject: Complete the work for the runtime libdbus-1 support Commit a2da88712f1e057747f68a28361b300faac5e605 was incomplete. Though it did enable building of QtDBus without the libdbus-1 headers, but it still kept looking for it. We don't need to do it anymore if CFG_DBUS is the default (runtime), so skip the actual check. This commit does not change behavior. All it does is skip the D-Bus tests if we're about to use dlopen'ed libdbus-1. Change-Id: I3947443c9ef6cc409cb6b154564f8af6fb5de84e Reviewed-by: Simon Hausmann --- configure | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/configure b/configure index a461541e36..31a59fc802 100755 --- a/configure +++ b/configure @@ -658,7 +658,7 @@ CFG_TSLIB=no CFG_NIS=auto CFG_CUPS=auto CFG_ICONV=auto -CFG_DBUS=auto +CFG_DBUS=runtime CFG_GLIB=auto CFG_QGTKSTYLE=auto CFG_LARGEFILE=auto @@ -1871,8 +1871,10 @@ while [ "$#" -gt 0 ]; do fi ;; dbus) - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ] || [ "$VAL" = "runtime" ]; then + if [ "$VAL" = "no" ] || [ "$VAL" = "linked" ] || [ "$VAL" = "runtime" ]; then CFG_DBUS="$VAL" + elif [ "$VAL" = "yes" ]; then + CFG_DBUS="runtime" else UNKNOWN_OPT=yes fi @@ -4630,7 +4632,7 @@ if [ "$CFG_ICONV" != "no" ]; then fi # auto-detect libdbus-1 support -if [ "$CFG_DBUS" != "no" ]; then +if [ "$CFG_DBUS" = "linked" ]; then if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null` QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null` @@ -4638,7 +4640,6 @@ if [ "$CFG_DBUS" != "no" ]; then QT_LIBS_DBUS="-ldbus-1" fi if compileTest unix/dbus "D-Bus" $QT_CFLAGS_DBUS $QT_LIBS_DBUS; then - [ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS" QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS" # Try find correct host configuration for dbus tools when cross-compiling @@ -4648,11 +4649,7 @@ if [ "$CFG_DBUS" != "no" ]; then fi QMakeVar set QT_HOST_CFLAGS_DBUS "$QT_CFLAGS_DBUS" else - if [ "$CFG_DBUS" != "linked" ]; then - CFG_DBUS=runtime - elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then - # CFG_DBUS is "yes" or "linked" here - + if [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "The Qt D-Bus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found." echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" -- cgit v1.2.3 From 1fc4053337b55c98b66de63b4fae223f1eb72563 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 11 Dec 2014 17:37:42 -0800 Subject: Allow the QtDBus type benchmark to run without libdbus-1 found Change-Id: I1086e6cd6534dc96311e981cc9c73f501c1128ac Reviewed-by: Friedemann Kleint Reviewed-by: Frederik Gladhorn --- tests/benchmarks/dbus/qdbustype/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/benchmarks/dbus/qdbustype/main.cpp b/tests/benchmarks/dbus/qdbustype/main.cpp index b405df99d5..4723ed1b97 100644 --- a/tests/benchmarks/dbus/qdbustype/main.cpp +++ b/tests/benchmarks/dbus/qdbustype/main.cpp @@ -48,7 +48,8 @@ private Q_SLOTS: static inline void benchmarkAddRow(const char *name, const char *data) { - QTest::newRow(QByteArray(QByteArray("native-") + name)) << data << true; + if (qdbus_loadLibDBus()) + QTest::newRow(QByteArray(QByteArray("native-") + name)) << data << true; QTest::newRow(name) << data << false; } -- cgit v1.2.3 From cf4b413fa4a81dbfaaaf50cb52f92ecc0d3c3f2a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 9 Dec 2014 14:16:33 -0800 Subject: Make QtDBus unit tests compile with runtime dbus-1 too There's a change in Qt 5.4.0 that makes Qt compile with its own set of D-Bus headers, which means QT_CFLAGS_DBUS may be empty. Thus, we can't compile or link if we're using the actual libdbus-1 API to build the test. This commit makes these unit tests use the same dynamic loading mechanism. Change-Id: I56b2a7320086ef88793f6552cb54ca6224010451 Reviewed-by: Simon Hausmann --- src/dbus/qdbus_symbols_p.h | 3 + tests/auto/dbus/qdbusmarshall/test/test.pro | 9 ++- .../auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp | 76 +++++++++++++--------- tests/auto/dbus/qdbustype/qdbustype.pro | 9 ++- tests/auto/dbus/qdbustype/tst_qdbustype.cpp | 26 +++++--- tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp | 4 +- tests/benchmarks/dbus/qdbustype/main.cpp | 9 ++- tests/benchmarks/dbus/qdbustype/qdbustype.pro | 11 +++- 8 files changed, 96 insertions(+), 51 deletions(-) diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h index 88c51947ed..0785fea4b4 100644 --- a/src/dbus/qdbus_symbols_p.h +++ b/src/dbus/qdbus_symbols_p.h @@ -107,6 +107,9 @@ DEFINEFUNC(dbus_bool_t , dbus_connection_add_filter, (DBusConnection void *user_data, DBusFreeFunction free_data_function), (connection, function, user_data, free_data_function), return) +DEFINEFUNC(dbus_bool_t , dbus_connection_can_send_type, (DBusConnection *connection, + int type), + (connection, type), return) DEFINEFUNC(void , dbus_connection_close, (DBusConnection *connection), (connection), return) DEFINEFUNC(DBusDispatchStatus , dbus_connection_dispatch, (DBusConnection *connection), diff --git a/tests/auto/dbus/qdbusmarshall/test/test.pro b/tests/auto/dbus/qdbusmarshall/test/test.pro index 658cc52fde..4999080453 100644 --- a/tests/auto/dbus/qdbusmarshall/test/test.pro +++ b/tests/auto/dbus/qdbusmarshall/test/test.pro @@ -5,8 +5,13 @@ DESTDIR = ./ QT = core-private dbus-private testlib -LIBS += $$QT_LIBS_DBUS -QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS +contains(QT_CONFIG, dbus-linked) { + DEFINES += QT_LINKED_LIBDBUS + LIBS += $$QT_LIBS_DBUS + QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS +} else { + SOURCES += ../../../../../src/dbus/qdbus_symbols.cpp +} DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp index 0e8ac9b0f3..6507b34c97 100644 --- a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp +++ b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp @@ -37,7 +37,8 @@ #include "common.h" #include -#include +#include +#include #define QT_LINKED_LIBDBUS #include @@ -1033,23 +1034,31 @@ struct DisconnectRawDBus { { if (!connection) return; - dbus_connection_close(connection); - dbus_connection_unref(connection); + q_dbus_connection_close(connection); + q_dbus_connection_unref(connection); + } +}; +struct UnrefDBusMessage +{ + static void cleanup(DBusMessage *type) + { + if (!type) return; + q_dbus_message_unref(type); } }; -template struct GenericUnref +struct UnrefDBusPendingCall { - static void cleanup(T *type) + static void cleanup(DBusPendingCall *type) { if (!type) return; - unref(type); + q_dbus_pending_call_unref(type); } }; // use these scoped types to avoid memory leaks if QVERIFY or QCOMPARE fails typedef QScopedPointer ScopedDBusConnection; -typedef QScopedPointer > ScopedDBusMessage; -typedef QScopedPointer > ScopedDBusPendingCall; +typedef QScopedPointer ScopedDBusMessage; +typedef QScopedPointer ScopedDBusPendingCall; template struct SetResetValue { @@ -1074,12 +1083,12 @@ void tst_QDBusMarshall::receiveUnknownType() // this needs to be implemented in raw // open a new connection to the bus daemon DBusError error; - dbus_error_init(&error); - ScopedDBusConnection rawcon(dbus_bus_get_private(DBUS_BUS_SESSION, &error)); + q_dbus_error_init(&error); + ScopedDBusConnection rawcon(q_dbus_bus_get_private(DBUS_BUS_SESSION, &error)); QVERIFY2(rawcon.data(), error.name); // check if this bus supports passing file descriptors - if (!dbus_connection_can_send_type(rawcon.data(), DBUS_TYPE_UNIX_FD)) + if (!q_dbus_connection_can_send_type(rawcon.data(), DBUS_TYPE_UNIX_FD)) QSKIP("Your session bus does not allow sending Unix file descriptors"); // make sure this QDBusConnection won't handle Unix file descriptors @@ -1090,18 +1099,20 @@ void tst_QDBusMarshall::receiveUnknownType() // create a call back to us containing a file descriptor QDBusMessageSpy spy; con.registerObject("/spyObject", &spy, QDBusConnection::ExportAllSlots); - ScopedDBusMessage msg(dbus_message_new_method_call(con.baseService().toLatin1(), "/spyObject", NULL, "theSlot")); + ScopedDBusMessage msg(q_dbus_message_new_method_call(con.baseService().toLatin1(), "/spyObject", NULL, "theSlot")); int fd = fileno(stdout); - dbus_message_append_args(msg.data(), DBUS_TYPE_UNIX_FD, &fd, DBUS_TYPE_INVALID); + DBusMessageIter iter; + q_dbus_message_iter_init_append(msg.data(), &iter); + q_dbus_message_iter_append_basic(&iter, DBUS_TYPE_UNIX_FD, &fd); // try to send to us DBusPendingCall *pending_ptr; - dbus_connection_send_with_reply(rawcon.data(), msg.data(), &pending_ptr, 1000); + q_dbus_connection_send_with_reply(rawcon.data(), msg.data(), &pending_ptr, 1000); ScopedDBusPendingCall pending(pending_ptr); // check that it got sent - while (dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS) + while (q_dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS) ; // now spin our event loop. We don't catch this call, so let's get the reply @@ -1110,7 +1121,7 @@ void tst_QDBusMarshall::receiveUnknownType() loop.exec(); // now try to receive the reply - dbus_pending_call_block(pending.data()); + q_dbus_pending_call_block(pending.data()); // check that the spy received what it was supposed to receive QCOMPARE(spy.list.size(), 1); @@ -1118,48 +1129,49 @@ void tst_QDBusMarshall::receiveUnknownType() QFETCH(int, receivedTypeId); QCOMPARE(spy.list.at(0).arguments().at(0).userType(), receivedTypeId); - msg.reset(dbus_pending_call_steal_reply(pending.data())); + msg.reset(q_dbus_pending_call_steal_reply(pending.data())); QVERIFY(msg); - QCOMPARE(dbus_message_get_type(msg.data()), DBUS_MESSAGE_TYPE_METHOD_RETURN); - QCOMPARE(dbus_message_get_signature(msg.data()), DBUS_TYPE_INT32_AS_STRING); + QCOMPARE(q_dbus_message_get_type(msg.data()), DBUS_MESSAGE_TYPE_METHOD_RETURN); + QCOMPARE(q_dbus_message_get_signature(msg.data()), DBUS_TYPE_INT32_AS_STRING); int retval; - QVERIFY(dbus_message_get_args(msg.data(), &error, DBUS_TYPE_INT32, &retval, DBUS_TYPE_INVALID)); + QVERIFY(q_dbus_message_iter_init(msg.data(), &iter)); + q_dbus_message_iter_get_basic(&iter, &retval); QCOMPARE(retval, 42); } else { // create a signal that we'll emit static const char signalName[] = "signalName"; static const char interfaceName[] = "local.interface.name"; - ScopedDBusMessage msg(dbus_message_new_signal("/", interfaceName, signalName)); - con.connect(dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &QTestEventLoop::instance(), SLOT(exitLoop())); + ScopedDBusMessage msg(q_dbus_message_new_signal("/", interfaceName, signalName)); + con.connect(q_dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &QTestEventLoop::instance(), SLOT(exitLoop())); QDBusMessageSpy spy; - con.connect(dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &spy, SLOT(theSlot(QDBusMessage))); + con.connect(q_dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &spy, SLOT(theSlot(QDBusMessage))); DBusMessageIter iter; - dbus_message_iter_init_append(msg.data(), &iter); + q_dbus_message_iter_init_append(msg.data(), &iter); int fd = fileno(stdout); if (qstrcmp(QTest::currentDataTag(), "type-naked") == 0) { // send naked - dbus_message_iter_append_basic(&iter, DBUS_TYPE_UNIX_FD, &fd); + q_dbus_message_iter_append_basic(&iter, DBUS_TYPE_UNIX_FD, &fd); } else { DBusMessageIter subiter; if (qstrcmp(QTest::currentDataTag(), "type-variant") == 0) - dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter); + q_dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter); else if (qstrcmp(QTest::currentDataTag(), "type-array") == 0) - dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter); + q_dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter); else if (qstrcmp(QTest::currentDataTag(), "type-struct") == 0) - dbus_message_iter_open_container(&iter, DBUS_TYPE_STRUCT, 0, &subiter); - dbus_message_iter_append_basic(&subiter, DBUS_TYPE_UNIX_FD, &fd); - dbus_message_iter_close_container(&iter, &subiter); + q_dbus_message_iter_open_container(&iter, DBUS_TYPE_STRUCT, 0, &subiter); + q_dbus_message_iter_append_basic(&subiter, DBUS_TYPE_UNIX_FD, &fd); + q_dbus_message_iter_close_container(&iter, &subiter); } // send it - dbus_connection_send(rawcon.data(), msg.data(), 0); + q_dbus_connection_send(rawcon.data(), msg.data(), 0); // check that it got sent - while (dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS) + while (q_dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS) ; // now let's see what happens diff --git a/tests/auto/dbus/qdbustype/qdbustype.pro b/tests/auto/dbus/qdbustype/qdbustype.pro index 1e6335aa3b..21df33d2c7 100644 --- a/tests/auto/dbus/qdbustype/qdbustype.pro +++ b/tests/auto/dbus/qdbustype/qdbustype.pro @@ -2,6 +2,11 @@ CONFIG += testcase TARGET = tst_qdbustype QT = core-private dbus-private testlib SOURCES += tst_qdbustype.cpp -QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS -LIBS_PRIVATE += $$QT_LIBS_DBUS +contains(QT_CONFIG, dbus-linked) { + DEFINES += QT_LINKED_LIBDBUS + LIBS += $$QT_LIBS_DBUS + QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS +} else { + SOURCES += ../../../../src/dbus/qdbus_symbols.cpp +} DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbustype/tst_qdbustype.cpp b/tests/auto/dbus/qdbustype/tst_qdbustype.cpp index 791a42dcc4..e674b6d686 100644 --- a/tests/auto/dbus/qdbustype/tst_qdbustype.cpp +++ b/tests/auto/dbus/qdbustype/tst_qdbustype.cpp @@ -35,8 +35,18 @@ #include #include - -#include +#include + +DEFINEFUNC(dbus_bool_t, dbus_signature_validate, (const char *signature, + DBusError *error), + (signature, error), return) +DEFINEFUNC(dbus_bool_t, dbus_signature_validate_single, (const char *signature, + DBusError *error), + (signature, error), return) +DEFINEFUNC(dbus_bool_t, dbus_type_is_basic, (int typecode), + (typecode), return) +DEFINEFUNC(dbus_bool_t, dbus_type_is_fixed, (int typecode), + (typecode), return) class tst_QDBusType : public QObject { @@ -182,7 +192,7 @@ void tst_QDBusType::isValidFixedType() int type = data.at(0).unicode(); if (isValid) - QCOMPARE(bool(dbus_type_is_fixed(type)), result); + QCOMPARE(bool(q_dbus_type_is_fixed(type)), result); QCOMPARE(QDBusUtil::isValidFixedType(type), result); } @@ -204,7 +214,7 @@ void tst_QDBusType::isValidBasicType() int type = data.at(0).unicode(); if (isValid) - QCOMPARE(bool(dbus_type_is_basic(type)), result); + QCOMPARE(bool(q_dbus_type_is_basic(type)), result); QCOMPARE(QDBusUtil::isValidBasicType(type), result); } @@ -220,7 +230,7 @@ void tst_QDBusType::isValidSingleSignature() QFETCH(QString, data); QFETCH(bool, result); - QCOMPARE(bool(dbus_signature_validate_single(data.toLatin1(), 0)), result); + QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result); QCOMPARE(QDBusUtil::isValidSingleSignature(data), result); } @@ -236,11 +246,11 @@ void tst_QDBusType::isValidArray() QFETCH(bool, result); data.prepend("a"); - QCOMPARE(bool(dbus_signature_validate_single(data.toLatin1(), 0)), result); + QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result); QCOMPARE(QDBusUtil::isValidSingleSignature(data), result); data.prepend("a"); - QCOMPARE(bool(dbus_signature_validate_single(data.toLatin1(), 0)), result); + QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result); QCOMPARE(QDBusUtil::isValidSingleSignature(data), result); } @@ -256,7 +266,7 @@ void tst_QDBusType::isValidSignature() data.append(data); if (data.at(0).unicode()) - QCOMPARE(bool(dbus_signature_validate(data.toLatin1(), 0)), result); + QCOMPARE(bool(q_dbus_signature_validate(data.toLatin1(), 0)), result); QCOMPARE(QDBusUtil::isValidSignature(data), result); } diff --git a/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp b/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp index eac61a38b8..7d0c5d8d99 100644 --- a/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp +++ b/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp @@ -34,7 +34,9 @@ #include #include #include -#include + +// We just need the DBUS_TYPE_* constants, so use our own copy +#include "../../../../src/dbus/dbus_minimal_p.h" class tst_qdbusxml2cpp : public QObject { diff --git a/tests/benchmarks/dbus/qdbustype/main.cpp b/tests/benchmarks/dbus/qdbustype/main.cpp index 4723ed1b97..ae7eb6582a 100644 --- a/tests/benchmarks/dbus/qdbustype/main.cpp +++ b/tests/benchmarks/dbus/qdbustype/main.cpp @@ -35,8 +35,11 @@ #include #include +#include -#include +DEFINEFUNC(dbus_bool_t, dbus_signature_validate, (const char *signature, + DBusError *error), + (signature, error), return) class tst_QDBusType: public QObject { @@ -85,9 +88,9 @@ void tst_QDBusType::benchmarkSignature() bool result; if (useNative) { - dbus_signature_validate(data.toLatin1(), 0); + q_dbus_signature_validate(data.toLatin1(), 0); QBENCHMARK { - result = dbus_signature_validate(data.toLatin1(), 0); + result = q_dbus_signature_validate(data.toLatin1(), 0); } } else { QDBusUtil::isValidSignature(data); diff --git a/tests/benchmarks/dbus/qdbustype/qdbustype.pro b/tests/benchmarks/dbus/qdbustype/qdbustype.pro index 0307dda4a0..1437e4d9eb 100644 --- a/tests/benchmarks/dbus/qdbustype/qdbustype.pro +++ b/tests/benchmarks/dbus/qdbustype/qdbustype.pro @@ -1,8 +1,13 @@ TARGET = tst_bench_qdbustype QT -= gui -QT += dbus dbus-private testlib -QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS -LIBS_PRIVATE += $$QT_LIBS_DBUS +QT += core-private dbus-private testlib +contains(QT_CONFIG, dbus-linked) { + DEFINES += QT_LINKED_LIBDBUS + LIBS += $$QT_LIBS_DBUS + QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS +} else { + SOURCES += ../../../../src/dbus/qdbus_symbols.cpp +} SOURCES += main.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -- cgit v1.2.3 From 6796f2337ee31b4b4f07eaa54d868b999c39233a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 19 Dec 2014 11:07:47 +0100 Subject: Windows: Fix OS version determination for Windows >= 8 First, try to determine the version of kernel32.dll by using the version API. If that fails, loop using the version macros, taking the major version into account. Hangs in the minor version loop have been observed, potentially related to the major version. Task-number: QTBUG-43413 Change-Id: I982e78873510e7598c7cf839177e59812acd86f6 Reviewed-by: Joerg Bornemann --- src/corelib/global/qglobal.cpp | 78 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 10 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index ae3e86629e..997e804579 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -40,6 +40,8 @@ #include "qdir.h" #include "qdatetime.h" +#include + #ifndef QT_NO_QOBJECT #include #endif @@ -1865,6 +1867,70 @@ QT_BEGIN_INCLUDE_NAMESPACE QT_END_INCLUDE_NAMESPACE #ifndef Q_OS_WINRT + +# ifndef Q_OS_WINCE + +// Determine Windows versions >= 8 by querying the version of kernel32.dll. +static inline bool determineWinOsVersionPost8(OSVERSIONINFO *result) +{ + typedef WORD (WINAPI* PtrGetFileVersionInfoSizeW)(LPCWSTR, LPDWORD); + typedef BOOL (WINAPI* PtrVerQueryValueW)(LPCVOID, LPCWSTR, LPVOID, PUINT); + typedef BOOL (WINAPI* PtrGetFileVersionInfoW)(LPCWSTR, DWORD, DWORD, LPVOID); + + QSystemLibrary versionLib(QStringLiteral("version")); + if (!versionLib.load()) + return false; + PtrGetFileVersionInfoSizeW getFileVersionInfoSizeW = (PtrGetFileVersionInfoSizeW)versionLib.resolve("GetFileVersionInfoSizeW"); + PtrVerQueryValueW verQueryValueW = (PtrVerQueryValueW)versionLib.resolve("VerQueryValueW"); + PtrGetFileVersionInfoW getFileVersionInfoW = (PtrGetFileVersionInfoW)versionLib.resolve("GetFileVersionInfoW"); + if (!getFileVersionInfoSizeW || !verQueryValueW || !getFileVersionInfoW) + return false; + + const wchar_t kernel32Dll[] = L"kernel32.dll"; + DWORD handle; + const DWORD size = getFileVersionInfoSizeW(kernel32Dll, &handle); + if (!size) + return false; + QScopedArrayPointer versionInfo(new BYTE[size]); + if (!getFileVersionInfoW(kernel32Dll, handle, size, versionInfo.data())) + return false; + UINT uLen; + VS_FIXEDFILEINFO *fileInfo = Q_NULLPTR; + if (!verQueryValueW(versionInfo.data(), L"\\", (LPVOID *)&fileInfo, &uLen)) + return false; + const DWORD fileVersionMS = fileInfo->dwFileVersionMS; + const DWORD fileVersionLS = fileInfo->dwFileVersionLS; + result->dwMajorVersion = HIWORD(fileVersionMS); + result->dwMinorVersion = LOWORD(fileVersionMS); + result->dwBuildNumber = HIWORD(fileVersionLS); + return true; +} + +// Fallback for determining Windows versions >= 8 by looping using the +// version check macros. Note that it will return build number=0 to avoid +// inefficient looping. +static inline void determineWinOsVersionFallbackPost8(OSVERSIONINFO *result) +{ + result->dwBuildNumber = 0; + DWORDLONG conditionMask = 0; + VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL); + VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL); + OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result->dwMajorVersion, 0, + result->dwBuildNumber, result->dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 }; + for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMajorVersion) + result->dwMajorVersion = checkVersion.dwMajorVersion; + conditionMask = 0; + checkVersion.dwMajorVersion = result->dwMajorVersion; + checkVersion.dwMinorVersion = 0; + VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_EQUAL); + VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL); + VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL); + for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion) + result->dwMinorVersion = checkVersion.dwMinorVersion; +} + +# endif // !Q_OS_WINCE + static inline OSVERSIONINFO winOsVersion() { OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}}; @@ -1880,16 +1946,8 @@ static inline OSVERSIONINFO winOsVersion() # endif # ifndef Q_OS_WINCE if (result.dwMajorVersion == 6 && result.dwMinorVersion == 2) { - // This could be Windows 8.1 or higher. Note that as of Windows 9, - // the major version needs to be checked as well. - DWORDLONG conditionMask = 0; - VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL); - VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL); - VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL); - OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result.dwMajorVersion, result.dwMinorVersion, - result.dwBuildNumber, result.dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 }; - for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion) - result.dwMinorVersion = checkVersion.dwMinorVersion; + if (!determineWinOsVersionPost8(&result)) + determineWinOsVersionFallbackPost8(&result); } # endif // !Q_OS_WINCE return result; -- cgit v1.2.3 From d74d0a3b304b32f793cfd745c632c404a1c39b42 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 5 Jan 2015 14:31:47 +0100 Subject: Disable ANGLE builds for MSVC <= 2008. Task-number: QTBUG-43475 Change-Id: If0f68ed6823564fd67219812334256936031f35f Reviewed-by: Laszlo Agocs --- tools/configure/configureapp.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 105a9ef04c..6e9d4aa80b 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2101,6 +2101,11 @@ bool Configure::checkAngleAvailability(QString *errorMessage /* = 0 */) const // it is also present in MinGW. const QString directXSdk = Environment::detectDirectXSdk(); const Compiler compiler = Environment::compilerFromQMakeSpec(dictionary[QStringLiteral("QMAKESPEC")]); + if (compiler >= CC_NET2003 && compiler <= CC_NET2008) { + if (errorMessage) + *errorMessage = QStringLiteral("ANGLE is no longer supported for this compiler."); + return false; + } if (compiler < CC_NET2012 && directXSdk.isEmpty()) { if (errorMessage) *errorMessage = QStringLiteral("There is no Direct X SDK installed or the environment variable \"DXSDK_DIR\" is not set."); -- cgit v1.2.3 From 58fc02241a96b18a1062f2495d40dcdc047a7d5c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 6 Jan 2015 09:59:52 +0100 Subject: Windows: Release mouse capture when window is blocked by modal window. The capture needs to be cleared when for example a modal dialog is opened from a timer slot or similar while moving the window. Task-number: QTBUG-43308 Change-Id: Id0c01080d67d1057004a7f85b037dce5e220de42 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 7d67aa0d09..4df27faf81 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1770,6 +1770,8 @@ void QWindowsWindow::windowEvent(QEvent *event) case QEvent::WindowBlocked: // Blocked by another modal window. setEnabled(false); setFlag(BlockedByModal); + if (hasMouseCapture()) + ReleaseCapture(); break; case QEvent::WindowUnblocked: setEnabled(true); -- cgit v1.2.3 From 5517d1fde55ee3d4601b4a47543d846467b4d267 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 6 Jan 2015 12:31:59 +0100 Subject: Windows: Remove check for minimum/maximum size constraints. The warning was triggered when increasing the fixed size of a window. If there is a real violation of the size constraints, the below warning will show. Task-number: QTBUG-43420 Change-Id: I85d7d0a91d040aa3ddeff8c3d105351efd5e14a9 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 4df27faf81..6279b6f4af 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1307,21 +1307,7 @@ void QWindowsWindow::setGeometryDp(const QRect &rectIn) const QMargins margins = frameMarginsDp(); rect.moveTopLeft(rect.topLeft() + QPoint(margins.left(), margins.top())); } - const QSize oldSize = m_data.geometry.size(); m_data.geometry = rect; - const QSize newSize = rect.size(); - // Check on hint. - if (newSize != oldSize) { - const QWindowsGeometryHint hint(window(), m_data.customMargins); - if (!hint.validSize(newSize)) { - qWarning("%s: Attempt to set a size (%dx%d) violating the constraints" - "(%dx%d - %dx%d) on window %s/'%s'.", __FUNCTION__, - newSize.width(), newSize.height(), - hint.minimumSize.width(), hint.minimumSize.height(), - hint.maximumSize.width(), hint.maximumSize.height(), - window()->metaObject()->className(), qPrintable(window()->objectName())); - } - } if (m_data.hwnd) { // A ResizeEvent with resulting geometry will be sent. If we cannot // achieve that size (for example, window title minimal constraint), -- cgit v1.2.3 From bb16ceac6871a9096547f5170ff174e87a605437 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 5 Jan 2015 14:26:03 +0100 Subject: Prevent buffer overrun when getting the glyph images The change 35bc3dc45aacaf36a8bdfccc7627136cc2e5b185 moved some padding out of QTextureGlyphCache into the font engines directly, however this was not done for the DirectWrite font engine so it caused a buffer overrun. Task-number: QTBUG-41782 Change-Id: I4e643159036f06c5edd8a742dc6694d517a47826 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/windows/qwindowsfontenginedirectwrite.cpp | 17 +++++++++++++++-- .../platforms/windows/qwindowsfontenginedirectwrite.h | 1 + tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 17 ++++++++++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 648f68bb19..ed512f78ca 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -515,8 +515,9 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t, const QTransform &xform) { glyph_metrics_t metrics = QFontEngine::boundingBox(t, xform); - int width = (metrics.width + margin * 2 + 4).ceil().toInt() ; - int height = (metrics.height + margin * 2 + 4).ceil().toInt(); + // This needs to be kept in sync with alphaMapBoundingBox + int width = (metrics.width + margin * 2).ceil().toInt() ; + int height = (metrics.height + margin * 2).ceil().toInt(); UINT16 glyphIndex = t; FLOAT glyphAdvance = metrics.xoff.toReal(); @@ -699,6 +700,18 @@ QString QWindowsFontEngineDirectWrite::fontNameSubstitute(const QString &familyN return QSettings(QLatin1String(keyC), QSettings::NativeFormat).value(familyName, familyName).toString(); } +glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph, QFixed pos, const QTransform &matrix, GlyphFormat format) +{ + Q_UNUSED(pos); + int margin = 0; + if (format == QFontEngine::Format_A32 || format == QFontEngine::Format_ARGB) + margin = glyphMargin(QFontEngine::Format_A32); + glyph_metrics_t gm = QFontEngine::boundingBox(glyph, matrix); + gm.width += margin * 2; + gm.height += margin * 2; + return gm; +} + QT_END_NAMESPACE #endif // QT_NO_DIRECTWRITE diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h index 2addb90de3..e0466c138d 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h @@ -75,6 +75,7 @@ public: glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); glyph_metrics_t boundingBox(glyph_t g); + glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat); QFixed ascent() const; QFixed descent() const; diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index c5755dcdad..41ceebb646 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -289,7 +289,7 @@ private slots: void blendARGBonRGB(); void RasterOp_NotDestination(); - + void drawTextNoHinting(); private: void fillData(); void setPenColor(QPainter& p); @@ -4812,6 +4812,21 @@ void tst_QPainter::RasterOp_NotDestination() QCOMPARE(pixel, 0xff00ffff); } +void tst_QPainter::drawTextNoHinting() +{ + { + QImage image(250, 250, QImage::Format_RGB32); + QPainter p(&image); + QFont font("Arial", 8); + font.setHintingPreference(QFont::PreferNoHinting); + font.setStyleStrategy(QFont::PreferAntialias); + p.setFont(font); + p.drawText(image.rect(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"); + } + // Testing for a crash when DirectWrite is used on Windows + QVERIFY(true); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" -- cgit v1.2.3 From bca693e0c1a2bfc05eaee9f8ddae06371afa6ef0 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 2 Jan 2015 15:41:23 +0100 Subject: Remove the -load_all option from the linker enabling static builds With the -load_all option turned on then it will cause a problem with the network bearer plugins as they share the same files and on OS X two plugins will be built and potentially linked against when building statically. This only effects gcc builds because clang does not turn this option on when linking by default either. Task-number: QTBUG-39238 Change-Id: Ib259304c3da74b6b4f6fcc6e3766427303af3bbe Reviewed-by: Gabriel de Dietrich --- mkspecs/common/g++-macx.conf | 2 -- 1 file changed, 2 deletions(-) diff --git a/mkspecs/common/g++-macx.conf b/mkspecs/common/g++-macx.conf index 086510dd96..0ee8130828 100644 --- a/mkspecs/common/g++-macx.conf +++ b/mkspecs/common/g++-macx.conf @@ -14,8 +14,6 @@ QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -gdwarf-2 QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -gdwarf-2 QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += -g -gdwarf-2 -QMAKE_LFLAGS_STATIC_LIB += -all_load - QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvmgcc42 QMAKE_OBJCFLAGS_PRECOMPILE = -x objective-c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -- cgit v1.2.3 From e7210a4945b4fbc65c90285acc0e136ae2d80d95 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 5 Jan 2015 14:47:53 +0100 Subject: Remove redundant code The non client mouse events have the right information regarding the modifiers now so the old code covered with Q_WS_WIN can be removed. Change-Id: I3e4ebc0debdd66970b18233f189b5d9e880e40a9 Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qdockwidget.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 93e6131ab9..2bf8a37e7f 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -930,12 +930,7 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event) initDrag(event->pos(), true); if (state == 0) break; -#ifdef Q_WS_WIN - // On Windows, NCA mouse events don't contain modifier info - state->ctrlDrag = GetKeyState(VK_CONTROL) & 0x8000; -#else state->ctrlDrag = event->modifiers() & Qt::ControlModifier; -#endif startDrag(); break; case QEvent::NonClientAreaMouseMove: -- cgit v1.2.3 From ea4dcc5931d455e4ee3e958ffa54a9f54ab022c8 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Mon, 5 Jan 2015 10:45:25 +0100 Subject: Fix crash on Mac OS if PAC URL contains non-URL legal chars macQueryInternal() was retrieving the PAC URL string as-entered by the user in the 'Proxies' tab of the system network settings dialog and passing it to CFURLCreateWithString(). CFURLCreateWithString() returns null if the input string contains non-URL legal chars or is empty. Change-Id: I9166d0433a62c7b2274b5435a7dea0a16997d10e Patch-By: Robert Knight Task-number: QTBUG-36787 Reviewed-by: Peter Hartmann Reviewed-by: Markus Goetz --- src/network/kernel/qnetworkproxy_mac.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp index 7d262467c3..81bce0c300 100644 --- a/src/network/kernel/qnetworkproxy_mac.cpp +++ b/src/network/kernel/qnetworkproxy_mac.cpp @@ -221,7 +221,11 @@ QList macQueryInternal(const QNetworkProxyQuery &query) int enabled; if (CFNumberGetValue(pacEnabled, kCFNumberIntType, &enabled) && enabled) { // PAC is enabled - CFStringRef cfPacLocation = (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString); + // kSCPropNetProxiesProxyAutoConfigURLString returns the URL string + // as entered in the system proxy configuration dialog + CFStringRef pacLocationSetting = (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString); + QCFType cfPacLocation = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, pacLocationSetting, NULL, NULL, + kCFStringEncodingUTF8); if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) { QCFType pacData; -- cgit v1.2.3 From a83e4d1d9dd90d4563ce60f27dfb7802a780e33e Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Mon, 5 Jan 2015 11:42:52 +0100 Subject: Fix possible crash when passing an invalid PAC URL This commit checks whether CFURLCreateWithString() succeeded. It does not appear to be possible to enter an empty URL directly in the PAC configuration dialog but I can't rule out the possibility that it could find its way into the settings via some other means. Change-Id: I6c2053d385503bf0330f5ae9fb1ec36a473d425d Patch-By: Robert Knight Task-number: QTBUG-36787 Reviewed-by: Markus Goetz Reviewed-by: Peter Hartmann --- src/network/kernel/qnetworkproxy_mac.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp index 81bce0c300..6be032ed9b 100644 --- a/src/network/kernel/qnetworkproxy_mac.cpp +++ b/src/network/kernel/qnetworkproxy_mac.cpp @@ -230,6 +230,10 @@ QList macQueryInternal(const QNetworkProxyQuery &query) if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) { QCFType pacData; QCFType pacUrl = CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL); + if (!pacUrl) { + qWarning("Invalid PAC URL \"%s\"", qPrintable(QCFString::toQString(cfPacLocation))); + return result; + } SInt32 errorCode; if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, pacUrl, &pacData, NULL, NULL, &errorCode)) { QString pacLocation = QCFString::toQString(cfPacLocation); -- cgit v1.2.3 From 83bd9393e5564ea9168fda90c0f44456633a483a Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Mon, 5 Jan 2015 15:22:57 +0100 Subject: Fix crash if PAC script retrieval returns a null CFData instance The documentation for CFURLCreateDataAndPropertiesFromResource() does not make this clear but from looking at the CFNetwork implementation and a user stacktrace it appears that this function can return true but not set the data argument under certain circumstances. Change-Id: I48034a640d6f47a51cd5883bbafacad4bcbd0415 Task-number: QTBUG-36787 Patch-By: Robert Knight Reviewed-by: Markus Goetz Reviewed-by: Peter Hartmann --- src/network/kernel/qnetworkproxy_mac.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp index 6be032ed9b..a1ac349949 100644 --- a/src/network/kernel/qnetworkproxy_mac.cpp +++ b/src/network/kernel/qnetworkproxy_mac.cpp @@ -240,7 +240,10 @@ QList macQueryInternal(const QNetworkProxyQuery &query) qWarning("Unable to get the PAC script at \"%s\" (%s)", qPrintable(pacLocation), cfurlErrorDescription(errorCode)); return result; } - + if (!pacData) { + qWarning("\"%s\" returned an empty PAC script", qPrintable(QCFString::toQString(cfPacLocation))); + return result; + } QCFType pacScript = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, pacData, kCFStringEncodingISOLatin1); if (!pacScript) { // This should never happen, but the documentation says it may return NULL if there was a problem creating the object. -- cgit v1.2.3 From 8f9ced985727136dc7d1502b7212a54f65b8b113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 12 Dec 2014 15:14:04 +0100 Subject: iOS: Raise window level instead of hiding statusbar during VKB scroll MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hiding the statusbar using the normal iOS APIs result in QScreen reporting new availableGeometry, which is not what we want. The scroll of the screen is a purely visual effect, and shouldn't have any effect on observable Qt APIs besides the keyboard rect changing. Instead of actually hiding the statusbar, we achieve the same effect by raising the key window (and any other application windows, including the keyboard) to the level of the statusbar, effectively putting them above the statusbar. This still leaves popups and alert windows above the key window, as normal. Change-Id: Ib7694240ca86cfb9000de35bf0c49343ffb37e32 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosinputcontext.mm | 17 ++++++++++++++++- src/plugins/platforms/ios/qiosviewcontroller.mm | 8 +------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index bbfc03667e..6e56f47954 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -503,7 +503,22 @@ void QIOSInputContext::scroll(int y) [rootView.layer addAnimation:animation forKey:@"AnimateSubLayerTransform"]; rootView.layer.sublayerTransform = translationTransform; - [rootView.qtViewController updateProperties]; + bool keyboardScrollIsActive = y != 0; + + // Raise all known windows to above the status-bar if we're scrolling the screen, + // while keeping the relative window level between the windows the same. + NSArray *applicationWindows = [[UIApplication sharedApplication] windows]; + static QHash originalWindowLevels; + for (UIWindow *window in applicationWindows) { + if (keyboardScrollIsActive && !originalWindowLevels.contains(window)) + originalWindowLevels.insert(window, window.windowLevel); + + UIWindowLevel windowLevelAdjustment = keyboardScrollIsActive ? UIWindowLevelStatusBar : 0; + window.windowLevel = originalWindowLevels.value(window) + windowLevelAdjustment; + + if (!keyboardScrollIsActive) + originalWindowLevels.remove(window); + } } completion:^(BOOL){ if (self) { diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index a2d81e3b6c..f678f7e807 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -281,14 +281,8 @@ // All decisions are based on the the top level window focusWindow = qt_window_private(focusWindow)->topLevelWindow(); - bool hasScrolledRootViewDueToVirtualKeyboard = - !CATransform3DIsIdentity(self.view.layer.sublayerTransform); - bool currentStatusBarVisibility = self.prefersStatusBarHidden; - self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen - || hasScrolledRootViewDueToVirtualKeyboard; - self.preferredStatusBarUpdateAnimation = hasScrolledRootViewDueToVirtualKeyboard ? - UIStatusBarAnimationFade : UIStatusBarAnimationNone; + self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen; if (self.prefersStatusBarHidden != currentStatusBarVisibility) { #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0) -- cgit v1.2.3 From b0088967c3373b604d102384d97e1d56a9c0ac9e Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Fri, 5 Dec 2014 12:28:53 +0100 Subject: QCoreTextFontDatabase: release CTFontDescriptorRef references in dtor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QCoreTextFontDatabase::m_systemFontDescriptors owns the references to the underlying CTFontDescriptorRef objects. in order to avoid a leak, we should release them Change-Id: I8fc6c158908e0173696cd91058ac34efb3de01d5 Reviewed-by: Tor Arne Vestbø --- src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 9f2ff10a21..f447defbce 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -177,6 +177,8 @@ QCoreTextFontDatabase::QCoreTextFontDatabase() QCoreTextFontDatabase::~QCoreTextFontDatabase() { + foreach (CTFontDescriptorRef ref, m_systemFontDescriptors) + CFRelease(ref); } static CFArrayRef availableFamilyNames() -- cgit v1.2.3 From 099075427b05bbb7075854401da15afd474f18dc Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 16 Dec 2014 13:19:40 +0100 Subject: QCoreTextFontDatabase: close memory leak in themeFont MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit if the CTFontDescriptorRef is already contained in m_systemFontDescriptors we leak a reference, unless we explicitly release it. Change-Id: I5b263aa52b4433e7e28cc01164098892cc9cd2ae Reviewed-by: Tor Arne Vestbø --- src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index f447defbce..5a6c5de0b4 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -828,7 +828,11 @@ QFont *QCoreTextFontDatabase::themeFont(QPlatformTheme::Font f) const CTFontDescriptorRef fontDesc = fontDescriptorFromTheme(f); FontDescription fd; getFontDescription(fontDesc, &fd); - m_systemFontDescriptors.insert(fontDesc); + + if (!m_systemFontDescriptors.contains(fontDesc)) + m_systemFontDescriptors.insert(fontDesc); + else + CFRelease(fontDesc); QFont *font = new QFont(fd.familyName, fd.pixelSize, fd.weight, fd.style == QFont::StyleItalic); return font; -- cgit v1.2.3 From 1daa7aff4d29f82a31c4d7d0172a119aaa43aaa3 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Thu, 11 Dec 2014 07:44:28 +0100 Subject: Remove extra ';' after QPrint namespace block The extra ';' causes a warning when gcc is used with -Wpedantic. Change-Id: I3d99aca6f160e46dbe2173106160474664e06b2c Reviewed-by: Friedemann Kleint --- src/printsupport/kernel/qprint_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/printsupport/kernel/qprint_p.h b/src/printsupport/kernel/qprint_p.h index 504a0d6e20..ebb165190e 100644 --- a/src/printsupport/kernel/qprint_p.h +++ b/src/printsupport/kernel/qprint_p.h @@ -143,7 +143,7 @@ namespace QPrint { QPrint::OutputBinId id; }; -}; +} struct InputSlotMap { QPrint::InputSlotId id; -- cgit v1.2.3 From 85af7f4538bdf5ee441506226e154c3d49a743a2 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 17 Dec 2014 16:02:25 +0100 Subject: use the major qt version for the library stem also in cmake files amends 7ef2f9f65cc8e35. Change-Id: I1b7a029d8c73f5ce20d216e3b40a7c118eca4891 Reviewed-by: Titta Heikkala Reviewed-by: Stephen Kelly --- mkspecs/features/create_cmake.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index 8beeba3f39..3b0e03755d 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -179,7 +179,7 @@ CMAKE_MODULE_DEPS = $$cmakeModuleList($$sort_depends(QT.$${MODULE}.depends, QT.) CMAKE_PARTIAL_MODULE_DEPS = $$replace(CMAKE_MODULE_DEPS, ";", ";Qt5::") !isEmpty(CMAKE_PARTIAL_MODULE_DEPS):CMAKE_QT5_MODULE_DEPS = "Qt5::$${CMAKE_PARTIAL_MODULE_DEPS}" -CMAKE_QT_STEM = Qt$$eval(QT.$${MODULE}.MAJOR_VERSION)$${CMAKE_MODULE_NAME}$${QT_LIBINFIX} +CMAKE_QT_STEM = Qt$$QT_MAJOR_VERSION$${CMAKE_MODULE_NAME}$${QT_LIBINFIX} mac { !isEmpty(CMAKE_STATIC_TYPE) { -- cgit v1.2.3 From 8190291fb0b0e93fe3d80efdff831d50a8ef9671 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 24 Dec 2014 17:17:13 -0200 Subject: Autotest: don't leak a socket every call to QtNetworkSettings::hasIPv6 Change-Id: I87e31945052233cee17460ee6f59c02ec416b27b Reviewed-by: Richard J. Moore --- tests/auto/network-settings.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index e06744b44e..e46189dd7d 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -116,6 +116,7 @@ public: return false; } } + ::close(s); #endif return true; } -- cgit v1.2.3 From d40b66a8ef98777c69ac293dac9a332f88832c23 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Wed, 7 Jan 2015 14:50:41 +0100 Subject: Fix use-after-free bug xcb_image_destroy() calls free on m_xcb_image and then few lines down we access member of m_xcb_image. Swap order of these two actions. Change-Id: I01fb43a066459cce462df6af22161c35cef524eb Task-number: QTBUG-43623 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 0b9717759b..f4382c7b50 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -145,8 +145,6 @@ void QXcbShmImage::destroy() if (segmentSize && m_shm_info.shmaddr) Q_XCB_CALL(xcb_shm_detach(xcb_connection(), m_shm_info.shmseg)); - xcb_image_destroy(m_xcb_image); - if (segmentSize) { if (m_shm_info.shmaddr) { shmdt(m_shm_info.shmaddr); @@ -156,6 +154,8 @@ void QXcbShmImage::destroy() } } + xcb_image_destroy(m_xcb_image); + if (m_gc) Q_XCB_CALL(xcb_free_gc(xcb_connection(), m_gc)); } -- cgit v1.2.3 From d511aa906cf4174dc0f551cbd6b2e798c082d7a5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 15 Oct 2014 12:10:57 +0200 Subject: QVersionNumber: test more version numbers QVersionNumber will gain a small-version-number optimization, which stores sequences of less than 4 (32bit) or 8 (64bit) 8-bit signed segments inside the class instead of a QVector. Make sure the tests cover those cases, too. Change-Id: If1d875c75d284908756b305f767a7218cab5226f Reviewed-by: Keith Gardner Reviewed-by: Thiago Macieira --- .../tools/qversionnumber/tst_qversionnumber.cpp | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp index f97b8a4df8..0f7c42c122 100644 --- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp +++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp @@ -109,14 +109,35 @@ void tst_QVersionNumber::singleInstanceData() QTest::newRow("0.1.2alpha") << (QVector() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2alpha") << 5 << false; QTest::newRow("0.1.2-alpha") << (QVector() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2-alpha") << 5 << false; QTest::newRow("0.1.2.alpha") << (QVector() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2.alpha") << 5 << false; + QTest::newRow("0.1.2.3alpha") << (QVector() << 0 << 1 << 2 << 3) << QVersionNumber(QVector() << 0 << 1 << 2 << 3) << QStringLiteral("0.1.2.3") << QStringLiteral("0.1.2.3alpha") << 7 << false; + QTest::newRow("0.1.2.3.alpha") << (QVector() << 0 << 1 << 2 << 3) << QVersionNumber(QVector() << 0 << 1 << 2 << 3) << QStringLiteral("0.1.2.3") << QStringLiteral("0.1.2.3.alpha") << 7 << false; QTest::newRow("0.1.2.3.4.alpha") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4.alpha") << 9 << false; QTest::newRow("0.1.2.3.4 alpha") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4 alpha") << 9 << false; QTest::newRow("0.1.2.3.4 alp ha") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4 alp ha") << 9 << false; QTest::newRow("0.1.2.3.4alp ha") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4alp ha") << 9 << false; QTest::newRow("0.1.2.3.4alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4alpha ") << 9 << false; + QTest::newRow("0.1.2.3.4.5alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5) << QStringLiteral("0.1.2.3.4.5") << QStringLiteral("0.1.2.3.4.5alpha ") << 11 << false; + QTest::newRow("0.1.2.3.4.5.6alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6) << QStringLiteral("0.1.2.3.4.5.6") << QStringLiteral("0.1.2.3.4.5.6alpha ") << 13 << false; + QTest::newRow("0.1.2.3.4.5.6.7alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7) << QStringLiteral("0.1.2.3.4.5.6.7") << QStringLiteral("0.1.2.3.4.5.6.7alpha ") << 15 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8alpha ") << 17 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8.alpha") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8.alpha") << 17 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8 alpha") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8 alpha") << 17 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8 alp ha") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8 alp ha") << 17 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8alp ha") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8alp ha") << 17 << false; QTest::newRow("10.09") << (QVector() << 10 << 9) << QVersionNumber(QVector() << 10 << 9) << QStringLiteral("10.9") << QStringLiteral("10.09") << 5 << false; QTest::newRow("10.0x") << (QVector() << 10 << 0) << QVersionNumber(QVector() << 10 << 0) << QStringLiteral("10.0") << QStringLiteral("10.0x") << 4 << false; QTest::newRow("10.0xTest") << (QVector() << 10 << 0) << QVersionNumber(QVector() << 10 << 0) << QStringLiteral("10.0") << QStringLiteral("10.0xTest") << 4 << false; + QTest::newRow("127.09") << (QVector() << 127 << 9) << QVersionNumber(QVector() << 127 << 9) << QStringLiteral("127.9") << QStringLiteral("127.09") << 6 << false; + QTest::newRow("127.0x") << (QVector() << 127 << 0) << QVersionNumber(QVector() << 127 << 0) << QStringLiteral("127.0") << QStringLiteral("127.0x") << 5 << false; + QTest::newRow("127.0xTest") << (QVector() << 127 << 0) << QVersionNumber(QVector() << 127 << 0) << QStringLiteral("127.0") << QStringLiteral("127.0xTest") << 5 << false; + QTest::newRow("128.09") << (QVector() << 128 << 9) << QVersionNumber(QVector() << 128 << 9) << QStringLiteral("128.9") << QStringLiteral("128.09") << 6 << false; + QTest::newRow("128.0x") << (QVector() << 128 << 0) << QVersionNumber(QVector() << 128 << 0) << QStringLiteral("128.0") << QStringLiteral("128.0x") << 5 << false; + QTest::newRow("128.0xTest") << (QVector() << 128 << 0) << QVersionNumber(QVector() << 128 << 0) << QStringLiteral("128.0") << QStringLiteral("128.0xTest") << 5 << false; +} + +namespace UglyOperator { +// ugh, but the alternative (operator <<) is even worse... +static inline QVector operator+(QVector v, int i) { v.push_back(i); return qMove(v); } } void tst_QVersionNumber::comparisonData() @@ -141,6 +162,7 @@ void tst_QVersionNumber::comparisonData() QTest::newRow("1.0, 1.0") << QVersionNumber(1, 0) << QVersionNumber(1, 0) << true << false << false << true << false << true << 0 << true << QVersionNumber(1, 0); QTest::newRow("1, 1.0") << QVersionNumber(1) << QVersionNumber(1, 0) << false << true << true << true << false << false << -1 << true << QVersionNumber(1); QTest::newRow("1.0, 1") << QVersionNumber(1, 0) << QVersionNumber(1) << false << true << false << false << true << true << 1 << false << QVersionNumber(1); + QTest::newRow("0.1.2, 0.1") << QVersionNumber(0, 1, 2) << QVersionNumber(0, 1) << false << true << false << false << true << true << 2 << false << QVersionNumber(0, 1); QTest::newRow("0.1, 0.1.2") << QVersionNumber(0, 1) << QVersionNumber(0, 1, 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(0, 1); QTest::newRow("0.1.2, 0.1.2") << QVersionNumber(0, 1, 2) << QVersionNumber(0, 1, 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(0, 1, 2); @@ -152,6 +174,44 @@ void tst_QVersionNumber::comparisonData() QTest::newRow("0.-1, 0.1") << QVersionNumber(0, -1) << QVersionNumber(0, 1) << false << true << true << true << false << false << -2 << false << QVersionNumber(0); QTest::newRow("0.-1, 0") << QVersionNumber(0, -1) << QVersionNumber(0) << false << true << true << true << false << false << -1 << false << QVersionNumber(0); QTest::newRow("0, 0.-1") << QVersionNumber(0) << QVersionNumber(0, -1) << false << true << false << false << true << true << 1 << true << QVersionNumber(0); + + QTest::newRow("0.127.2, 0.127") << QVersionNumber(0, 127, 2) << QVersionNumber(0, 127) << false << true << false << false << true << true << 2 << false << QVersionNumber(0, 127); + QTest::newRow("0.127, 0.127.2") << QVersionNumber(0, 127) << QVersionNumber(0, 127, 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(0, 127); + QTest::newRow("0.127.2, 0.127.2") << QVersionNumber(0, 127, 2) << QVersionNumber(0, 127, 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(0, 127, 2); + QTest::newRow("0.127.2, 127.127.2") << QVersionNumber(0, 127, 2) << QVersionNumber(127, 127, 2) << false << true << true << true << false << false << -127 << false << QVersionNumber(); + QTest::newRow("127.127.2, 0.127.2") << QVersionNumber(127, 127, 2) << QVersionNumber(0, 127, 2) << false << true << false << false << true << true << 127 << false << QVersionNumber(); + QTest::newRow("127, -128") << QVersionNumber(127) << QVersionNumber(-128) << false << true << false << false << true << true << 255 << false << QVersionNumber(); + QTest::newRow("-128, 127") << QVersionNumber(-128) << QVersionNumber(127) << false << true << true << true << false << false << -255 << false << QVersionNumber(); + QTest::newRow("0.127, 0.-128") << QVersionNumber(0, 127) << QVersionNumber(0, -128) << false << true << false << false << true << true << 255 << false << QVersionNumber(0); + QTest::newRow("0.-128, 0.127") << QVersionNumber(0, -128) << QVersionNumber(0, 127) << false << true << true << true << false << false << -255 << false << QVersionNumber(0); + QTest::newRow("0.-128, 0") << QVersionNumber(0, -128) << QVersionNumber(0) << false << true << true << true << false << false << -128 << false << QVersionNumber(0); + QTest::newRow("0, 0.-128") << QVersionNumber(0) << QVersionNumber(0, -128) << false << true << false << false << true << true << 128 << true << QVersionNumber(0); + + QTest::newRow("0.128.2, 0.128") << QVersionNumber(0, 128, 2) << QVersionNumber(0, 128) << false << true << false << false << true << true << 2 << false << QVersionNumber(0, 128); + QTest::newRow("0.128, 0.128.2") << QVersionNumber(0, 128) << QVersionNumber(0, 128, 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(0, 128); + QTest::newRow("0.128.2, 0.128.2") << QVersionNumber(0, 128, 2) << QVersionNumber(0, 128, 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(0, 128, 2); + QTest::newRow("0.128.2, 128.128.2") << QVersionNumber(0, 128, 2) << QVersionNumber(128, 128, 2) << false << true << true << true << false << false << -128 << false << QVersionNumber(); + QTest::newRow("128.128.2, 0.128.2") << QVersionNumber(128, 128, 2) << QVersionNumber(0, 128, 2) << false << true << false << false << true << true << 128 << false << QVersionNumber(); + QTest::newRow("128, -129") << QVersionNumber(128) << QVersionNumber(-129) << false << true << false << false << true << true << 257 << false << QVersionNumber(); + QTest::newRow("-129, 128") << QVersionNumber(-129) << QVersionNumber(128) << false << true << true << true << false << false << -257 << false << QVersionNumber(); + QTest::newRow("0.128, 0.-129") << QVersionNumber(0, 128) << QVersionNumber(0, -129) << false << true << false << false << true << true << 257 << false << QVersionNumber(0); + QTest::newRow("0.-129, 0.128") << QVersionNumber(0, -129) << QVersionNumber(0, 128) << false << true << true << true << false << false << -257 << false << QVersionNumber(0); + QTest::newRow("0.-129, 0") << QVersionNumber(0, -129) << QVersionNumber(0) << false << true << true << true << false << false << -129 << false << QVersionNumber(0); + QTest::newRow("0, 0.-129") << QVersionNumber(0) << QVersionNumber(0, -129) << false << true << false << false << true << true << 129 << true << QVersionNumber(0); + + const QVector common = QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6; + using namespace UglyOperator; + QTest::newRow("0.1.2.3.4.5.6.0.1.2, 0.1.2.3.4.5.6.0.1") << QVersionNumber(common + 0 + 1 + 2) << QVersionNumber(common + 0 + 1) << false << true << false << false << true << true << 2 << false << QVersionNumber(common + 0 + 1); + QTest::newRow("0.1.2.3.4.5.6.0.1, 0.1.2.3.4.5.6.0.1.2") << QVersionNumber(common + 0 + 1) << QVersionNumber(common + 0 + 1 + 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(common + 0 + 1); + QTest::newRow("0.1.2.3.4.5.6.0.1.2, 0.1.2.3.4.5.6.0.1.2") << QVersionNumber(common + 0 + 1 + 2) << QVersionNumber(common + 0 + 1 + 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(common + 0 + 1 + 2); + QTest::newRow("0.1.2.3.4.5.6.0.1.2, 0.1.2.3.4.5.6.1.1.2") << QVersionNumber(common + 0 + 1 + 2) << QVersionNumber(common + 1 + 1 + 2) << false << true << true << true << false << false << -1 << false << QVersionNumber(common); + QTest::newRow("0.1.2.3.4.5.6.1.1.2, 0.1.2.3.4.5.6.0.1.2") << QVersionNumber(common + 1 + 1 + 2) << QVersionNumber(common + 0 + 1 + 2) << false << true << false << false << true << true << 1 << false << QVersionNumber(common); + QTest::newRow("0.1.2.3.4.5.6.1, 0.1.2.3.4.5.6.-1") << QVersionNumber(common + 1) << QVersionNumber(common + -1) << false << true << false << false << true << true << 2 << false << QVersionNumber(common); + QTest::newRow("0.1.2.3.4.5.6.-1, 0.1.2.3.4.5.6.1") << QVersionNumber(common + -1) << QVersionNumber(common + 1) << false << true << true << true << false << false << -2 << false << QVersionNumber(common); + QTest::newRow("0.1.2.3.4.5.6.0.1, 0.1.2.3.4.5.6.0.-1") << QVersionNumber(common + 0 + 1) << QVersionNumber(common + 0 + -1) << false << true << false << false << true << true << 2 << false << QVersionNumber(common + 0); + QTest::newRow("0.1.2.3.4.5.6.0.-1, 0.1.2.3.4.5.6.0.1") << QVersionNumber(common + 0 + -1) << QVersionNumber(common + 0 + 1) << false << true << true << true << false << false << -2 << false << QVersionNumber(common + 0); + QTest::newRow("0.1.2.3.4.5.6.0.-1, 0.1.2.3.4.5.6.0") << QVersionNumber(common + 0 + -1) << QVersionNumber(common + 0) << false << true << true << true << false << false << -1 << false << QVersionNumber(common + 0); + QTest::newRow("0.1.2.3.4.5.6.0, 0.1.2.3.4.5.6.0.-1") << QVersionNumber(common + 0) << QVersionNumber(common + 0 + -1) << false << true << false << false << true << true << 1 << true << QVersionNumber(common + 0); } void tst_QVersionNumber::initTestCase() -- cgit v1.2.3 From 72bc032ca8f7fc00900a9ca20bab8560ccf99727 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Wed, 24 Dec 2014 10:11:02 +1000 Subject: Refactor networkmanager QtBearer backend to use QDBusAbstractInterface. Using QDBusInterface causes introspection, which may not be permitted by some platforms. Change-Id: I953d27b9c0fc7c21d52fefeb8c7760a7235aed9d Reviewed-by: Alex Blasche --- .../networkmanager/qnetworkmanagerengine.cpp | 52 +- .../networkmanager/qnetworkmanagerservice.cpp | 556 +++++---------------- .../bearer/networkmanager/qnetworkmanagerservice.h | 88 +--- 3 files changed, 186 insertions(+), 510 deletions(-) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index f0977b4735..f52b9d4b4d 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -125,7 +125,6 @@ void QNetworkManagerEngine::setupConfigurations() activeConnectionsList.insert(acPath.path(), activeConnection); connect(activeConnection, SIGNAL(propertiesChanged(QMap)), this, SLOT(activeConnectionPropertiesChanged(QMap))); - activeConnection->setConnections(); QStringList devices = activeConnection->devices(); if (!devices.isEmpty()) { @@ -180,7 +179,7 @@ void QNetworkManagerEngine::connectToId(const QString &id) NMDeviceType connectionType = connection->getType(); QString dbusDevicePath; - const QString settingsPath = connection->connectionInterface()->path(); + const QString settingsPath = connection->path(); QString specificPath = configuredAccessPoints.key(settingsPath); if (isConnectionActive(settingsPath)) @@ -277,7 +276,6 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QMap)), this, SLOT(activeConnectionPropertiesChanged(QMap))); - activeConnection->setConnections(); } const QString id = activeConnection->connection().path(); @@ -373,10 +371,10 @@ void QNetworkManagerEngine::deviceConnectionsChanged(const QStringList &connecti { QMutexLocker locker(&mutex); for (int i = 0; i < connections.count(); ++i) { - if (connectionsList.contains(connections.at(i)->connectionInterface()->path())) + if (connectionsList.contains(connections.at(i)->path())) continue; - const QString settingsPath = connections.at(i)->connectionInterface()->path(); + const QString settingsPath = connections.at(i)->path(); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(settingsPath); @@ -399,11 +397,10 @@ void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) connect(iDevice,SIGNAL(connectionsChanged(QStringList)), this,SLOT(deviceConnectionsChanged(QStringList))); - iDevice->setConnections(); interfaceDevices.insert(path.path(),iDevice); if (iDevice->deviceType() == DEVICE_TYPE_WIFI) { QNetworkManagerInterfaceDeviceWireless *wirelessDevice = - new QNetworkManagerInterfaceDeviceWireless(iDevice->connectionInterface()->path(),this); + new QNetworkManagerInterfaceDeviceWireless(iDevice->path(),this); connect(wirelessDevice, SIGNAL(accessPointAdded(QString)), this, SLOT(newAccessPoint(QString))); @@ -417,9 +414,9 @@ void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) if (iDevice->deviceType() == DEVICE_TYPE_ETHERNET) { QNetworkManagerInterfaceDeviceWired *wiredDevice = - new QNetworkManagerInterfaceDeviceWired(iDevice->connectionInterface()->path(),this); + new QNetworkManagerInterfaceDeviceWired(iDevice->path(),this); connect(wiredDevice,SIGNAL(carrierChanged(bool)),this,SLOT(wiredCarrierChanged(bool))); - wiredDevices.insert(iDevice->connectionInterface()->path(), wiredDevice); + wiredDevices.insert(iDevice->path(), wiredDevice); } } @@ -454,7 +451,7 @@ void QNetworkManagerEngine::wiredCarrierChanged(bool carrier) for (int i = 0; i < connections.count(); ++i) { QNetworkManagerSettingsConnection *connection = connections.at(i); if (connection->getType() == DEVICE_TYPE_ETHERNET - && settingsPath.path() == connection->connectionInterface()->path()) { + && settingsPath.path() == connection->path()) { QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(settingsPath.path()); @@ -486,9 +483,9 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, } QNetworkManagerSettingsConnection *connection = - new QNetworkManagerSettingsConnection(settings->connectionInterface()->service(), + new QNetworkManagerSettingsConnection(settings->service(), path.path(),this); - const QString settingsPath = connection->connectionInterface()->path(); + const QString settingsPath = connection->path(); if (accessPointConfigurations.contains(settingsPath)) { return; } @@ -506,7 +503,7 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, for (int i = 0; i < accessPoints.count(); ++i) { if (connection->getSsid() == accessPoints.at(i)->ssid()) { // remove the corresponding accesspoint from configurations - apPath = accessPoints.at(i)->connectionInterface()->path(); + apPath = accessPoints.at(i)->path(); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(apPath); if (ptr) { @@ -533,7 +530,7 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, i.next(); if (i.value()->deviceType() == deviceType) { QNetworkManagerInterfaceDeviceWired *wiredDevice - = wiredDevices.value(i.value()->connectionInterface()->path()); + = wiredDevices.value(i.value()->path()); if (wiredDevice->carrier()) { cpPriv->state |= QNetworkConfiguration::Discovered; } @@ -564,7 +561,7 @@ bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath) QNetworkManagerSettingsConnection *settingsConnection = connectionFromId(settingsPath); if (settingsConnection->getType() == DEVICE_TYPE_MODEM) { - return isActiveContext(settingsConnection->connectionInterface()->path()); + return isActiveContext(settingsConnection->path()); } return false; @@ -611,7 +608,7 @@ void QNetworkManagerEngine::updateConnection() qobject_cast(sender()); if (!connection) return; - const QString settingsPath = connection->connectionInterface()->path(); + const QString settingsPath = connection->path(); QNetworkConfigurationPrivate *cpPriv = parseConnection(settingsPath, connection->getSettings()); @@ -682,20 +679,19 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path) bool okToAdd = true; for (int i = 0; i < accessPoints.count(); ++i) { - if (accessPoints.at(i)->connectionInterface()->path() == path) { + if (accessPoints.at(i)->path() == path) { okToAdd = false; } } if (okToAdd) { accessPoints.append(accessPoint); - accessPoint->setConnections(); } // Check if configuration exists for connection. if (!accessPoint->ssid().isEmpty()) { for (int i = 0; i < connections.count(); ++i) { QNetworkManagerSettingsConnection *connection = connections.at(i); - const QString settingsPath = connection->connectionInterface()->path(); + const QString settingsPath = connection->path(); if (accessPoint->ssid() == connection->getSsid()) { if (!configuredAccessPoints.contains(path)) { @@ -741,18 +737,18 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path) QMutexLocker locker(&mutex); for (int i = 0; i < accessPoints.count(); ++i) { QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i); - if (accessPoint->connectionInterface()->path() == path) { + if (accessPoint->path() == path) { accessPoints.removeOne(accessPoint); - if (configuredAccessPoints.contains(accessPoint->connectionInterface()->path())) { + if (configuredAccessPoints.contains(accessPoint->path())) { // find connection and change state to Defined - configuredAccessPoints.remove(accessPoint->connectionInterface()->path()); + configuredAccessPoints.remove(accessPoint->path()); for (int i = 0; i < connections.count(); ++i) { QNetworkManagerSettingsConnection *connection = connections.at(i); if (accessPoint->ssid() == connection->getSsid()) {//might not have bssid yet - const QString settingsPath = connection->connectionInterface()->path(); + const QString settingsPath = connection->path(); const QString connectionId = settingsPath; QNetworkConfigurationPrivatePointer ptr = @@ -804,7 +800,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri foreach (const QDBusObjectPath &devicePath, managerInterface->getDevices()) { QNetworkManagerInterfaceDevice device(devicePath.path(),this); if (device.deviceType() == DEVICE_TYPE_ETHERNET) { - QNetworkManagerInterfaceDeviceWired *wiredDevice = wiredDevices.value(device.connectionInterface()->path()); + QNetworkManagerInterfaceDeviceWired *wiredDevice = wiredDevices.value(device.path()); if (wiredDevice->carrier()) { cpPriv->state |= QNetworkConfiguration::Discovered; break; @@ -819,10 +815,10 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri if (connectionSsid == accessPoints.at(i)->ssid() && map.value("802-11-wireless").value("seen-bssids").toStringList().contains(accessPoints.at(i)->hwAddress())) { cpPriv->state |= QNetworkConfiguration::Discovered; - if (!configuredAccessPoints.contains(accessPoints.at(i)->connectionInterface()->path())) { - configuredAccessPoints.insert(accessPoints.at(i)->connectionInterface()->path(),settingsPath); + if (!configuredAccessPoints.contains(accessPoints.at(i)->path())) { + configuredAccessPoints.insert(accessPoints.at(i)->path(),settingsPath); - const QString accessPointId = accessPoints.at(i)->connectionInterface()->path(); + const QString accessPointId = accessPoints.at(i)->path(); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(accessPointId); @@ -881,7 +877,7 @@ QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const { for (int i = 0; i < connections.count(); ++i) { QNetworkManagerSettingsConnection *connection = connections.at(i); - if (id == connection->connectionInterface()->path()) + if (id == connection->path()) return connection; } diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index 9f4ae55e78..16a7e475e0 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -47,32 +47,24 @@ #ifndef QT_NO_DBUS +#define DBUS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties" + QT_BEGIN_NAMESPACE -class QNetworkManagerInterfacePrivate -{ -public: - QDBusInterface *connectionInterface; - bool valid; -}; QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent) - : QObject(parent) -{ - d = new QNetworkManagerInterfacePrivate(); - d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE), - QLatin1String(NM_DBUS_PATH), - QLatin1String(NM_DBUS_INTERFACE), - QDBusConnection::systemBus(),parent); - if (!d->connectionInterface->isValid()) { - d->valid = false; + : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE), + QLatin1String(NM_DBUS_PATH), + NM_DBUS_INTERFACE, + QDBusConnection::systemBus(),parent) +{ + if (!isValid()) { return; } - d->valid = true; - QDBusInterface managerPropertiesInterface(QLatin1String(NM_DBUS_SERVICE), + PropertiesDBusInterface managerPropertiesInterface(QLatin1String(NM_DBUS_SERVICE), QLatin1String(NM_DBUS_PATH), - QLatin1String("org.freedesktop.DBus.Properties"), + DBUS_PROPERTIES_INTERFACE, QDBusConnection::systemBus()); QList argumentList; argumentList << QLatin1String(NM_DBUS_INTERFACE); @@ -81,13 +73,17 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent) argumentList); if (!propsReply.isError()) { propertyMap = propsReply.value(); + } else { + qWarning() << Q_FUNC_INFO << "propsReply"< > nmReply - = d->connectionInterface->call(QLatin1String("GetDevices")); + = call(QLatin1String("GetDevices")); nmReply.waitForFinished(); if (!nmReply.isError()) { devicesPathList = nmReply.value(); + } else { + qWarning() << Q_FUNC_INFO <<"nmReply"<connectionInterface; - delete d; -} - -bool QNetworkManagerInterface::isValid() -{ - return d->valid; } bool QNetworkManagerInterface::setConnections() @@ -138,16 +127,11 @@ bool QNetworkManagerInterface::setConnections() return allOk; } -QDBusInterface *QNetworkManagerInterface::connectionInterface() const -{ - return d->connectionInterface; -} - QList QNetworkManagerInterface::getDevices() { if (devicesPathList.isEmpty()) { //qWarning() << "using blocking call!"; - QDBusReply > reply = d->connectionInterface->call(QLatin1String("GetDevices")); + QDBusReply > reply = call(QLatin1String("GetDevices")); devicesPathList = reply.value(); } return devicesPathList; @@ -157,7 +141,7 @@ void QNetworkManagerInterface::activateConnection(QDBusObjectPath connectionPath QDBusObjectPath devicePath, QDBusObjectPath specificObject) { - QDBusPendingCall pendingCall = d->connectionInterface->asyncCall(QLatin1String("ActivateConnection"), + QDBusPendingCall pendingCall = asyncCall(QLatin1String("ActivateConnection"), QVariant::fromValue(connectionPath), QVariant::fromValue(devicePath), QVariant::fromValue(specificObject)); @@ -167,9 +151,9 @@ void QNetworkManagerInterface::activateConnection(QDBusObjectPath connectionPath this, SIGNAL(activationFinished(QDBusPendingCallWatcher*))); } -void QNetworkManagerInterface::deactivateConnection(QDBusObjectPath connectionPath) const +void QNetworkManagerInterface::deactivateConnection(QDBusObjectPath connectionPath) { - d->connectionInterface->asyncCall(QLatin1String("DeactivateConnection"), QVariant::fromValue(connectionPath)); + asyncCall(QLatin1String("DeactivateConnection"), QVariant::fromValue(connectionPath)); } bool QNetworkManagerInterface::wirelessEnabled() const @@ -245,73 +229,38 @@ void QNetworkManagerInterface::propertiesSwap(QMap map) } } -class QNetworkManagerInterfaceAccessPointPrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; - QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent) - : QObject(parent) -{ - d = new QNetworkManagerInterfaceAccessPointPrivate(); - d->path = dbusPathName; - d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE), - d->path, - QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT), - QDBusConnection::systemBus(),parent); - if (!d->connectionInterface->isValid()) { - d->valid = false; + : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE), + dbusPathName, + NM_DBUS_INTERFACE_ACCESS_POINT, + QDBusConnection::systemBus(),parent) +{ + if (!isValid()) { return; } - QDBusInterface accessPointPropertiesInterface(QLatin1String(NM_DBUS_SERVICE), - d->path, - QLatin1String("org.freedesktop.DBus.Properties"), + PropertiesDBusInterface *accessPointPropertiesInterface = new PropertiesDBusInterface(QLatin1String(NM_DBUS_SERVICE), + dbusPathName, + DBUS_PROPERTIES_INTERFACE, QDBusConnection::systemBus()); QList argumentList; argumentList << QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT); QDBusPendingReply propsReply - = accessPointPropertiesInterface.callWithArgumentList(QDBus::Block,QLatin1String("GetAll"), + = accessPointPropertiesInterface->callWithArgumentList(QDBus::Block,QLatin1String("GetAll"), argumentList); if (!propsReply.isError()) { propertyMap = propsReply.value(); } QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE), - d->path, + dbusPathName, QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT), QLatin1String("PropertiesChanged"), this,SLOT(propertiesSwap(QMap))); - - d->valid = true; - } QNetworkManagerInterfaceAccessPoint::~QNetworkManagerInterfaceAccessPoint() { - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerInterfaceAccessPoint::isValid() -{ - return d->valid; -} - -bool QNetworkManagerInterfaceAccessPoint::setConnections() -{ - if (!isValid()) - return false; - - return true; -} - -QDBusInterface *QNetworkManagerInterfaceAccessPoint::connectionInterface() const -{ - return d->connectionInterface; } quint32 QNetworkManagerInterfaceAccessPoint::flags() const @@ -386,31 +335,19 @@ void QNetworkManagerInterfaceAccessPoint::propertiesSwap(QMap } } -class QNetworkManagerInterfaceDevicePrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; - QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent) - : QObject(parent) + : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE), + deviceObjectPath, + NM_DBUS_INTERFACE_DEVICE, + QDBusConnection::systemBus(),parent) { - d = new QNetworkManagerInterfaceDevicePrivate(); - d->path = deviceObjectPath; - d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE), - d->path, - QLatin1String(NM_DBUS_INTERFACE_DEVICE), - QDBusConnection::systemBus(),parent); - if (!d->connectionInterface->isValid()) { - d->valid = false; + if (!isValid()) { return; } - QDBusInterface devicePropertiesInterface(QLatin1String(NM_DBUS_SERVICE), - d->path, - QLatin1String("org.freedesktop.DBus.Properties"), + PropertiesDBusInterface devicePropertiesInterface(QLatin1String(NM_DBUS_SERVICE), + deviceObjectPath, + DBUS_PROPERTIES_INTERFACE, QDBusConnection::systemBus(),parent); QList argumentList; @@ -424,35 +361,14 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de } QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE), - d->path, + deviceObjectPath, QLatin1String(NM_DBUS_INTERFACE_DEVICE), QLatin1String("PropertiesChanged"), this,SLOT(propertiesSwap(QMap))); - d->valid = true; } QNetworkManagerInterfaceDevice::~QNetworkManagerInterfaceDevice() { - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerInterfaceDevice::isValid() -{ - return d->valid; -} - -bool QNetworkManagerInterfaceDevice::setConnections() -{ - if (!isValid()) - return false; - - return true; -} - -QDBusInterface *QNetworkManagerInterfaceDevice::connectionInterface() const -{ - return d->connectionInterface; } QString QNetworkManagerInterfaceDevice::udi() const @@ -519,31 +435,19 @@ void QNetworkManagerInterfaceDevice::propertiesSwap(QMap map) Q_EMIT propertiesChanged(map); } -class QNetworkManagerInterfaceDeviceWiredPrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; - QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent) - : QObject(parent) -{ - d = new QNetworkManagerInterfaceDeviceWiredPrivate(); - d->path = ifaceDevicePath; - d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE), - d->path, - QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED), - QDBusConnection::systemBus(), parent); - if (!d->connectionInterface->isValid()) { - d->valid = false; + : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE), + ifaceDevicePath, + NM_DBUS_INTERFACE_DEVICE_WIRED, + QDBusConnection::systemBus(), parent) +{ + if (!isValid()) { return; } - QDBusInterface deviceWiredPropertiesInterface(QLatin1String(NM_DBUS_SERVICE), - d->path, - QLatin1String("org.freedesktop.DBus.Properties"), - QDBusConnection::systemBus(),parent); + PropertiesDBusInterface deviceWiredPropertiesInterface(QLatin1String(NM_DBUS_SERVICE), + ifaceDevicePath, + DBUS_PROPERTIES_INTERFACE, + QDBusConnection::systemBus(),parent); QList argumentList; argumentList << QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED); @@ -556,36 +460,14 @@ QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const Q } QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE), - d->path, + ifaceDevicePath, QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED), QLatin1String("PropertiesChanged"), this,SLOT(propertiesSwap(QMap))); - - d->valid = true; } QNetworkManagerInterfaceDeviceWired::~QNetworkManagerInterfaceDeviceWired() { - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerInterfaceDeviceWired::isValid() -{ - - return d->valid; -} - -bool QNetworkManagerInterfaceDeviceWired::setConnections() -{ - if (!isValid()) - return false; - return true; -} - -QDBusInterface *QNetworkManagerInterfaceDeviceWired::connectionInterface() const -{ - return d->connectionInterface; } QString QNetworkManagerInterfaceDeviceWired::hwAddress() const @@ -639,39 +521,27 @@ void QNetworkManagerInterfaceDeviceWired::propertiesSwap(QMap Q_EMIT propertiesChanged(map); } -class QNetworkManagerInterfaceDeviceWirelessPrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; - QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent) - : QObject(parent) -{ - d = new QNetworkManagerInterfaceDeviceWirelessPrivate(); - d->path = ifaceDevicePath; - d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE), - d->path, - QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS), - QDBusConnection::systemBus(), parent); - if (!d->connectionInterface->isValid()) { - d->valid = false; + : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE), + ifaceDevicePath, + NM_DBUS_INTERFACE_DEVICE_WIRELESS, + QDBusConnection::systemBus(), parent) +{ + if (!isValid()) { return; } - + interfacePath = ifaceDevicePath; QDBusPendingReply > nmReply - = d->connectionInterface->call(QLatin1String("GetAccessPoints")); + = call(QLatin1String("GetAccessPoints")); if (!nmReply.isError()) { accessPointsList = nmReply.value(); } - QDBusInterface deviceWirelessPropertiesInterface(QLatin1String(NM_DBUS_SERVICE), - d->path, - QLatin1String("org.freedesktop.DBus.Properties"), + PropertiesDBusInterface deviceWirelessPropertiesInterface(QLatin1String(NM_DBUS_SERVICE), + interfacePath, + DBUS_PROPERTIES_INTERFACE, QDBusConnection::systemBus(),parent); QList argumentList; @@ -684,31 +554,21 @@ QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(c } QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE), - d->path, + interfacePath, QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS), QLatin1String("PropertiesChanged"), this,SLOT(propertiesSwap(QMap))); QDBusPendingReply > reply - = d->connectionInterface->asyncCall(QLatin1String("GetAccessPoints")); + = asyncCall(QLatin1String("GetAccessPoints")); QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(reply); connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(accessPointsFinished(QDBusPendingCallWatcher*))); - - - d->valid = true; } QNetworkManagerInterfaceDeviceWireless::~QNetworkManagerInterfaceDeviceWireless() { - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerInterfaceDeviceWireless::isValid() -{ - return d->valid; } void QNetworkManagerInterfaceDeviceWireless::slotAccessPointAdded(QDBusObjectPath path) @@ -732,16 +592,16 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections() bool allOk = true; if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE), - d->path, - QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS), - QLatin1String("AccessPointAdded"), - this, SLOT(slotAccessPointAdded(QDBusObjectPath)))) { + interfacePath, + QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS), + QLatin1String("AccessPointAdded"), + this, SLOT(slotAccessPointAdded(QDBusObjectPath)))) { allOk = false; } if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE), - d->path, + interfacePath, QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS), QLatin1String("AccessPointRemoved"), this, SLOT(slotAccessPointRemoved(QDBusObjectPath)))) { @@ -749,7 +609,7 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections() } if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE), - d->path, + interfacePath, QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS), QLatin1String("ScanDone"), this, SLOT(scanIsDone()))) { @@ -771,17 +631,12 @@ void QNetworkManagerInterfaceDeviceWireless::accessPointsFinished(QDBusPendingCa } } -QDBusInterface *QNetworkManagerInterfaceDeviceWireless::connectionInterface() const -{ - return d->connectionInterface; -} - QList QNetworkManagerInterfaceDeviceWireless::getAccessPoints() { if (accessPointsList.isEmpty()) { //qWarning() << "Using blocking call!"; QDBusReply > reply - = d->connectionInterface->call(QLatin1String("GetAccessPoints")); + = call(QLatin1String("GetAccessPoints")); accessPointsList = reply.value(); } return accessPointsList; @@ -829,7 +684,7 @@ void QNetworkManagerInterfaceDeviceWireless::scanIsDone() void QNetworkManagerInterfaceDeviceWireless::requestScan() { - d->connectionInterface->asyncCall(QLatin1String("RequestScan")); + asyncCall(QLatin1String("RequestScan")); } void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMap map) @@ -844,29 +699,17 @@ void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMappath = ifaceDevicePath; - d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE), - d->path, - QLatin1String(NM_DBUS_INTERFACE_DEVICE_MODEM), - QDBusConnection::systemBus(), parent); - if (!d->connectionInterface->isValid()) { - d->valid = false; + : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE), + ifaceDevicePath, + NM_DBUS_INTERFACE_DEVICE_MODEM, + QDBusConnection::systemBus(), parent) +{ + if (!isValid()) { return; } - QDBusInterface deviceModemPropertiesInterface(QLatin1String(NM_DBUS_SERVICE), - d->path, + PropertiesDBusInterface deviceModemPropertiesInterface(QLatin1String(NM_DBUS_SERVICE), + ifaceDevicePath, QLatin1String("org.freedesktop.DBus.Properties"), QDBusConnection::systemBus(),parent); @@ -880,36 +723,14 @@ QNetworkManagerInterfaceDeviceModem::QNetworkManagerInterfaceDeviceModem(const Q } QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE), - d->path, + ifaceDevicePath, QLatin1String(NM_DBUS_INTERFACE_DEVICE_MODEM), QLatin1String("PropertiesChanged"), this,SLOT(propertiesSwap(QMap))); - d->valid = true; } QNetworkManagerInterfaceDeviceModem::~QNetworkManagerInterfaceDeviceModem() { - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerInterfaceDeviceModem::isValid() -{ - - return d->valid; -} - -bool QNetworkManagerInterfaceDeviceModem::setConnections() -{ - if (!isValid() ) - return false; - - return true; -} - -QDBusInterface *QNetworkManagerInterfaceDeviceModem::connectionInterface() const -{ - return d->connectionInterface; } QNetworkManagerInterfaceDeviceModem::ModemCapabilities QNetworkManagerInterfaceDeviceModem::modemCapabilities() const @@ -936,59 +757,39 @@ void QNetworkManagerInterfaceDeviceModem::propertiesSwap(QMap Q_EMIT propertiesChanged(map); } -class QNetworkManagerSettingsPrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService, QObject *parent) - : QObject(parent) -{ - d = new QNetworkManagerSettingsPrivate(); - d->path = settingsService; - d->connectionInterface = new QDBusInterface(settingsService, - QLatin1String(NM_DBUS_PATH_SETTINGS), - QLatin1String(NM_DBUS_IFACE_SETTINGS), - QDBusConnection::systemBus()); - if (!d->connectionInterface->isValid()) { - d->valid = false; + : QDBusAbstractInterface(settingsService, + NM_DBUS_PATH_SETTINGS, + NM_DBUS_IFACE_SETTINGS, + QDBusConnection::systemBus(), parent) +{ + if (!isValid()) { return; } - + interfacePath = settingsService; QDBusPendingReply > nmReply - = d->connectionInterface->call(QLatin1String("ListConnections")); + = call(QLatin1String("ListConnections")); if (!nmReply.isError()) { connectionsList = nmReply.value(); } - - d->valid = true; } QNetworkManagerSettings::~QNetworkManagerSettings() { - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerSettings::isValid() -{ - return d->valid; } bool QNetworkManagerSettings::setConnections() { bool allOk = true; - - if (!QDBusConnection::systemBus().connect(d->path, + if (!QDBusConnection::systemBus().connect(interfacePath, QLatin1String(NM_DBUS_PATH_SETTINGS), QLatin1String(NM_DBUS_IFACE_SETTINGS), QLatin1String("NewConnection"), this, SIGNAL(newConnection(QDBusObjectPath)))) { allOk = false; + qWarning() << Q_FUNC_INFO << "NewConnection could not be connected"; } return allOk; @@ -999,7 +800,7 @@ QList QNetworkManagerSettings::listConnections() if (connectionsList.isEmpty()) { //qWarning() << "Using blocking call!"; QDBusReply > reply - = d->connectionInterface->call(QLatin1String("ListConnections")); + = call(QLatin1String("ListConnections")); connectionsList = reply.value(); } return connectionsList; @@ -1010,59 +811,30 @@ QString QNetworkManagerSettings::getConnectionByUuid(const QString &uuid) { QList argumentList; argumentList << QVariant::fromValue(uuid); - QDBusReply reply = d->connectionInterface->callWithArgumentList(QDBus::Block,QLatin1String("GetConnectionByUuid"), argumentList); + QDBusReply reply = callWithArgumentList(QDBus::Block,QLatin1String("GetConnectionByUuid"), argumentList); return reply.value().path(); } -QDBusInterface *QNetworkManagerSettings::connectionInterface() const -{ - return d->connectionInterface; -} - - -class QNetworkManagerSettingsConnectionPrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - QString service; - QNmSettingsMap settingsMap; - bool valid; -}; - QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent) - : QObject(parent) + : QDBusAbstractInterface(settingsService, + connectionObjectPath, + NM_DBUS_IFACE_SETTINGS_CONNECTION, + QDBusConnection::systemBus(), parent) { qDBusRegisterMetaType(); - d = new QNetworkManagerSettingsConnectionPrivate(); - d->path = connectionObjectPath; - d->service = settingsService; - d->connectionInterface = new QDBusInterface(settingsService, - d->path, - QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION), - QDBusConnection::systemBus(), parent); - if (!d->connectionInterface->isValid()) { - d->valid = false; + if (!isValid()) { return; } - d->valid = true; - + interfacepath = connectionObjectPath; QDBusPendingReply nmReply - = d->connectionInterface->call(QLatin1String("GetSettings")); + = call(QLatin1String("GetSettings")); if (!nmReply.isError()) { - d->settingsMap = nmReply.value(); + settingsMap = nmReply.value(); } } QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection() { - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerSettingsConnection::isValid() -{ - return d->valid; } bool QNetworkManagerSettingsConnection::setConnections() @@ -1072,16 +844,16 @@ bool QNetworkManagerSettingsConnection::setConnections() QDBusConnection dbusConnection = QDBusConnection::systemBus(); bool allOk = true; - if (!dbusConnection.connect(d->service, - d->path, + if (!dbusConnection.connect(service(), + interfacepath, QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION), QLatin1String("Updated"), this, SIGNAL(updated()))) { allOk = false; } - if (!dbusConnection.connect(d->service, - d->path, + if (!dbusConnection.connect(service(), + interfacepath, QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION), QLatin1String("Removed"), this, SIGNAL(slotSettingsRemoved()))) { @@ -1092,28 +864,23 @@ bool QNetworkManagerSettingsConnection::setConnections() void QNetworkManagerSettingsConnection::slotSettingsRemoved() { - Q_EMIT removed(d->path); -} - -QDBusInterface *QNetworkManagerSettingsConnection::connectionInterface() const -{ - return d->connectionInterface; + Q_EMIT removed(interfacepath); } QNmSettingsMap QNetworkManagerSettingsConnection::getSettings() { - if (d->settingsMap.isEmpty()) { + if (settingsMap.isEmpty()) { //qWarning() << "Using blocking call!"; - QDBusReply reply = d->connectionInterface->call(QLatin1String("GetSettings")); - d->settingsMap = reply.value(); + QDBusReply reply = call(QLatin1String("GetSettings")); + settingsMap = reply.value(); } - return d->settingsMap; + return settingsMap; } NMDeviceType QNetworkManagerSettingsConnection::getType() { const QString devType = - d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("type")).toString(); + settingsMap.value(QLatin1String("connection")).value(QLatin1String("type")).toString(); if (devType == QLatin1String("802-3-ethernet")) return DEVICE_TYPE_ETHERNET; @@ -1128,7 +895,7 @@ NMDeviceType QNetworkManagerSettingsConnection::getType() bool QNetworkManagerSettingsConnection::isAutoConnect() { const QVariant autoConnect = - d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("autoconnect")); + settingsMap.value(QLatin1String("connection")).value(QLatin1String("autoconnect")); // NetworkManager default is to auto connect if (!autoConnect.isValid()) @@ -1139,27 +906,27 @@ bool QNetworkManagerSettingsConnection::isAutoConnect() quint64 QNetworkManagerSettingsConnection::getTimestamp() { - return d->settingsMap.value(QLatin1String("connection")) + return settingsMap.value(QLatin1String("connection")) .value(QLatin1String("timestamp")).toUInt(); } QString QNetworkManagerSettingsConnection::getId() { - return d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("id")).toString(); + return settingsMap.value(QLatin1String("connection")).value(QLatin1String("id")).toString(); } QString QNetworkManagerSettingsConnection::getUuid() { - const QString id = d->settingsMap.value(QLatin1String("connection")) + const QString id = settingsMap.value(QLatin1String("connection")) .value(QLatin1String("uuid")).toString(); // is no uuid, return the connection path - return id.isEmpty() ? d->connectionInterface->path() : id; + return id.isEmpty() ? path() : id; } QString QNetworkManagerSettingsConnection::getSsid() { - return d->settingsMap.value(QLatin1String("802-11-wireless")) + return settingsMap.value(QLatin1String("802-11-wireless")) .value(QLatin1String("ssid")).toString(); } @@ -1168,10 +935,10 @@ QString QNetworkManagerSettingsConnection::getMacAddress() NMDeviceType type = getType(); if (type == DEVICE_TYPE_ETHERNET) { - return d->settingsMap.value(QLatin1String("802-3-ethernet")) + return settingsMap.value(QLatin1String("802-3-ethernet")) .value(QLatin1String("mac-address")).toString(); } else if (type == DEVICE_TYPE_WIFI) { - return d->settingsMap.value(QLatin1String("802-11-wireless")) + return settingsMap.value(QLatin1String("802-11-wireless")) .value(QLatin1String("mac-address")).toString(); } else { return QString(); @@ -1181,36 +948,24 @@ QString QNetworkManagerSettingsConnection::getMacAddress() QStringList QNetworkManagerSettingsConnection::getSeenBssids() { if (getType() == DEVICE_TYPE_WIFI) { - return d->settingsMap.value(QLatin1String("802-11-wireless")) + return settingsMap.value(QLatin1String("802-11-wireless")) .value(QLatin1String("seen-bssids")).toStringList(); } else { return QStringList(); } } -class QNetworkManagerConnectionActivePrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; - QNetworkManagerConnectionActive::QNetworkManagerConnectionActive(const QString &activeConnectionObjectPath, QObject *parent) - : QObject(parent) -{ - d = new QNetworkManagerConnectionActivePrivate(); - d->path = activeConnectionObjectPath; - d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE), - d->path, - QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION), - QDBusConnection::systemBus(), parent); - if (!d->connectionInterface->isValid()) { - d->valid = false; + : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE), + activeConnectionObjectPath, + NM_DBUS_INTERFACE_ACTIVE_CONNECTION, + QDBusConnection::systemBus(), parent) +{ + if (!isValid()) { return; } - QDBusInterface connectionActivePropertiesInterface(QLatin1String(NM_DBUS_SERVICE), - d->path, + PropertiesDBusInterface connectionActivePropertiesInterface(QLatin1String(NM_DBUS_SERVICE), + activeConnectionObjectPath, QLatin1String("org.freedesktop.DBus.Properties"), QDBusConnection::systemBus()); @@ -1228,35 +983,14 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive(const QString & } QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE), - d->path, + activeConnectionObjectPath, QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION), QLatin1String("PropertiesChanged"), this,SLOT(propertiesSwap(QMap))); - d->valid = true; } QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive() { - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerConnectionActive::isValid() -{ - return d->valid; -} - -bool QNetworkManagerConnectionActive::setConnections() -{ - if (!isValid()) - return false; - - return true; -} - -QDBusInterface *QNetworkManagerConnectionActive::connectionInterface() const -{ - return d->connectionInterface; } QDBusObjectPath QNetworkManagerConnectionActive::connection() const @@ -1327,44 +1061,24 @@ void QNetworkManagerConnectionActive::propertiesSwap(QMap map) } } -class QNetworkManagerIp4ConfigPrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; - QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectPath, QObject *parent) - : QObject(parent) -{ - d = new QNetworkManagerIp4ConfigPrivate(); - d->path = deviceObjectPath; - d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE), - d->path, - QLatin1String(NM_DBUS_INTERFACE_IP4_CONFIG), - QDBusConnection::systemBus(), parent); - if (!d->connectionInterface->isValid()) { - d->valid = false; + : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE), + deviceObjectPath, + NM_DBUS_INTERFACE_IP4_CONFIG, + QDBusConnection::systemBus(), parent) +{ + if (!isValid()) { return; } - d->valid = true; } QNetworkManagerIp4Config::~QNetworkManagerIp4Config() { - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerIp4Config::isValid() -{ - return d->valid; } QStringList QNetworkManagerIp4Config::domains() const { - return d->connectionInterface->property("Domains").toStringList(); + return property("Domains").toStringList(); } QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h index e645159d71..f945532603 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h @@ -55,6 +55,7 @@ #include #include #include +#include #include #ifndef QT_NO_DBUS @@ -128,8 +129,7 @@ Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(ServerThing)) QT_BEGIN_NAMESPACE -class QNetworkManagerInterfacePrivate; -class QNetworkManagerInterface : public QObject +class QNetworkManagerInterface : public QDBusAbstractInterface { Q_OBJECT @@ -151,10 +151,9 @@ public: QList getDevices(); void activateConnection(QDBusObjectPath connection,QDBusObjectPath device, QDBusObjectPath specificObject); - void deactivateConnection(QDBusObjectPath connectionPath) const; + void deactivateConnection(QDBusObjectPath connectionPath); QDBusObjectPath path() const; - QDBusInterface *connectionInterface() const; bool wirelessEnabled() const; bool wirelessHardwareEnabled() const; @@ -162,7 +161,6 @@ public: NMState state(); QString version() const; bool setConnections(); - bool isValid(); Q_SIGNALS: void deviceAdded(QDBusObjectPath); @@ -177,14 +175,12 @@ private Q_SLOTS: void propertiesSwap(QMap); private: - QNetworkManagerInterfacePrivate *d; QVariantMap propertyMap; QList devicesPathList; }; -class QNetworkManagerInterfaceAccessPointPrivate; -class QNetworkManagerInterfaceAccessPoint : public QObject +class QNetworkManagerInterfaceAccessPoint : public QDBusAbstractInterface { Q_OBJECT @@ -229,8 +225,6 @@ public: explicit QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = 0); ~QNetworkManagerInterfaceAccessPoint(); - QDBusInterface *connectionInterface() const; - quint32 flags() const; quint32 wpaFlags() const; quint32 rsnFlags() const; @@ -240,8 +234,7 @@ public: quint32 mode() const; quint32 maxBitrate() const; quint32 strength() const; - bool setConnections(); - bool isValid(); + // bool setConnections(); Q_SIGNALS: void propertiesChanged(QMap ); @@ -251,12 +244,10 @@ private Q_SLOTS: void propertiesSwap(QMap); private: - QNetworkManagerInterfaceAccessPointPrivate *d; QVariantMap propertyMap; }; -class QNetworkManagerInterfaceDevicePrivate; -class QNetworkManagerInterfaceDevice : public QObject +class QNetworkManagerInterfaceDevice : public QDBusAbstractInterface { Q_OBJECT @@ -267,14 +258,11 @@ public: QString udi() const; QString networkInterface() const; - QDBusInterface *connectionInterface() const; quint32 ip4Address() const; quint32 state() const; quint32 deviceType() const; QDBusObjectPath ip4config() const; - bool setConnections(); - bool isValid(); Q_SIGNALS: void stateChanged(const QString &, quint32); @@ -284,12 +272,10 @@ Q_SIGNALS: private Q_SLOTS: void propertiesSwap(QMap); private: - QNetworkManagerInterfaceDevicePrivate *d; QVariantMap propertyMap; }; -class QNetworkManagerInterfaceDeviceWiredPrivate; -class QNetworkManagerInterfaceDeviceWired : public QObject +class QNetworkManagerInterfaceDeviceWired : public QDBusAbstractInterface { Q_OBJECT @@ -299,12 +285,9 @@ public: QObject *parent = 0); ~QNetworkManagerInterfaceDeviceWired(); - QDBusInterface *connectionInterface() const; QString hwAddress() const; quint32 speed() const; bool carrier() const; - bool setConnections(); - bool isValid(); QStringList availableConnections(); Q_SIGNALS: @@ -316,12 +299,10 @@ private Q_SLOTS: void propertiesSwap(QMap); private: - QNetworkManagerInterfaceDeviceWiredPrivate *d; QVariantMap propertyMap; }; -class QNetworkManagerInterfaceDeviceWirelessPrivate; -class QNetworkManagerInterfaceDeviceWireless : public QObject +class QNetworkManagerInterfaceDeviceWireless : public QDBusAbstractInterface { Q_OBJECT @@ -343,7 +324,6 @@ public: QDBusObjectPath path() const; QList getAccessPoints(); - QDBusInterface *connectionInterface() const; QString hwAddress() const; quint32 mode() const; @@ -351,7 +331,6 @@ public: QDBusObjectPath activeAccessPoint() const; quint32 wirelessCapabilities() const; bool setConnections(); - bool isValid(); void requestScan(); Q_SIGNALS: @@ -372,13 +351,12 @@ private Q_SLOTS: void accessPointsFinished(QDBusPendingCallWatcher *watcher); private: - QNetworkManagerInterfaceDeviceWirelessPrivate *d; QVariantMap propertyMap; QList accessPointsList; + QString interfacePath; }; -class QNetworkManagerInterfaceDeviceModemPrivate; -class QNetworkManagerInterfaceDeviceModem : public QObject +class QNetworkManagerInterfaceDeviceModem : public QDBusAbstractInterface { Q_OBJECT @@ -397,12 +375,6 @@ public: QObject *parent = 0); ~QNetworkManagerInterfaceDeviceModem(); - QDBusObjectPath path() const; - QDBusInterface *connectionInterface() const; - - bool setConnections(); - bool isValid(); - ModemCapabilities modemCapabilities() const; ModemCapabilities currentCapabilities() const; @@ -414,14 +386,12 @@ private Q_SLOTS: void propertiesSwap(QMap); private: - QNetworkManagerInterfaceDeviceModemPrivate *d; QVariantMap propertyMap; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkManagerInterfaceDeviceModem::ModemCapabilities) -class QNetworkManagerSettingsPrivate; -class QNetworkManagerSettings : public QObject +class QNetworkManagerSettings : public QDBusAbstractInterface { Q_OBJECT @@ -430,22 +400,19 @@ public: explicit QNetworkManagerSettings(const QString &settingsService, QObject *parent = 0); ~QNetworkManagerSettings(); - QDBusInterface *connectionInterface() const; QList listConnections(); QString getConnectionByUuid(const QString &uuid); bool setConnections(); - bool isValid(); Q_SIGNALS: void newConnection(QDBusObjectPath); void connectionsListReady(); private: - QNetworkManagerSettingsPrivate *d; QList connectionsList; + QString interfacePath; }; -class QNetworkManagerSettingsConnectionPrivate; -class QNetworkManagerSettingsConnection : public QObject +class QNetworkManagerSettingsConnection : public QDBusAbstractInterface { Q_OBJECT @@ -454,7 +421,6 @@ public: QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent = 0); ~QNetworkManagerSettingsConnection(); - QDBusInterface *connectionInterface() const; QNmSettingsMap getSettings(); bool setConnections(); NMDeviceType getType(); @@ -465,7 +431,6 @@ public: QString getSsid(); QString getMacAddress(); QStringList getSeenBssids(); - bool isValid(); Q_SIGNALS: void updated(); @@ -474,13 +439,12 @@ Q_SIGNALS: private Q_SLOTS: void slotSettingsRemoved(); - private: - QNetworkManagerSettingsConnectionPrivate *d; + QNmSettingsMap settingsMap; + QString interfacepath; }; -class QNetworkManagerConnectionActivePrivate; -class QNetworkManagerConnectionActive : public QObject +class QNetworkManagerConnectionActive : public QDBusAbstractInterface { Q_OBJECT @@ -495,15 +459,12 @@ public: explicit QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = 0); ~ QNetworkManagerConnectionActive(); - QDBusInterface *connectionInterface() const; QDBusObjectPath connection() const; QDBusObjectPath specificObject() const; QStringList devices() const; quint32 state() const; bool defaultRoute() const; bool default6Route() const; - bool setConnections(); - bool isValid(); Q_SIGNALS: @@ -514,12 +475,10 @@ private Q_SLOTS: void propertiesSwap(QMap); private: - QNetworkManagerConnectionActivePrivate *d; QVariantMap propertyMap; }; -class QNetworkManagerIp4ConfigPrivate; -class QNetworkManagerIp4Config : public QObject +class QNetworkManagerIp4Config : public QDBusAbstractInterface { Q_OBJECT @@ -528,10 +487,17 @@ public: ~QNetworkManagerIp4Config(); QStringList domains() const; - bool isValid(); +}; - private: - QNetworkManagerIp4ConfigPrivate *d; +class PropertiesDBusInterface : public QDBusAbstractInterface +{ +public: + PropertiesDBusInterface(const QString &service, const QString &path, + const QString &interface, const QDBusConnection &connection, + QObject *parent = 0) + : QDBusAbstractInterface(service, path, interface.toLatin1().data(), connection, parent) + {} + ~PropertiesDBusInterface() = default; }; QT_END_NAMESPACE -- cgit v1.2.3 From da6a706eb31f1505edfaeefefc1adfb65ea6d893 Mon Sep 17 00:00:00 2001 From: Ashish Kulkarni Date: Sun, 21 Dec 2014 06:36:24 +0530 Subject: fix error when cross-compiling with --system-zlib This is broken since 1f461ac45bfa8887261510a95fb33a346d68eaba, where Z_PREFIX was defined to namespace the bundled zlib symbols. The bundled zlib is used by bootstrap.pro when cross-compiling which uses the namespaced symbols. This breaks linking of rcc when --system-zlib is used, as it will try to link to compress2 instead of z_compress2. To fix this, the aliases are pulled in via zconf.h and the bundled zlib is prepended to the INCLUDEPATH (i.e. before the system zlib). Change-Id: Iec76cbdead40f888e2ac6a887ec8f3b7bc7db501 Reviewed-by: Oswald Buddenhagen --- src/3rdparty/zlib.pri | 2 +- src/corelib/tools/qbytearray.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/zlib.pri b/src/3rdparty/zlib.pri index a7073d5c3a..868d1c71bb 100644 --- a/src/3rdparty/zlib.pri +++ b/src/3rdparty/zlib.pri @@ -1,5 +1,5 @@ wince*: DEFINES += NO_ERRNO_H -INCLUDEPATH += $$PWD/zlib +INCLUDEPATH = $$PWD/zlib $$INCLUDEPATH SOURCES+= \ $$PWD/zlib/adler32.c \ $$PWD/zlib/compress.c \ diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index d8b2efbef3..a3c1cc3907 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -43,6 +43,7 @@ #include #ifndef QT_NO_COMPRESS +#include #include #endif #include -- cgit v1.2.3 From 05b96ae5d7f4c42bce5b82a68139eb1f90bf1e10 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 6 Jan 2015 14:05:40 +0100 Subject: iOS: bump QMAKE_IOS_DEPLOYMENT_TARGET to 5.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AppStore validation requires deployment target to be at least 5.1.1 for 64-bit applications. Change-Id: I4d857ad983e6d4059f541bff523dd63479aca849 Reviewed-by: Tor Arne Vestbø --- mkspecs/macx-ios-clang/qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/macx-ios-clang/qmake.conf b/mkspecs/macx-ios-clang/qmake.conf index 0c083edf80..0dd761760c 100644 --- a/mkspecs/macx-ios-clang/qmake.conf +++ b/mkspecs/macx-ios-clang/qmake.conf @@ -7,7 +7,7 @@ CONFIG += app_bundle reduce_exports incremental global_init_link QMAKE_INCREMENTAL_STYLE = sublib QMAKE_MACOSX_DEPLOYMENT_TARGET = -QMAKE_IOS_DEPLOYMENT_TARGET = 5.0 +QMAKE_IOS_DEPLOYMENT_TARGET = 5.1.1 INCLUDEPATH += $$PWD/ios DEFINES += DARWIN_NO_CARBON QT_NO_PRINTER QT_NO_PRINTDIALOG -- cgit v1.2.3 From 57949b5f2d1434fd935b94331dcf97a81663d6db Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 8 Jan 2015 09:57:10 +0200 Subject: Android: Fix qimagewriter test. We must add all test data to resources. Write output data into a writable location. Change-Id: I5a1c212f6108abf2a82288a2c84cfb31eda5e101 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/gui/image/qimagewriter/qimagewriter.pro | 2 +- tests/auto/gui/image/qimagewriter/qimagewriter.qrc | 16 ++++++++++++ .../gui/image/qimagewriter/tst_qimagewriter.cpp | 30 +++++++++++++--------- 3 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 tests/auto/gui/image/qimagewriter/qimagewriter.qrc diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.pro b/tests/auto/gui/image/qimagewriter/qimagewriter.pro index f77ff0659b..ce6707ec92 100644 --- a/tests/auto/gui/image/qimagewriter/qimagewriter.pro +++ b/tests/auto/gui/image/qimagewriter/qimagewriter.pro @@ -5,5 +5,5 @@ SOURCES += tst_qimagewriter.cpp MOC_DIR=tmp win32-msvc:QMAKE_CXXFLAGS -= -Zm200 win32-msvc:QMAKE_CXXFLAGS += -Zm800 - +android:!android-no-sdk:RESOURCES+= qimagewriter.qrc TESTDATA += images/* diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.qrc b/tests/auto/gui/image/qimagewriter/qimagewriter.qrc new file mode 100644 index 0000000000..29b036e303 --- /dev/null +++ b/tests/auto/gui/image/qimagewriter/qimagewriter.qrc @@ -0,0 +1,16 @@ + + + images/beavis.jpg + images/colorful.bmp + images/earth.gif + images/font.bmp + images/gnus.xbm + images/kollada.png + images/marble.xpm + images/ship63.pbm + images/teapot.ppm + images/trolltech.gif + images/YCbCr_cmyk.jpg + images/YCbCr_rgb.jpg + + diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index 7e826310a1..f1045a8cf7 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -90,6 +90,7 @@ private slots: void saveToTemporaryFile(); private: QString prefix; + QString writePrefix; }; // helper to skip an autotest when the given image format is not supported @@ -114,6 +115,11 @@ void tst_QImageWriter::initTestCase() prefix = QFINDTESTDATA("images/"); if (prefix.isEmpty()) QFAIL("Can't find images directory!"); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + writePrefix = QDir::homePath(); +#else + writePrefix = prefix; +#endif } // Testing get/set functions @@ -212,7 +218,7 @@ void tst_QImageWriter::writeImage() QVERIFY2(!image.isNull(), qPrintable(reader.errorString())); } { - QImageWriter writer(prefix + "gen-" + fileName, format); + QImageWriter writer(writePrefix + "gen-" + fileName, format); QVERIFY(writer.write(image)); } @@ -224,11 +230,11 @@ void tst_QImageWriter::writeImage() #endif if (!skip) { // Shouldn't be able to write to read-only file - QFile sourceFile(prefix + "gen-" + fileName); + QFile sourceFile(writePrefix + "gen-" + fileName); QFile::Permissions permissions = sourceFile.permissions(); QVERIFY(sourceFile.setPermissions(QFile::ReadOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther)); - QImageWriter writer(prefix + "gen-" + fileName, format); + QImageWriter writer(writePrefix + "gen-" + fileName, format); QVERIFY(!writer.write(image)); QVERIFY(sourceFile.setPermissions(permissions)); @@ -237,7 +243,7 @@ void tst_QImageWriter::writeImage() QImage image2; { - QImageReader reader(prefix + "gen-" + fileName); + QImageReader reader(writePrefix + "gen-" + fileName); image2 = reader.read(); QVERIFY(!image2.isNull()); } @@ -456,7 +462,7 @@ void tst_QImageWriter::supportsOption() << QImageIOHandler::Animation << QImageIOHandler::BackgroundColor; - QImageWriter writer(prefix + fileName); + QImageWriter writer(writePrefix + fileName); for (int i = 0; i < options.size(); ++i) { QVERIFY(writer.supportsOption(QImageIOHandler::ImageOption(options.at(i)))); allOptions.remove(QImageIOHandler::ImageOption(options.at(i))); @@ -472,13 +478,13 @@ void tst_QImageWriter::saveWithNoFormat_data() QTest::addColumn("format"); QTest::addColumn("error"); - QTest::newRow("garble") << prefix + QString("gen-out.garble") << QByteArray("jpeg") << QImageWriter::UnsupportedFormatError; - QTest::newRow("bmp") << prefix + QString("gen-out.bmp") << QByteArray("bmp") << QImageWriter::ImageWriterError(0); - QTest::newRow("xbm") << prefix + QString("gen-out.xbm") << QByteArray("xbm") << QImageWriter::ImageWriterError(0); - QTest::newRow("xpm") << prefix + QString("gen-out.xpm") << QByteArray("xpm") << QImageWriter::ImageWriterError(0); - QTest::newRow("png") << prefix + QString("gen-out.png") << QByteArray("png") << QImageWriter::ImageWriterError(0); - QTest::newRow("ppm") << prefix + QString("gen-out.ppm") << QByteArray("ppm") << QImageWriter::ImageWriterError(0); - QTest::newRow("pbm") << prefix + QString("gen-out.pbm") << QByteArray("pbm") << QImageWriter::ImageWriterError(0); + QTest::newRow("garble") << writePrefix + QString("gen-out.garble") << QByteArray("jpeg") << QImageWriter::UnsupportedFormatError; + QTest::newRow("bmp") << writePrefix + QString("gen-out.bmp") << QByteArray("bmp") << QImageWriter::ImageWriterError(0); + QTest::newRow("xbm") << writePrefix + QString("gen-out.xbm") << QByteArray("xbm") << QImageWriter::ImageWriterError(0); + QTest::newRow("xpm") << writePrefix + QString("gen-out.xpm") << QByteArray("xpm") << QImageWriter::ImageWriterError(0); + QTest::newRow("png") << writePrefix + QString("gen-out.png") << QByteArray("png") << QImageWriter::ImageWriterError(0); + QTest::newRow("ppm") << writePrefix + QString("gen-out.ppm") << QByteArray("ppm") << QImageWriter::ImageWriterError(0); + QTest::newRow("pbm") << writePrefix + QString("gen-out.pbm") << QByteArray("pbm") << QImageWriter::ImageWriterError(0); } void tst_QImageWriter::saveWithNoFormat() -- cgit v1.2.3 From 954d355fbcf901587a4dd177fe176cc2131ec4a0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 6 Jan 2015 15:53:03 +0100 Subject: Android: Fix QPainter autotest The testdata needs to be in a qrc to be available on Android. Note that a single test will still fail. Since this requires a platform-independent fix, it will be committed separately. Change-Id: Ib2438a3298d81d77b7f4f240ef045aa0500d8382 Reviewed-by: BogDan Vatra --- tests/auto/gui/painting/qpainter/qpainter.pro | 5 + tests/auto/gui/painting/qpainter/testdata.qrc | 186 ++++++++++++++++++++++++++ 2 files changed, 191 insertions(+) create mode 100644 tests/auto/gui/painting/qpainter/testdata.qrc diff --git a/tests/auto/gui/painting/qpainter/qpainter.pro b/tests/auto/gui/painting/qpainter/qpainter.pro index 752f9be1f4..7e9d438e1b 100644 --- a/tests/auto/gui/painting/qpainter/qpainter.pro +++ b/tests/auto/gui/painting/qpainter/qpainter.pro @@ -10,3 +10,8 @@ SOURCES += tst_qpainter.cpp TESTDATA += drawEllipse/* drawLine_rop_bitmap/* drawPixmap_rop/* drawPixmap_rop_bitmap/* \ task217400.png DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/gui/painting/qpainter/testdata.qrc b/tests/auto/gui/painting/qpainter/testdata.qrc new file mode 100644 index 0000000000..a7b8c222e5 --- /dev/null +++ b/tests/auto/gui/painting/qpainter/testdata.qrc @@ -0,0 +1,186 @@ + + + task217400.png + drawEllipse/10x10SizeAt0x0.png + drawEllipse/10x10SizeAt100x100.png + drawEllipse/10x10SizeAt200x200.png + drawEllipse/13x100SizeAt0x0.png + drawEllipse/13x100SizeAt100x100.png + drawEllipse/13x100SizeAt200x200.png + drawEllipse/200x200SizeAt0x0.png + drawEllipse/200x200SizeAt100x100.png + drawEllipse/200x200SizeAt200x200.png + drawLine_rop_bitmap/dst.xbm + drawLine_rop_bitmap/res/res_AndNotROP.xbm + drawLine_rop_bitmap/res/res_AndROP.xbm + drawLine_rop_bitmap/res/res_ClearROP.xbm + drawLine_rop_bitmap/res/res_CopyROP.xbm + drawLine_rop_bitmap/res/res_NandROP.xbm + drawLine_rop_bitmap/res/res_NopROP.xbm + drawLine_rop_bitmap/res/res_NorROP.xbm + drawLine_rop_bitmap/res/res_NotAndROP.xbm + drawLine_rop_bitmap/res/res_NotCopyROP.xbm + drawLine_rop_bitmap/res/res_NotOrROP.xbm + drawLine_rop_bitmap/res/res_NotROP.xbm + drawLine_rop_bitmap/res/res_NotXorROP.xbm + drawLine_rop_bitmap/res/res_OrNotROP.xbm + drawLine_rop_bitmap/res/res_OrROP.xbm + drawLine_rop_bitmap/res/res_SetROP.xbm + drawLine_rop_bitmap/res/res_XorROP.xbm + drawPixmap_rop/dst1.png + drawPixmap_rop/dst2.png + drawPixmap_rop/dst3.png + drawPixmap_rop/src1.xbm + drawPixmap_rop/src2-mask.xbm + drawPixmap_rop/src2.xbm + drawPixmap_rop/src3.xbm + drawPixmap_rop/res/res_AndNotROP0.png + drawPixmap_rop/res/res_AndNotROP1.png + drawPixmap_rop/res/res_AndNotROP2.png + drawPixmap_rop/res/res_AndNotROP3.png + drawPixmap_rop/res/res_AndNotROP4.png + drawPixmap_rop/res/res_AndNotROP5.png + drawPixmap_rop/res/res_AndNotROP6.png + drawPixmap_rop/res/res_AndNotROP7.png + drawPixmap_rop/res/res_AndROP0.png + drawPixmap_rop/res/res_AndROP1.png + drawPixmap_rop/res/res_AndROP2.png + drawPixmap_rop/res/res_AndROP3.png + drawPixmap_rop/res/res_AndROP4.png + drawPixmap_rop/res/res_AndROP5.png + drawPixmap_rop/res/res_AndROP6.png + drawPixmap_rop/res/res_AndROP7.png + drawPixmap_rop/res/res_ClearROP0.png + drawPixmap_rop/res/res_ClearROP1.png + drawPixmap_rop/res/res_ClearROP2.png + drawPixmap_rop/res/res_ClearROP3.png + drawPixmap_rop/res/res_ClearROP4.png + drawPixmap_rop/res/res_ClearROP5.png + drawPixmap_rop/res/res_ClearROP6.png + drawPixmap_rop/res/res_ClearROP7.png + drawPixmap_rop/res/res_CopyROP0.png + drawPixmap_rop/res/res_CopyROP1.png + drawPixmap_rop/res/res_CopyROP2.png + drawPixmap_rop/res/res_CopyROP3.png + drawPixmap_rop/res/res_CopyROP4.png + drawPixmap_rop/res/res_CopyROP5.png + drawPixmap_rop/res/res_CopyROP6.png + drawPixmap_rop/res/res_CopyROP7.png + drawPixmap_rop/res/res_NandROP0.png + drawPixmap_rop/res/res_NandROP1.png + drawPixmap_rop/res/res_NandROP2.png + drawPixmap_rop/res/res_NandROP3.png + drawPixmap_rop/res/res_NandROP4.png + drawPixmap_rop/res/res_NandROP5.png + drawPixmap_rop/res/res_NandROP6.png + drawPixmap_rop/res/res_NandROP7.png + drawPixmap_rop/res/res_NopROP0.png + drawPixmap_rop/res/res_NopROP1.png + drawPixmap_rop/res/res_NopROP2.png + drawPixmap_rop/res/res_NopROP3.png + drawPixmap_rop/res/res_NopROP4.png + drawPixmap_rop/res/res_NopROP5.png + drawPixmap_rop/res/res_NopROP6.png + drawPixmap_rop/res/res_NopROP7.png + drawPixmap_rop/res/res_NorROP0.png + drawPixmap_rop/res/res_NorROP1.png + drawPixmap_rop/res/res_NorROP2.png + drawPixmap_rop/res/res_NorROP3.png + drawPixmap_rop/res/res_NorROP4.png + drawPixmap_rop/res/res_NorROP5.png + drawPixmap_rop/res/res_NorROP6.png + drawPixmap_rop/res/res_NorROP7.png + drawPixmap_rop/res/res_NotAndROP0.png + drawPixmap_rop/res/res_NotAndROP1.png + drawPixmap_rop/res/res_NotAndROP2.png + drawPixmap_rop/res/res_NotAndROP3.png + drawPixmap_rop/res/res_NotAndROP4.png + drawPixmap_rop/res/res_NotAndROP5.png + drawPixmap_rop/res/res_NotAndROP6.png + drawPixmap_rop/res/res_NotAndROP7.png + drawPixmap_rop/res/res_NotCopyROP0.png + drawPixmap_rop/res/res_NotCopyROP1.png + drawPixmap_rop/res/res_NotCopyROP2.png + drawPixmap_rop/res/res_NotCopyROP3.png + drawPixmap_rop/res/res_NotCopyROP4.png + drawPixmap_rop/res/res_NotCopyROP5.png + drawPixmap_rop/res/res_NotCopyROP6.png + drawPixmap_rop/res/res_NotCopyROP7.png + drawPixmap_rop/res/res_NotOrROP0.png + drawPixmap_rop/res/res_NotOrROP1.png + drawPixmap_rop/res/res_NotOrROP2.png + drawPixmap_rop/res/res_NotOrROP3.png + drawPixmap_rop/res/res_NotOrROP4.png + drawPixmap_rop/res/res_NotOrROP5.png + drawPixmap_rop/res/res_NotOrROP6.png + drawPixmap_rop/res/res_NotOrROP7.png + drawPixmap_rop/res/res_NotROP0.png + drawPixmap_rop/res/res_NotROP1.png + drawPixmap_rop/res/res_NotROP2.png + drawPixmap_rop/res/res_NotROP3.png + drawPixmap_rop/res/res_NotROP4.png + drawPixmap_rop/res/res_NotROP5.png + drawPixmap_rop/res/res_NotROP6.png + drawPixmap_rop/res/res_NotROP7.png + drawPixmap_rop/res/res_NotXorROP0.png + drawPixmap_rop/res/res_NotXorROP1.png + drawPixmap_rop/res/res_NotXorROP2.png + drawPixmap_rop/res/res_NotXorROP3.png + drawPixmap_rop/res/res_NotXorROP4.png + drawPixmap_rop/res/res_NotXorROP5.png + drawPixmap_rop/res/res_NotXorROP6.png + drawPixmap_rop/res/res_NotXorROP7.png + drawPixmap_rop/res/res_OrNotROP0.png + drawPixmap_rop/res/res_OrNotROP1.png + drawPixmap_rop/res/res_OrNotROP2.png + drawPixmap_rop/res/res_OrNotROP3.png + drawPixmap_rop/res/res_OrNotROP4.png + drawPixmap_rop/res/res_OrNotROP5.png + drawPixmap_rop/res/res_OrNotROP6.png + drawPixmap_rop/res/res_OrNotROP7.png + drawPixmap_rop/res/res_OrROP0.png + drawPixmap_rop/res/res_OrROP1.png + drawPixmap_rop/res/res_OrROP2.png + drawPixmap_rop/res/res_OrROP3.png + drawPixmap_rop/res/res_OrROP4.png + drawPixmap_rop/res/res_OrROP5.png + drawPixmap_rop/res/res_OrROP6.png + drawPixmap_rop/res/res_OrROP7.png + drawPixmap_rop/res/res_SetROP0.png + drawPixmap_rop/res/res_SetROP1.png + drawPixmap_rop/res/res_SetROP2.png + drawPixmap_rop/res/res_SetROP3.png + drawPixmap_rop/res/res_SetROP4.png + drawPixmap_rop/res/res_SetROP5.png + drawPixmap_rop/res/res_SetROP6.png + drawPixmap_rop/res/res_SetROP7.png + drawPixmap_rop/res/res_XorROP0.png + drawPixmap_rop/res/res_XorROP1.png + drawPixmap_rop/res/res_XorROP2.png + drawPixmap_rop/res/res_XorROP3.png + drawPixmap_rop/res/res_XorROP4.png + drawPixmap_rop/res/res_XorROP5.png + drawPixmap_rop/res/res_XorROP6.png + drawPixmap_rop/res/res_XorROP7.png + drawPixmap_rop_bitmap/dst.xbm + drawPixmap_rop_bitmap/src1-mask.xbm + drawPixmap_rop_bitmap/src1.xbm + drawPixmap_rop_bitmap/src2.xbm + drawPixmap_rop_bitmap/res/res_AndNotROP.xbm + drawPixmap_rop_bitmap/res/res_AndROP.xbm + drawPixmap_rop_bitmap/res/res_ClearROP.xbm + drawPixmap_rop_bitmap/res/res_CopyROP.xbm + drawPixmap_rop_bitmap/res/res_NandROP.xbm + drawPixmap_rop_bitmap/res/res_NopROP.xbm + drawPixmap_rop_bitmap/res/res_NorROP.xbm + drawPixmap_rop_bitmap/res/res_NotAndROP.xbm + drawPixmap_rop_bitmap/res/res_NotCopyROP.xbm + drawPixmap_rop_bitmap/res/res_NotOrROP.xbm + drawPixmap_rop_bitmap/res/res_NotROP.xbm + drawPixmap_rop_bitmap/res/res_NotXorROP.xbm + drawPixmap_rop_bitmap/res/res_OrNotROP.xbm + drawPixmap_rop_bitmap/res/res_OrROP.xbm + drawPixmap_rop_bitmap/res/res_SetROP.xbm + drawPixmap_rop_bitmap/res/res_XorROP.xbm + + -- cgit v1.2.3 From 7ad75cd8ef7e95bba3cfc694b7baffbc445bd2b0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 19 Dec 2014 14:34:46 +0100 Subject: Android: Fix QTemporaryFile tests Fixed a few instances of files that should be deployed to the file system. The way we do this on Android is via qrc. We also need a special case for the resources/test.txt, because QFINDTESTDATA will find this in qrc, but that's not the one we are looking for. Change-Id: I7097e8b7795b3a8fd483adad090208f295478412 Reviewed-by: BogDan Vatra --- .../corelib/io/qtemporaryfile/android_testdata.qrc | 6 +++ .../corelib/io/qtemporaryfile/qtemporaryfile.pro | 6 ++- .../io/qtemporaryfile/tst_qtemporaryfile.cpp | 45 ++++++++++++++++++---- 3 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc diff --git a/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc b/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc new file mode 100644 index 0000000000..f30290c262 --- /dev/null +++ b/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc @@ -0,0 +1,6 @@ + + + tst_qtemporaryfile.cpp + resources/test.txt + + diff --git a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro index 8a91340e5f..c16a729ad0 100644 --- a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro @@ -5,4 +5,8 @@ QT = core testlib SOURCES = tst_qtemporaryfile.cpp TESTDATA += tst_qtemporaryfile.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -RESOURCES += qtemporaryfile.qrc \ No newline at end of file +RESOURCES += qtemporaryfile.qrc + +android:!android-no-sdk { + RESOURCES += android_testdata.qrc +} diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index a08a0ae777..29a3c4e18a 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -92,6 +92,24 @@ void tst_QTemporaryFile::initTestCase() // For QTBUG_4796 QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX")); QCoreApplication::setApplicationName("tst_qtemporaryfile"); + +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QString sourceDir(":/android_testdata/"); + QDirIterator it(sourceDir, QDirIterator::Subdirectories); + while (it.hasNext()) { + it.next(); + + QFileInfo sourceFileInfo = it.fileInfo(); + if (!sourceFileInfo.isDir()) { + QFileInfo destinationFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/') + sourceFileInfo.filePath().mid(sourceDir.length())); + + if (!destinationFileInfo.exists()) { + QVERIFY(QDir().mkpath(destinationFileInfo.path())); + QVERIFY(QFile::copy(sourceFileInfo.filePath(), destinationFileInfo.filePath())); + } + } + } +#endif } void tst_QTemporaryFile::cleanupTestCase() @@ -253,20 +271,21 @@ void tst_QTemporaryFile::autoRemove() QVERIFY(!QFile::exists(fileName)); } +struct ChdirOnReturn +{ + ChdirOnReturn(const QString& d) : dir(d) {} + ~ChdirOnReturn() { + QDir::setCurrent(dir); + } + QString dir; +}; + void tst_QTemporaryFile::nonWritableCurrentDir() { #ifdef Q_OS_UNIX if (::geteuid() == 0) QSKIP("not valid running this test as root"); - struct ChdirOnReturn - { - ChdirOnReturn(const QString& d) : dir(d) {} - ~ChdirOnReturn() { - QDir::setCurrent(dir); - } - QString dir; - }; ChdirOnReturn cor(QDir::currentPath()); #if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) @@ -443,6 +462,12 @@ void tst_QTemporaryFile::rename() void tst_QTemporaryFile::renameFdLeak() { #ifdef Q_OS_UNIX + +# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + ChdirOnReturn cor(QDir::currentPath()); + QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); +# endif + const QByteArray sourceFile = QFile::encodeName(QFINDTESTDATA(__FILE__)); QVERIFY(!sourceFile.isEmpty()); // Test this on Unix only @@ -646,7 +671,11 @@ void tst_QTemporaryFile::createNativeFile_data() QTest::addColumn("valid"); QTest::addColumn("content"); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + const QString nativeFilePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/resources/test.txt"); +#else const QString nativeFilePath = QFINDTESTDATA("resources/test.txt"); +#endif QTest::newRow("nativeFile") << nativeFilePath << (qint64)-1 << false << QByteArray(); QTest::newRow("nativeFileWithPos") << nativeFilePath << (qint64)5 << false << QByteArray(); -- cgit v1.2.3 From d056618d685bd93d57538b703f25d8cb35d91aed Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 6 Jan 2015 15:41:05 +0100 Subject: Make sure widget is polished before checking its font QWidget is polished when show() is called, so unless you do this first, QWidget::font() will return a default constructed QFont, and not necessarily the default specified in the platform theme. Comparing this to QPainter::font() later, which has been resolved against the platform theme font, and not the default constructed font, you can get a mismatch and a false test failure. This happened on Android. Change-Id: I41ef5b10879bbd4bb8ef8d52ecaccf5e8e894075 Reviewed-by: Gunnar Sletta --- tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 41ceebb646..8a0705630d 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -730,6 +730,7 @@ void tst_QPainter::initFrom() pal.setColor(QPalette::Foreground, QColor(255, 0, 0)); pal.setBrush(QPalette::Background, QColor(0, 255, 0)); widget->setPalette(pal); + widget->show(); QFont font = widget->font(); font.setPointSize(26); -- cgit v1.2.3 From 14c94240f9d7d630873dc402d787c0fe4a7b38bd Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 7 Jan 2015 20:27:47 +0100 Subject: Android: Fix some QStyle tests This adds the testdata to a qrc to make them available on Android. There are still some failures which might be actual errors, and which will be addressed separately. Change-Id: I1bdcfb2c6676134ca52388d49a1b2d25cf2813f9 Reviewed-by: BogDan Vatra --- tests/auto/widgets/styles/qstyle/qstyle.pro | 5 +++++ tests/auto/widgets/styles/qstyle/testdata.qrc | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/auto/widgets/styles/qstyle/testdata.qrc diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index 4d18971cc6..b4546aa760 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -10,3 +10,8 @@ wince* { addPixmap.path = . DEPLOYMENT += addPixmap } + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/widgets/styles/qstyle/testdata.qrc b/tests/auto/widgets/styles/qstyle/testdata.qrc new file mode 100644 index 0000000000..c16b9be775 --- /dev/null +++ b/tests/auto/widgets/styles/qstyle/testdata.qrc @@ -0,0 +1,20 @@ + + + images/mac/button.png + images/mac/combobox.png + images/mac/lineedit.png + images/mac/mdi.png + images/mac/menu.png + images/mac/radiobutton.png + images/mac/slider.png + images/mac/spinbox.png + images/vista/button.png + images/vista/combobox.png + images/vista/lineedit.png + images/vista/menu.png + images/vista/radiobutton.png + images/vista/slider.png + images/vista/spinbox.png + task_25863.png + + -- cgit v1.2.3 From c161197b5f749393e462015d0c5fdecad42127b5 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 8 Jan 2015 11:07:48 +0200 Subject: Android: Fix qimage test. We must add all test data to resources. Change-Id: I1b18415cd53a27bd23e51ac6b738d3ed94162ac9 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/gui/image/qimage/qimage.pro | 2 ++ tests/auto/gui/image/qimage/qimage.qrc | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/auto/gui/image/qimage/qimage.qrc diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro index 117e34653d..42280d3bd4 100644 --- a/tests/auto/gui/image/qimage/qimage.pro +++ b/tests/auto/gui/image/qimage/qimage.pro @@ -6,4 +6,6 @@ SOURCES += tst_qimage.cpp QT += core-private gui-private testlib contains(QT_CONFIG, c++11): CONFIG += c++11 +android:!android-no-sdk:RESOURCES+=qimage.qrc + TESTDATA += images/* diff --git a/tests/auto/gui/image/qimage/qimage.qrc b/tests/auto/gui/image/qimage/qimage.qrc new file mode 100644 index 0000000000..e5de27faf8 --- /dev/null +++ b/tests/auto/gui/image/qimage/qimage.qrc @@ -0,0 +1,22 @@ + + + images/image.bmp + images/image.gif + images/image.ico + images/image.jpg + images/image.pbm + images/image.pgm + images/image.png + images/image.ppm + images/image.xbm + images/image.xpm + images/jpeg_exif_orientation_value_1.jpg + images/jpeg_exif_orientation_value_2.jpg + images/jpeg_exif_orientation_value_3.jpg + images/jpeg_exif_orientation_value_4.jpg + images/jpeg_exif_orientation_value_5.jpg + images/jpeg_exif_orientation_value_6.jpg + images/jpeg_exif_orientation_value_7.jpg + images/jpeg_exif_orientation_value_8.jpg + + -- cgit v1.2.3 From 7ab513d539f34fe5183c93bc15c190970d468a74 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 19 Dec 2014 16:07:59 +0200 Subject: Android: Fix qpixmap test. Add all test data to resources. Change-Id: I31b0dbb7546a15151f64523c86bf8eb687ff9ec0 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/gui/image/qpixmap/qpixmap.qrc | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/auto/gui/image/qpixmap/qpixmap.qrc b/tests/auto/gui/image/qpixmap/qpixmap.qrc index 99fde61a29..3965622dba 100644 --- a/tests/auto/gui/image/qpixmap/qpixmap.qrc +++ b/tests/auto/gui/image/qpixmap/qpixmap.qrc @@ -1,5 +1,27 @@ - - + + + loadFromData/designer_argb32.png + loadFromData/designer_indexed8_no_alpha_animated.gif + loadFromData/designer_indexed8_no_alpha.gif + loadFromData/designer_indexed8_no_alpha.png + loadFromData/designer_indexed8_with_alpha_animated.gif + loadFromData/designer_indexed8_with_alpha.gif + loadFromData/designer_indexed8_with_alpha.png + loadFromData/designer_rgb32.jpg + loadFromData/designer_rgb32.png + convertFromImage/task31722_1/img1.png + convertFromImage/task31722_1/img2.png + convertFromToHICON/icon_8bpp_16x16.png + convertFromToHICON/icon_8bpp_32x32.png + convertFromToHICON/icon_8bpp_48x48.png + convertFromToHICON/icon_8bpp.ico + convertFromToHICON/icon_32bpp_16x16.png + convertFromToHICON/icon_32bpp_32x32.png + convertFromToHICON/icon_32bpp_48x48.png + convertFromToHICON/icon_32bpp_256x256.png + convertFromToHICON/icon_32bpp.ico + convertFromImage/task31722_0/img1.png + convertFromImage/task31722_0/img2.png images/designer.png images/dx_0_dy_0_50_50_100_100.png images/dx_0_dy_0_null.png @@ -25,5 +47,5 @@ images/dx_-128_dy_-128_x_y_w_h.png images/dx_128_dy_128_x_y_w_h.png images/dx_1_dy_0_null.png - + -- cgit v1.2.3 From e6699afbee77b853773579d29d78a1ade2a4ab2c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 7 Jan 2015 15:19:07 +0100 Subject: Fix physical DPI and size for rotated screens on X11 Rotated screens would use the unrotated physical geometry, causing the calculated physical DPI to be completely wrong. In RandR, the output does not rotate, so the physical size is always for the unrotated display. The transformation is done on the crtc. http://www.x.org/releases/X11R7.6/doc/randrproto/randrproto.txt Task-number: QTBUG-43688 Change-Id: Ifde192fcc99a37d0bfd6d57b4cdeac124a054ca3 Reviewed-by: Friedemann Kleint Reviewed-by: Shawn Rutledge Reviewed-by: Uli Schlachter --- src/plugins/platforms/xcb/qxcbscreen.cpp | 22 +++++++++++++++++++++- src/plugins/platforms/xcb/qxcbscreen.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 8bdedba8ac..73f27c7117 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -53,7 +53,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, , m_screen(scr) , m_crtc(output ? output->crtc : 0) , m_outputName(outputName) - , m_sizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize()) + , m_outputSizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize()) , m_virtualSize(scr->width_in_pixels, scr->height_in_pixels) , m_virtualSizeMillimeters(scr->width_in_millimeters, scr->height_in_millimeters) , m_orientation(Qt::PrimaryOrientation) @@ -71,6 +71,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, updateGeometry(output ? output->timestamp : 0); updateRefreshRate(); + const int dpr = int(devicePixelRatio()); // On VNC, it can be that physical size is unknown while // virtual size is known (probably back-calculated from DPI and resolution) @@ -93,6 +94,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, qDebug(" virtual height.: %lf", m_virtualSizeMillimeters.height()); qDebug(" virtual geom...: %d x %d", m_virtualSize.width(), m_virtualSize.height()); qDebug(" avail virt geom: %d x %d +%d +%d", m_availableGeometry.width(), m_availableGeometry.height(), m_availableGeometry.x(), m_availableGeometry.y()); + qDebug(" orientation....: %d", m_orientation); qDebug(" pixel ratio....: %d", m_devicePixelRatio); qDebug(" depth..........: %d", screen()->root_depth); qDebug(" white pixel....: %x", screen()->white_pixel); @@ -413,6 +415,24 @@ void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp) if (crtc) { xGeometry = QRect(crtc->x, crtc->y, crtc->width, crtc->height); xAvailableGeometry = xGeometry; + switch (crtc->rotation) { + case XCB_RANDR_ROTATION_ROTATE_0: // xrandr --rotate normal + m_orientation = Qt::LandscapeOrientation; + m_sizeMillimeters = m_outputSizeMillimeters; + break; + case XCB_RANDR_ROTATION_ROTATE_90: // xrandr --rotate left + m_orientation = Qt::PortraitOrientation; + m_sizeMillimeters = m_outputSizeMillimeters.transposed(); + break; + case XCB_RANDR_ROTATION_ROTATE_180: // xrandr --rotate inverted + m_orientation = Qt::InvertedLandscapeOrientation; + m_sizeMillimeters = m_outputSizeMillimeters; + break; + case XCB_RANDR_ROTATION_ROTATE_270: // xrandr --rotate right + m_orientation = Qt::InvertedPortraitOrientation; + m_sizeMillimeters = m_outputSizeMillimeters.transposed(); + break; + } free(crtc); } } diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index ca0aee2cc4..b9ee331104 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -111,6 +111,7 @@ private: xcb_screen_t *m_screen; xcb_randr_crtc_t m_crtc; QString m_outputName; + QSizeF m_outputSizeMillimeters; QSizeF m_sizeMillimeters; QRect m_geometry; QRect m_availableGeometry; -- cgit v1.2.3 From d62cd6508a54fbc7950b669c1bc966663d7c10b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 7 Jan 2015 13:44:34 +0100 Subject: iOS: Move implementation details of QIOSViewController to class extension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I602d8f1c9f20d3bfed4db3405460021146b546d8 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosviewcontroller.h | 10 ++++------ src/plugins/platforms/ios/qiosviewcontroller.mm | 6 ++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/ios/qiosviewcontroller.h b/src/plugins/platforms/ios/qiosviewcontroller.h index 586edd589d..684e06e030 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.h +++ b/src/plugins/platforms/ios/qiosviewcontroller.h @@ -35,15 +35,13 @@ class QIOSScreen; -@interface QIOSViewController : UIViewController { - QIOSScreen *m_screen; -} +@interface QIOSViewController : UIViewController + +- (id)initWithQIOSScreen:(QIOSScreen *)screen; +- (void)updateProperties; -@property (nonatomic, assign) BOOL changingOrientation; @property (nonatomic, assign) BOOL prefersStatusBarHidden; @property (nonatomic, assign) UIStatusBarAnimation preferredStatusBarUpdateAnimation; -- (id)initWithQIOSScreen:(QIOSScreen *)screen; -- (void)updateProperties; @end diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index f678f7e807..8f59d41509 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -119,6 +119,12 @@ // ------------------------------------------------------------------------- +@interface QIOSViewController () { + QIOSScreen *m_screen; +} +@property (nonatomic, assign) BOOL changingOrientation; +@end + @implementation QIOSViewController - (id)initWithQIOSScreen:(QIOSScreen *)screen -- cgit v1.2.3 From 5c5f43e95b8f56d2bdf34cf5c11aae9d5102f9c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Thu, 8 Jan 2015 11:31:27 +0000 Subject: docs: Explain the limitations of QWidget::grabMouse() on Windows Because carbon is dead, I merged both OSX and Windows in the same note. Change-Id: I5d43c5fce30e187f63a1e3e5af688c344eb80d28 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qwidget.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index c362530264..c99e15b9b8 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -12392,10 +12392,9 @@ static void releaseMouseGrabOfWidget(QWidget *widget) \note Only visible widgets can grab mouse input. If isVisible() returns \c false for a widget, that widget cannot call grabMouse(). - \note \b{(Mac OS X developers)} For \e Cocoa, calling - grabMouse() on a widget only works when the mouse is inside the - frame of that widget. For \e Carbon, it works outside the widget's - frame as well, like for Windows and X11. + \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. \sa releaseMouse(), grabKeyboard(), releaseKeyboard() */ @@ -12416,7 +12415,7 @@ void QWidget::grabMouse() \warning Grabbing the mouse might lock the terminal. - \note \b{(Mac OS X developers)} See the note in QWidget::grabMouse(). + \note See the note in QWidget::grabMouse(). \sa releaseMouse(), grabKeyboard(), releaseKeyboard(), setCursor() */ -- cgit v1.2.3 From 95cb745e002c38e821b385e90d954adf73363e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 11 Dec 2013 14:37:19 +0100 Subject: iOS: Fix QWindow::reportContentOrientationChange on iOS6+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On iOS 6 and above, [UIViewController supportedInterfaceOrientations] needs to return 0 for [UIApplication setStatusBarOrientation] to work. This means once you report a content orientation other than the primary orientation, you'll disable auto-rotation. Reporting the orientation as Qt::PrimaryOrientation restores the auto-rotation behavior. Change-Id: I1b8c765c507728fdbc5b828e0b4215324014e221 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosscreen.mm | 17 +++++ src/plugins/platforms/ios/qiosviewcontroller.h | 4 ++ src/plugins/platforms/ios/qiosviewcontroller.mm | 93 +++++++++++++++++++++---- src/plugins/platforms/ios/qioswindow.mm | 19 +++-- 4 files changed, 116 insertions(+), 17 deletions(-) diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 4af2a4965f..712bf0098b 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -46,6 +46,7 @@ #include #include "qiosapplicationdelegate.h" #include "qiosviewcontroller.h" +#include "quiview.h" #include @@ -244,6 +245,22 @@ void QIOSScreen::updateProperties() m_geometry = fromCGRect([rootView convertRect:m_uiScreen.bounds fromView:m_uiWindow]).toRect(); m_availableGeometry = fromCGRect([rootView convertRect:m_uiScreen.applicationFrame fromView:m_uiWindow]).toRect(); + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0 && ![m_uiWindow.rootViewController shouldAutorotate]) { + // Setting the statusbar orientation (content orientation) on iOS8+ will result in the UIScreen + // updating its geometry and available geometry, which in the case of content orientation is not + // what we want. We want to reflect the screen geometry based on the locked orientation, and + // adjust the available geometry based on the repositioned status bar for the current status + // bar orientation. + + Qt::ScreenOrientation lockedOrientation = toQtScreenOrientation(UIDeviceOrientation(rootView.qtViewController.lockedOrientation)); + Qt::ScreenOrientation contenOrientation = toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation)); + + QTransform transform = screen()->transformBetween(lockedOrientation, contenOrientation, m_geometry).inverted(); + + m_geometry = transform.mapRect(m_geometry); + m_availableGeometry = transform.mapRect(m_availableGeometry); + } + if (m_geometry != previousGeometry || m_availableGeometry != previousAvailableGeometry) { const qreal millimetersPerInch = 25.4; m_physicalSize = QSizeF(m_geometry.size()) / m_unscaledDpi * millimetersPerInch; diff --git a/src/plugins/platforms/ios/qiosviewcontroller.h b/src/plugins/platforms/ios/qiosviewcontroller.h index 684e06e030..df7ce0ff4a 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.h +++ b/src/plugins/platforms/ios/qiosviewcontroller.h @@ -40,6 +40,10 @@ class QIOSScreen; - (id)initWithQIOSScreen:(QIOSScreen *)screen; - (void)updateProperties; +@property (nonatomic, assign) UIInterfaceOrientation lockedOrientation; + +// UIViewController +@property (nonatomic, assign) BOOL shouldAutorotate; @property (nonatomic, assign) BOOL prefersStatusBarHidden; @property (nonatomic, assign) UIStatusBarAnimation preferredStatusBarUpdateAnimation; diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 8f59d41509..0afd2bf8ba 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -153,6 +153,7 @@ #endif self.changingOrientation = NO; + self.shouldAutorotate = [super shouldAutorotate]; // Status bar may be initially hidden at startup through Info.plist self.prefersStatusBarHidden = infoPlistValue(@"UIStatusBarHidden", false); @@ -179,6 +180,10 @@ [center addObserver:self selector:@selector(willChangeStatusBarFrame:) name:UIApplicationWillChangeStatusBarFrameNotification object:[UIApplication sharedApplication]]; + + [center addObserver:self selector:@selector(didChangeStatusBarOrientation:) + name:UIApplicationDidChangeStatusBarOrientationNotification + object:[UIApplication sharedApplication]]; } - (void)viewDidUnload @@ -189,19 +194,16 @@ // ------------------------------------------------------------------------- --(BOOL)shouldAutorotate -{ - // Until a proper orientation and rotation API is in place, we always auto rotate. - // If auto rotation is not wanted, you would need to switch it off manually from Info.plist. - return YES; -} - #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_6_0) -(NSUInteger)supportedInterfaceOrientations { - // We need to tell iOS that we support all orientations in order to set - // status bar orientation when application content orientation changes. - return UIInterfaceOrientationMaskAll; + // As documented by Apple in the iOS 6.0 release notes, setStatusBarOrientation:animated: + // only works if the supportedInterfaceOrientations of the view controller is 0, making + // us responsible for ensuring that the status bar orientation is consistent. We enter + // this mode when auto-rotation is disabled due to an explicit content orientation being + // set on the focus window. Note that this is counter to what the documentation for + // supportedInterfaceOrientations says, which states that the method should not return 0. + return [self shouldAutorotate] ? UIInterfaceOrientationMaskAll : 0; } #endif @@ -209,7 +211,7 @@ -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { Q_UNUSED(interfaceOrientation); - return YES; + return [self shouldAutorotate]; } #endif @@ -256,6 +258,22 @@ }]; } +- (void)didChangeStatusBarOrientation:(NSNotification *)notification +{ + Q_UNUSED(notification); + + if (self.view.window.screen != [UIScreen mainScreen]) + return; + + // If the statusbar changes orientation due to auto-rotation we don't care, + // there will be re-layout anyways. Only if the statusbar changes due to + // reportContentOrientation, we need to update the window layout. + if (self.changingOrientation) + return; + + [self.view setNeedsLayout]; +} + - (void)viewWillLayoutSubviews { if (!QCoreApplication::instance()) @@ -287,6 +305,8 @@ // All decisions are based on the the top level window focusWindow = qt_window_private(focusWindow)->topLevelWindow(); + UIApplication *uiApplication = [UIApplication sharedApplication]; + bool currentStatusBarVisibility = self.prefersStatusBarHidden; self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen; @@ -297,13 +317,60 @@ } else #endif { - [[UIApplication sharedApplication] - setStatusBarHidden:self.prefersStatusBarHidden + [uiApplication setStatusBarHidden:self.prefersStatusBarHidden withAnimation:self.preferredStatusBarUpdateAnimation]; } [self.view setNeedsLayout]; } + + + // -------------- Content orientation --------------- + + static BOOL kAnimateContentOrientationChanges = YES; + + Qt::ScreenOrientation contentOrientation = focusWindow->contentOrientation(); + if (contentOrientation != Qt::PrimaryOrientation) { + // An explicit content orientation has been reported for the focus window, + // so we keep the status bar in sync with content orientation. This will ensure + // that the task bar (and associated gestures) are also rotated accordingly. + + if (self.shouldAutorotate) { + // We are moving from Qt::PrimaryOrientation to an explicit orientation, + // so we need to store the current statusbar orientation, as we need it + // later when mapping screen coordinates for QScreen and for returning + // to Qt::PrimaryOrientation. + self.lockedOrientation = uiApplication.statusBarOrientation; + + // Calling setStatusBarOrientation only has an effect when auto-rotation is + // disabled, which makes sense when there's an explicit content orientation. + self.shouldAutorotate = NO; + } + + [uiApplication setStatusBarOrientation: + UIInterfaceOrientation(fromQtScreenOrientation(contentOrientation)) + animated:kAnimateContentOrientationChanges]; + + } else { + // The content orientation is set to Qt::PrimaryOrientation, meaning + // that auto-rotation should be enabled. But we may be coming out of + // a state of locked orientation, which needs some cleanup before we + // can enable auto-rotation again. + if (!self.shouldAutorotate) { + // First we need to restore the statusbar to what it was at the + // time of locking the orientation, otherwise iOS will be very + // confused when it starts doing auto-rotation again. + [uiApplication setStatusBarOrientation: + UIInterfaceOrientation(self.lockedOrientation) + animated:kAnimateContentOrientationChanges]; + + // Then we can re-enable auto-rotation + self.shouldAutorotate = YES; + + // And finally let iOS rotate the root view to match the device orientation + [UIViewController attemptRotationToDeviceOrientation]; + } + } } #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0) diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 480062e4de..6c4614408d 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -75,6 +75,15 @@ QIOSWindow::QIOSWindow(QWindow *window) setWindowState(window->windowState()); setOpacity(window->opacity()); + + Qt::ScreenOrientation initialOrientation = window->contentOrientation(); + if (initialOrientation != Qt::PrimaryOrientation) { + // Start up in portrait, then apply possible content orientation, + // as per Apple's documentation. + dispatch_async(dispatch_get_main_queue(), ^{ + handleContentOrientationChange(initialOrientation); + }); + } } QIOSWindow::~QIOSWindow() @@ -322,10 +331,12 @@ void QIOSWindow::updateWindowLevel() void QIOSWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { - // Keep the status bar in sync with content orientation. This will ensure - // that the task bar (and associated gestures) are aligned correctly: - UIInterfaceOrientation uiOrientation = UIInterfaceOrientation(fromQtScreenOrientation(orientation)); - [[UIApplication sharedApplication] setStatusBarOrientation:uiOrientation animated:NO]; + // Update the QWindow representation straight away, so that + // we can update the statusbar orientation based on the new + // content orientation. + qt_window_private(window())->contentOrientation = orientation; + + [m_view.qtViewController updateProperties]; } void QIOSWindow::applicationStateChanged(Qt::ApplicationState) -- cgit v1.2.3 From 56a82e87e654fa9e77bee8956e94e08a77941e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 7 Jan 2015 15:14:17 +0100 Subject: iOS: Prevent recursion when updating/syncing QIOSViewController properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I22f1eaa892cba23c498ae210a9a483e468268581 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosviewcontroller.mm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 0afd2bf8ba..01bc84ae68 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -41,6 +41,8 @@ #import "qiosviewcontroller.h" +#include + #include #include #include @@ -121,6 +123,7 @@ @interface QIOSViewController () { QIOSScreen *m_screen; + BOOL m_updatingProperties; } @property (nonatomic, assign) BOOL changingOrientation; @end @@ -289,6 +292,15 @@ if (!isQtApplication()) return; + // Prevent recursion caused by updating the status bar appearance (position + // or visibility), which in turn may cause a layout of our subviews, and + // a reset of window-states, which themselves affect the view controller + // properties such as the statusbar visibilty. + if (m_updatingProperties) + return; + + QScopedValueRollback updateRollback(m_updatingProperties, YES); + QWindow *focusWindow = QGuiApplication::focusWindow(); // If we don't have a focus window we leave the statusbar -- cgit v1.2.3 From 099db090d5772439f13e7c0bfd8268923db5a87f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 9 Jan 2015 13:39:54 +0100 Subject: Android: Fix QTextBoundaryFinder test Include test data on Android. Change-Id: I35c17618d84822df126fe3462a00d3d49b1377c8 Reviewed-by: BogDan Vatra --- .../corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro | 5 +++++ tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro index 498d8f9c40..29b9854ebb 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro +++ b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro @@ -5,3 +5,8 @@ SOURCES = tst_qtextboundaryfinder.cpp TESTDATA += data DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc b/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc new file mode 100644 index 0000000000..0cc4ccaa57 --- /dev/null +++ b/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc @@ -0,0 +1,8 @@ + + + data/GraphemeBreakTest.txt + data/LineBreakTest.txt + data/SentenceBreakTest.txt + data/WordBreakTest.txt + + -- cgit v1.2.3 From d30c446d35ae404f5a67421ac59e6f0997123321 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 9 Jan 2015 13:26:06 +0100 Subject: Android: Fix QDataStream test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include test data on Android. Change-Id: Ic0890495c0bf8d2e38595585226a03073b043d57 Reviewed-by: Tony Sarajärvi Reviewed-by: BogDan Vatra --- tests/auto/corelib/io/qdatastream/qdatastream.pro | 5 +++++ tests/auto/corelib/io/qdatastream/testdata.qrc | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 tests/auto/corelib/io/qdatastream/testdata.qrc diff --git a/tests/auto/corelib/io/qdatastream/qdatastream.pro b/tests/auto/corelib/io/qdatastream/qdatastream.pro index 25c29b83ee..9ab2b0948d 100644 --- a/tests/auto/corelib/io/qdatastream/qdatastream.pro +++ b/tests/auto/corelib/io/qdatastream/qdatastream.pro @@ -5,3 +5,8 @@ SOURCES = tst_qdatastream.cpp TESTDATA += datastream.q42 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/corelib/io/qdatastream/testdata.qrc b/tests/auto/corelib/io/qdatastream/testdata.qrc new file mode 100644 index 0000000000..fb63cb3438 --- /dev/null +++ b/tests/auto/corelib/io/qdatastream/testdata.qrc @@ -0,0 +1,5 @@ + + + datastream.q42 + + -- cgit v1.2.3 From ccf50893e8086ae15db10296655db23364e55674 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 8 Jan 2015 16:02:07 +0100 Subject: Skip incompatible QTextLayout tests when dpi-scaling is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On e.g. Android, the tabs will be scaled by DPI. This breaks the logic in the QTextLayout tests for tabs. It's not possible to just scale the expected sizes either, since the whole text layout will be affected by font sizes and scaling, and it's difficult to predict where characters will land on different platforms and resolutions. To avoid breaking this test on other platforms, we just skip them when we know they will break. Since the code tested is cross-platform, this will hopefully not have any significant impact on our coverage. Change-Id: I65d6c33c9c6724665983a17f99eadcf1baedcc20 Reviewed-by: Tony Sarajärvi Reviewed-by: BogDan Vatra --- .../auto/gui/text/qtextlayout/tst_qtextlayout.cpp | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index 4b2970cd17..4fa8575153 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -1280,6 +1280,13 @@ void tst_QTextLayout::smallTextLengthWrapAtWordBoundaryOrAnywhere() void tst_QTextLayout::testDefaultTabs() { QTextLayout layout("Foo\tBar\ta slightly longer text\tend.", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); layout.beginLayout(); QTextLine line = layout.createLine(); @@ -1322,6 +1329,13 @@ void tst_QTextLayout::testDefaultTabs() void tst_QTextLayout::testTabs() { QTextLayout layout("Foo\tBar.", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); QTextOption option = layout.textOption(); option.setTabStop(150); @@ -1339,6 +1353,13 @@ void tst_QTextLayout::testTabs() void tst_QTextLayout::testMultilineTab() { QTextLayout layout("Lorem ipsum dolor sit\tBar.", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); // test if this works on the second line. layout.beginLayout(); @@ -1348,12 +1369,20 @@ void tst_QTextLayout::testMultilineTab() line.setLineWidth(220.); layout.endLayout(); + QCOMPARE(line.cursorToX(22), 80.); } void tst_QTextLayout::testMultiTab() { QTextLayout layout("Foo\t\t\tBar.", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); layout.beginLayout(); QTextLine line = layout.createLine(); @@ -1367,6 +1396,13 @@ void tst_QTextLayout::testTabsInAlignedParag() { QTextLayout layout("Foo\tsome more words", testFont); layout.setCacheEnabled(true); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + QTextOption option = layout.textOption(); // right option.setAlignment(Qt::AlignRight); @@ -1426,6 +1462,12 @@ void tst_QTextLayout::testRightTab() */ layout.setCacheEnabled(true); + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + QTextOption option = layout.textOption(); QList tabs; QTextOption::Tab tab; @@ -1463,6 +1505,13 @@ void tst_QTextLayout::testRightTab() void tst_QTextLayout::testCenteredTab() { QTextLayout layout("Foo\tBar", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); // test if centering the tab works. We expect the center of 'Bar.' to be at the tab point. QTextOption option = layout.textOption(); @@ -1484,6 +1533,13 @@ void tst_QTextLayout::testCenteredTab() void tst_QTextLayout::testDelimiterTab() { QTextLayout layout("Foo\tBar. Barrabas", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); // try the different delimiter characters to see if the alignment works there. QTextOption option = layout.textOption(); @@ -1537,6 +1593,12 @@ void tst_QTextLayout::tabsForRtl() */ layout.setCacheEnabled(true); + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + QTextOption option = layout.textOption(); QList tabs; QTextOption::Tab tab; -- cgit v1.2.3 From 8f095d67a0a28d28b463e80a398041989ccdeb88 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 9 Dec 2014 17:04:38 +0100 Subject: Fix glyph runs painted badly with perspective transform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A mismatch between requiresPretransformedGlyphPositions and shouldDrawCachedGlyphs in QRasterPaintEngine will cause the text position to be transformed twice when using drawGlyphRun on a QPainter with a perspective transform. Since this case falls back to drawing text as paths there is no reason to require any special treatment. Change-Id: Ib1c14aee4cc6774dd8feadc5748f0b0ee59633b9 Reviewed-by: Tor Arne Vestbø Reviewed-by: Gunnar Sletta --- src/gui/painting/qpaintengineex.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 0c3ea37b29..f5e6f7cca6 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -1075,9 +1075,9 @@ void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem) } } -bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &t) const +bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &) const { - return t.type() >= QTransform::TxProject; + return false; } bool QPaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const -- cgit v1.2.3 From 2153ac61c921c8da3852ff018eec2279ee7d06f7 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 8 Jan 2015 11:09:36 +0100 Subject: Doc: add Qt Creator 3.3.1 pages to externalsites Change-Id: I9dd02f7fc1da30d68dca5983e5c9a0cba41bcab5 Reviewed-by: Martin Smith --- doc/global/externalsites/qtcreator.qdoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/global/externalsites/qtcreator.qdoc b/doc/global/externalsites/qtcreator.qdoc index c2eed07c6d..c96920a689 100644 --- a/doc/global/externalsites/qtcreator.qdoc +++ b/doc/global/externalsites/qtcreator.qdoc @@ -391,6 +391,14 @@ \externalpage http://doc.qt.io/qtcreator/creator-project-wizards.html \title Qt Creator: Adding New Custom Wizards */ +/*! + \externalpage http://doc.qt.io/qtcreator/creator-project-wizards-json.html + \title Qt Creator: Adding JSON-Based Wizards +*/ +/*! + \externalpage http://doc.qt.io/qtcreator/creator-project-wizards-xml.html + \title Qt Creator: Adding XML-Based Wizards +*/ /*! \externalpage http://doc.qt.io/qtcreator/creator-projects-autotools.html \title Qt Creator: Setting Up an Autotools Project -- cgit v1.2.3 From e0981a0d9e0330fe3a1c4f310e7c9877c341ba5d Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 9 Jan 2015 15:12:19 +0100 Subject: QScreen manual test: use sizeHint; don't override QLineEdit text color The window size was too small on high-DPI screens. Save the default text color instead of setting it to black. Change-Id: I78b50624110be0cb1d077d3782d421eb323f4fb0 Reviewed-by: Paul Olav Tvete --- tests/manual/qscreen/main.cpp | 5 ++++- tests/manual/qscreen/propertyfield.cpp | 7 ++++--- tests/manual/qscreen/propertyfield.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp index 487e95266b..dc1e0e08c0 100644 --- a/tests/manual/qscreen/main.cpp +++ b/tests/manual/qscreen/main.cpp @@ -80,8 +80,11 @@ void screenAdded(QScreen* screen) // But this works as long as the screens are all virtual siblings w->show(); QRect geom = w->geometry(); + geom.setSize(w->sizeHint()); + if (geom.height() > screen->geometry().height()) + geom.setHeight(screen->geometry().height() * 9 / 10); geom.moveCenter(screen->geometry().center()); - w->move(geom.topLeft()); + w->setGeometry(geom); props->insert(screen, w); diff --git a/tests/manual/qscreen/propertyfield.cpp b/tests/manual/qscreen/propertyfield.cpp index e6392465f2..f1e5e22ec9 100644 --- a/tests/manual/qscreen/propertyfield.cpp +++ b/tests/manual/qscreen/propertyfield.cpp @@ -34,8 +34,9 @@ #include "propertyfield.h" #include -PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent) : - QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop) +PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent) + : QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop) + , m_defaultBrush(palette().brush(QPalette::Active, QPalette::Text)) { setReadOnly(true); if (prop.hasNotifySignal()) { @@ -99,7 +100,7 @@ void PropertyField::propertyChanged() setText(text); m_lastText = text; m_lastTextShowing = text; - modPalette.setBrush(QPalette::Text, Qt::black); + modPalette.setBrush(QPalette::Text, m_defaultBrush); } setPalette(modPalette); } diff --git a/tests/manual/qscreen/propertyfield.h b/tests/manual/qscreen/propertyfield.h index 2738a215a6..f76ac7fc6b 100644 --- a/tests/manual/qscreen/propertyfield.h +++ b/tests/manual/qscreen/propertyfield.h @@ -63,6 +63,7 @@ private: QString m_lastTextShowing; QTime m_lastChangeTime; const QMetaProperty m_prop; + QBrush m_defaultBrush; }; #endif // PROPERTYFIELD_H -- cgit v1.2.3 From b077ed746ae91321ff9aa72ebd17a463bec98413 Mon Sep 17 00:00:00 2001 From: Ashish Kulkarni Date: Wed, 7 Jan 2015 23:52:01 +0530 Subject: allow detection of static/shared target in the config tests It was not possible to determine whether Qt is being built as a shared or static library in the config tests, as that information was not added to QMAKE_CONFIG used in the compileTest function. For linking to ICU on Windows, there is logic which depends on it in config.tests/unix/icu/icu.pro, but was broken for the static target, as the expected library name was not found (icuXX -> sicuXX). Change-Id: I22c2d543ea14feebbad36961c9a29e99f66323ff Reviewed-by: Oswald Buddenhagen --- configure | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 31a59fc802..75fe189bef 100755 --- a/configure +++ b/configure @@ -3954,7 +3954,13 @@ compileTest() path=config.tests/$1 name=$2 shift 2 - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@" + # allow config tests which behave differently depending on the type of + # library being built (shared/static) e.g. see config.tests/unix/icu + test_config="$QMAKE_CONFIG shared" + if [ "$CFG_SHARED" = "no" ]; then + test_config="$QMAKE_CONFIG static" + fi + "$unixtests/compile.test" "$XQMAKESPEC" "$test_config" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@" } #------------------------------------------------------------------------------- -- cgit v1.2.3 From 6e217f067800541ccb9596cf03d52093b2909385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Tue, 6 Jan 2015 18:13:27 +0000 Subject: QColorDialog: Don't loose focus while color picking On Windows mouse grabbing doesn't work across processes, which means we're interacting with other windows when picking colors. Workaround that by having a transparent 1x1 window below the cursor at all times so we catch the mouse click. Clicking before the window is below the cursor won't happen because our timer interval is 30ms, so it's quite fast. It's hacky but it's what we can do for a feature which was very broken on Windows. Task-number: QTBUG-43663 Change-Id: I295378e033ddc6d9c2230335f0953a727c21e1dd Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qcolordialog.cpp | 24 +++++++++++++++++++----- src/widgets/dialogs/qcolordialog_p.h | 6 ++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 882bb999fb..b133c49b5e 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1579,12 +1579,17 @@ void QColorDialogPrivate::_q_pickScreenColor() q->grabMouse(); #endif -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 // excludes WinCE and WinRT // On Windows mouse tracking doesn't work over other processes's windows updateTimer->start(30); + + // HACK: Because mouse grabbing doesn't work across processes, we have to have a dummy, + // invisible window to catch the mouse click, otherwise we will click whatever we clicked + // and loose focus. + dummyTransparentWindow.show(); #endif q->grabKeyboard(); - /* With setMouseTracking(true) the desired color can be more precisedly picked up, + /* With setMouseTracking(true) the desired color can be more precisely picked up, * and continuously pushing the mouse button is not necessary. */ q->setMouseTracking(true); @@ -1606,8 +1611,9 @@ void QColorDialogPrivate::releaseColorPicking() cp->setCrossVisible(true); q->removeEventFilter(colorPickingEventFilter); q->releaseMouse(); -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 updateTimer->stop(); + dummyTransparentWindow.setVisible(false); #endif q->releaseKeyboard(); q->setMouseTracking(false); @@ -1635,6 +1641,10 @@ void QColorDialogPrivate::init(const QColor &initial) #ifdef Q_WS_MAC delegate = 0; #endif +#ifdef Q_OS_WIN32 + dummyTransparentWindow.resize(1, 1); + dummyTransparentWindow.setFlags(Qt::Tool | Qt::FramelessWindowHint); +#endif q->setCurrentColor(initial); } @@ -1791,7 +1801,7 @@ void QColorDialogPrivate::initWidgets() cancel = buttons->addButton(QDialogButtonBox::Cancel); QObject::connect(cancel, SIGNAL(clicked()), q, SLOT(reject())); -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 updateTimer = new QTimer(q); QObject::connect(updateTimer, SIGNAL(timeout()), q, SLOT(_q_updateColorPicking())); #endif @@ -2219,8 +2229,12 @@ void QColorDialogPrivate::_q_updateColorPicking() return; lastGlobalPos = newGlobalPos; - if (!q->rect().contains(q->mapFromGlobal(newGlobalPos))) // Inside the dialog mouse tracking works, handleColorPickingMouseMove will be called + if (!q->rect().contains(q->mapFromGlobal(newGlobalPos))) { // Inside the dialog mouse tracking works, handleColorPickingMouseMove will be called updateColorPicking(newGlobalPos); +#ifdef Q_OS_WIN32 + dummyTransparentWindow.setPosition(newGlobalPos); +#endif + } #endif // ! QT_NO_CURSOR } diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h index 2b501522f5..9182b510f1 100644 --- a/src/widgets/dialogs/qcolordialog_p.h +++ b/src/widgets/dialogs/qcolordialog_p.h @@ -49,6 +49,7 @@ #include "private/qdialog_p.h" #include "qcolordialog.h" #include "qsharedpointer.h" +#include "qwindow.h" #ifndef QT_NO_COLORDIALOG @@ -77,7 +78,7 @@ public: }; QColorDialogPrivate() : options(new QColorDialogOptions) -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 , updateTimer(0) #endif {} @@ -143,8 +144,9 @@ public: QPointer receiverToDisconnectOnClose; QByteArray memberToDisconnectOnClose; -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 QTimer *updateTimer; + QWindow dummyTransparentWindow; #endif #ifdef Q_WS_MAC -- cgit v1.2.3 From 079adae309398b3c8670ebc45c1749e98e40ff53 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 20 Nov 2014 17:39:43 +0100 Subject: fix distclean for dynamic libraries again Task-number: QTBUG-40264 Change-Id: I1d28d2ef96c5c53274ca21c0ea3f416f0d9628dd Reviewed-by: Joerg Bornemann --- qmake/generators/unix/unixmake2.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 8270f02feb..9165da4d38 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1019,8 +1019,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t-$(DEL_FILE) -r " << bundlePath << endl; } else if(project->isActiveConfig("compile_libtool")) { t << "\t-$(LIBTOOL) --mode=clean $(DEL_FILE) $(TARGET)\n"; - } else if(!project->isActiveConfig("staticlib") && project->values("QMAKE_APP_FLAG").isEmpty() && - !project->isActiveConfig("plugin")) { + } else if (project->isActiveConfig("staticlib")) { + t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n"; + } else if (project->values("QMAKE_APP_FLAG").isEmpty() && !project->isActiveConfig("plugin")) { t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n"; if (!project->isActiveConfig("unversioned_libname")) { t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " @@ -1029,7 +1030,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t-$(DEL_FILE) $(TARGETA)\n"; } } else { - t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n"; + t << "\t-$(DEL_FILE) $(TARGET) \n"; } t << varGlue("QMAKE_DISTCLEAN","\t-$(DEL_FILE) "," ","\n"); { -- cgit v1.2.3 From a19f1d320a5d97b08741ea51f8bda40747d11d71 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 27 Nov 2014 21:08:45 +0100 Subject: document QMAKE_CFLAGS Task-number: QTBUG-16577 Change-Id: I9ab76dc0715187e059c3403447c27929261bd064 Reviewed-by: Joerg Bornemann Reviewed-by: Leena Miettinen --- qmake/doc/src/qmake-manual.qdoc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 202df7e03c..414b42d48e 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -1464,6 +1464,15 @@ executable needs to be specified as long as it is on a path contained in the \c PATH variable when the Makefile is processed. + \section1 QMAKE_CFLAGS + + Specifies the C compiler flags for building + a project. The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. The flags specific to debug and release modes can be + adjusted by modifying the \c QMAKE_CFLAGS_DEBUG and + \c QMAKE_CFLAGS_RELEASE variables, respectively. + \target QMAKE_CFLAGS_DEBUG \section1 QMAKE_CFLAGS_DEBUG -- cgit v1.2.3 From 4c3fdc01c40585e552dbef0b43d30c305289d88d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 27 Nov 2014 20:20:19 +0100 Subject: fix file separators in 'clean' targets Task-number: QTBUG-39690 Change-Id: Ibbed847258a3a7e21d6d10b9400af0001d10c6f8 Reviewed-by: Joerg Bornemann --- qmake/generators/win32/winmakefile.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 81bc16a3c6..663665897b 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -537,12 +537,13 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) const QString del_statement("-$(DEL_FILE)"); if(project->isActiveConfig("no_delete_multiple_files")) { for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) - t << "\n\t" << del_statement << " " << escapeFilePath((*it)); + t << "\n\t" << del_statement + << ' ' << escapeFilePath(Option::fixPathToTargetOS((*it).toQString())); } else { QString files, file; const int commandlineLimit = 2047; // NT limit, expanded for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { - file = " " + escapeFilePath((*it)); + file = ' ' + escapeFilePath(Option::fixPathToTargetOS((*it).toQString())); if(del_statement.length() + files.length() + qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) { t << "\n\t" << del_statement << files; -- cgit v1.2.3 From 26547c0275a25d19ddbc53edd71b277f71c4de59 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Dec 2014 19:17:05 +0100 Subject: remove nonsensical conditional we are in an #else of #ifndef QT_BOOTSTRAPPED here already. Change-Id: I02c4ff2959490110c21ad1016c664b7ddcfea7c0 Reviewed-by: Thiago Macieira --- src/corelib/global/qlibraryinfo.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 7ca0aa7f0b..1f8de2e05d 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -128,9 +128,7 @@ QLibrarySettings::QLibrarySettings() settings.reset(0); #else } else { -#ifdef QT_BOOTSTRAPPED haveEffectiveSourcePaths = false; -#endif haveEffectivePaths = false; havePaths = false; #endif -- cgit v1.2.3 From 44f8f2084b36960fd5e04636604b2e3416e8c947 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Dec 2014 19:19:05 +0100 Subject: de-duplicate and comment EffectivePaths presence detection Change-Id: Ibf9731c216df84c9e17ebd699d8349cc716ff3cc Reviewed-by: Thiago Macieira --- src/corelib/global/qlibraryinfo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 1f8de2e05d..4f9f54cde8 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -116,10 +116,11 @@ QLibrarySettings::QLibrarySettings() QStringList children = settings->childGroups(); #ifdef QT_BOOTSTRAPPED haveEffectiveSourcePaths = children.contains(QLatin1String("EffectiveSourcePaths")); - haveEffectivePaths = haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths")); #else - haveEffectivePaths = children.contains(QLatin1String("EffectivePaths")); + // EffectiveSourcePaths is for the Qt build only, so needs no backwards compat trickery. + bool haveEffectiveSourcePaths = false; #endif + haveEffectivePaths = haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths")); // Backwards compat: an existing but empty file is claimed to contain the Paths section. havePaths = (!haveEffectivePaths && !children.contains(QLatin1String(platformsSection))) || children.contains(QLatin1String("Paths")); -- cgit v1.2.3 From b25cfdce468c59305113b06c31473cbfaec1c139 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 7 Jan 2015 14:20:34 -0800 Subject: Fix compilation with MSVC 2010 2013 and 2015 compile this fine. I didn't test 2012. I wouldn't have fixed if the objective weren't to enable QtDBus by default on all architectures: since it is, we can't have Qt fail to compile from sources on MSVC 2010. qdbus_symbols.cpp(92) : fatal error C1001: An internal error has occurred in the compiler Change-Id: I42b930bc37c4e478a66725d83c8a73836fbf567c Reviewed-by: Friedemann Kleint Reviewed-by: Simon Hausmann --- src/dbus/qdbus_symbols.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dbus/qdbus_symbols.cpp b/src/dbus/qdbus_symbols.cpp index e475a23f48..67643098d9 100644 --- a/src/dbus/qdbus_symbols.cpp +++ b/src/dbus/qdbus_symbols.cpp @@ -86,9 +86,9 @@ bool qdbus_loadLibDBus() static int majorversions[] = { 3, 2, -1 }; const QString baseNames[] = { #ifdef Q_OS_WIN - QStringLiteral("dbus-1"), + QLatin1String("dbus-1"), #endif - QStringLiteral("libdbus-1") + QLatin1String("libdbus-1") }; lib->unload(); -- cgit v1.2.3 From b9258717f4fb98a6a89c967fd3ddfe9b66a6e2f8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Dec 2014 14:21:55 -0800 Subject: Remove EXTRA_CPPFLAGS This is not used or referenced anywhere Change-Id: I02e1aa76631627f64e5d1f9b36a13cdb5677e93f Reviewed-by: Oswald Buddenhagen --- qmake/Makefile.win32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index ebadd52f99..4a1347c954 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -42,7 +42,7 @@ CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \ -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ -DUNICODE -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS -CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) $(EXTRA_CPPFLAGS) +CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) CXXFLAGS_BARE = $(CFLAGS_BARE) CXXFLAGS = $(CFLAGS) -- cgit v1.2.3 From 8761b2b5d9f36395a52608ec853047fc6052e600 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 29 Oct 2014 13:21:22 -0700 Subject: Print some debugging information for pkg-config detection Commit d44781730ccd4d48af79f480813bf3f9a4000253 disabled use of pkg- config on Mac, which in turn automatically disables all of the tests that depend on pkg-config too, like D-Bus. If you then use the -dbus flag, configure would error out telling you that it couldn't find D-Bus, despite it being there. Now we print some helpful information on error and extra information for finding out why it may have got disabled. Change-Id: Ic4e41c58d62d80eb1a0f3ca1c93529e049aaf231 Reviewed-by: Oswald Buddenhagen --- configure | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/configure b/configure index 75fe189bef..5ad29bb784 100755 --- a/configure +++ b/configure @@ -3883,13 +3883,16 @@ fi if [ -z "$PKG_CONFIG" ]; then # See if PKG_CONFIG is set in the mkspec: PKG_CONFIG="`"$outpath/bin/qmake" -E -nocache -spec "$XQMAKESPEC" "CONFIG=" $DEV_NULL 2>&1 | sed -n -e 's,^PKG_CONFIG = \(.*\),\1,p'`" + [ -n "$PKG_CONFIG" ] && [ "$OPT_VERBOSE" = "yes" ] && echo "Found pkg-config from mkspec: $PKG_CONFIG" fi if [ -z "$PKG_CONFIG" ]; then PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null` + [ -n "$PKG_CONFIG" ] && [ "$OPT_VERBOSE" = "yes" ] && echo "Found pkg-config from \$PATH: $PKG_CONFIG" fi if [ "$CFG_PKGCONFIG" = "no" ]; then PKG_CONFIG= + [ "$OPT_VERBOSE" = "yes" ] && echo "pkg-config support disabled." elif [ "$CFG_PKGCONFIG" = "force" ]; then echo >&2 "" echo >&2 "You have asked to use pkg-config. Please make sure you have" @@ -4657,6 +4660,7 @@ if [ "$CFG_DBUS" = "linked" ]; then else if [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "The Qt D-Bus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found." + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -4678,6 +4682,7 @@ if [ "$CFG_GLIB" != "no" ]; then else if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "Glib support cannot be enabled due to functionality tests!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -4705,6 +4710,7 @@ if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then else if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "GTK theme support cannot be enabled due to functionality tests!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the fin al report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -4749,6 +4755,7 @@ if [ "$CFG_PULSEAUDIO" != "no" ]; then else if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "PulseAudio support cannot be enabled due to functionality tests!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -4875,6 +4882,7 @@ elif [ "$CFG_OPENGL" = "es2" ]; then compileTest unix/opengles2 "OpenGL ES 2.0" $QMAKE_LIBS_OPENGL_ES2 $QMAKE_CFLAGS_OPENGL_ES2 if [ $? != "0" ]; then echo "The OpenGL ES 2.0 functionality test failed!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " You might need to modify the include and library search paths by editing" echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in" echo " ${XQMAKESPEC}." @@ -4948,6 +4956,7 @@ if [ "$CFG_LIBUDEV" != "no" ]; then QT_CONFIG="$QT_CONFIG libudev" elif [ "$CFG_LIBUDEV" = "yes" ]; then echo "The libudev functionality test failed!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" exit 1 else CFG_LIBUDEV=no @@ -5099,6 +5108,7 @@ if [ "$CFG_XCB" != "no" ]; then else if [ "$CFG_XCB" != "auto" ]; then echo "The test for linking against libxcb failed!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " You might need to install dependency packages for libxcb." echo " See src/plugins/platforms/xcb/README." exit 1 @@ -5115,6 +5125,7 @@ if [ "$CFG_DIRECTFB" != "no" ]; then CFG_DIRECTFB=yes elif [ "$CFG_DIRECTFB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo " DirectFB support cannot be enabled due to functionality tests!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -5171,6 +5182,7 @@ if [ "$CFG_XCB" != "no" ]; then elif [ "$CFG_XKBCOMMON" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo " xkbcommon support cannot be enabled because either xkbcommon or " echo " xkbcommon-x11 >= $MIN_REQ_XKBCOMMON was not found via pkg-config!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -5231,6 +5243,7 @@ if [ "$CFG_EGL" != "no" ]; then fi elif [ "$CFG_EGL" = "yes" ]; then echo " The EGL functionality test failed; EGL is required by some QPA plugins to manage contexts & surfaces." + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " You might need to modify the include and library search paths by editing" echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in ${XQMAKESPEC}." exit 1 -- cgit v1.2.3 From 05d39ec9c0428696d3d523e6b024df59d456fc59 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 24 Dec 2014 12:28:38 -0200 Subject: Optimize QHostAddress::operator== for SpecialAddress There's no need to allocate memory for the special address. Change-Id: I5f3760565807731ab595e91fc934c21d10df212a Reviewed-by: Richard J. Moore --- src/network/kernel/qhostaddress.cpp | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index 10fdf2f97d..b68f6adfff 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -778,18 +778,34 @@ bool QHostAddress::operator==(const QHostAddress &other) const bool QHostAddress::operator ==(SpecialAddress other) const { QT_ENSURE_PARSED(this); - QHostAddress otherAddress(other); - QT_ENSURE_PARSED(&otherAddress); + switch (other) { + case Null: + return d->protocol == QAbstractSocket::UnknownNetworkLayerProtocol; - if (d->protocol == QAbstractSocket::IPv4Protocol) - return otherAddress.d->protocol == QAbstractSocket::IPv4Protocol && d->a == otherAddress.d->a; - if (d->protocol == QAbstractSocket::IPv6Protocol) { - return otherAddress.d->protocol == QAbstractSocket::IPv6Protocol - && memcmp(&d->a6, &otherAddress.d->a6, sizeof(Q_IPV6ADDR)) == 0; + case Broadcast: + return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_BROADCAST; + + case LocalHost: + return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_LOOPBACK; + + case Any: + return d->protocol == QAbstractSocket::AnyIPProtocol; + + case AnyIPv4: + return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_ANY; + + case LocalHostIPv6: + case AnyIPv6: + if (d->protocol == QAbstractSocket::IPv6Protocol) { + Q_IPV6ADDR ip6 = { { 0 } }; + ip6[15] = quint8(other == LocalHostIPv6); // 1 for localhost, 0 for any + return memcmp(&d->a6, &ip6, sizeof ip6) == 0; + } + return false; } - if (d->protocol == QAbstractSocket::AnyIPProtocol) - return other == QHostAddress::Any; - return int(other) == int(Null); + + Q_UNREACHABLE(); + return false; } /*! -- cgit v1.2.3 From a0737f65a62a5d72f15f5f1196b86f16605d936b Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 8 Jan 2015 17:11:43 +0200 Subject: Fixes for surface creation/destruction - After reset a surface we must call makeCurrent before we are usign swapBuffers. - No need to set the surface in QPA when surfaceCreated are called in QtSurface.java, some time the OpenGL surface is not fully initialized at this stage. Is better to wait for surfaceChanged which is always fired at least once. - DO NOT reset m_surfaceId to 1 when there is no surface. The problem is that if we have one surface and when we distory it we don't (need to) wait for its surfaceChanged/surfaceDestroyed notifications, and if we create another one quicly it will have the same id (1). Task-number: QTBUG-39712 Change-Id: I2aa31e5b59d81ef3b03624d4636a4381eea6d543 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../jar/src/org/qtproject/qt5/android/QtSurface.java | 2 -- src/plugins/platforms/android/androidjnimain.cpp | 2 -- .../android/qandroidplatformopenglcontext.cpp | 6 ++++-- .../android/qandroidplatformopenglwindow.cpp | 20 ++++++++++++-------- .../platforms/android/qandroidplatformopenglwindow.h | 4 ++-- .../platforms/android/qandroidplatformscreen.cpp | 2 +- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java index 34fc31b222..516671739e 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java @@ -45,7 +45,6 @@ package org.qtproject.qt5.android; import android.app.Activity; import android.content.Context; import android.graphics.PixelFormat; -import android.util.Log; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.SurfaceHolder; @@ -87,7 +86,6 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback @Override public void surfaceCreated(SurfaceHolder holder) { - QtNative.setSurface(getId(), holder.getSurface(), getWidth(), getHeight()); } @Override diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index d1e78dfe5d..1c157c79c3 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -376,8 +376,6 @@ namespace QtAndroid const auto &it = m_surfaces.find(surfaceId); if (it != m_surfaces.end()) m_surfaces.remove(surfaceId); - if (m_surfaces.isEmpty()) - m_surfaceId = 1; QJNIEnvironmentPrivate env; if (!env) diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp index 5781f0d7c6..4c38178343 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp @@ -50,8 +50,10 @@ QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(const QSurfaceForma void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface) { - if (surface->surface()->surfaceClass() == QSurface::Window) - static_cast(surface)->checkNativeSurface(eglConfig()); + if (surface->surface()->surfaceClass() == QSurface::Window && + static_cast(surface)->checkNativeSurface(eglConfig())) { + QEGLPlatformContext::makeCurrent(surface); + } QEGLPlatformContext::swapBuffers(surface); } diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp index 8dc8e84f0a..de7f1f6990 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp @@ -138,19 +138,19 @@ EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config) return m_eglSurface; } -void QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config) +bool QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config) { QMutexLocker lock(&m_surfaceMutex); if (m_nativeSurfaceId == -1 || !m_androidSurfaceObject.isValid()) - return; + return false; // makeCurrent is NOT needed. createEgl(config); - // we've create another surface, the window should be repainted QRect availableGeometry = screen()->availableGeometry(); if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0) QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size()))); + return true; // makeCurrent is needed! } void QAndroidPlatformOpenGLWindow::applicationStateChanged(Qt::ApplicationState state) @@ -209,15 +209,19 @@ void QAndroidPlatformOpenGLWindow::surfaceChanged(JNIEnv *jniEnv, jobject surfac Q_UNUSED(jniEnv); Q_UNUSED(w); Q_UNUSED(h); + lockSurface(); m_androidSurfaceObject = surface; - m_surfaceWaitCondition.wakeOne(); + if (surface) // wait until we have a valid surface to draw into + m_surfaceWaitCondition.wakeOne(); unlockSurface(); - // repaint the window - QRect availableGeometry = screen()->availableGeometry(); - if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0) - QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size()))); + if (surface) { + // repaint the window, when we have a valid surface + QRect availableGeometry = screen()->availableGeometry(); + if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0) + QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size()))); + } } QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.h b/src/plugins/platforms/android/qandroidplatformopenglwindow.h index 71787edee1..6d6548fc6a 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.h +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.h @@ -54,7 +54,7 @@ public: EGLSurface eglSurface(EGLConfig config); QSurfaceFormat format() const; - void checkNativeSurface(EGLConfig config); + bool checkNativeSurface(EGLConfig config); void applicationStateChanged(Qt::ApplicationState); @@ -66,7 +66,7 @@ protected: void clearEgl(); private: - EGLDisplay m_eglDisplay; + EGLDisplay m_eglDisplay = EGL_NO_DISPLAY; EGLSurface m_eglSurface = EGL_NO_SURFACE; EGLNativeWindowType m_nativeWindow = nullptr; diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp index b70f936be1..092ade2e4a 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.cpp +++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp @@ -391,7 +391,7 @@ Qt::ScreenOrientation QAndroidPlatformScreen::nativeOrientation() const void QAndroidPlatformScreen::surfaceChanged(JNIEnv *env, jobject surface, int w, int h) { lockSurface(); - if (surface && w && h) { + if (surface && w > 0 && h > 0) { releaseSurface(); m_nativeSurface = ANativeWindow_fromSurface(env, surface); QMetaObject::invokeMethod(this, "setDirty", Qt::QueuedConnection, Q_ARG(QRect, QRect(0, 0, w, h))); -- cgit v1.2.3 From 2924279c235e9cb12b58b0f3ae0b139f8ac5ac2c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 24 Dec 2014 16:29:30 -0200 Subject: Don't unnecessariy set localAddress in QNativeSocketEngine's nativeBind The outer QNativeSocketEngine::bind() function will call fetchConnectionParameters() as soon as nativeBind() returns, so don't bother copying localAddress. Change-Id: Ice13e507ccb9c575a7d3bdf0b41394f35230b746 Reviewed-by: Richard J. Moore --- src/network/socket/qnativesocketengine_unix.cpp | 3 --- src/network/socket/qnativesocketengine_win.cpp | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index ad170e187c..eed1b70025 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -567,9 +567,6 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16 return false; } - localPort = port; - localAddress = address; - #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == true", address.toString().toLatin1().constData(), port); diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index f5943d657f..184add15c3 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -852,9 +852,6 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &a, quint16 port) return false; } - localPort = port; - localAddress = address; - #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == true", address.toString().toLatin1().constData(), port); -- cgit v1.2.3 From cefaf61edac309216b7ff6c170602f5474aa1209 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 9 Jan 2015 13:02:39 +0100 Subject: remove pointless pwd fallbacks neither qmake_getpwd()'s return value nor a fileFixify()'d version of it can be empty. Change-Id: Ic3b7d20becc57209b9dbe71ad9dc8e7547d435b1 Reviewed-by: Thiago Macieira --- qmake/generators/mac/pbuilder_pbx.cpp | 2 -- qmake/generators/makefile.cpp | 2 -- qmake/generators/unix/unixmake2.cpp | 2 -- qmake/generators/win32/mingw_make.cpp | 2 -- 4 files changed, 8 deletions(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 0ff42500de..f80c3e84c8 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -742,8 +742,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) mkt << "INCPATH = -I" << specdir(); if(!project->isActiveConfig("no_include_pwd")) { QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - if(pwd.isEmpty()) - pwd = "."; mkt << " -I" << pwd; } { diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 4c501983d8..e34b820a8b 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -795,8 +795,6 @@ MakefileGenerator::init() incDirs += v["INCLUDEPATH"]; if(!project->isActiveConfig("no_include_pwd")) { QString pwd = qmake_getpwd(); - if(pwd.isEmpty()) - pwd = "."; incDirs += pwd; } QList deplist; diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 9165da4d38..3f9df31a1c 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -187,8 +187,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "INCPATH = -I" << specdir(); if(!project->isActiveConfig("no_include_pwd")) { QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - if(pwd.isEmpty()) - pwd = "."; t << " -I" << pwd; } { diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 3c53421fc4..9bb5b1e416 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -308,8 +308,6 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) if (!project->isActiveConfig("no_include_pwd")) { QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - if (pwd.isEmpty()) - pwd = "."; t << "-I" << pwd << " "; } -- cgit v1.2.3 From a90bb5b89a09490a1795064133f6d8ce33b6874e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 9 Jan 2015 13:42:57 +0100 Subject: centralize/unify/sanitize INCLUDEPATH "enrichment" instead of having each generator do its own magic (little surprisingly, with different outcomes), add "stuff" to the search path in one place used by all generators. this has several consequences: - (unless disabled via CONFIG+=no_include_pwd) $$PWD is now consistently prepended by all generators. most notably, this was entirely missing from the MSVC generators (both nmake and VS) - despite them needing it most. this also affects Xcode projects. - $$OUT_PWD (if different from $$PWD) is now added right after $$PWD, not at the end. this precedence clarification only makes sense, given that qmake tries to make shadow builds as transparent as possible. - the qmakespec's dir is now consistently appended. the UNIX and PBX generators prepended it, while the rest already appended. few files actually include qplatformdefs.h, so having it late in the search path seems reasonable. - the effect of CONFIG+=depend_includepath is now fully consistent with the actual include path. Change-Id: I5f7570183351ade29342ea74fef706a0738842bf Reviewed-by: Simon Hausmann Reviewed-by: Thiago Macieira --- qmake/generators/mac/pbuilder_pbx.cpp | 8 ++------ qmake/generators/makefile.cpp | 28 +++++++++++++++++++--------- qmake/generators/unix/unixmake2.cpp | 6 +----- qmake/generators/win32/mingw_make.cpp | 8 +------- qmake/generators/win32/msvc_vcproj.cpp | 1 - qmake/generators/win32/winmakefile.cpp | 3 +-- 6 files changed, 24 insertions(+), 30 deletions(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index f80c3e84c8..8f24c20712 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -739,11 +739,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) mkt << "DEFINES = " << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") << varGlue("DEFINES","-D"," -D","") << endl; - mkt << "INCPATH = -I" << specdir(); - if(!project->isActiveConfig("no_include_pwd")) { - QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - mkt << " -I" << pwd; - } + mkt << "INCPATH ="; { const ProStringList &incs = project->values("INCLUDEPATH"); for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) @@ -1495,7 +1491,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t\t\t" << writeSettings("GCC_PRECOMPILE_PREFIX_HEADER", "YES") << ";\n" << "\t\t\t\t" << writeSettings("GCC_PREFIX_HEADER", escapeFilePath(project->first("PRECOMPILED_HEADER"))) << ";\n"; } - t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH") + ProStringList(fixForOutput(specdir())), SettingsAsList, 5) << ";\n" + t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH"), SettingsAsList, 5) << ";\n" << "\t\t\t\t" << writeSettings("LIBRARY_SEARCH_PATHS", fixListForOutput("QMAKE_PBX_LIBPATHS"), SettingsAsList, 5) << ";\n" << "\t\t\t\t" << writeSettings("FRAMEWORK_SEARCH_PATHS", fixListForOutput("QMAKE_FRAMEWORKPATH"), !project->values("QMAKE_FRAMEWORKPATH").isEmpty() ? SettingsAsList : 0, 5) << ";\n"; diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index e34b820a8b..804eab9ca7 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -444,6 +444,25 @@ MakefileGenerator::init() setSystemIncludes(v["QMAKE_DEFAULT_INCDIRS"]); + ProStringList &incs = project->values("INCLUDEPATH"); + if (!project->isActiveConfig("no_include_pwd")) { + if (Option::output_dir != qmake_getpwd()) { + // Pretend that the build dir is the source dir for #include purposes, + // consistently with the "transparent shadow builds" strategy. This is + // also consistent with #include "foo.h" falling back to #include + // behavior if it doesn't find the file in the source dir. + incs.prepend(Option::output_dir); + } + // This makes #include work if the header lives in the source dir. + // The benefit of that is questionable, as generally the user should use the + // correct include style, and extra compilers that put stuff in the source dir + // should add the dir themselves. + // More importantly, it makes #include "foo.h" work with MSVC when shadow-building, + // as this compiler looks files up relative to %CD%, not the source file's parent. + incs.prepend(qmake_getpwd()); + } + incs.append(project->specDir()); + const char * const cacheKeys[] = { "_QMAKE_STASH_", "_QMAKE_SUPER_CACHE_", 0 }; for (int i = 0; cacheKeys[i]; ++i) { if (v[cacheKeys[i]].isEmpty()) @@ -793,10 +812,6 @@ MakefileGenerator::init() ProStringList incDirs = v["DEPENDPATH"] + v["QMAKE_ABSOLUTE_SOURCE_PATH"]; if(project->isActiveConfig("depend_includepath")) incDirs += v["INCLUDEPATH"]; - if(!project->isActiveConfig("no_include_pwd")) { - QString pwd = qmake_getpwd(); - incDirs += pwd; - } QList deplist; for (ProStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it) deplist.append(QMakeLocalFileName(unescapeFilePath((*it).toQString()))); @@ -848,11 +863,6 @@ MakefileGenerator::init() (*it) = Option::fixPathToLocalOS((*it).toQString()); } - if(!project->isActiveConfig("no_include_pwd")) { //get the output_dir into the pwd - if(Option::output_dir != qmake_getpwd()) - project->values("INCLUDEPATH").append("."); - } - //fix up the target deps static const char * const fixpaths[] = { "PRE_TARGETDEPS", "POST_TARGETDEPS", 0 }; for (int path = 0; fixpaths[path]; path++) { diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 3f9df31a1c..469f23340d 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -184,11 +184,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << varGlue("DEFINES","-D"," -D","") << endl; t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)\n"; t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n"; - t << "INCPATH = -I" << specdir(); - if(!project->isActiveConfig("no_include_pwd")) { - QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - t << " -I" << pwd; - } + t << "INCPATH ="; { QString isystem = var("QMAKE_CFLAGS_ISYSTEM"); const ProStringList &incs = project->values("INCLUDEPATH"); diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 9bb5b1e416..f2d6678cdf 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -306,11 +306,6 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) { t << "INCPATH = "; - if (!project->isActiveConfig("no_include_pwd")) { - QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - t << "-I" << pwd << " "; - } - QString isystem = var("QMAKE_CFLAGS_ISYSTEM"); const ProStringList &incs = project->values("INCLUDEPATH"); for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) { @@ -324,8 +319,7 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) t << "-I"; t << quote << inc << quote << " "; } - t << "-I" << quote << specdir() << quote - << endl; + t << endl; } void MingwMakefileGenerator::writeLibsPart(QTextStream &t) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index f271eb0679..e3031d559c 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1688,7 +1688,6 @@ void VcprojGenerator::initOld() inc = QString("\"%1\"").arg(inc); // Quote all paths if not quoted already project->values("MSVCPROJ_INCPATH").append("-I" + inc); } - project->values("MSVCPROJ_INCPATH").append("-I" + specdir()); QString dest = Option::fixPathToTargetOS(project->first("TARGET").toQString()) + project->first("TARGET_EXT"); project->values("MSVCPROJ_TARGET") = ProStringList(dest); diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 663665897b..3a2e146a33 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -606,8 +606,7 @@ void Win32MakefileGenerator::writeIncPart(QTextStream &t) if(!inc.isEmpty()) t << "-I\"" << inc << "\" "; } - t << "-I\"" << specdir() << "\"" - << endl; + t << endl; } void Win32MakefileGenerator::writeStandardParts(QTextStream &t) -- cgit v1.2.3 From fb166648936410f791ae6e600756d255b4a50545 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Jan 2015 22:06:18 -0200 Subject: Fix memory leaks with QDBusServer Two serious mistakes: - we need to call dbus_server_free_data_slot as many times as we call dbus_server_allocate_data_slot - we need to delete the d pointer... The changes to the unit tests are simply to cause the used peer connections to be removed so they don't show up in valgrind. Change-Id: I9fd1ada5503db9ba481806c09116874ee81f450d Reviewed-by: Alex Blasche --- src/dbus/qdbus_symbols_p.h | 2 ++ src/dbus/qdbusintegrator.cpp | 9 ++++++--- src/dbus/qdbusserver.cpp | 1 + tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h index 0785fea4b4..4bec3af490 100644 --- a/src/dbus/qdbus_symbols_p.h +++ b/src/dbus/qdbus_symbols_p.h @@ -323,6 +323,8 @@ DEFINEFUNC(void , dbus_pending_call_unref, (DBusPendingCall /* dbus-server.h */ DEFINEFUNC(dbus_bool_t , dbus_server_allocate_data_slot, (dbus_int32_t *slot_p), (slot_p), return) +DEFINEFUNC(void , dbus_server_free_data_slot, (dbus_int32_t *slot_p), + (slot_p), return) DEFINEFUNC(void , dbus_server_disconnect, (DBusServer *server), (server), ) DEFINEFUNC(char* , dbus_server_get_address, (DBusServer *server), diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index dd92602dce..698fb1b46c 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -66,6 +66,9 @@ QT_BEGIN_NAMESPACE +// used with dbus_server_allocate_data_slot +static dbus_int32_t server_slot = -1; + static QBasicAtomicInt isDebugging = Q_BASIC_ATOMIC_INITIALIZER(-1); #define qDBusDebug if (::isDebugging == 0); else qDebug @@ -1084,8 +1087,10 @@ void QDBusConnectionPrivate::closeConnection() mode = InvalidMode; // prevent reentrancy baseService.clear(); - if (server) + if (server) { q_dbus_server_disconnect(server); + q_dbus_server_free_data_slot(&server_slot); + } if (oldMode == ClientMode || oldMode == PeerMode) { if (connection) { @@ -1651,8 +1656,6 @@ void QDBusConnectionPrivate::handleSignal(const QDBusMessage& msg) handleSignal(key, msg); // third try } -static dbus_int32_t server_slot = -1; - void QDBusConnectionPrivate::setServer(DBusServer *s, const QDBusErrorInternal &error) { mode = ServerMode; diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp index b2c76a8750..3fec7c9111 100644 --- a/src/dbus/qdbusserver.cpp +++ b/src/dbus/qdbusserver.cpp @@ -110,6 +110,7 @@ QDBusServer::~QDBusServer() } d->serverConnectionNames.clear(); } + d->deleteLater(); } /*! diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp index df6fb9e9bc..70794a52f5 100644 --- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp +++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp @@ -294,6 +294,7 @@ void tst_QDBusConnection::connectToPeer() "", "newconn"); QVERIFY(!con.isConnected()); QVERIFY(con.lastError().isValid()); + QDBusConnection::disconnectFromPeer("newconn"); } QDBusServer server; @@ -303,6 +304,7 @@ void tst_QDBusConnection::connectToPeer() "unix:abstract=/tmp/dbus-XXXXXXXXXX,guid=00000000000000000000000000000000", "newconn2"); QVERIFY(!con.isConnected()); QVERIFY(con.lastError().isValid()); + QDBusConnection::disconnectFromPeer("newconn2"); } { -- cgit v1.2.3 From 3ba1b989a6c7e22e8f0b92c59c5bbb52cdcab638 Mon Sep 17 00:00:00 2001 From: Tomasz Olszak Date: Fri, 9 Jan 2015 22:20:02 +0100 Subject: xcb: build fix when XCB_USE_XLIB is not defined. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When XCB_USE_XLIB was not defined QXcbXSettings still used XIproto.h. This change removes XIProto.h dependency and leaves QXcbXSettings uninitialized when XCB_USE_XLIB is not defined. QXcbXSettings::initialize() is already used in other parts of code e.g. qxcbcursor.cpp. Change-Id: I48eb82e39c5c091b41e8ec19e742a21d41de2610 Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qxcbxsettings.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index 13d42832db..a1dadb0e54 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -36,7 +36,9 @@ #include #include +#ifdef XCB_USE_XLIB #include +#endif //XCB_USE_XLIB QT_BEGIN_NAMESPACE /* Implementation of http://standards.freedesktop.org/xsettings-spec/xsettings-0.5.html */ @@ -138,6 +140,7 @@ public: return value + 4 - remainder; } +#ifdef XCB_USE_XLIB void populateSettings(const QByteArray &xSettings) { if (xSettings.length() < 12) @@ -212,6 +215,7 @@ public: } } +#endif //XCB_USE_XLIB QXcbScreen *screen; xcb_window_t x_settings_window; @@ -258,8 +262,10 @@ QXcbXSettings::QXcbXSettings(QXcbScreen *screen) const uint32_t event_mask[] = { XCB_EVENT_MASK_STRUCTURE_NOTIFY|XCB_EVENT_MASK_PROPERTY_CHANGE }; xcb_change_window_attributes(screen->xcb_connection(),d_ptr->x_settings_window,event,event_mask); +#ifdef XCB_USE_XLIB d_ptr->populateSettings(d_ptr->getSettings()); d_ptr->initialized = true; +#endif //XCB_USE_XLIB } QXcbXSettings::~QXcbXSettings() @@ -279,7 +285,9 @@ void QXcbXSettings::handlePropertyNotifyEvent(const xcb_property_notify_event_t Q_D(QXcbXSettings); if (event->window != d->x_settings_window) return; +#ifdef XCB_USE_XLIB d->populateSettings(d->getSettings()); +#endif //XCB_USE_XLIB } void QXcbXSettings::registerCallbackForProperty(const QByteArray &property, QXcbXSettings::PropertyChangeFunc func, void *handle) -- cgit v1.2.3 From 075ae987c48ce732e6a22c1eba71023fa0ea1775 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 7 Jan 2015 15:44:12 +0100 Subject: X11 devicePixelRatio screen mapping fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix screen detection and window geometry when screens have different displayPixelRatios. We must use the native coordinate system to figure out which screen a window belongs to. Also, when a window moves to a screen with a different devicePixelRatio, we must recalculate the Qt geometry. Task-number: QTBUG-43713 Change-Id: I93063e37354ff88f3c8a13320b76dfb272e43a9c Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qxcbscreen.cpp | 5 ++++- src/plugins/platforms/xcb/qxcbscreen.h | 2 ++ src/plugins/platforms/xcb/qxcbwindow.cpp | 29 +++++++++++++++++++++++++++-- src/plugins/platforms/xcb/qxcbwindow.h | 2 ++ 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 73f27c7117..f8d68c68f0 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -77,8 +77,10 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, // virtual size is known (probably back-calculated from DPI and resolution) if (m_sizeMillimeters.isEmpty()) m_sizeMillimeters = m_virtualSizeMillimeters; - if (m_geometry.isEmpty()) + if (m_geometry.isEmpty()) { m_geometry = QRect(QPoint(), m_virtualSize/dpr); + m_nativeGeometry = QRect(QPoint(), m_virtualSize); + } if (m_availableGeometry.isEmpty()) m_availableGeometry = m_geometry; @@ -461,6 +463,7 @@ void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp) m_devicePixelRatio = qRound(dpi/96); const int dpr = int(devicePixelRatio()); // we may override m_devicePixelRatio m_geometry = QRect(xGeometry.topLeft()/dpr, xGeometry.size()/dpr); + m_nativeGeometry = QRect(xGeometry.topLeft(), xGeometry.size()); m_availableGeometry = QRect(xAvailableGeometry.topLeft()/dpr, xAvailableGeometry.size()/dpr); QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index b9ee331104..4675b12d9c 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -62,6 +62,7 @@ public: QWindow *topLevelAt(const QPoint &point) const; QRect geometry() const { return m_geometry; } + QRect nativeGeometry() const { return m_nativeGeometry; } QRect availableGeometry() const {return m_availableGeometry;} int depth() const { return m_screen->root_depth; } QImage::Format format() const; @@ -114,6 +115,7 @@ private: QSizeF m_outputSizeMillimeters; QSizeF m_sizeMillimeters; QRect m_geometry; + QRect m_nativeGeometry; QRect m_availableGeometry; QSize m_virtualSize; QSizeF m_virtualSizeMillimeters; diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index e1ccc3f086..590e296f61 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1831,6 +1831,23 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even } } +// Temporary workaround for bug in QPlatformScreen::screenForNativeGeometry +// we need the native geometries to detect our screen, but that's not +// available in cross-platform code. Will be fixed properly when highDPI +// support is refactored to expose the native coordinate system. + +QPlatformScreen *QXcbWindow::screenForNativeGeometry(const QRect &newGeometry) const +{ + QXcbScreen *currentScreen = static_cast(screen()); + if (!parent() && !currentScreen->nativeGeometry().intersects(newGeometry)) { + Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) { + if (static_cast(screen)->nativeGeometry().intersects(newGeometry)) + return screen; + } + } + return currentScreen; +} + void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event) { bool fromSendEvent = (event->response_type & 0x80); @@ -1847,15 +1864,23 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * } } - QRect rect = mapFromNative(QRect(pos, QSize(event->width, event->height)), int(devicePixelRatio())); + const int dpr = devicePixelRatio(); + const QRect nativeRect = QRect(pos, QSize(event->width, event->height)); + const QRect rect = mapFromNative(nativeRect, dpr); QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(window(), rect); - QPlatformScreen *newScreen = screenForGeometry(rect); + QPlatformScreen *newScreen = screenForNativeGeometry(nativeRect); if (newScreen != m_screen) { m_screen = static_cast(newScreen); QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen()); + int newDpr = devicePixelRatio(); + if (newDpr != dpr) { + QRect newRect = mapFromNative(nativeRect, newDpr); + QPlatformWindow::setGeometry(newRect); + QWindowSystemInterface::handleGeometryChange(window(), newRect); + } } m_configureNotifyPending = false; diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 12d20d004d..254421e57d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -154,6 +154,8 @@ public: qreal devicePixelRatio() const; + QPlatformScreen *screenForNativeGeometry(const QRect &newGeometry) const; + public Q_SLOTS: void updateSyncRequestCounter(); -- cgit v1.2.3 From 3f0b8a9f198cd1e0e8ae9150561f93fb1b931b7e Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 8 Jan 2015 13:55:32 +0100 Subject: Multi-screen DPI support for X11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calculate the logical DPI independently per screen, but only when auto dpr is enabled. Using a constant DPI value for all screens, based on the combined geometry is arguably incorrect, but changing this now will cause pixel-size fonts to behave visibly different from point-size fonts when moving the window to a different screen. However, with QT_DEVICE_PIXEL_RATIO=auto, the pixel size fonts are already changing when the devicePixelRatio changes. Without this change, the point-size fonts will *not* adapt, which is a clear bug. Task-number: QTBUG-43713 Change-Id: I3e71618f9d55b7828ccd70b69a7b7ce656c69d65 Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind Reviewed-by: Simon Hausmann Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbscreen.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index f8d68c68f0..6559a0bdba 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -317,8 +317,14 @@ QDpi QXcbScreen::logicalDpi() const if (m_forcedDpi > 0) return QDpi(m_forcedDpi/dpr, m_forcedDpi/dpr); - return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width() / dpr, - Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height() / dpr); + static const bool auto_dpr = qgetenv("QT_DEVICE_PIXEL_RATIO").toLower() == "auto"; + if (auto_dpr) { + return QDpi(Q_MM_PER_INCH * m_geometry.width() / m_sizeMillimeters.width(), + Q_MM_PER_INCH * m_geometry.height() / m_sizeMillimeters.height()); + } else { + return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width() / dpr, + Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height() / dpr); + } } -- cgit v1.2.3 From e1bd0ee534fe396b244c587fb51d2c00ef1c1953 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 9 Jan 2015 15:31:58 +0100 Subject: Android: XFAIL a few tests in QDnsLookup Some of these tests are verifying things that are not supported on Android, so we XFAIL these cases when we see the appropriate error message. Change-Id: I8245266f061c902515bb12251521159a8e19bfb7 Reviewed-by: Thiago Macieira --- .../auto/network/kernel/qdnslookup/tst_qdnslookup.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index cc8dd2105f..e7f30f8940 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -200,6 +200,12 @@ void tst_QDnsLookup::lookup() lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); + +#if defined(Q_OS_ANDROID) + if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) + QEXPECT_FAIL("", "Not yet supported on Android", Abort); +#endif + QVERIFY2(int(lookup.error()) == error, qPrintable(lookup.errorString())); if (error == QDnsLookup::NoError) QVERIFY(lookup.errorString().isEmpty()); @@ -295,6 +301,12 @@ void tst_QDnsLookup::lookupReuse() lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); + +#if defined(Q_OS_ANDROID) + if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) + QEXPECT_FAIL("", "Not yet supported on Android", Abort); +#endif + QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("a-single")); @@ -333,6 +345,12 @@ void tst_QDnsLookup::lookupAbortRetry() lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); + +#if defined(Q_OS_ANDROID) + if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) + QEXPECT_FAIL("", "Not yet supported on Android", Abort); +#endif + QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("aaaa-single")); -- cgit v1.2.3 From 34ce66cd89ea1c618d8f63dd2d9b95aed0a81b11 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Fri, 2 Jan 2015 12:56:18 +0100 Subject: Doc: link issue D-Bus Viewer Moved doc D-Bus Viewer from qdbusviewer.cpp to qtdbus-index.qdoc Doc moved from qttools to qtbase Task-number: QTBUG-43537 Change-Id: I718781a8f5029f64fea0f2be241b4d584cc8bfce Reviewed-by: Martin Smith --- src/dbus/doc/src/qtdbus-index.qdoc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/dbus/doc/src/qtdbus-index.qdoc b/src/dbus/doc/src/qtdbus-index.qdoc index 2249924ada..d534ea9140 100644 --- a/src/dbus/doc/src/qtdbus-index.qdoc +++ b/src/dbus/doc/src/qtdbus-index.qdoc @@ -212,5 +212,22 @@ \li \l{Qt D-Bus XML compiler (qdbusxml2cpp)} \li \l{Qt D-Bus C++ Classes} \li \l{Qt D-Bus Examples} + \li \l{D-Bus Viewer} \endlist */ + +/*! + \page qdbusviewer.html + \title D-Bus Viewer + \keyword qdbusviewer + + The Qt D-Bus Viewer is a tool that lets you introspect D-Bus objects and messages. You can + choose between the system bus and the session bus. Click on any service on the list + on the left side to see all the exported objects. + + You can invoke methods by double-clicking on them. If a method takes one or more IN parameters, + a property editor opens. + + Right-click on a signal to connect to it. All emitted signals including their parameters + are output in the message view on the lower side of the window. +*/ -- cgit v1.2.3 From 13ecde3b7af364be2db466029f796f3cb6310685 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 13 Jan 2015 12:53:04 +0100 Subject: iOS: guard text responder from clearing selection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When programatically setting a text selection on iOS, we call [UITextInputDelegate selectionWillChange] to report the change. If auto correction is enabled, UIKit will then reset the current tracking, and for some reason tell us to clear the selection. This is contradictory to us saying the the selection is about to change, and will cause an unwanted recursion back to Qt. Since there seems to be no way to stop UIKit from doing this, this patch will instead add a guard that refuses to change the selection recursively while processing a selection change from Qt. Task-number: QTBUG-43716 Change-Id: Id487a57cdda55d7e2d09c3efc14c7f03f566f15a Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiostextresponder.h | 1 + src/plugins/platforms/ios/qiostextresponder.mm | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/plugins/platforms/ios/qiostextresponder.h b/src/plugins/platforms/ios/qiostextresponder.h index 118ab8958a..21b61bf8da 100644 --- a/src/plugins/platforms/ios/qiostextresponder.h +++ b/src/plugins/platforms/ios/qiostextresponder.h @@ -51,6 +51,7 @@ class QIOSInputContext; QIOSInputContext *m_inputContext; QString m_markedText; BOOL m_inSendEventToFocusObject; + BOOL m_inSelectionChange; } - (id)initWithInputContext:(QIOSInputContext *)context; diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index bebc7577f8..15fade0838 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -171,6 +171,7 @@ return self; m_inSendEventToFocusObject = NO; + m_inSelectionChange = NO; m_inputContext = inputContext; QVariantMap platformData = [self imValue:Qt::ImPlatformData].toMap(); @@ -302,6 +303,7 @@ return; if (updatedProperties & (Qt::ImCursorPosition | Qt::ImAnchorPosition)) { + QScopedValueRollback rollback(m_inSelectionChange, true); [self.inputDelegate selectionWillChange:self]; [self.inputDelegate selectionDidChange:self]; } @@ -349,6 +351,15 @@ - (void)setSelectedTextRange:(UITextRange *)range { + if (m_inSelectionChange) { + // After [UITextInputDelegate selectionWillChange], UIKit will cancel + // any ongoing auto correction (if enabled) and ask us to set an empty selection. + // This is contradictory to our current attempt to set a selection, so we ignore + // the callback. UIKit will be re-notified of the new selection after + // [UITextInputDelegate selectionDidChange]. + return; + } + QUITextRange *r = static_cast(range); QList attrs; attrs << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, r.range.location, r.range.length, 0); -- cgit v1.2.3 From c3590c76775c889fde13dc155c2a31508db612e9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Jan 2015 15:34:45 -0800 Subject: Update doc saying QDateTime::setTime with invalid time sets to midnight QDateTimePrivate::setDateTime has a comment saying this is intentional, so document it. Task-number: QTBUG-43704 Change-Id: Ic5d393bfd36e48a193fcffff13b965409eaf7be9 Reviewed-by: Martin Smith --- src/corelib/tools/qdatetime.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index d52dea8d4f..082b721e82 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3296,8 +3296,8 @@ bool QDateTime::isDaylightTime() const } /*! - Sets the date part of this datetime to \a date. - If no time is set, it is set to midnight. + Sets the date part of this datetime to \a date. If no time is set yet, it + is set to midnight. If \a date is invalid, this QDateTime becomes invalid. \sa date(), setTime(), setTimeSpec() */ @@ -3309,7 +3309,14 @@ void QDateTime::setDate(const QDate &date) } /*! - Sets the time part of this datetime to \a time. + Sets the time part of this datetime to \a time. If \a time is not valid, + this function sets it to midnight. Therefore, it's possible to clear any + set time in a QDateTime by setting it to a default QTime: + + \code + QDateTime dt = QDateTime::currentDateTime(); + dt.setTime(QTime()); + \endcode \sa time(), setDate(), setTimeSpec() */ -- cgit v1.2.3 From 63ca2846e19df60e3eff1a451ef6fa459aa1bbdd Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 11 Jan 2015 10:06:44 -0800 Subject: Fix compilation with older MSVC: use qIsNan instead of isnan isnan is C99 and POSIX.1, which the older MSVC do not support. Use the Qt equivalent. Change-Id: Ic5d393bfd36e48a193fcffff13b8679cb83d12db Reviewed-by: Alex Blasche Reviewed-by: Friedemann Kleint --- tests/auto/dbus/qdbusmarshall/common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/dbus/qdbusmarshall/common.h b/tests/auto/dbus/qdbusmarshall/common.h index 76fe0e4bfb..323b54a137 100644 --- a/tests/auto/dbus/qdbusmarshall/common.h +++ b/tests/auto/dbus/qdbusmarshall/common.h @@ -30,7 +30,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include // isnan +#include // qIsNan #include #ifdef Q_OS_UNIX @@ -320,7 +320,7 @@ bool compare(const QVariant &v1, const QVariant &v2); bool compare(double d1, double d2) { - if (isnan(d1) && isnan(d2)) + if (qIsNaN(d1) && qIsNaN(d2)) return true; return d1 == d2; } -- cgit v1.2.3 From 241d32bfe3638b0e92e8e1dd1ae75411fe1aa6c7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 15 Jan 2015 14:45:46 +0100 Subject: Fix inlining order of functions in qpathclipper_p.h. When compiling tst_qpathclipper with MinGW: In file included from QtGui/private/qpathclipper_p.h:1:0, from tst_qpathclipper.cpp:33: src/gui/painting/qpathclipper_p.h:469:29: warning: 'static QPathEdge::Traversal QWingedEdge::flip(QPathEdge::Traversal)' redeclared without dllimport attribute after being referenced with dll linkage inline QPathEdge::Traversal QWingedEdge::flip(QPathEdge::Traversal traversal) ^ qpathclipper_p.h:474:29: warning: 'static QPathEdge::Direction QWingedEdge::flip(QPathEdge::Direction)' redeclared without dllimport attribute after being referenced with dll linkage inline QPathEdge::Direction QWingedEdge::flip(QPathEdge::Direction direction) Change-Id: I38feb07d693768285c1d405b3fc92a58c3309547 Reviewed-by: Gunnar Sletta --- src/gui/painting/qpathclipper_p.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h index 5475503f22..5fc8bbaf09 100644 --- a/src/gui/painting/qpathclipper_p.h +++ b/src/gui/painting/qpathclipper_p.h @@ -414,22 +414,6 @@ inline void QPathSegments::addIntersection(int index, const Intersection &inters } } -inline void QWingedEdge::TraversalStatus::flipDirection() -{ - direction = QWingedEdge::flip(direction); -} - -inline void QWingedEdge::TraversalStatus::flipTraversal() -{ - traversal = QWingedEdge::flip(traversal); -} - -inline void QWingedEdge::TraversalStatus::flip() -{ - flipDirection(); - flipTraversal(); -} - inline int QWingedEdge::edgeCount() const { return m_edges.size(); @@ -471,11 +455,27 @@ inline QPathEdge::Traversal QWingedEdge::flip(QPathEdge::Traversal traversal) return traversal == QPathEdge::RightTraversal ? QPathEdge::LeftTraversal : QPathEdge::RightTraversal; } +inline void QWingedEdge::TraversalStatus::flipTraversal() +{ + traversal = QWingedEdge::flip(traversal); +} + inline QPathEdge::Direction QWingedEdge::flip(QPathEdge::Direction direction) { return direction == QPathEdge::Forward ? QPathEdge::Backward : QPathEdge::Forward; } +inline void QWingedEdge::TraversalStatus::flipDirection() +{ + direction = QWingedEdge::flip(direction); +} + +inline void QWingedEdge::TraversalStatus::flip() +{ + flipDirection(); + flipTraversal(); +} + QT_END_NAMESPACE #endif // QPATHCLIPPER_P_H -- cgit v1.2.3 From ccb5978c6d45569e590bba527255fafbcb840d08 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 3 Dec 2014 14:08:39 +0100 Subject: Fix namespacing of QNSViewMouseMoveHelper Task-number: QTBUG-43061 Change-Id: Ied8cdf49c34ef155b0f0bbc7e547b7c01bcd1d11 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qnsview.h | 4 ++-- src/plugins/platforms/cocoa/qnsview.mm | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 8d8df13dc3..fa71ab4086 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -48,7 +48,7 @@ class QCocoaBackingStore; class QCocoaGLContext; QT_END_NAMESPACE -Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper); +Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); @interface QT_MANGLE_NAMESPACE(QNSView) : NSView { QImage m_backingStore; @@ -72,7 +72,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper); bool m_shouldSetGLContextinDrawRect; #endif NSString *m_inputSource; - QNSViewMouseMoveHelper *m_mouseMoveHelper; + QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) *m_mouseMoveHelper; bool m_resendKeyEvent; } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 699340795d..771b464805 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -83,7 +83,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; - (CGFloat)deviceDeltaZ; @end -@interface QNSViewMouseMoveHelper : NSObject +@interface QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) : NSObject { QNSView *view; } @@ -97,7 +97,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; @end -@implementation QNSViewMouseMoveHelper +@implementation QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) - (id)initWithView:(QNSView *)theView { @@ -158,7 +158,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; currentCustomDragTypes = 0; m_sendUpAsRightButton = false; m_inputSource = 0; - m_mouseMoveHelper = [[QNSViewMouseMoveHelper alloc] initWithView:self]; + m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self]; m_resendKeyEvent = false; if (!touchDevice) { -- cgit v1.2.3 From f6a59f8defbb478f7960c36982acb611d709ae40 Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Mon, 5 Jan 2015 14:11:05 +0100 Subject: Benchmarks: Build gui benchmarks only when gui module available Change-Id: I57fc2f09a4e31e379c256dfe3f5d7546cdcf2b4b Reviewed-by: Frederik Gladhorn --- tests/benchmarks/benchmarks.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro index e5a6f5d7d2..8ee8d017ab 100644 --- a/tests/benchmarks/benchmarks.pro +++ b/tests/benchmarks/benchmarks.pro @@ -1,12 +1,12 @@ TEMPLATE = subdirs SUBDIRS = \ corelib \ - gui \ sql \ # removed-by-refactor qtHaveModule(opengl): SUBDIRS += opengl qtHaveModule(dbus): SUBDIRS += dbus qtHaveModule(network): SUBDIRS += network +qtHaveModule(gui): SUBDIRS += gui check-trusted.CONFIG += recursive QMAKE_EXTRA_TARGETS += check-trusted -- cgit v1.2.3 From 997b04031039408790131359b4af393f7600bac6 Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Tue, 13 Jan 2015 15:49:09 +0100 Subject: Autotest: Find all autotests due to changed naming conventions The algorithm searches for all executables in search path starting with "tst_". Tests are not named like the folder they are contained in anymore. Change-Id: I360f293e43e30292fe0ae6230fd3ec7abf3d632d Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/test.pl | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/tests/auto/test.pl b/tests/auto/test.pl index 7c3708472c..48166e1c30 100755 --- a/tests/auto/test.pl +++ b/tests/auto/test.pl @@ -138,35 +138,22 @@ sub handleDir { my ($dir) = @_; my $currentDir = getcwd(); - chdir($dir) || die("Could not chdir to $dir"); - my @components; - my $command; - @components = split(/\//, $dir); - my $component = $components[$#components]; - - $command = "tst_".$component; - - if ( -e $command.$EXE_SUFFIX ) - { - executeTestCurrentDir($command); - } else { - opendir(DIR, $dir); - my @files = readdir(DIR); - closedir DIR; - my $file; - foreach $file (@files) - { - #skip hidden files - next if (substr($file,0,1) eq "."); - - if ( -d $dir."/".$file) - { - handleDir($dir."/".$file) - } - + opendir(DIR, $dir); + my @files = readdir(DIR); + closedir DIR; + my $file; + foreach $file (@files) { + #skip hidden files + next if (substr($file,0,1) eq "."); + + if ( -d $dir."/".$file) { + handleDir($dir."/".$file) + } elsif ( $file =~ /^tst_/ and -x $dir."/".$file ) { + chdir($dir) || die("Could not chdir to $dir"); + executeTestCurrentDir($file); + chdir($currentDir); } } - chdir($currentDir); } sub executeTestCurrentDir { -- cgit v1.2.3 From 988f1b2e5745646cf1bd7f9f65507356ff2ba12e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 6 Jan 2015 16:21:41 +0100 Subject: Windows: Use DND effect chosen in DragEnter/Move for Drop. The value of pdwEffect passed to IOleDropTarget::Drop() is always the one with which the drag was initiated. Task-number: QTBUG-43466 Change-Id: I045fef634b55d4f113b393aa0ad4aa15d37db372 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsdrag.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp index fce60c3169..d3eb049269 100644 --- a/src/plugins/platforms/windows/qwindowsdrag.cpp +++ b/src/plugins/platforms/windows/qwindowsdrag.cpp @@ -626,7 +626,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState, const QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_window, windowsDrag->dropData(), m_lastPoint / QWindowsScaling::factor(), - translateToQDragDropActions(*pdwEffect)); + translateToQDragDropActions(m_chosenEffect)); if (response.isAccepted()) { const Qt::DropAction action = response.acceptedAction(); -- cgit v1.2.3 From b4031387f91d9e96c19521486b82accdc45c178e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 7 Jan 2015 16:01:16 +0100 Subject: Android: Fix QImageReader test The files for the test have to be included in a qrc to be available on Android. Most of the image files are already in a qrc, but a couple were missing. We add this in a separate qrc to avoid interfering with the tests on other platforms. Change-Id: Ibb24f5015a1aba4d5622e14f7aae80bc18611ec4 Reviewed-by: BogDan Vatra --- tests/auto/gui/image/qimagereader/android_testdata.qrc | 6 ++++++ tests/auto/gui/image/qimagereader/qimagereader.pro | 4 ++++ 2 files changed, 10 insertions(+) create mode 100644 tests/auto/gui/image/qimagereader/android_testdata.qrc diff --git a/tests/auto/gui/image/qimagereader/android_testdata.qrc b/tests/auto/gui/image/qimagereader/android_testdata.qrc new file mode 100644 index 0000000000..bba32781fa --- /dev/null +++ b/tests/auto/gui/image/qimagereader/android_testdata.qrc @@ -0,0 +1,6 @@ + + + images/trans.gif + images/kollada-noext + + diff --git a/tests/auto/gui/image/qimagereader/qimagereader.pro b/tests/auto/gui/image/qimagereader/qimagereader.pro index 7686643b3a..76fb4d8bfc 100644 --- a/tests/auto/gui/image/qimagereader/qimagereader.pro +++ b/tests/auto/gui/image/qimagereader/qimagereader.pro @@ -5,6 +5,10 @@ MOC_DIR=tmp QT += core-private gui-private network testlib RESOURCES += qimagereader.qrc +android: !android-no-sdk { + RESOURCES += android_testdata.qrc +} + win32-msvc:QMAKE_CXXFLAGS -= -Zm200 win32-msvc:QMAKE_CXXFLAGS += -Zm800 win32-msvc.net:QMAKE_CXXFLAGS -= -Zm300 -- cgit v1.2.3 From 1ee6fdc72c8f9903ef813341007156436f0758ea Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 8 Jan 2015 11:59:23 +0100 Subject: Fix QRawFont test when used with bundled FreeType The auto-hinter in the FreeType version bundled in Qt gives slightly different advances on some glyphs. As noted in the removed code, this was already observed on Windows and QNX, and recently also on Android. I'm sure it could also happen on platforms using the system library if the system library was the same version as the one bundled in Qt. Instead of expect-failing the test, we simply accept both the observed results as valid. Note that we need to accept 9 as a result for the default hinting preference on all platforms, not just Windows, since the default hinting preference in FreeType can be a system setting. Change-Id: I3cc0f33f0f66dd64419770b37c10dee457706b5e Reviewed-by: Konstantin Ritt Reviewed-by: Friedemann Kleint Reviewed-by: Simon Hausmann --- tests/auto/gui/text/qrawfont/tst_qrawfont.cpp | 42 +++++++++++++++------------ 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index bd4da12ea3..969c8f9ce7 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -307,24 +307,22 @@ void tst_QRawFont::advances() bool supportsSubPixelPositions = font_d->fontEngine->supportsSubPixelPositions(); QVector advances = font.advancesForGlyphIndexes(glyphIndices); - // On Windows and QNX, freetype engine returns advance of 9 for some of the glyphs - // when full hinting is used (default on Windows). - bool mayFail = false; -#if defined (Q_OS_WIN) - mayFail = font_d->fontEngine->type() == QFontEngine::Freetype - && (hintingPreference == QFont::PreferFullHinting - || hintingPreference == QFont::PreferDefaultHinting); -#elif defined(Q_OS_QNX) - mayFail = font_d->fontEngine->type() == QFontEngine::Freetype - && hintingPreference == QFont::PreferFullHinting; -#endif + bool mayDiffer = font_d->fontEngine->type() == QFontEngine::Freetype + && (hintingPreference == QFont::PreferFullHinting + || hintingPreference == QFont::PreferDefaultHinting); for (int i = 0; i < glyphIndices.size(); ++i) { - if (mayFail && (i == 0 || i == 5)) { - QEXPECT_FAIL("", "FreeType engine reports unexpected advance " - "for some glyphs (9 instead of 8)", Continue); + if ((i == 0 || i == 5) && mayDiffer) { + QVERIFY2(qRound(advances.at(i).x()) == 8 + || qRound(advances.at(i).x()) == 9, + qPrintable(QStringLiteral("%1 != %2 && %1 != %3") + .arg(qRound(advances.at(i).x())) + .arg(8) + .arg(9))); + } else { + QCOMPARE(qRound(advances.at(i).x()), 8); } - QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0)); + if (supportsSubPixelPositions) QVERIFY(advances.at(i).x() > 8.0); @@ -342,11 +340,17 @@ void tst_QRawFont::advances() QVERIFY(font.advancesForGlyphIndexes(glyphIndices.constData(), advances.data(), numGlyphs)); for (int i = 0; i < glyphIndices.size(); ++i) { - if (mayFail && (i == 0 || i == 5)) { - QEXPECT_FAIL("", "FreeType engine reports unexpected advance " - "for some glyphs (9 instead of 8)", Continue); + if ((i == 0 || i == 5) && mayDiffer) { + QVERIFY2(qRound(advances.at(i).x()) == 8 + || qRound(advances.at(i).x()) == 9, + qPrintable(QStringLiteral("%1 != %2 && %1 != %3") + .arg(qRound(advances.at(i).x())) + .arg(8) + .arg(9))); + } else { + QCOMPARE(qRound(advances.at(i).x()), 8); } - QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0)); + if (supportsSubPixelPositions) QVERIFY(advances.at(i).x() > 8.0); -- cgit v1.2.3 From 9a34b69b7dfa40d19957a61457fc47e25af2d81f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 12 Jan 2015 13:24:55 +0100 Subject: Android: Skip QProcess_and_GuiEventLoop test This requires building a command line tool and running it using QProcess, which is not a supported deployment option on Android. Change-Id: I795374bf809a8e4d8634a55f5ebf1699ee9745d1 Reviewed-by: Christian Stromme --- .../other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp index 8321f4fee1..a44afcbe8f 100644 --- a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp +++ b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp @@ -45,6 +45,10 @@ private slots: void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop() { +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Not supported on Android"); +#endif + // based on testcase provided in QTBUG-39488 QByteArray msg = "Hello World"; -- cgit v1.2.3 From a0c21829eaa2bfc70b4d134c26ac96a63e48a6a5 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 12 Jan 2015 14:30:28 +0100 Subject: Android: Fix QSideBar test On Android, the HOME and TMPDIR environment variables both point to the application sandbox, whereas the QSideBar test assumed they were different. We work around this simply by creating a new directory and using this as the test dir in place of the home directory. Change-Id: I67e01926b901ddf237b05aff116d30b6c7885535 Reviewed-by: BogDan Vatra --- tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp index 3ed8e1e88e..273be1d9c3 100644 --- a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp @@ -113,6 +113,12 @@ void tst_QSidebar::addUrls() QAbstractItemModel *model = qsidebar.model(); QDir testDir = QDir::home(); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + // temp and home is the same directory on Android + testDir.mkdir(QStringLiteral("test")); + QVERIFY(testDir.cd(QStringLiteral("test"))); +#endif + // default QCOMPARE(model->rowCount(), 0); -- cgit v1.2.3 From 7a760f5ed91055b536219b7beff7a1e5446e1b59 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 13 Jan 2015 16:02:48 +0100 Subject: Android: Fix QDirModel tests This test needs to have a test environment available on the regular file system, so we create this when initializing the test. In addition we QEXPECT_FAIL one of the tests which seems to expose a legitimate bug. A bug report has been created for this. Change-Id: I7c90aea78a067815cb647a51db5d91a652a9fc1c Reviewed-by: BogDan Vatra --- .../auto/widgets/itemviews/qdirmodel/qdirmodel.pro | 6 +++- .../auto/widgets/itemviews/qdirmodel/testdata.qrc | 11 +++++++ .../widgets/itemviews/qdirmodel/tst_qdirmodel.cpp | 34 ++++++++++++++++++++-- 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 tests/auto/widgets/itemviews/qdirmodel/testdata.qrc diff --git a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro index 680286d1e4..79848ac22c 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro +++ b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro @@ -13,9 +13,13 @@ wince* { DEPLOYMENT += addit tests sourceFile } -wince*: { +android|wince*: { DEFINES += SRCDIR=\\\"./\\\" } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc b/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc new file mode 100644 index 0000000000..e0ef4203fe --- /dev/null +++ b/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc @@ -0,0 +1,11 @@ + + + dirtest/test1/dummy + dirtest/test1/test + test/file01.tst + test/file02.tst + test/file03.tst + test/file04.tst + tst_qdirmodel.cpp + + diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp index 4fee5fb1e5..56a8d1f1f4 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp @@ -42,6 +42,7 @@ class tst_QDirModel : public QObject { Q_OBJECT public slots: + void initTestCase(); void cleanupTestCase(); void init(); private slots: @@ -113,6 +114,29 @@ void tst_QDirModel::getSetCheck() QCOMPARE(true, obj1.lazyChildCount()); } +void tst_QDirModel::initTestCase() +{ +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QString dataPath = SRCDIR; + QString resourceSourcePath = QStringLiteral(":/android_testdata"); + QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories); + while (it.hasNext()) { + it.next(); + + QFileInfo fileInfo = it.fileInfo(); + if (!fileInfo.isDir()) { + QString destination = dataPath + QLatin1Char('/') + fileInfo.filePath().mid(resourceSourcePath.length()); + QFileInfo destinationFileInfo(destination); + if (!destinationFileInfo.exists()) { + QDir().mkpath(destinationFileInfo.path()); + if (!QFile::copy(fileInfo.filePath(), destination)) + qWarning("Failed to copy %s", qPrintable(fileInfo.filePath())); + } + } + } +#endif +} + void tst_QDirModel::cleanupTestCase() { QDir current; @@ -556,10 +580,12 @@ void tst_QDirModel::filePath() model.setResolveSymlinks(false); QModelIndex index = model.index(SRCDIR "test.lnk"); QVERIFY(index.isValid()); -#ifndef Q_OS_WINCE +#if !defined(Q_OS_WINCE) && !defined(Q_OS_ANDROID) QString path = SRCDIR; #else - QString path = QFileInfo(SRCDIR).absoluteFilePath() + "/"; + QString path = QFileInfo(SRCDIR).absoluteFilePath(); + if (!path.endsWith("/")) + path += "/"; #endif QCOMPARE(model.filePath(index), path + QString( "test.lnk")); model.setResolveSymlinks(true); @@ -592,6 +618,10 @@ void tst_QDirModel::task196768_sorting() view.setSortingEnabled(true); index2 = model.index(path); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QEXPECT_FAIL("", "QTBUG-43818", Continue); +#endif + QCOMPARE(index.data(), index2.data()); } -- cgit v1.2.3 From 4448576ae04ad9261ffad07c8ff15486d56fa28c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 13 Jan 2015 16:13:34 +0100 Subject: Android: Fix QLayout tests This test requires test data to be available and the testRetainSizeWhenHidden test assumes that a widget will be sized based on its sizeHint(), which does not work on platforms where show() implies showMaximized(). Change-Id: I9bf372d8c0ea94845ae08481ec555fe25dcfebc0 Reviewed-by: BogDan Vatra --- tests/auto/widgets/kernel/qlayout/qlayout.pro | 5 +++++ tests/auto/widgets/kernel/qlayout/testdata.qrc | 5 +++++ tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp | 4 ++++ 3 files changed, 14 insertions(+) create mode 100644 tests/auto/widgets/kernel/qlayout/testdata.qrc diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro index 4a5db512c8..8bdbde9282 100644 --- a/tests/auto/widgets/kernel/qlayout/qlayout.pro +++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro @@ -11,3 +11,8 @@ wince* { } else { TESTDATA += baseline/* } + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/widgets/kernel/qlayout/testdata.qrc b/tests/auto/widgets/kernel/qlayout/testdata.qrc new file mode 100644 index 0000000000..24e8e56263 --- /dev/null +++ b/tests/auto/widgets/kernel/qlayout/testdata.qrc @@ -0,0 +1,5 @@ + + + baseline/smartmaxsize + + diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index c889643524..0bdc71e55b 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -345,6 +345,10 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated() void tst_QLayout::testRetainSizeWhenHidden() { +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Test does not work on platforms which default to showMaximized()"); +#endif + QWidget widget; QBoxLayout layout(QBoxLayout::TopToBottom, &widget); -- cgit v1.2.3 From c1d08afd31074a2733057ed6620735ef2f4dd8c6 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 12 Jan 2015 10:14:44 +0100 Subject: Fix constantly growing window bug with devicePixelRatio Rectangles need to be mapped differently depending on what they are used for. Expose events need to cover the entire geometry, so they must be rounded up, potentially increasing the size. If we use the same conversion for window geometries, it is possible to end up with a feedback loop if the window reacts to the new size. Task-number: QTBUG-43743 Change-Id: I7881cc77bf2148fed2ae743c4226617a61197434 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbwindow.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 590e296f61..4fd71f1635 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -151,7 +151,7 @@ static inline QRect mapToNative(const QRect &qtRect, int dpr) return QRect(qtRect.x() * dpr, qtRect.y() * dpr, qtRect.width() * dpr, qtRect.height() * dpr); } -// When converting native rects to Qt rects: round top/left towards the origin and +// When mapping expose events to Qt rects: round top/left towards the origin and // bottom/right away from the origin, making sure that we cover the whole widget static inline QPoint dpr_floor(const QPoint &p, int dpr) @@ -164,11 +164,15 @@ static inline QPoint dpr_ceil(const QPoint &p, int dpr) return QPoint((p.x() + dpr - 1) / dpr, (p.y() + dpr - 1) / dpr); } -static inline QRect mapFromNative(const QRect &xRect, int dpr) +static inline QRect mapExposeFromNative(const QRect &xRect, int dpr) { return QRect(dpr_floor(xRect.topLeft(), dpr), dpr_ceil(xRect.bottomRight(), dpr)); } +static inline QRect mapGeometryFromNative(const QRect &xRect, int dpr) +{ + return QRect(xRect.topLeft() / dpr, xRect.bottomRight() / dpr); +} // Returns \c true if we should set WM_TRANSIENT_FOR on \a w static inline bool isTransient(const QWindow *w) @@ -1718,7 +1722,7 @@ public: return false; if (expose->count == 0) m_pending = false; - *m_region |= mapFromNative(QRect(expose->x, expose->y, expose->width, expose->height), m_dpr); + *m_region |= mapExposeFromNative(QRect(expose->x, expose->y, expose->width, expose->height), m_dpr); return true; } @@ -1746,7 +1750,7 @@ void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event) { const int dpr = int(devicePixelRatio()); QRect x_rect(event->x, event->y, event->width, event->height); - QRect rect = mapFromNative(x_rect, dpr); + QRect rect = mapExposeFromNative(x_rect, dpr); if (m_exposeRegion.isEmpty()) m_exposeRegion = rect; @@ -1866,7 +1870,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * const int dpr = devicePixelRatio(); const QRect nativeRect = QRect(pos, QSize(event->width, event->height)); - const QRect rect = mapFromNative(nativeRect, dpr); + const QRect rect = mapGeometryFromNative(nativeRect, dpr); QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(window(), rect); @@ -1877,7 +1881,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen()); int newDpr = devicePixelRatio(); if (newDpr != dpr) { - QRect newRect = mapFromNative(nativeRect, newDpr); + QRect newRect = mapGeometryFromNative(nativeRect, newDpr); QPlatformWindow::setGeometry(newRect); QWindowSystemInterface::handleGeometryChange(window(), newRect); } -- cgit v1.2.3 From a8a00f646b57b5a7ca2cf8603311888ff6ff09f8 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 13 Jan 2015 12:45:28 +0100 Subject: Turn off font hinting when we do high DPI scaling Font hinting depends on the specific pixel size, and ends up very wrong when the painter is scaled. Change-Id: I2007ec7e7ad8d52358d76e88e030ea4df7e91455 Task-number: QTBUG-43809 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../fontdatabases/fontconfig/qfontconfigdatabase.cpp | 5 +++++ src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 6 +++++- src/plugins/platforms/xcb/qxcbnativeinterface.h | 3 ++- src/plugins/platforms/xcb/qxcbscreen.cpp | 7 +++++++ src/plugins/platforms/xcb/qxcbscreen.h | 2 ++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 5dec1d0915..27ff33be86 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -521,6 +521,11 @@ QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintin break; } + if (QGuiApplication::platformNativeInterface()->nativeResourceForScreen("nofonthinting", + QGuiApplication::primaryScreen())) { + return QFontEngine::HintNone; + } + if (useXftConf) { void *hintStyleResource = QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle", diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 3058b29f2d..31dedd40a2 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -78,7 +78,8 @@ static int resourceType(const QByteArray &key) QByteArrayLiteral("startupid"), QByteArrayLiteral("traywindow"), QByteArrayLiteral("gettimestamp"), QByteArrayLiteral("x11screen"), QByteArrayLiteral("rootwindow"), - QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingEnabled") + QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingEnabled"), + QByteArrayLiteral("nofonthinting") }; const QByteArray *end = names + sizeof(names) / sizeof(names[0]); const QByteArray *result = std::find(names, end, key); @@ -283,6 +284,9 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q case GetTimestamp: result = getTimestamp(xcbScreen); break; + case NoFontHinting: + result = xcbScreen->noFontHinting() ? this : 0; //qboolptr... + break; default: break; } diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index b667f1a372..330dd008c4 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -67,7 +67,8 @@ public: X11Screen, RootWindow, ScreenSubpixelType, - ScreenAntialiasingEnabled + ScreenAntialiasingEnabled, + NoFontHinting }; QXcbNativeInterface(); diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 6559a0bdba..7136455754 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -62,6 +62,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, , m_forcedDpi(-1) , m_devicePixelRatio(1) , m_hintStyle(QFontEngine::HintStyle(-1)) + , m_noFontHinting(false) , m_subpixelType(QFontEngine::SubpixelAntialiasingType(-1)) , m_antialiasingEnabled(-1) , m_xSettings(0) @@ -86,6 +87,12 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, readXResources(); + // disable font hinting when we do UI scaling + static bool dpr_scaling_enabled = (qgetenv("QT_DEVICE_PIXEL_RATIO").toInt() > 1 + || qgetenv("QT_DEVICE_PIXEL_RATIO").toLower() == "auto"); + if (dpr_scaling_enabled) + m_noFontHinting = true; + #ifdef Q_XCB_DEBUG qDebug(); qDebug("Screen output %s of xcb screen %d:", m_outputName.toUtf8().constData(), m_number); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 4675b12d9c..e9ab2edaa0 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -98,6 +98,7 @@ public: void readXResources(); QFontEngine::HintStyle hintStyle() const { return m_hintStyle; } + bool noFontHinting() const { return m_noFontHinting; } QFontEngine::SubpixelAntialiasingType subpixelType() const { return m_subpixelType; } int antialiasingEnabled() const { return m_antialiasingEnabled; } @@ -132,6 +133,7 @@ private: int m_forcedDpi; int m_devicePixelRatio; QFontEngine::HintStyle m_hintStyle; + bool m_noFontHinting; QFontEngine::SubpixelAntialiasingType m_subpixelType; int m_antialiasingEnabled; QXcbXSettings *m_xSettings; -- cgit v1.2.3 From 24238e6a3188062521ce7ed6d8d5468751a28d97 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 4 Dec 2014 15:14:18 +0100 Subject: Doc: link issues in corelib Task-number: QTBUG-43115 Change-Id: Ia80802e698f16730698e9a90102f549fb35f9305 Reviewed-by: Martin Smith --- src/corelib/doc/src/external-resources.qdoc | 11 +++++++++++ src/corelib/kernel/qobject.cpp | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/corelib/doc/src/external-resources.qdoc b/src/corelib/doc/src/external-resources.qdoc index a4f1b8723a..03af1d81bf 100644 --- a/src/corelib/doc/src/external-resources.qdoc +++ b/src/corelib/doc/src/external-resources.qdoc @@ -55,3 +55,14 @@ \externalpage http://www.iana.org/assignments/character-sets/character-sets.xml \title IANA character-sets encoding file */ + +/*! + \externalpage http://doc-snapshot.qt-project.org/qt5-5.4/qtdesigner-manual.html + \title Using a Designer UI File in Your Application +*/ + +/*! + \externalpage http://doc-snapshot.qt-project.org/qt5-5.4/designer-widget-mode.html#the-property-editor + \title Qt Designer's Widget Editing Mode#The Property Editor +*/ +*/ diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 492031d7fe..a1a04b3ce5 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2741,9 +2741,9 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign You can check if the QMetaObject::Connection is valid by casting it to a bool. This function works in the same way as - connect(const QObject *sender, const char *signal, + \c {connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, - Qt::ConnectionType type) + Qt::ConnectionType type)} but it uses QMetaMethod to specify signal and method. \sa connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) @@ -2996,7 +2996,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal, otherwise returns \c false. This function provides the same possibilities like - disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) + \c {disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) } but uses QMetaMethod to represent the signal and the method to be disconnected. Additionally this function returnsfalse and no signals and slots disconnected @@ -4110,7 +4110,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) { This macro associates extra information to the class, which is available using QObject::metaObject(). Qt makes only limited use of this feature, in - the \l{Active Qt}, \l{Qt D-Bus} and \l{Qt QML} modules. + the \l{Active Qt}, \l{Qt D-Bus} and \l{Qt QML module}{Qt QML}. The extra information takes the form of a \a Name string and a \a Value literal string. @@ -4122,7 +4122,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) { \sa QMetaObject::classInfo() \sa QAxFactory \sa {Using Qt D-Bus Adaptors} - \sa {Extending QML - Default Property Example} + \sa {Extending QML} */ /*! -- cgit v1.2.3 From 871560d45c1e4ad5c70c9d6b77cad8d3b15a4103 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 23 Dec 2014 13:39:24 +0100 Subject: Doc: define target voor function qsnprintf() Task-number: QTBUG-43537 Change-Id: I76c511891a1a07eca77da399d23097e76047f824 Reviewed-by: Martin Smith --- src/corelib/tools/qvsnprintf.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/tools/qvsnprintf.cpp b/src/corelib/tools/qvsnprintf.cpp index cf595b8f31..be92e20fac 100644 --- a/src/corelib/tools/qvsnprintf.cpp +++ b/src/corelib/tools/qvsnprintf.cpp @@ -97,6 +97,7 @@ int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap) #endif /*! + \target bytearray-qsnprintf \relates QByteArray A portable snprintf() function, calls qvsnprintf. -- cgit v1.2.3 From ddbac7de8d904d02d1f84d4d2d76c2885ffa32c0 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 5 Jan 2015 13:11:18 +0100 Subject: Doc: added entry for link to main page Qt Creator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-43115 Change-Id: I10413536b981bf248950522dfe07b96394db9c29 Reviewed-by: Martin Smith Reviewed-by: Topi Reiniö --- doc/global/externalsites/qch-urls.qdoc | 95 ---------------------------------- qmake/doc/src/qmake-manual.qdoc | 8 +-- 2 files changed, 4 insertions(+), 99 deletions(-) delete mode 100644 doc/global/externalsites/qch-urls.qdoc diff --git a/doc/global/externalsites/qch-urls.qdoc b/doc/global/externalsites/qch-urls.qdoc deleted file mode 100644 index 53ab94091e..0000000000 --- a/doc/global/externalsites/qch-urls.qdoc +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \externalpage http://doc.qt.digia.com/qtcreator/creator-qml-application.html - \title external: Developing Qt Quick Applications with Creator -*/ -/*! - \externalpage http://doc.qt.digia.com/qtcreator/creator-visual-editor.html - \title external: Developing Qt Quick Applications -*/ -/*! - \externalpage http://doc.qt.digia.com/qtcreator/creator-publish-ovi.html - \title external: Publishing Applications to Ovi Store -*/ -/*! - \externalpage http://doc.qt.io/qtcreator - \title external: Qt Creator Manual -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/index.html - \title external: Qt Mobility Manual -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/qml-plugins.html - \title external: Qt Mobility QML Plugins -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-project-managing.html - \title external: Creating Qt Projects in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-building-running.html - \title external: Building and Running Applications in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-running-targets.html - \title external: Set Compiler Targets in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-build-settings.html - \title external: Build Settings in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-run-settings.html - \title external: Run Settings in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-using-qt-designer.html - \title external: Designer in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-debugging.html - \title external: Debugging Applications in Creator -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/multimedia.html - \title external: Mobility Multimedia -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/location-overview.html - \title external: Mobility Location -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/all-examples.html - \title external: Qt Mobility Examples -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-overview.html - \title external: Qt Creator Overview -*/ diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 414b42d48e..b78a742999 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -122,10 +122,10 @@ configuration options to fine tune the build process. For more information, see \l{Building Common Project Types}. - You can use the \l{external: Qt Creator Manual}{Qt Creator} new project - wizard to create the project file. You choose the project template, and Qt - Creator creates a project file with default values that enable you to build - and run the project. You can modify the project file to suit your purposes. + You can use the \l{Qt Creator: Creating Projects}{Qt Creator new project wizard} to create the project file. + You choose the project template, and Qt Creator creates a project file with + default values that enable you to build and run the project. You can modify + the project file to suit your purposes. You can also use qmake to generate project files. For a full description of qmake command line options, see \l{Running qmake}. -- cgit v1.2.3 From 576cf413bb126e0350a2d8d79267496d7619e6c2 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 6 Jan 2015 12:55:58 +0100 Subject: Doc: verb "to layout" changed to "to lay out" Task-number: QTBUG-43657 Change-Id: I574186253ee423cc380ec3c6f274f1caa2a6aa2a Reviewed-by: Martin Smith --- src/gui/text/qfontmetrics.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 9610482145..e010dd62ae 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -647,7 +647,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const e.g. for italicized fonts, and that the width of the returned rectangle might be different than what the width() method returns. - If you want to know the advance width of the string (to layout + If you want to know the advance width of the string (to lay out a set of strings next to each other), use width() instead. Newline characters are processed as normal characters, \e not as @@ -817,7 +817,7 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA e.g. for italicized fonts, and that the width of the returned rectangle might be different than what the width() method returns. - If you want to know the advance width of the string (to layout + If you want to know the advance width of the string (to lay out a set of strings next to each other), use width() instead. Newline characters are processed as normal characters, \e not as @@ -1432,7 +1432,7 @@ qreal QFontMetricsF::width(QChar ch) const e.g. for italicized fonts, and that the width of the returned rectangle might be different than what the width() method returns. - If you want to know the advance width of the string (to layout + If you want to know the advance width of the string (to lay out a set of strings next to each other), use width() instead. Newline characters are processed as normal characters, \e not as @@ -1606,7 +1606,7 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta e.g. for italicized fonts, and that the width of the returned rectangle might be different than what the width() method returns. - If you want to know the advance width of the string (to layout + If you want to know the advance width of the string (to lay out a set of strings next to each other), use width() instead. Newline characters are processed as normal characters, \e not as -- cgit v1.2.3 From 5884160db62f32bed91f8449c4ca1204b8ba5dbd Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 7 Jan 2015 13:49:52 +0100 Subject: iOS: add AppIcon asset name to Xcode project MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current work-flow for adding app icons to an iOS app during deployment is not good. You basically need to specify that you want to use asset catalogs from within Xcode and add your icons there. The problem is that qmake will regenerate the Xcode project the next time it runs, and your changes will then be lost. This patch will check if the project has a valid asset catalog assigned to QMAKE_BUNDLE_DATA, and configure the Xcode project to use it for app icons. Change-Id: I06621ca46aad91de96cb23ba8ca3b1a3f1226670 Reviewed-by: Tor Arne Vestbø --- mkspecs/macx-ios-clang/features/default_post.prf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf index aa849eb8b1..f1f23dd716 100644 --- a/mkspecs/macx-ios-clang/features/default_post.prf +++ b/mkspecs/macx-ios-clang/features/default_post.prf @@ -174,6 +174,21 @@ macx-xcode { ios_device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY QMAKE_MAC_XCODE_SETTINGS += ios_device_family + # If QMAKE_BUNDLE_DATA contains an asset catalog that includes an + # AppIcon.appiconset, we configure Xcode to use it for app icons. + for(bundle_data, QMAKE_BUNDLE_DATA) { + for(bundle_file, $${bundle_data}.files) { + !contains(bundle_file, .*\.xcassets$): next() + !exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next() + + asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME" + asset_catalog_appicon.value = "AppIcon" + QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon + break() + } + !isEmpty(asset_catalog_appicon.name): break() + } + # Set up default 4-inch iPhone/iPod launch image so that our apps # support the full screen resolution of those devices. launch_image = Default-568h@2x.png -- cgit v1.2.3 From e01c8103e14371dab7660343aff058528a11d763 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 22 Dec 2014 16:45:09 +0100 Subject: fix MSVC target architecture detection for amd64_x86 When using the cross-compiler toolchain for 32 bit on a 64 bit machine, qmake generated a 64 bit VS project. This was because qmake didn't know about the amd64_x86 cross-compiler, and qmake did not use the first MSVC bin directory it found in PATH. Task-number: QTBUG-43457 Change-Id: I50c6f7bb9afe44a58321c670d680dbcc7cd07223 Reviewed-by: Oswald Buddenhagen --- qmake/library/qmakeevaluator.cpp | 57 +++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 4eb624aa87..fe089c1059 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -944,6 +944,45 @@ void QMakeEvaluator::setTemplate() } } +#if defined(Q_CC_MSVC) +static ProString msvcBinDirToQMakeArch(QString subdir) +{ + int idx = subdir.indexOf(QLatin1Char('\\')); + if (idx == -1) + return ProString("x86"); + subdir.remove(0, idx + 1); + idx = subdir.indexOf(QLatin1Char('_')); + if (idx >= 0) + subdir.remove(0, idx + 1); + subdir = subdir.toLower(); + if (subdir == QStringLiteral("amd64")) + return ProString("x86_64"); + return ProString(subdir); +} + +static ProString defaultMsvcArchitecture() +{ + return ProString("x86"); +} + +static ProString msvcArchitecture(const QString &vcInstallDir, const QString &pathVar) +{ + if (vcInstallDir.isEmpty()) + return defaultMsvcArchitecture(); + QString vcBinDir = vcInstallDir; + if (vcBinDir.endsWith(QLatin1Char('\\'))) + vcBinDir.chop(1); + foreach (const QString &dir, pathVar.split(QLatin1Char(';'))) { + if (!dir.startsWith(vcBinDir, Qt::CaseInsensitive)) + continue; + const ProString arch = msvcBinDirToQMakeArch(dir.mid(vcBinDir.length() + 1)); + if (!arch.isEmpty()) + return arch; + } + return defaultMsvcArchitecture(); +} +#endif // defined(Q_CC_MSVC) + void QMakeEvaluator::loadDefaults() { ProValueMap &vars = m_valuemapStack.top(); @@ -1004,21 +1043,9 @@ void QMakeEvaluator::loadDefaults() vars[ProKey("QMAKE_HOST.arch")] << archStr; # if defined(Q_CC_MSVC) // ### bogus condition, but nobody x-builds for msvc with a different qmake - QLatin1Char backslash('\\'); - QString paths = m_option->getEnv(QLatin1String("PATH")); - QString vcBin64 = m_option->getEnv(QLatin1String("VCINSTALLDIR")); - if (!vcBin64.endsWith(backslash)) - vcBin64.append(backslash); - vcBin64.append(QLatin1String("bin\\amd64")); - QString vcBinX86_64 = m_option->getEnv(QLatin1String("VCINSTALLDIR")); - if (!vcBinX86_64.endsWith(backslash)) - vcBinX86_64.append(backslash); - vcBinX86_64.append(QLatin1String("bin\\x86_amd64")); - if (paths.contains(vcBin64, Qt::CaseInsensitive) - || paths.contains(vcBinX86_64, Qt::CaseInsensitive)) - vars[ProKey("QMAKE_TARGET.arch")] << ProString("x86_64"); - else - vars[ProKey("QMAKE_TARGET.arch")] << ProString("x86"); + vars[ProKey("QMAKE_TARGET.arch")] = msvcArchitecture( + m_option->getEnv(QLatin1String("VCINSTALLDIR")), + m_option->getEnv(QLatin1String("PATH"))); # endif #elif defined(Q_OS_UNIX) struct utsname name; -- cgit v1.2.3 From c28718b88b0cfc712a5177f04475813045c45119 Mon Sep 17 00:00:00 2001 From: Eric Lemanissier Date: Fri, 16 Jan 2015 11:44:59 +0100 Subject: Correction on bound values in case of repeated QSqlQuery::execBatch Until now, QSqlQuery::execBatch did not call resetBindCount, which lead the next call to QSqlQuery::addBindValue to start at non zero index. This is problematic in case of a prepared query which is called several times. Task-number: QTBUG-43874 Change-Id: I1a0f46e39b74d9538009967fd98a269e05aac6f2 Reviewed-by: Mark Brand --- src/sql/kernel/qsqlquery.cpp | 1 + tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 30 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index 98e262a7e2..2808587d96 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -1060,6 +1060,7 @@ bool QSqlQuery::exec() */ bool QSqlQuery::execBatch(BatchExecutionMode mode) { + d->sqlResult->resetBindCount(); return d->sqlResult->execBatch(mode == ValuesAsColumns); } diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index a862ce2094..ecf3a9b050 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -147,6 +147,8 @@ private slots: void invalidQuery(); void batchExec_data() { generic_data(); } void batchExec(); + void QTBUG_43874_data() { generic_data(); } + void QTBUG_43874(); void oraArrayBind_data() { generic_data(); } void oraArrayBind(); void lastInsertId_data() { generic_data(); } @@ -338,6 +340,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) << qTableName("blobstest", __FILE__, db) << qTableName("oraRowId", __FILE__, db) << qTableName("qtest_batch", __FILE__, db) + << qTableName("bug43874", __FILE__, db) << qTableName("bug6421", __FILE__, db).toUpper() << qTableName("bug5765", __FILE__, db) << qTableName("bug6852", __FILE__, db) @@ -2185,6 +2188,33 @@ void tst_QSqlQuery::batchExec() QVERIFY( q.value( 3 ).isNull() ); } +void tst_QSqlQuery::QTBUG_43874() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlQuery q(db); + const QString tableName = qTableName("bug43874", __FILE__, db); + + QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id INT)")); + QVERIFY_SQL(q, prepare("INSERT INTO " + tableName + " (id) VALUES (?)")); + + for (int i = 0; i < 2; ++i) { + QVariantList ids; + ids << i; + q.addBindValue(ids); + QVERIFY_SQL(q, execBatch()); + } + QVERIFY_SQL(q, exec("SELECT id FROM " + tableName + " ORDER BY id")); + + QVERIFY(q.next()); + QCOMPARE(q.value(0).toInt(), 0); + + QVERIFY(q.next()); + QCOMPARE(q.value(0).toInt(), 1); +} + void tst_QSqlQuery::oraArrayBind() { QFETCH( QString, dbName ); -- cgit v1.2.3 From 593e3f2fbb324f076e4d3f05b269f21f8c3ca403 Mon Sep 17 00:00:00 2001 From: Marcel Krems Date: Tue, 9 Dec 2014 14:58:26 +0100 Subject: Update printer metrics after resolution change. [ChangeLog][QtPrintSupport] Fixed QPrinter::{width,height} return values when the resolution is changed in the print dialog. Task-number: QTBUG-43124 Change-Id: Ib805907affed4b1ffb48e6b1ff89f7a79ab3e329 Reviewed-by: Andy Shaw --- src/printsupport/kernel/qprintengine_win.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index 4e0a3e0795..69f74ef775 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -931,6 +931,8 @@ void QWin32PrintEnginePrivate::initHDC() default: break; } + + updateMetrics(); } void QWin32PrintEnginePrivate::release() -- cgit v1.2.3 From 5239ba95e8d68a96b2783793576490f119fb5700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 15 Jan 2015 23:42:25 +0100 Subject: Add missing AppDataLocation case This amends commit f3bc9f5c. Change-Id: I69b1a5080e7ac92b8a39746d814da77b17c271c2 Task-number: QTBUG-43868 Reviewed-by: Friedemann Kleint --- src/corelib/io/qstandardpaths_mac.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm index 01d1c01f78..13b864600e 100644 --- a/src/corelib/io/qstandardpaths_mac.mm +++ b/src/corelib/io/qstandardpaths_mac.mm @@ -167,6 +167,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) case TempLocation: return QDir::tempPath(); case GenericDataLocation: + case AppDataLocation: case AppLocalDataLocation: case GenericCacheLocation: case CacheLocation: -- cgit v1.2.3 From b2cff0b4bf93bc85b9b76098e8e8ff2fdaf83198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 14 Jan 2015 14:20:04 +0100 Subject: Fix stylesheet crash. Style sheets that refer to the progress bar (like "QProgressDialog[maximum='0']{}") may dereference a null-pointer during the styleHint() call in QProgressDialogPrivate::init() since the progress bar has not been created yet. Move the creation of the progress bar closer to the top of init(), before the styleHint() call. Change-Id: I31c3c1c346430fc9fe86b0977403dea0c0dc5e90 Task-number: QTBUG-43830 Reviewed-by: Andras Becsi --- src/widgets/dialogs/qprogressdialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index 01ca398a14..371949e768 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -108,10 +108,10 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance { Q_Q(QProgressDialog); label = new QLabel(labelText, q); - int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q); - label->setAlignment(Qt::Alignment(align)); bar = new QProgressBar(q); bar->setRange(min, max); + int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q); + label->setAlignment(Qt::Alignment(align)); autoClose = true; autoReset = true; forceHide = false; -- cgit v1.2.3 From 9d1bcd727ae50331980e52119f2256266c27b5d4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 14 Jan 2015 14:15:30 +0100 Subject: Diaglib/Event filter: Output application state on focus events. Output the current active/modal/popup windows when receiving FocusAboutToChange or FocusIn events. Task-number: QTBUG-42731 Change-Id: Ia88e9a9b41f7c80fb7a2a048b06da56d989ff18a Reviewed-by: Shawn Rutledge --- tests/manual/diaglib/eventfilter.cpp | 74 ++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 4 deletions(-) diff --git a/tests/manual/diaglib/eventfilter.cpp b/tests/manual/diaglib/eventfilter.cpp index 23a6d44fef..0a815fd883 100644 --- a/tests/manual/diaglib/eventfilter.cpp +++ b/tests/manual/diaglib/eventfilter.cpp @@ -36,6 +36,28 @@ #include #include +#if QT_VERSION >= 0x050000 +# if defined(QT_WIDGETS_LIB) +# define HAVE_APPLICATION +# endif +# if defined(QT_GUI_LIB) +# define HAVE_GUI_APPLICATION +# endif +#else // Qt 5 +# if defined(QT_GUI_LIB) +# define HAVE_APPLICATION +# endif +#endif + +#ifdef HAVE_APPLICATION +# include +# include +#endif +#ifdef HAVE_GUI_APPLICATION +# include +# include +#endif + namespace QtDiag { EventFilter::EventFilter(EventCategories eventCategories, QObject *p) @@ -131,16 +153,60 @@ static inline bool matchesType(const QObject *o, EventFilter::ObjectTypes types) return types & EventFilter::OtherType; } +static void formatObject(const QObject *o, QDebug debug) +{ + if (o) { + debug << o->metaObject()->className(); + const QString on = o->objectName(); + if (!on.isEmpty()) + debug << '/' << on; + } else { + debug << "null"; + } +} + +static void formatApplicationState(QDebug debug) +{ +#if defined(HAVE_APPLICATION) + if (const QWidget *mw = QApplication::activeModalWidget()) { + debug << "\n QApplication::activeModalWidget = "; + formatObject(mw, debug); + } + if (const QWidget *pw = QApplication::activePopupWidget()) { + debug << "\n QApplication::activePopupWidget = "; + formatObject(pw, debug); + } + debug << "\n QApplication::activeWindow = "; + formatObject(QApplication::activeWindow(), debug); +#endif // HAVE_APPLICATION +#if defined(HAVE_GUI_APPLICATION) + if (const QWindow *mw = QGuiApplication::modalWindow()) { + debug << "\n QGuiApplication::modalWindow = "; + formatObject(mw, debug); + } + debug << "\n QGuiApplication::focusWindow = "; + formatObject(QGuiApplication::focusWindow(), debug); +#endif // HAVE_GUI_APPLICATION +} + bool EventFilter::eventFilter(QObject *o, QEvent *e) { static int n = 0; if (matchesType(o, m_objectTypes) && m_eventTypes.contains(e->type())) { QDebug debug = qDebug().nospace(); - const QString on = o->objectName(); - debug << '#' << n++ << ' ' << o->metaObject()->className(); - if (!on.isEmpty()) - debug << '/' << on; + debug << '#' << n++ << ' '; + formatObject(o, debug); debug << ' ' << e; + switch (e->type()) { +#if QT_VERSION >= 0x050000 + case QEvent::FocusAboutToChange: +#endif + case QEvent::FocusIn: + formatApplicationState(debug); + break; + default: + break; + } } return false; } -- cgit v1.2.3 From be5b04fd3782cc17bebef5ad9ffd302b8a1edef4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 15 Jan 2015 09:39:24 -0800 Subject: Move enabling of C++11 Unicode Strings with ICC from 12.1 to 14.0 The support in 12.1 and 13.x appears to be incomplete. Move it to the official supported version https://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler Note: this commit will cause a conflict in 5.5 against 99357e32a0e29c73ed721d6d31da66635e6586ca Task-number: QTBUG-43864 Change-Id: Ic5d393bfd36e48a193fcffff13b9a07106e96795 Reviewed-by: Marc Mutz --- src/corelib/global/qcompilerdetection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 3f813e163b..7effb24130 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -533,7 +533,6 @@ # define Q_COMPILER_AUTO_FUNCTION # define Q_COMPILER_NULLPTR # define Q_COMPILER_TEMPLATE_ALIAS -# define Q_COMPILER_UNICODE_STRINGS # define Q_COMPILER_VARIADIC_TEMPLATES # endif # if __INTEL_COMPILER >= 1300 @@ -554,6 +553,7 @@ # define Q_COMPILER_RANGE_FOR # define Q_COMPILER_RAW_STRINGS # define Q_COMPILER_REF_QUALIFIERS +# define Q_COMPILER_UNICODE_STRINGS # define Q_COMPILER_UNRESTRICTED_UNIONS # endif # if __INTEL_COMPILER >= 1500 -- cgit v1.2.3 From ec9bc843d8a5c18459f3669c6e22acac2077df67 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Jan 2015 11:02:28 -0800 Subject: Fix compilation with Apple Clang 425 This version was based on Clang mainline between releases 3.1 and 3.2, which means it has part of 3.2 features but not all. One of the missing features is __builtin_bswap16. Change-Id: Ic5d393bfd36e48a193fcffff13b95664c7f664de Reviewed-by: Shawn Rutledge --- src/corelib/global/qendian.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 7c643f7592..0e383c18d2 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -272,9 +272,15 @@ template <> inline qint8 qFromBigEndian(const uchar *src) */ template T qbswap(T source); +#ifdef __has_builtin +# define QT_HAS_BUILTIN(x) __has_builtin(x) +#else +# define QT_HAS_BUILTIN(x) 0 +#endif + // GCC 4.3 implemented all the intrinsics, but the 16-bit one only got implemented in 4.8; // Clang 2.6 implemented the 32- and 64-bit but waited until 3.2 to implement the 16-bit one -#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 206) +#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || QT_HAS_BUILTIN(__builtin_bswap32) template <> inline quint64 qbswap(quint64 source) { return __builtin_bswap64(source); @@ -306,7 +312,7 @@ template <> inline quint32 qbswap(quint32 source) | ((source & 0xff000000) >> 24); } #endif // GCC & Clang intrinsics -#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 302) +#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || QT_HAS_BUILTIN(__builtin_bswap16) template <> inline quint16 qbswap(quint16 source) { return __builtin_bswap16(source); @@ -320,6 +326,8 @@ template <> inline quint16 qbswap(quint16 source) } #endif // GCC & Clang intrinsics +#undef QT_HAS_BUILTIN + // signed specializations template <> inline qint64 qbswap(qint64 source) { -- cgit v1.2.3 From 20480070a60469017770257b6c574c5707cda58b Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Thu, 15 Jan 2015 09:45:07 +0100 Subject: Autotest: Selftests fail in UTC timezone Selftests for testlib fail when executed in UTC timezone because local and UTC are the same, but expected to be different. A custom timezone is used instead. Debug output of qCompare does only handle local and non-local timezones, using new Qt5 features allows to show the correct timezone in format string. Change-Id: I753884a12370952b7b62a90d62896db4f2d3d1b4 Reviewed-by: Jason McDonald --- src/testlib/qtest.h | 3 +-- tests/auto/testlib/selftests/datetime/tst_datetime.cpp | 2 +- tests/auto/testlib/selftests/expected_datetime.lightxml | 2 +- tests/auto/testlib/selftests/expected_datetime.txt | 2 +- tests/auto/testlib/selftests/expected_datetime.xml | 2 +- tests/auto/testlib/selftests/expected_datetime.xunitxml | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 6298262958..995d653118 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -91,8 +91,7 @@ template<> inline char *toString(const QDate &date) template<> inline char *toString(const QDateTime &dateTime) { return dateTime.isValid() - ? qstrdup(qPrintable(dateTime.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")) + - (dateTime.timeSpec() == Qt::LocalTime ? QLatin1String("[local time]") : QLatin1String("[UTC]")))) + ? qstrdup(qPrintable(dateTime.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz[t]")))) : qstrdup("Invalid QDateTime"); } #endif // QT_NO_DATESTRING diff --git a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp index d684f46f16..95bc72298e 100644 --- a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp +++ b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp @@ -52,7 +52,7 @@ private slots: void tst_DateTime::dateTime() const { const QDateTime utc(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::UTC); - const QDateTime local(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::LocalTime); + const QDateTime local(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::OffsetFromUTC, 120 /* 2 minutes */); QCOMPARE(local, utc); } diff --git a/tests/auto/testlib/selftests/expected_datetime.lightxml b/tests/auto/testlib/selftests/expected_datetime.lightxml index 48ad0933f7..1aeac37e42 100644 --- a/tests/auto/testlib/selftests/expected_datetime.lightxml +++ b/tests/auto/testlib/selftests/expected_datetime.lightxml @@ -10,7 +10,7 @@ diff --git a/tests/auto/testlib/selftests/expected_datetime.txt b/tests/auto/testlib/selftests/expected_datetime.txt index 1139c70ab8..c29fa050a1 100644 --- a/tests/auto/testlib/selftests/expected_datetime.txt +++ b/tests/auto/testlib/selftests/expected_datetime.txt @@ -2,7 +2,7 @@ Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@ PASS : tst_DateTime::initTestCase() FAIL! : tst_DateTime::dateTime() Compared values are not the same - Actual (local): 2000/05/03 04:03:04.000[local time] + Actual (local): 2000/05/03 04:03:04.000[UTC+00:02] Expected (utc) : 2000/05/03 04:03:04.000[UTC] Loc: [tst_datetime.cpp(65)] PASS : tst_DateTime::qurl(empty urls) diff --git a/tests/auto/testlib/selftests/expected_datetime.xml b/tests/auto/testlib/selftests/expected_datetime.xml index 30afde60ec..4c5bb0525b 100644 --- a/tests/auto/testlib/selftests/expected_datetime.xml +++ b/tests/auto/testlib/selftests/expected_datetime.xml @@ -12,7 +12,7 @@ diff --git a/tests/auto/testlib/selftests/expected_datetime.xunitxml b/tests/auto/testlib/selftests/expected_datetime.xunitxml index 901462b6bf..6fc95719f3 100644 --- a/tests/auto/testlib/selftests/expected_datetime.xunitxml +++ b/tests/auto/testlib/selftests/expected_datetime.xunitxml @@ -8,7 +8,7 @@ -- cgit v1.2.3 From 7fc8c560e21e7175b1fe33c988f3f30e4b326efe Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 29 Dec 2014 16:37:55 +0100 Subject: Fix QPrinter::setPaperSize regression when using QPrinter::DevicePixel The QPageSize-based refactoring led to casting DevicePixel to a QPageSize::Unit value of 6 (out of bounds). And then the switch in qt_nameForCustomSize would leave the string empty, leading to "QString::arg: Argument missing: , 672" warnings. Change-Id: I85e97174cc8ead9beccaaa3ded6edfad80f8e360 Reviewed-by: Friedemann Kleint Reviewed-by: Andy Shaw --- src/printsupport/kernel/qprinter.cpp | 5 ++++- tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 437a68e609..8ed2732c1e 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -1224,7 +1224,10 @@ void QPrinter::setPageSize(PageSize newPageSize) void QPrinter::setPaperSize(const QSizeF &paperSize, QPrinter::Unit unit) { - setPageSize(QPageSize(paperSize, QPageSize::Unit(unit))); + if (unit == QPrinter::DevicePixel) + setPageSize(QPageSize(paperSize * qt_pixelMultiplier(resolution()), QPageSize::Point)); + else + setPageSize(QPageSize(paperSize, QPageSize::Unit(unit))); } /*! diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index 78aa0af43d..62bd9828ba 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -526,7 +526,7 @@ void tst_QPrinter::testCustomPageSizes() { QPrinter p; - QSizeF customSize(8.5, 11.0); + QSizeF customSize(7.0, 11.0); p.setPaperSize(customSize, QPrinter::Inch); QSizeF paperSize = p.paperSize(QPrinter::Inch); @@ -538,6 +538,16 @@ void tst_QPrinter::testCustomPageSizes() paperSize = p.paperSize(QPrinter::Inch); QCOMPARE(paperSize.width(), customSize.width()); QCOMPARE(paperSize.height(), customSize.height()); + + const QSizeF sizeInPixels = p.paperSize(QPrinter::DevicePixel); + QPrinter p3; + p3.setPaperSize(sizeInPixels, QPrinter::DevicePixel); + paperSize = p3.paperSize(QPrinter::Inch); + QCOMPARE(paperSize.width(), customSize.width()); + QCOMPARE(paperSize.height(), customSize.height()); + QPageSize pageSize = p3.pageLayout().pageSize(); + QCOMPARE(pageSize.key(), QString("Custom.504x792")); + QCOMPARE(pageSize.name(), QString("Custom (504pt x 792pt)")); } void tst_QPrinter::customPaperSizeAndMargins_data() -- cgit v1.2.3 From b18e6396bde2931a302b8fa5910268e23590c8a8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 18 Jan 2015 13:34:59 +0100 Subject: QBenchmarkResult: fix uninitialized value This manifested itself in a UBSan report about loading a non-enumerated value from an enumeration variable: src/testlib/qbenchmark_p.h:95:7: runtime error: load of value 11091, which is not a valid value for type 'QBenchmarkMetric' (or similar). The chosen value is simply QTest::QBenchmarkMetric(0). Change-Id: I8492a871a71d89fa6f7902d38f9eecee4b060646 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/testlib/qbenchmark_p.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h index 889798e862..5bf3760f66 100644 --- a/src/testlib/qbenchmark_p.h +++ b/src/testlib/qbenchmark_p.h @@ -105,6 +105,7 @@ public: QBenchmarkResult() : value(-1) , iterations(-1) + , metric(QTest::FramesPerSecond) , setByMacro(true) , valid(false) { } -- cgit v1.2.3 From 390ea21873cf229447c2dcaea85a40e472fab03c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 18 Jan 2015 13:43:37 +0100 Subject: QByteArrayMatcher: fix undefined shift The REHASH macro is used in qFindByteArray() with a char argument. Applying the shift operator promotes (a) to int. The check in REHASH, however, checks for the shift being permissible for _unsigned_ ints. Since hashHaystack is a uint, too, rectify by casting (a) to uint prior to shifting. Found by UBSan: src/corelib/tools/qbytearraymatcher.cpp:314:72: runtime error: left shift of 34 by 30 places cannot be represented in type 'int' Change-Id: Id09c037d570ca70b49f87ad22bed31bbb7dcc7fb Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qbytearraymatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp index f14d941c27..82f012be66 100644 --- a/src/corelib/tools/qbytearraymatcher.cpp +++ b/src/corelib/tools/qbytearraymatcher.cpp @@ -256,7 +256,7 @@ static int qFindByteArrayBoyerMoore( #define REHASH(a) \ if (sl_minus_1 < sizeof(uint) * CHAR_BIT) \ - hashHaystack -= (a) << sl_minus_1; \ + hashHaystack -= uint(a) << sl_minus_1; \ hashHaystack <<= 1 /*! -- cgit v1.2.3 From 62a96dbb53d77d6cd7320c6fc8d33ee9c4add0fe Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 18 Jan 2015 21:57:20 +0100 Subject: QTextFormat: fix undefined behavior Left-shifting of negative values is undefined ([expr.shift]/2). Since hashValue is a uint already, rectify by casting it->key to uint prior to shifting. Found by UBSan. Change-Id: I94a5311f5a4492f514f595b8fb79726df1e7d0de Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/text/qtextformat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index cecfd85df1..ecd87188e7 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -319,7 +319,7 @@ uint QTextFormatPrivate::recalcHash() const { hashValue = 0; for (QVector::ConstIterator it = props.constBegin(); it != props.constEnd(); ++it) - hashValue += (it->key << 16) + variantHash(it->value); + hashValue += (static_cast(it->key) << 16) + variantHash(it->value); hashDirty = false; -- cgit v1.2.3 From b69c2e86de99cb2ac9bcd2e33ae77c960cfbc57a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 19 Jan 2015 01:26:56 +0100 Subject: QFreeList: fix undefined behavior Signed integer overflow is undefined behavior ([expr]/4), but unsigned arithmetic doesn't overflow, so isn't ([basic.fundamental]/4, footnote there). So, use unsigned arithmetic for the loop-around serial number generation in incrementserial(). While we're at it, also use it for the masking operation in the same function. Found by UBSan. Change-Id: I500fae9d80fd3f6e39d06e79a53d271b82ea8df8 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qfreelist_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h index bfb03fb723..189140016c 100644 --- a/src/corelib/tools/qfreelist_p.h +++ b/src/corelib/tools/qfreelist_p.h @@ -171,7 +171,7 @@ class QFreeList // take the current serial number from \a o, increment it, and store it in \a n static inline int incrementserial(int o, int n) { - return (n & ConstantsType::IndexMask) | ((o + ConstantsType::SerialCounter) & ConstantsType::SerialMask); + return int((uint(n) & ConstantsType::IndexMask) | ((uint(o) + ConstantsType::SerialCounter) & ConstantsType::SerialMask)); } // the blocks -- cgit v1.2.3 From 17cce246487ca8a9b2d1999bfdbbb3b368b44177 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 14 Jan 2015 20:35:21 +0100 Subject: Only call ShowWindow() once when going from FullScreen to Maximized Since going from FullScreen to Maximized is taken care of inside the FullScreen block then we don't want to call ShowWindow() again in the Maximized block. Therefore the Maximized block is moved so it is only invoked if it is not coming or going to fullscreen. As the minimized case is not accounted for in FullScreen that is left as is in its own if block. Task-number: QTBUG-43849 Change-Id: I3141347e072c50b2a4475098d7b8ee0b207578a7 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 6279b6f4af..e7061dbfde 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1620,17 +1620,6 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) setFlag(FrameDirty); - if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) { - if (visible && !(newState == Qt::WindowMinimized)) { - setFlag(WithinMaximize); - if (newState == Qt::WindowFullScreen) - setFlag(MaximizeToFullScreen); - ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE); - clearFlag(WithinMaximize); - clearFlag(MaximizeToFullScreen); - } - } - if ((oldState == Qt::WindowFullScreen) != (newState == Qt::WindowFullScreen)) { #ifdef Q_OS_WINCE HWND handle = FindWindow(L"HHTaskBar", L""); @@ -1710,6 +1699,15 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) m_savedStyle = 0; m_savedFrameGeometry = QRect(); } + } else if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) { + if (visible && !(newState == Qt::WindowMinimized)) { + setFlag(WithinMaximize); + if (newState == Qt::WindowFullScreen) + setFlag(MaximizeToFullScreen); + ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE); + clearFlag(WithinMaximize); + clearFlag(MaximizeToFullScreen); + } } if ((oldState == Qt::WindowMinimized) != (newState == Qt::WindowMinimized)) { -- cgit v1.2.3 From 730d07df831435d41d40152d5ecec5dea2658042 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 12 Jan 2015 21:08:13 +0100 Subject: Account for pixmap's device pixel ratio when calculating the label size When determining the size of the QPushButton's label then the device pixel ratio of the pixmap used to represent the icon needs to be taken into consideration so it is rendered correctly. Change-Id: If32760b120d7a749a51e2c30592d621c0e63dace Reviewed-by: Pierre Rossi Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/styles/qstylesheetstyle.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index e9f20de842..3d9ba6b490 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -3397,8 +3397,10 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q state = QIcon::On; QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state); - int labelWidth = pixmap.width(); - int labelHeight = pixmap.height(); + int pixmapWidth = pixmap.width() / pixmap.devicePixelRatio(); + int pixmapHeight = pixmap.height() / pixmap.devicePixelRatio(); + int labelWidth = pixmapWidth; + int labelHeight = pixmapHeight; int iconSpacing = 4;//### 4 is currently hardcoded in QPushButton::sizeHint() int textWidth = button->fontMetrics.boundingRect(opt->rect, tf, button->text).width(); if (!button->text.isEmpty()) @@ -3407,15 +3409,15 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q //Determine label alignment: if (textAlignment & Qt::AlignLeft) { /*left*/ iconRect = QRect(textRect.x(), textRect.y() + (textRect.height() - labelHeight) / 2, - pixmap.width(), pixmap.height()); + pixmapWidth, pixmapHeight); } else if (textAlignment & Qt::AlignHCenter) { /* center */ iconRect = QRect(textRect.x() + (textRect.width() - labelWidth) / 2, textRect.y() + (textRect.height() - labelHeight) / 2, - pixmap.width(), pixmap.height()); + pixmapWidth, pixmapHeight); } else { /*right*/ iconRect = QRect(textRect.x() + textRect.width() - labelWidth, textRect.y() + (textRect.height() - labelHeight) / 2, - pixmap.width(), pixmap.height()); + pixmapWidth, pixmapHeight); } iconRect = visualRect(button->direction, textRect, iconRect); -- cgit v1.2.3 From 7c9497ad6ae9cb4b596bc76c70077577d97fe3cb Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 12 Jan 2015 20:58:53 +0100 Subject: Respect the hotspot passed in for the cursor When the hotspot is set to be QPoint(0,0) then QPoint will see this as being a null QPoint. However, it is a valid position as far as the hot spot for the cursor is concerned, so we default to QPoint(-1,-1) instead and check for that. Task-number: QTBUG-43787 Change-Id: Ibf6253033016c4b556b8a2a79c89819a4d5825cb Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowscursor.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index d10c7fdb20..9a42b7712d 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -126,13 +126,15 @@ HCURSOR QWindowsCursor::createPixmapCursor(const QPixmap &pixmap, const QPoint & // Create a cursor from image and mask of the format QImage::Format_Mono. static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits, - QPoint hotSpot = QPoint(), + QPoint hotSpot = QPoint(-1, -1), bool invb = false, bool invm = false) { const int width = bbits.width(); const int height = bbits.height(); - if (hotSpot.isNull()) - hotSpot = QPoint(width / 2, height / 2); + if (hotSpot.x() < 0) + hotSpot.setX(width / 2); + if (hotSpot.y() < 0) + hotSpot.setY(height / 2); const int n = qMax(1, width / 8); #if !defined(Q_OS_WINCE) QScopedArrayPointer xBits(new uchar[height * n]); -- cgit v1.2.3 From 890ae41d0601d20505df2f955a99d0238bf4f59e Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Wed, 7 Jan 2015 16:16:23 +0100 Subject: Fix a crash in QPlainTextEdit::documentChanged The layout for an invalid block is very likely to be null, it shouldn't be accessed without checking the block's validity first. We can make the check a bit more conservative and simply check that the block isn't empty. Change-Id: Ic1459a6168b1b8ce36e9c6d019dc28653676efbe Task-number: QTBUG-43562 Reviewed-by: Simon Hausmann --- src/widgets/widgets/qplaintextedit.cpp | 3 +- .../widgets/qplaintextedit/tst_qplaintextedit.cpp | 33 ++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 72a556db7c..e56fd111e5 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -288,8 +288,7 @@ void QPlainTextDocumentLayout::documentChanged(int from, int charsRemoved, int c if (changeStartBlock == changeEndBlock && newBlockCount == d->blockCount) { QTextBlock block = changeStartBlock; - int blockLineCount = block.layout()->lineCount(); - if (block.isValid() && blockLineCount) { + if (block.isValid() && block.length()) { QRectF oldBr = blockBoundingRect(block); layoutBlock(block); QRectF newBr = blockBoundingRect(block); diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index d8e7fb7a99..cf495e2238 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp @@ -148,6 +148,7 @@ private slots: #endif void layoutAfterMultiLineRemove(); void undoCommandRemovesAndReinsertsBlock(); + void taskQTBUG_43562_lineCountCrash(); private: void createSelection(); @@ -1629,5 +1630,37 @@ void tst_QPlainTextEdit::undoCommandRemovesAndReinsertsBlock() } +class ContentsChangedFunctor { +public: + ContentsChangedFunctor(QPlainTextEdit *t) : textEdit(t) {} + void operator()(int, int, int) + { + QTextCursor c(textEdit->textCursor()); + c.beginEditBlock(); + c.movePosition(QTextCursor::Start); + c.movePosition(QTextCursor::End, QTextCursor::KeepAnchor); + c.setCharFormat(QTextCharFormat()); + c.endEditBlock(); + } + +private: + QPlainTextEdit *textEdit; +}; + +void tst_QPlainTextEdit::taskQTBUG_43562_lineCountCrash() +{ + connect(ed->document(), &QTextDocument::contentsChange, ContentsChangedFunctor(ed)); + // Don't crash + QTest::keyClicks(ed, "Some text"); + QTest::keyClick(ed, Qt::Key_Left); + QTest::keyClick(ed, Qt::Key_Right); + QTest::keyClick(ed, Qt::Key_A); + QTest::keyClick(ed, Qt::Key_Left); + QTest::keyClick(ed, Qt::Key_Right); + QTest::keyClick(ed, Qt::Key_Space); + QTest::keyClicks(ed, "nd some more"); + disconnect(ed->document(), SIGNAL(contentsChange(int, int, int)), 0, 0); +} + QTEST_MAIN(tst_QPlainTextEdit) #include "tst_qplaintextedit.moc" -- cgit v1.2.3 From 0f5b970894718c2c38f0e3e805c4a497e8c89c65 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sun, 18 Jan 2015 20:34:48 +0800 Subject: Doc: Remove references to QOpenGLContext::destroy() This function is private. Task-number: QTBUG-35907 Change-Id: I370c0bfd8fda11c68ee76ee42967f117a81b381c Reviewed-by: Sean Harmer --- src/gui/kernel/qopenglcontext.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 5918f30660..b663afabbc 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -518,8 +518,9 @@ void QOpenGLContext::setScreen(QScreen *screen) in addition. Therefore \a handle is variant containing a platform-specific value type. These classes can be found in the QtPlatformHeaders module. - When create() is called with native handles set, the handles' ownership are - not taken, meaning that \c destroy() will not destroy the native context. + When create() is called with native handles set, QOpenGLContext does not + take ownership of the handles, so destroying the QOpenGLContext does not + destroy the native context. \note Some frameworks track the current context and surfaces internally. Making the adopted QOpenGLContext current via Qt will have no effect on such @@ -582,8 +583,8 @@ QVariant QOpenGLContext::nativeHandle() const Returns \c true if the native context was successfully created and is ready to be used with makeCurrent(), swapBuffers(), etc. - \note If the context is already created, this function will first call - \c destroy(), and then create a new OpenGL context. + \note If the context already exists, this function destroys the existing + context first, and then creates a new one. \sa makeCurrent(), format() */ @@ -605,6 +606,8 @@ bool QOpenGLContext::create() } /*! + \internal + Destroy the underlying platform context associated with this context. If any other context is directly or indirectly sharing resources with this @@ -658,8 +661,7 @@ void QOpenGLContext::destroy() /*! Destroys the QOpenGLContext object. - This implicitly calls \c destroy(), so if this is the current context for the - thread, doneCurrent() is also called. + If this is the current context for the thread, doneCurrent() is also called. */ QOpenGLContext::~QOpenGLContext() { -- cgit v1.2.3 From c49641a117356662aea31d8b4e7fdf4055cc0b4f Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Fri, 2 Jan 2015 20:06:08 +0800 Subject: Doc: Fix typos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I29d5576902a5d1ea25558e980081952d9157f7f0 Reviewed-by: Topi Reiniö --- examples/corelib/threads/doc/src/waitconditions.qdoc | 2 +- src/corelib/thread/qthread.cpp | 4 ++-- src/corelib/tools/qbytearray.cpp | 2 +- src/corelib/tools/qmargins.cpp | 2 +- src/corelib/xml/qxmlstream.cpp | 4 ++-- src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp | 2 +- src/network/access/qnetworkreply.cpp | 2 +- src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc | 2 +- src/widgets/doc/src/widgets-and-layouts/layout.qdoc | 2 +- src/widgets/kernel/qwidget.cpp | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/corelib/threads/doc/src/waitconditions.qdoc b/examples/corelib/threads/doc/src/waitconditions.qdoc index aff6997b55..3d15f0d4bf 100644 --- a/examples/corelib/threads/doc/src/waitconditions.qdoc +++ b/examples/corelib/threads/doc/src/waitconditions.qdoc @@ -136,7 +136,7 @@ byte in the buffer, \c numUsedBytes is \c BufferSize - 1 and the \c bufferNotEmpty condition is signalled. 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. + reads that byte, or the producer gets to produce a second byte. The producer-consumer model presented in this example makes it possible to write highly concurrent multithreaded applications. diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 3caad7c4b2..933fd06afa 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -178,7 +178,7 @@ QThreadPrivate::~QThreadPrivate() event loop by calling exec() and runs a Qt event loop inside the thread. You can use worker objects by moving them to the thread using - QObject::moveToThread. + QObject::moveToThread(). \snippet code/src_corelib_thread_qthread.cpp worker @@ -256,7 +256,7 @@ QThreadPrivate::~QThreadPrivate() \l{Mandelbrot Example}, as that is the name of the QThread subclass). Note that this is currently not available with release builds on Windows. - \sa {Thread Support in Qt}, QThreadStorage, {Synchronizing Threads} + \sa {Thread Support in Qt}, QThreadStorage, {Synchronizing Threads}, {Mandelbrot Example}, {Semaphores Example}, {Wait Conditions Example} */ diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index a3c1cc3907..bd0215902c 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -3945,7 +3945,7 @@ QByteArray QByteArray::fromRawData(const char *data, int size) copies of it exist that have not been modified. This function can be used instead of fromRawData() to re-use - existings QByteArray objects to save memory re-allocations. + existing QByteArray objects to save memory re-allocations. \sa fromRawData(), data(), constData() */ diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index 419551aaca..265e44bfcf 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -484,7 +484,7 @@ QDebug operator<<(QDebug dbg, const QMargins &m) { /*! \fn bool QMarginsF::isNull() const - Returns \c true if all margins are is 0; otherwise returns + Returns \c true if all margins are 0; otherwise returns false. */ diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index 94f6a8bcde..e4ee71f0b1 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -726,7 +726,7 @@ static const short QXmlStreamReader_tokenTypeString_indices[] = { /*! \property QXmlStreamReader::namespaceProcessing - the namespace-processing flag of the stream reader + The namespace-processing flag of the stream reader This property controls whether or not the stream reader processes namespaces. If enabled, the reader processes namespaces, otherwise @@ -3315,7 +3315,7 @@ QTextCodec *QXmlStreamWriter::codec() const /*! \property QXmlStreamWriter::autoFormatting \since 4.4 - the auto-formatting flag of the stream writer + The auto-formatting flag of the stream writer This property controls whether or not the stream writer automatically formats the generated XML data. If enabled, the diff --git a/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp b/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp index f43bba1324..a691c24ce0 100644 --- a/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp +++ b/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp @@ -48,7 +48,7 @@ static const char * const start_xpm[]={ //! [1] QPixmap myPixmap; -myPixmap->setMask(myPixmap->createHeuristicMask()); +myPixmap.setMask(myPixmap.createHeuristicMask()); //! [1] //! [2] diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index 18ff05fcd7..fe9564a91c 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -605,7 +605,7 @@ QList QNetworkReply::rawHeaderList() const /*! Returns the attribute associated with the code \a code. If the - attribute has not been set, it returns an invalid QVariant (type QMetaType::Unknown). + attribute has not been set, it returns an invalid QVariant (type QMetaType::UnknownType). You can expect the default values listed in QNetworkRequest::Attribute to be applied to the values returned by diff --git a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc index 446b441675..9f5ef59e94 100644 --- a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc @@ -805,7 +805,7 @@ {QWidget::addAction}(). \endquotation - If you don't include the function name with the \b{\\overlaod} + If you don't include the function name with the \b{\\overload} command, then instead of the "This function overloads..." line with the link to the documentation for the primary version, you get the old standard line: diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc index f581df4cb3..7e2e79fc5d 100644 --- a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc @@ -219,7 +219,7 @@ \section1 Custom Widgets in Layouts When you make your own widget class, you should also communicate its layout - properties. If the widget has a one of Qt's layouts, this is already taken + properties. If the widget uses one of Qt's layouts, this is already taken care of. If the widget does not have any child widgets, or uses manual layout, you can change the behavior of the widget using any or all of the following mechanisms: diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index c99e15b9b8..453a7ca537 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -7235,7 +7235,7 @@ QByteArray QWidget::saveGeometry() const /*! \since 4.2 - Restores the geometry and state top-level widgets stored in the + Restores the geometry and state of top-level widgets stored in the byte array \a geometry. Returns \c true on success; otherwise returns \c false. -- cgit v1.2.3 From c243dd564397fedbe3d2221da72d7ce207eebade Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Wed, 14 Jan 2015 16:27:10 +0100 Subject: QIncrementalSleepTimer: Use QElapsedTimer instead of QTime Since the former is monotonic and we need a monotonic timer here. Change-Id: I34325da4fe0317e12f64629a6eef6a80990c3e1a Reviewed-by: Daniel Teske Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/io/qwindowspipewriter_p.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h index 47b7744e81..6035993500 100644 --- a/src/corelib/io/qwindowspipewriter_p.h +++ b/src/corelib/io/qwindowspipewriter_p.h @@ -45,7 +45,7 @@ // We mean it. // -#include +#include #include #include #include @@ -83,7 +83,7 @@ public: { if (totalTimeOut == -1) return SLEEPMAX; - return qMax(totalTimeOut - timer.elapsed(), 0); + return qMax(int(totalTimeOut - timer.elapsed()), 0); } bool hasTimedOut() const @@ -99,7 +99,7 @@ public: } private: - QTime timer; + QElapsedTimer timer; int totalTimeOut; int nextSleep; }; -- cgit v1.2.3 From 0310cef332e8d9b034affc43e945f37c7ca4bee5 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 3 Dec 2014 11:22:24 +0100 Subject: FusionStyle: Don't try to draw null pixmaps We have the same check for null already for PE_IndicatorHeaderArrow which actually uses the same pixmap. If the file is not found the pixmap will be null and the code dividing by its width or height will thrown an arithmetic exception. Task-number: QTBUG-43067 Change-Id: I13a5ee9f21f4189b7bbcfd57a6f5b52113de834d Reviewed-by: Oswald Buddenhagen Reviewed-by: J-P Nurmi --- src/widgets/styles/qfusionstyle.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index ed7b4ab3b6..cf2f3ea26b 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -514,6 +514,9 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem, break; } arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation); + if (arrow.isNull()) + break; + QRect rect = option->rect; QRect arrowRect; int imageMax = qMin(arrow.height(), arrow.width()); -- cgit v1.2.3 From 553a3661c1272b9616900a0e97e101492d468a25 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 16 Jan 2015 21:08:22 +0100 Subject: Bump version Change-Id: I250fa893cdf831d03f9217b5dc0a5aa2f9a6a6b5 Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index cb8bd15d8d..dade7fc6ec 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -37,11 +37,11 @@ #include -#define QT_VERSION_STR "5.4.1" +#define QT_VERSION_STR "5.4.2" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x050401 +#define QT_VERSION 0x050402 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ -- cgit v1.2.3 From 9087df6bd2dd5198ccf101a237aadee331e51ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Fri, 16 Jan 2015 20:43:07 +0000 Subject: windowflags test: Fix showing which flags are set The text edit that shows which flags we have set should be updated in PreviewWindow::setWindowFlags() and PreviewWidget::setWindowFlags() but QWidget::setWindowFlags() isn't virtual so only the base class one was called. Change-Id: I5c9d47d003d5701dde1ab63df0d349f641d66f44 Reviewed-by: Friedemann Kleint --- tests/manual/windowflags/controllerwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp index 5c06a9a646..2fcc205ca7 100644 --- a/tests/manual/windowflags/controllerwindow.cpp +++ b/tests/manual/windowflags/controllerwindow.cpp @@ -137,7 +137,10 @@ void ControllerWindow::updatePreview() parentWindow->hide(); } - previewWidget->setWindowFlags(flags); + if (previewWidgetButton->isChecked()) + previewWindow->setWindowFlags(flags); + else + previewDialog->setWindowFlags(flags); if (fixedSizeWindowCheckBox->isChecked()) { previewWidget->setFixedSize(300, 300); -- cgit v1.2.3