From 47ce14cf74d673aa3d12f055e42f5fd4acc6ba3a Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 11 Apr 2013 18:12:55 +0200 Subject: s/uint32_t/quint32/ uint32_t is in C++11, which we can not rely on being present. It is also in C99, but some compilers do not support that in C++ mode. Change-Id: I29bada724f5646a0a0562b3ab133cb49cf928d6d Reviewed-by: Gatis Paeglis Reviewed-by: Tobias Hunger --- .../platforminputcontexts/compose/generator/qtablegenerator.cpp | 8 ++++---- .../platforminputcontexts/compose/generator/qtablegenerator.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index 3c61a69480..8fa812eecb 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -252,14 +252,14 @@ void TableGenerator::parseIncludeInstruction(QString line) processFile(line); } -ushort TableGenerator::keysymToUtf8(uint32_t sym) +ushort TableGenerator::keysymToUtf8(quint32 sym) { QByteArray chars; int bytes; chars.resize(8); if (needWorkaround(sym)) { - uint32_t codepoint; + quint32 codepoint; if (sym == XKB_KEY_KP_Space) codepoint = XKB_KEY_space & 0x7f; else @@ -284,9 +284,9 @@ ushort TableGenerator::keysymToUtf8(uint32_t sym) return ch->unicode(); } -uint32_t TableGenerator::stringToKeysym(QString keysymName) +quint32 TableGenerator::stringToKeysym(QString keysymName) { - uint32_t keysym; + quint32 keysym; QByteArray keysymArray = keysymName.toLatin1(); const char *name = keysymArray.constData(); diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h index 11e7b2b422..cc1db20432 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h @@ -109,8 +109,8 @@ protected: bool findSystemComposeDir(); QString systemComposeDir(); - ushort keysymToUtf8(uint32_t sym); - uint32_t stringToKeysym(QString keysymName); + ushort keysymToUtf8(quint32 sym); + quint32 stringToKeysym(QString keysymName); void readLocaleMappings(); void initPossibleLocations(); -- cgit v1.2.3 From 839a9c11de9b639d3e19ca62fd363a9db3a63d11 Mon Sep 17 00:00:00 2001 From: John Layt Date: Thu, 11 Apr 2013 10:25:45 +0100 Subject: QPagedPaintDevice: Fix setPageSize() to set correct metrics Use the correct metrics for the requested PageSize instead of always defaulting to A4. Task-number: QTBUG-30494 Change-Id: Ia3978afe3f7cc9b1ded1065416e5c3def44e7a05 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Gunnar Sletta --- src/gui/painting/qpagedpaintdevice.cpp | 2 +- .../printsupport/kernel/qprinter/tst_qprinter.cpp | 38 ++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qpagedpaintdevice.cpp b/src/gui/painting/qpagedpaintdevice.cpp index f67037cc39..0387f0020f 100644 --- a/src/gui/painting/qpagedpaintdevice.cpp +++ b/src/gui/painting/qpagedpaintdevice.cpp @@ -169,7 +169,7 @@ void QPagedPaintDevice::setPageSize(PageSize size) if (size >= Custom) return; d->pageSize = size; - d->pageSizeMM = QSizeF(pageSizes[A4].width, pageSizes[A4].height); + d->pageSizeMM = QSizeF(pageSizes[size].width, pageSizes[size].height); } /*! diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index c8ea74e6b2..b117edddd4 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -119,6 +119,8 @@ private slots: void taskQTBUG4497_reusePrinterOnDifferentFiles(); void testPdfTitle(); + void testPageMetrics_data(); + void testPageMetrics(); #endif }; @@ -1108,6 +1110,42 @@ void tst_QPrinter::testPdfTitle() const char *expected = reinterpret_cast(expectedBuf); QVERIFY(file.readAll().contains(QByteArray(expected, 26))); } + +void tst_QPrinter::testPageMetrics_data() +{ + QTest::addColumn("pageSize"); + QTest::addColumn("widthMM"); + QTest::addColumn("heightMM"); + QTest::addColumn("widthMMf"); + QTest::addColumn("heightMMf"); + + QTest::newRow("A4") << int(QPrinter::A4) << 210 << 297 << 210.0f << 297.0f; + QTest::newRow("A5") << int(QPrinter::A5) << 148 << 210 << 148.0f << 210.0f; + QTest::newRow("Letter") << int(QPrinter::Letter) << 216 << 279 << 215.9f << 279.4f; +} + +void tst_QPrinter::testPageMetrics() +{ + QFETCH(int, pageSize); + QFETCH(int, widthMM); + QFETCH(int, heightMM); + QFETCH(float, widthMMf); + QFETCH(float, heightMMf); + + QPrinter printer(QPrinter::HighResolution); + printer.setFullPage(true); + printer.setPageSize(QPrinter::PageSize(pageSize)); + + if (printer.pageSize() != pageSize) { + QSKIP("Current page size is not supported on this printer"); + return; + } + + QCOMPARE(printer.widthMM(), int(widthMM)); + QCOMPARE(printer.heightMM(), int(heightMM)); + QCOMPARE(printer.pageSizeMM(), QSizeF(widthMMf, heightMMf)); +} + #endif // QT_NO_PRINTER QTEST_MAIN(tst_QPrinter) -- cgit v1.2.3 From 61d0f728ae40b9031e2c76d4def15986a8e6439a Mon Sep 17 00:00:00 2001 From: John Layt Date: Thu, 11 Apr 2013 18:42:41 +0100 Subject: QPrinter - Fix doc errors Fix doc errors. Task-number: QTBUG-27143 Change-Id: I59376bdb48ce03eb61f38b7dd7eb58f0d517a873 Reviewed-by: Casper van Donderen --- src/printsupport/kernel/qprinter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 387101dc9b..a8a99564ac 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -295,9 +295,9 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke lower quality output than HighResolution and should only be used for drafts. - \value PrinterResolution This value is deprecated. Is is + \value PrinterResolution This value is deprecated. It is equivalent to ScreenResolution on Unix and HighResolution on - Windows and Mac. Due do the difference between ScreenResolution + Windows and Mac. Due to the difference between ScreenResolution and HighResolution, use of this value may lead to non-portable printer code. -- cgit v1.2.3 From 7d56edebc94b2b16afb1de5acb63abfb03f7c450 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Mar 2013 18:51:37 +0100 Subject: QDateTime - Fix auto tests on Windows before 1980 Auto tests using CET expect there to be no Daylight Time before 1980, but Windows does apply Daylight Time. Fix expected test results to match. Task-number: QTBUG-30420 Change-Id: I7080598fa0a20c1cd5680782606ab983e714e546 Reviewed-by: Friedemann Kleint --- tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index b84039f557..6cfcf74069 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -478,7 +478,12 @@ void tst_QDateTime::setMSecsSinceEpoch_data() // positive value 1 too big for qint64max, causing an overflow. << std::numeric_limits::min() + 1 << QDateTime(QDate(-292275056, 5, 16), QTime(16, 47, 4, 193), Qt::UTC) +#ifdef Q_OS_WIN + // Windows applies Daylight Time to dates before 1980, Olsen does not + << QDateTime(QDate(-292275056, 5, 16), QTime(18, 47, 4, 193), Qt::LocalTime); +#else << QDateTime(QDate(-292275056, 5, 16), QTime(17, 47, 4, 193), Qt::LocalTime); +#endif QTest::newRow("max") << std::numeric_limits::max() << QDateTime(QDate(292278994, 8, 17), QTime(7, 12, 55, 807), Qt::UTC) @@ -844,10 +849,20 @@ void tst_QDateTime::toTimeSpec_data() QTest::newRow("-271821/4/20 00:00 UTC (JavaScript min date, start of day)") << QDateTime(QDate(-271821, 4, 20), QTime(0, 0, 0), Qt::UTC) +#ifdef Q_OS_WIN + // Windows applies Daylight Time to dates before 1980, Olsen does not + << QDateTime(QDate(-271821, 4, 20), QTime(2, 0, 0), Qt::LocalTime); +#else << QDateTime(QDate(-271821, 4, 20), QTime(1, 0, 0), Qt::LocalTime); +#endif QTest::newRow("-271821/4/20 23:00 UTC (JavaScript min date, end of day)") << QDateTime(QDate(-271821, 4, 20), QTime(23, 0, 0), Qt::UTC) +#ifdef Q_OS_WIN + // Windows applies Daylight Time to dates before 1980, Olsen does not + << QDateTime(QDate(-271821, 4, 21), QTime(1, 0, 0), Qt::LocalTime); +#else << QDateTime(QDate(-271821, 4, 21), QTime(0, 0, 0), Qt::LocalTime); +#endif QTest::newRow("QDate min") << QDateTime(QDate::fromJulianDay(minJd()), QTime(0, 0, 0), Qt::UTC) -- cgit v1.2.3 From 4731ced45bb5d91216ce436e67901e7b3b5febfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 12 Apr 2013 13:47:31 +0200 Subject: iOS: Automatically disable pkgconfig, and don't build examples and tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So that the user doesn't have to pass -no-pkg-config and -nomake, when we already know that those flags are needed and that the build will break without them. Change-Id: Ic07e02bc1800f177cf09f704104c1a76bfc50aa2 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Morten Johan Sørvig --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index 6d68ed2682..1b301b7ca9 100755 --- a/configure +++ b/configure @@ -2830,6 +2830,8 @@ if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then fi if [ "$XPLATFORM_IOS" = "yes" ]; then + CFG_PKGCONFIG="no" + CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS examples tests" CFG_SHARED="no" # iOS builds should be static to be able to submit to the App Store CFG_CXX11="no" # C++11 support disabled for now CFG_SKIP_MODULES="$CFG_SKIP_MODULES qtdeclarative qtquickcontrols qtwebkit qtgraphicaleffects qtdoc qtmultimedia qtwebkit-examples-and-demos qttools" -- cgit v1.2.3 From cc38a1eee8081c6c48f801d007291156f6be3f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= Date: Thu, 11 Apr 2013 20:34:11 +0200 Subject: Fix C++11 support in clang prior to 3.2 The comments in this file suggested that the bug was only present in clang/3.1. However, qRegisterMetaType was failing even on clang 3.2 ("tags/RELEASE_32/final"). The clang's bugzilla says [1] that the problem was fixed two days before the release of 3.2, but apparently it didn't make it to the release branch. [1] http://llvm.org/bugs/show_bug.cgi?id=13470 Change-Id: I37db8f6f6b22ab939110e79240d92313c1786d6a Reviewed-by: Olivier Goffart --- src/corelib/thread/qbasicatomic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index b5a402857c..cf0a6a55e4 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -113,10 +113,10 @@ QT_END_NAMESPACE // New atomics #if defined(Q_COMPILER_CONSTEXPR) && defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS) -# if defined(Q_CC_CLANG) && ((((__clang_major__ * 100) + __clang_minor__) < 302) \ +# if defined(Q_CC_CLANG) && ((((__clang_major__ * 100) + __clang_minor__) < 303) \ || defined(__apple_build_version__) \ ) - /* Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for "stock" clang before version 3.2. + /* Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for "stock" clang before version 3.3. Apple's version has different (higher!) version numbers, so disable it for all of them for now. (The only way to distinguish between them seems to be a check for __apple_build_version__ .) -- cgit v1.2.3 From be08ef61313eb84d608eb56264189fc85e171eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 12 Apr 2013 14:03:23 +0200 Subject: iOS: Automatically disable rpath since it's not supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If4f707f5d32a1a38b9ca11d4f1703e1f20bb3c20 Reviewed-by: Morten Johan Sørvig --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 1b301b7ca9..f0037479ab 100755 --- a/configure +++ b/configure @@ -2830,6 +2830,7 @@ if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then fi if [ "$XPLATFORM_IOS" = "yes" ]; then + CFG_RPATH="no" CFG_PKGCONFIG="no" CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS examples tests" CFG_SHARED="no" # iOS builds should be static to be able to submit to the App Store -- cgit v1.2.3 From 4f400eeec1eed2d41f351ffd3f160cbde133c5eb Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 12 Apr 2013 15:23:22 +0300 Subject: QFontCache: Make clear() really clear/free cached data it maintains QFontCache::clear() now frees everything it keeps and resets the cache costs. Change-Id: I23ac2cab5c7c7d70db03f048b6fde151a18f92e1 Reviewed-by: Friedemann Kleint Reviewed-by: jian liang Reviewed-by: Lars Knoll --- src/gui/text/qfont.cpp | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 1d6cf3ceca..9d603bb08d 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2639,18 +2639,6 @@ QFontCache::QFontCache() QFontCache::~QFontCache() { clear(); - { - EngineDataCache::ConstIterator it = engineDataCache.constBegin(), - end = engineDataCache.constEnd(); - while (it != end) { - if (!it.value()->ref.deref()) - delete it.value(); - else - FC_DEBUG("QFontCache::~QFontCache: engineData %p still has refcount %d", - it.value(), it.value()->ref.load()); - ++it; - } - } } void QFontCache::clear() @@ -2669,29 +2657,47 @@ void QFontCache::clear() data->engines[i] = 0; } } + if (!data->ref.deref()) { + delete data; + } else { + FC_DEBUG("QFontCache::clear: engineData %p still has refcount %d", + data, data->ref.load()); + } ++it; } } - bool mightHaveEnginesLeftForCleanup = true; - while (mightHaveEnginesLeftForCleanup) { + engineDataCache.clear(); + + + bool mightHaveEnginesLeftForCleanup; + do { mightHaveEnginesLeftForCleanup = false; for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end(); - it != end; ++it) { - if (it.value().data && engineCacheCount.value(it.value().data) > 0) { - --engineCacheCount[it.value().data]; - if (!it.value().data->ref.deref()) { - Q_ASSERT(engineCacheCount.value(it.value().data) == 0); - delete it.value().data; - mightHaveEnginesLeftForCleanup = true; + it != end; ++it) { + QFontEngine *engine = it.value().data; + if (engine) { + const int cacheCount = --engineCacheCount[engine]; + Q_ASSERT(cacheCount >= 0); + if (!engine->ref.deref()) { + Q_ASSERT(cacheCount == 0); + mightHaveEnginesLeftForCleanup = engine->type() == QFontEngine::Multi; + delete engine; + } else if (cacheCount == 0) { + FC_DEBUG("QFontCache::clear: engine %p still has refcount %d", + engine, engine->ref.load()); } it.value().data = 0; } } - } + } while (mightHaveEnginesLeftForCleanup); engineCache.clear(); engineCacheCount.clear(); + + + total_cost = 0; + max_cost = min_cost; } -- cgit v1.2.3 From d3938c189833c8a7d684096762c16a9097eb6598 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 12 Apr 2013 21:01:36 +0300 Subject: Fix integer overflow for very large fonts This caused glitches up to unreadable text with i.e. pixelSize 256 and stretch factor 4x /* ((256*4)<<16)<<6 */. Change-Id: Ib6a038a043d820a94bd2019c50390a815a2a8277 Reviewed-by: Konstantin Ritt --- src/gui/text/qfontengine.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 47c59fb826..fcea2a0245 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -263,11 +263,15 @@ void *QFontEngine::harfbuzzFont() const { HB_FontRec *hbFont = (HB_FontRec *)font_; if (!hbFont->x_ppem) { - QFixed emSquare = emSquareSize(); + qint64 emSquare = emSquareSize().truncate(); + Q_ASSERT(emSquare == emSquareSize().toInt()); // ensure no truncation + if (emSquare == 0) + emSquare = 1000; // a fallback value suitable for Type1 fonts hbFont->y_ppem = fontDef.pixelSize; hbFont->x_ppem = fontDef.pixelSize * fontDef.stretch / 100; - hbFont->x_scale = (QFixed(hbFont->x_ppem * (1 << 16)) / emSquare).value(); - hbFont->y_scale = (QFixed(hbFont->y_ppem * (1 << 16)) / emSquare).value(); + // same as QFixed(x)/QFixed(emSquare) but without int32 overflow for x + hbFont->x_scale = (((qint64)hbFont->x_ppem << 6) * 0x10000L + (emSquare >> 1)) / emSquare; + hbFont->y_scale = (((qint64)hbFont->y_ppem << 6) * 0x10000L + (emSquare >> 1)) / emSquare; } return font_; } -- cgit v1.2.3 From 7628e6ed1aa5c2c75db24527fe1945709ea4f28b Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Sun, 7 Apr 2013 16:44:18 +0100 Subject: Android: Handle ':' in makeabs for Windows usage. Change-Id: I70de8fe9976a214d143b6174a5d7aebf8e79169b Reviewed-by: Oswald Buddenhagen --- config.tests/unix/makeabs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config.tests/unix/makeabs b/config.tests/unix/makeabs index c415cc7bda..4df26f769f 100755 --- a/config.tests/unix/makeabs +++ b/config.tests/unix/makeabs @@ -11,6 +11,8 @@ fi if [ `echo $FILE | cut $CUT_ARG` = "/" ]; then true +elif [ "$OSTYPE" = "msys" -a -z "${FILE##[a-zA-Z]:[/\\]*}" ]; then + true else RES="$PWD/$FILE" test -d "$RES" && RES="$RES/" -- cgit v1.2.3 From d121b37a4a4ed5530ba3d9377ab9423040cdf42b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 10 Apr 2013 11:52:31 +0200 Subject: Micro-optimization of list string list construction in qmetaobject. We know the size of constructed list, so it may be worth to reserve memory space for it. Change-Id: Idad061bc1dbf5acecaec48d2e00ca3504b9db8b8 Reviewed-by: Stephen Kelly --- src/corelib/kernel/qmetaobject.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 00d20d9300..7211a730ec 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1671,8 +1671,9 @@ void QMetaMethodPrivate::getParameterTypes(int *types) const QList QMetaMethodPrivate::parameterTypes() const { Q_ASSERT(priv(mobj->d.data)->revision >= 7); - QList list; int argc = parameterCount(); + QList list; + list.reserve(argc); int paramsIndex = parametersDataIndex(); for (int i = 0; i < argc; ++i) list += typeNameFromTypeInfo(mobj, mobj->d.data[paramsIndex + i]); @@ -1682,8 +1683,9 @@ QList QMetaMethodPrivate::parameterTypes() const QList QMetaMethodPrivate::parameterNames() const { Q_ASSERT(priv(mobj->d.data)->revision >= 7); - QList list; int argc = parameterCount(); + QList list; + list.reserve(argc); int namesIndex = parametersDataIndex() + argc; for (int i = 0; i < argc; ++i) list += stringData(mobj, mobj->d.data[namesIndex + i]); -- cgit v1.2.3 From 112b31bed6735a64810e425318b5a624c180acf2 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 12 Apr 2013 15:27:32 +0300 Subject: QWindowsFontEngineDirectWrite: Fix resources leaking fontFamily has been acquired by IDWriteFont::GetFontFamily() and thus must be released with IDWriteFontFamily::Release(). Task-number: QTBUG-26861 Change-Id: I314153f97b8b59c9ba728220f93b493b13337039 Reviewed-by: jian liang Reviewed-by: Lars Knoll --- src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 5b6ce695d8..90989c98f8 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -740,6 +740,8 @@ void QWindowsFontEngineDirectWrite::initFontInfo(const QFontDef &request, if (familyNames != NULL) familyNames->Release(); + if (fontFamily) + fontFamily->Release(); if (FAILED(hr)) qErrnoWarning(hr, "initFontInfo: Failed to get family name"); -- cgit v1.2.3 From 1f3a67e8701bd8e8d4e58ca740bc03781c10136b Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 12 Apr 2013 06:13:13 +0300 Subject: QFontEngine: Fix cache_cost might be not initialized Change-Id: I4cf4de5797e6623a71593e8f382496188e3abac8 Reviewed-by: jian liang Reviewed-by: Lars Knoll --- src/gui/text/qfontengine.cpp | 1 + src/gui/text/qfontengine_qpa.cpp | 1 + src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm | 2 ++ src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp | 1 + 4 files changed, 5 insertions(+) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index fcea2a0245..1ce70c6d83 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -199,6 +199,7 @@ QFontEngine::QFontEngine() font_(0), font_destroy_func(0), face_(0), face_destroy_func(0) { + cache_cost = 0; fsType = 0; symbol = false; diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index 837850e4be..0a730abcac 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -688,6 +688,7 @@ void QFontEngineMultiQPA::init(QFontEngine *fe) fe->ref.ref(); fontDef = engines[0]->fontDef; setObjectName(QStringLiteral("QFontEngineMultiQPA")); + cache_cost = fe->cache_cost; } void QFontEngineMultiQPA::loadEngine(int at) diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 3e553acd0a..8d1c4ed064 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -189,6 +189,8 @@ void QCoreTextFontEngine::init() avgCharWidth = QFixed::fromReal(width * fontDef.pixelSize / emSize); } else avgCharWidth = QFontEngine::averageCharWidth(); + + cache_cost = (CTFontGetAscent(ctfont) + CTFontGetDescent(ctfont)) * avgCharWidth.toInt() * 2000; } bool QCoreTextFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 90989c98f8..c0f1b3a000 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -220,6 +220,7 @@ QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *di fontDef.pixelSize = pixelSize; collectMetrics(); + cache_cost = (m_ascent.toInt() + m_descent.toInt()) * m_xHeight.toInt() * 2000; } QWindowsFontEngineDirectWrite::~QWindowsFontEngineDirectWrite() -- cgit v1.2.3 From cea58f4b77e1639e5671cf424544d4948fb8e9ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 24 Jan 2013 09:26:45 +0100 Subject: Add devicePixelRatio metric to QPaintDevice. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously QPainter computed the devicePixelRatio based on the physical and logical dpi, and expected that the ratio between them would be either 1x or 2x. This was problematic for paint devices like printers where the physical dpi can be much higher than the logical dpi, and also for QScreen where the physical dpi would have to be defined as a multiple of the logical dpi. Add QPaintDevice::PdmDevicePixelRatio and QPaintDevice:: devicePixelRatio() getter and implement it for the QPaintDevice subclasses. Use it when calculating the highdpi scale transform in qpainter.cpp and when scaling the clip rect in qwidget.cpp. Remove physical dpi scaling for QImage, QPixmap and QOpenGLPaintDevice, reverting to the old behavior. Change-Id: I6c97510613196d4536ff39d08e9750b8782283d4 Reviewed-by: Samuel Rødal Reviewed-by: Gunnar Sletta --- src/gui/image/qimage.cpp | 9 +++++-- src/gui/image/qpicture.cpp | 3 +++ src/gui/image/qpixmap_blitter.cpp | 2 ++ src/gui/image/qpixmap_raster.cpp | 6 +++-- src/gui/opengl/qopenglpaintdevice.cpp | 6 +++-- src/gui/painting/qpaintdevice.cpp | 2 ++ src/gui/painting/qpaintdevice.h | 4 +++- src/gui/painting/qpaintdevice.qdoc | 13 ++++++++++ src/gui/painting/qpainter.cpp | 32 ++++++++++++------------- src/gui/painting/qpainter_p.h | 1 + src/gui/painting/qpdf.cpp | 3 +++ src/opengl/qglframebufferobject.cpp | 3 +++ src/opengl/qglpaintdevice.cpp | 2 ++ src/opengl/qglpixelbuffer.cpp | 3 +++ src/plugins/platforms/cocoa/qprintengine_mac.mm | 3 +++ src/widgets/kernel/qwidget.cpp | 3 +-- src/widgets/kernel/qwidget_qpa.cpp | 2 ++ 17 files changed, 72 insertions(+), 25 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 7287f54e74..0efb9c2646 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4994,12 +4994,17 @@ int QImage::metric(PaintDeviceMetric metric) const break; case PdmPhysicalDpiX: - return qRound(d->dpmx * 0.0254 * d->devicePixelRatio); + return qRound(d->dpmx * 0.0254); break; case PdmPhysicalDpiY: - return qRound(d->dpmy * 0.0254 * d->devicePixelRatio); + return qRound(d->dpmy * 0.0254); break; + + case PdmDevicePixelRatio: + return d->devicePixelRatio; + break; + default: qWarning("QImage::metric(): Unhandled metric type %d", metric); break; diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index f6de22851d..1071ed754b 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -956,6 +956,9 @@ int QPicture::metric(PaintDeviceMetric m) const case PdmDepth: val = 24; break; + case PdmDevicePixelRatio: + val = 1; + break; default: val = 0; qWarning("QPicture::metric: Invalid metric command"); diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 75b7a4ba06..4c1b30a6d8 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -120,6 +120,8 @@ int QBlittablePlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) con case QPaintDevice::PdmDpiY: // fall-through case QPaintDevice::PdmPhysicalDpiY: return qt_defaultDpiY(); + case QPaintDevice::PdmDevicePixelRatio: + return 1; default: qWarning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric); break; diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 302945dbf8..c80ccd8b1d 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -278,11 +278,13 @@ int QRasterPlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const case QPaintDevice::PdmDpiX: return qt_defaultDpiX(); case QPaintDevice::PdmPhysicalDpiX: - return qt_defaultDpiX() * image.devicePixelRatio(); + return qt_defaultDpiX(); case QPaintDevice::PdmDpiY: return qt_defaultDpiX(); case QPaintDevice::PdmPhysicalDpiY: - return qt_defaultDpiY() * image.devicePixelRatio(); + return qt_defaultDpiY(); + case QPaintDevice::PdmDevicePixelRatio: + return image.devicePixelRatio(); default: qWarning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric); break; diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp index d55d6a91bf..1e427c9dd6 100644 --- a/src/gui/opengl/qopenglpaintdevice.cpp +++ b/src/gui/opengl/qopenglpaintdevice.cpp @@ -282,9 +282,11 @@ int QOpenGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const case PdmDpiY: return qRound(d_ptr->dpmy * 0.0254); case PdmPhysicalDpiX: - return qRound(d_ptr->dpmx * 0.0254 * d_ptr->devicePixelRatio); + return qRound(d_ptr->dpmx * 0.0254); case PdmPhysicalDpiY: - return qRound(d_ptr->dpmy * 0.0254 * d_ptr->devicePixelRatio); + return qRound(d_ptr->dpmy * 0.0254); + case PdmDevicePixelRatio: + return 1; default: qWarning("QOpenGLPaintDevice::metric() - metric %d not known", metric); return 0; diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp index 6ac288607d..81d2063039 100644 --- a/src/gui/painting/qpaintdevice.cpp +++ b/src/gui/painting/qpaintdevice.cpp @@ -95,6 +95,8 @@ int QPaintDevice::metric(PaintDeviceMetric m) const } else if (m == PdmNumColors) { // FIXME: does this need to be a real value? return 256; + } else if (m == PdmDevicePixelRatio) { + return 1; } else { qDebug("Unrecognised metric %d!",m); return 0; diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h index 1529b701cf..bb66f32b7f 100644 --- a/src/gui/painting/qpaintdevice.h +++ b/src/gui/painting/qpaintdevice.h @@ -65,7 +65,8 @@ public: PdmDpiX, PdmDpiY, PdmPhysicalDpiX, - PdmPhysicalDpiY + PdmPhysicalDpiY, + PdmDevicePixelRatio }; virtual ~QPaintDevice(); @@ -82,6 +83,7 @@ public: int logicalDpiY() const { return metric(PdmDpiY); } int physicalDpiX() const { return metric(PdmPhysicalDpiX); } int physicalDpiY() const { return metric(PdmPhysicalDpiY); } + int devicePixelRatio() const { return metric(PdmDevicePixelRatio); } int colorCount() const { return metric(PdmNumColors); } int depth() const { return metric(PdmDepth); } diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc index 7397dc7fc2..993b23850e 100644 --- a/src/gui/painting/qpaintdevice.qdoc +++ b/src/gui/painting/qpaintdevice.qdoc @@ -114,6 +114,10 @@ \value PdmPhysicalDpiY The vertical resolution of the device in dots per inch. See also physicalDpiY(). + \value PdmDevicePixelRatio The device pixel ratio for device. Common + values are 1 for normal-dpi displays and 2 for high-dpi "retina" + displays. + \sa metric() */ @@ -273,3 +277,12 @@ \sa physicalDpiX(), logicalDpiY() */ + +/*! + \fn int QPaintDevice::devicePixelRatio() const + + Returns the device pixel ratio for device. + + Common values are 1 for normal-dpi displays and 2 for high-dpi + "retina" displays. +*/ diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index be77fffc7c..e42b70427c 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -225,17 +225,24 @@ QTransform QPainterPrivate::viewTransform() const return QTransform(); } -QTransform QPainterPrivate::hidpiScaleTransform() const +int QPainterPrivate::effectiveDevicePixelRatio() const { -#ifdef Q_OS_MAC // Limited feature introduction for Qt 5.0.0, remove ifdef in a later release. - if (device->devType() == QInternal::Printer || device->physicalDpiX() == 0 || device->logicalDpiX() == 0) - return QTransform(); - const qreal deviceScale = (device->physicalDpiX() / device->logicalDpiX()); - if (deviceScale > 1.0) - return QTransform::fromScale(deviceScale, deviceScale); +#ifdef Q_OS_MAC + // Special cases for devices that does not support PdmDevicePixelRatio go here: + if (device->devType() == QInternal::Printer) + return 1; + + return qMax(1, device->metric(QPaintDevice::PdmDevicePixelRatio)); +#else + return 1; #endif - return QTransform(); +} + +QTransform QPainterPrivate::hidpiScaleTransform() const +{ + int devicePixelRatio = effectiveDevicePixelRatio(); + return QTransform::fromScale(devicePixelRatio, devicePixelRatio); } /* @@ -1837,14 +1844,7 @@ bool QPainter::begin(QPaintDevice *pd) Q_ASSERT(d->engine->isActive()); -#ifdef Q_OS_MAC - // Limited feature introduction for Qt 5.0.0, remove ifdef in a later release. - const bool isHighDpi = (pd->devType() == QInternal::Printer || d->device->physicalDpiX() == 0 || d->device->logicalDpiX() == 0) ? - false : (d->device->physicalDpiX() / d->device->logicalDpiX() > 1); -#else - const bool isHighDpi = false; -#endif - if (!d->state->redirectionMatrix.isIdentity() || isHighDpi) + if (!d->state->redirectionMatrix.isIdentity() || d->effectiveDevicePixelRatio() > 1) d->updateMatrix(); Q_ASSERT(d->engine->isActive()); diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h index 36a73866e7..04772b3ec9 100644 --- a/src/gui/painting/qpainter_p.h +++ b/src/gui/painting/qpainter_p.h @@ -249,6 +249,7 @@ public: } QTransform viewTransform() const; + int effectiveDevicePixelRatio() const; QTransform hidpiScaleTransform() const; static bool attachPainterPrivate(QPainter *q, QPaintDevice *pdev); void detachPainterPrivate(QPainter *q); diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index eed64180e5..5d9a743dac 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1455,6 +1455,9 @@ int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const case QPaintDevice::PdmDepth: val = 32; break; + case QPaintDevice::PdmDevicePixelRatio: + val = 1; + break; default: qWarning("QPdfWriter::metric: Invalid metric command"); return 0; diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 15880108f3..1c802cabcb 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -1232,6 +1232,9 @@ int QGLFramebufferObject::metric(PaintDeviceMetric metric) const case PdmPhysicalDpiY: return qRound(dpmy * 0.0254); + case QPaintDevice::PdmDevicePixelRatio: + return 1; + default: qWarning("QGLFramebufferObject::metric(), Unhandled metric type: %d.\n", metric); break; diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp index a3779218d2..ef9bdba070 100644 --- a/src/opengl/qglpaintdevice.cpp +++ b/src/opengl/qglpaintdevice.cpp @@ -67,6 +67,8 @@ int QGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const const QGLFormat f = format(); return f.redBufferSize() + f.greenBufferSize() + f.blueBufferSize() + f.alphaBufferSize(); } + case PdmDevicePixelRatio: + return 1; default: qWarning("QGLPaintDevice::metric() - metric %d not known", metric); return 0; diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp index e514e34552..e5e7de0fff 100644 --- a/src/opengl/qglpixelbuffer.cpp +++ b/src/opengl/qglpixelbuffer.cpp @@ -462,6 +462,9 @@ int QGLPixelBuffer::metric(PaintDeviceMetric metric) const case PdmPhysicalDpiY: return qRound(dpmy * 0.0254); + case QPaintDevice::PdmDevicePixelRatio: + return 1; + default: qWarning("QGLPixelBuffer::metric(), Unhandled metric type: %d\n", metric); break; diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm index 4748005f1a..2dedf99582 100644 --- a/src/plugins/platforms/cocoa/qprintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm @@ -364,6 +364,9 @@ int QMacPrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const case QPaintDevice::PdmDepth: val = 24; break; + case QPaintDevice::PdmDevicePixelRatio: + val = 1; + break; default: val = 0; qWarning("QPrinter::metric: Invalid metric command"); diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index edd2329df8..90cfb3446f 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1811,9 +1811,8 @@ void QWidgetPrivate::setSystemClip(QPaintDevice *paintDevice, const QRegion ® // it has been tested. QPaintEngine *paintEngine = paintDevice->paintEngine(); #ifdef Q_OS_MAC - const qreal devicePixelRatio = (paintDevice->physicalDpiX() == 0 || paintDevice->logicalDpiX() == 0) ? - 1.0 : (paintDevice->physicalDpiX() / paintDevice->logicalDpiX()); QTransform scaleTransform; + const qreal devicePixelRatio = paintDevice->devicePixelRatio(); scaleTransform.scale(devicePixelRatio, devicePixelRatio); paintEngine->d_func()->systemClip = scaleTransform.map(region); #else diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 1374d25cef..8c31d4ad26 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -836,6 +836,8 @@ int QWidget::metric(PaintDeviceMetric m) const return qRound(screen->physicalDotsPerInchX()); } else if (m == PdmPhysicalDpiY) { return qRound(screen->physicalDotsPerInchY()); + } else if (m == PdmDevicePixelRatio) { + return screen->devicePixelRatio(); } else { val = QPaintDevice::metric(m);// XXX } -- cgit v1.2.3 From fd038dc53ab42afb6a0160906cb8004930363d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 26 Mar 2013 15:41:58 +0100 Subject: Make QGLPaintEngine work on retina displays. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QGLWidgetGLPaintDevice::size now returns the size in device pixels. This fixes the QPainter "overpainting" and GraphicsView with a QGLWidget viewport use cases. Task-number: QTBUG-30217 Change-Id: I01998d39d7b4d755cf8b7b3fab5f75cd0d899ccf Reviewed-by: Samuel Rødal Reviewed-by: Gunnar Sletta --- src/opengl/qglpaintdevice.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp index ef9bdba070..6a8d5c042e 100644 --- a/src/opengl/qglpaintdevice.cpp +++ b/src/opengl/qglpaintdevice.cpp @@ -44,6 +44,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -188,7 +189,12 @@ void QGLWidgetGLPaintDevice::endPaint() QSize QGLWidgetGLPaintDevice::size() const { +#ifdef Q_OS_MAC + return glWidget->size() * (glWidget->windowHandle() ? + glWidget->windowHandle()->devicePixelRatio() : qApp->devicePixelRatio()); +#else return glWidget->size(); +#endif } QGLContext* QGLWidgetGLPaintDevice::context() const -- cgit v1.2.3 From 2da29c97364b5f4226bc6e943097c8bb2245b5a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 12 Apr 2013 11:43:53 +0200 Subject: Cocoa: Enable touch on 0->1 counter transition. Change-Id: I9d8fb84851a866c3020cbbca13d5b2dc297cfe65 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 4e567c6c63..c093881e16 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -905,7 +905,7 @@ QCocoaMenuBar *QCocoaWindow::menubar() const void QCocoaWindow::registerTouch(bool enable) { m_registerTouchCount += enable ? 1 : -1; - if (m_registerTouchCount == 1) + if (enable && m_registerTouchCount == 1) [m_contentView setAcceptsTouchEvents:YES]; else if (m_registerTouchCount == 0) [m_contentView setAcceptsTouchEvents:NO]; -- cgit v1.2.3 From 11fdd8edcd6a45f5e6bb1cd6e02b06d8f61eb406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 12 Apr 2013 11:46:28 +0200 Subject: Cocoa: Create QCocoaWindow when enabling touch. The ref-counting and (native) touch enabling is implemented in QCocoaWindow. Change-Id: I4f3f5e16db59afec7dd7dd2f8360dd60b90bfe6d Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index f0f1f56d90..5368b2f938 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -228,6 +228,11 @@ void QCocoaNativeInterface::setWindowContentView(QPlatformWindow *window, void * void QCocoaNativeInterface::registerTouchWindow(QWindow *window, bool enable) { + // Make sure the QCocoaWindow is created when enabling. Disabling might + // happen on window destruction, don't (re)create the QCocoaWindow then. + if (enable) + window->create(); + QCocoaWindow *cocoaWindow = static_cast(window->handle()); if (cocoaWindow) cocoaWindow->registerTouch(enable); -- cgit v1.2.3 From e5e0ec42bbae0816b1bb6c93bf1b7d14b077c64d Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 5 Apr 2013 20:55:28 +0200 Subject: Cocoa: Fix popup menus on modal windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, we used -popUpMenuPositioningItem:atLocation:inView: but this turns out not to work with modal windows. This can actually be reproduced in Cocoa. Change-Id: I9b750d1f97637f0cc30329d3da3acf5200f62206 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoamenu.mm | 36 ++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 0fe4c48510..e01af05ca9 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -97,7 +97,6 @@ static inline QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *getMenuLoader() if (![menuItem tag]) return YES; - QCocoaMenuItem* cocoaItem = reinterpret_cast([menuItem tag]); return cocoaItem->isEnabled(); } @@ -311,8 +310,39 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf QCocoaWindow *cocoaWindow = parentWindow ? static_cast(parentWindow->handle()) : 0; NSView *view = cocoaWindow ? cocoaWindow->contentView() : nil; NSMenuItem *nsItem = item ? ((QCocoaMenuItem *)item)->nsItem() : nil; - NSPoint nsPos = NSMakePoint(pos.x(), pos.y()); - [m_nativeMenu popUpMenuPositioningItem:nsItem atLocation:nsPos inView:view]; + + // Ideally, we would call -popUpMenuPositioningItem:atLocation:inView:. + // However, this showed not to work with modal windows where the menu items + // would appear disabled. So, we resort to a more artisanal solution. Note + // that this implies several things. + // + // First, we need to transform 'pos' to window or screen coordinates. + NSPoint nsPos = NSMakePoint(pos.x() - 1, pos.y()); + if (view) { + nsPos.y = view.frame.size.height - nsPos.y; + } else if (!QGuiApplication::screens().isEmpty()) { + QScreen *screen = QGuiApplication::screens().at(0); + nsPos.y = screen->availableVirtualSize().height() - nsPos.y; + } + if (nsItem) { + // Then, we need to position the menu ourselves to have the specified item + // at the specified position. This also means that we have to guess the menu + // item's height. (We could use HITheme to get it, but it looks like an overkill + // at this point). + CGFloat itemHeight = m_nativeMenu.font.pointSize == 13 ? 18.0 : 19.0; + nsPos.y += [m_nativeMenu indexOfItem:nsItem] * itemHeight; + } + // Last, we need to synthesize an event. + NSEvent *menuEvent = [NSEvent mouseEventWithType:NSRightMouseDown + location:nsPos + modifierFlags:0 + timestamp:0 + windowNumber:view ? view.window.windowNumber : 0 + context:nil + eventNumber:0 + clickCount:1 + pressure:1.0]; + [NSMenu popUpContextMenu:m_nativeMenu withEvent:menuEvent forView:view]; // The call above blocks, and also swallows any mouse release event, // so we need to clear any mouse button that triggered the menu popup. -- cgit v1.2.3 From 88272d6c04f0f67fa9612dc7bdb2a5f8ba8d0314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 15 Apr 2013 09:30:38 +0200 Subject: Don't warn on 0x0 sized windows. I don't think this is an user error. If it is then the warning should be in a cross-platform code path. Change-Id: I4c615d9b2372660bb03b17ccb25204b2a8d17b1a Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index c093881e16..161e2225a4 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -852,7 +852,7 @@ void QCocoaWindow::syncWindowState(Qt::WindowState newState) // if content view width or height is 0 then the window animations will crash so // do nothing except set the new state NSRect contentRect = [contentView() frame]; - if (contentRect.size.width <= 0 || contentRect.size.height <= 0) { + if (contentRect.size.width < 0 || contentRect.size.height < 0) { qWarning() << Q_FUNC_INFO << "invalid window content view size, check your window geometry"; m_synchedWindowState = newState; return; -- cgit v1.2.3 From b64c9a89da539280a947e34458a738bf3e19ff7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 10 Apr 2013 16:20:48 +0200 Subject: Added qtwaylandscanner rules to wayland-scanner.prf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In preparation of change in qtwayland. Change-Id: I337ea9f48bf692f31e406c47d9256ee0263d33f0 Reviewed-by: Oswald Buddenhagen Reviewed-by: Jørgen Lind --- mkspecs/features/wayland-scanner.prf | 50 +++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/mkspecs/features/wayland-scanner.prf b/mkspecs/features/wayland-scanner.prf index 90e1e0f953..2ec064f29d 100644 --- a/mkspecs/features/wayland-scanner.prf +++ b/mkspecs/features/wayland-scanner.prf @@ -1,32 +1,68 @@ # -# Wayland-scanner extra-compiler for handling files specified in the WAYLANDSOURCES variable +# Extra-compilers for handling files specified in +# the WAYLANDSERVERSOURCES and WAYLANDCLIENTSOURCES variables # isEmpty(QMAKE_WAYLAND_SCANNER):error("QMAKE_WAYLAND_SCANNER not defined for this mkspec") wayland-server-header.name = wayland ${QMAKE_FILE_BASE} -wayland-server-header.input = WAYLANDSOURCES +wayland-server-header.input = WAYLANDSERVERSOURCES wayland-server-header.variable_out = HEADERS wayland-server-header.output = wayland-${QMAKE_FILE_BASE}-server-protocol$${first(QMAKE_EXT_H)} wayland-server-header.commands = $$QMAKE_WAYLAND_SCANNER server-header < ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} - silent:wayland-server-header.commands = @echo Wayland server header ${QMAKE_FILE_IN} && $$wayland-server-header.commands QMAKE_EXTRA_COMPILERS += wayland-server-header wayland-client-header.name = wayland ${QMAKE_FILE_BASE} -wayland-client-header.input = WAYLANDSOURCES +wayland-client-header.input = WAYLANDCLIENTSOURCES wayland-client-header.variable_out = HEADERS wayland-client-header.output = wayland-${QMAKE_FILE_BASE}-client-protocol$${first(QMAKE_EXT_H)} wayland-client-header.commands = $$QMAKE_WAYLAND_SCANNER client-header < ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} - silent:wayland-client-header.commands = @echo Wayland client header ${QMAKE_FILE_IN} && $$wayland-client-header.commands QMAKE_EXTRA_COMPILERS += wayland-client-header wayland-code.name = wayland ${QMAKE_FILE_BASE} -wayland-code.input = WAYLANDSOURCES +wayland-code.input = WAYLANDCLIENTSOURCES WAYLANDSERVERSOURCES wayland-code.variable_out = SOURCES wayland-code.output = wayland-${QMAKE_FILE_BASE}-protocol.c wayland-code.commands = $$QMAKE_WAYLAND_SCANNER code < ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} - silent:wayland-code.commands = @echo Wayland code header ${QMAKE_FILE_IN} && $$wayland-code.commands QMAKE_EXTRA_COMPILERS += wayland-code + +qtPrepareTool(QMAKE_QTWAYLANDSCANNER, qtwaylandscanner) + +qtwayland-client-header.name = qtwayland ${QMAKE_FILE_BASE} +qtwayland-client-header.input = WAYLANDCLIENTSOURCES +qtwayland-client-header.variable_out = HEADERS +qtwayland-client-header.depends = wayland-${QMAKE_FILE_BASE}-client-protocol$${first(QMAKE_EXT_H)} +qtwayland-client-header.output = qwayland-${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)} +qtwayland-client-header.commands = $$QMAKE_QTWAYLANDSCANNER client-header ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} +silent:qtwayland-client-header.commands = @echo QtWayland client header ${QMAKE_FILE_IN} && $$qtwayland-client-header.commands +QMAKE_EXTRA_COMPILERS += qtwayland-client-header + +qtwayland-client-code.name = qtwayland ${QMAKE_FILE_BASE} +qtwayland-client-code.input = WAYLANDCLIENTSOURCES +qtwayland-client-code.variable_out = SOURCES +qtwayland-client-code.depends = qwayland-${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)} +qtwayland-client-code.output = qwayland-${QMAKE_FILE_BASE}.cpp +qtwayland-client-code.commands = $$QMAKE_QTWAYLANDSCANNER client-code ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} +silent:qtwayland-client-code.commands = @echo QtWayland client code ${QMAKE_FILE_IN} && $$qtwayland-client-code.commands +QMAKE_EXTRA_COMPILERS += qtwayland-client-code + +qtwayland-server-header.name = qtwayland ${QMAKE_FILE_BASE} +qtwayland-server-header.input = WAYLANDSERVERSOURCES +qtwayland-server-header.variable_out = HEADERS +qtwayland-server-header.depends = wayland-${QMAKE_FILE_BASE}-server-protocol$${first(QMAKE_EXT_H)} +qtwayland-server-header.output = qwayland-server-${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)} +qtwayland-server-header.commands = $$QMAKE_QTWAYLANDSCANNER server-header ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} +silent:qtwayland-server-header.commands = @echo QtWayland server header ${QMAKE_FILE_IN} && $$qtwayland-server-header.commands +QMAKE_EXTRA_COMPILERS += qtwayland-server-header + +qtwayland-server-code.name = qtwayland ${QMAKE_FILE_BASE} +qtwayland-server-code.input = WAYLANDSERVERSOURCES +qtwayland-server-code.variable_out = SOURCES +qtwayland-server-code.depends = qwayland-server-${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)} +qtwayland-server-code.output = qwayland-server-${QMAKE_FILE_BASE}.cpp +qtwayland-server-code.commands = $$QMAKE_QTWAYLANDSCANNER server-code ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} +silent:qtwayland-server-code.commands = @echo QtWayland server code ${QMAKE_FILE_IN} && $$qtwayland-server-code.commands +QMAKE_EXTRA_COMPILERS += qtwayland-server-code -- cgit v1.2.3 From 61b71b2baf10c8dc4fbff5fd4e8c7a7d325a8ee2 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 12 Apr 2013 15:25:38 +0200 Subject: Cocoa: Fix unresponsive main window after running more than one modal session For some reason, we postpone clearing the stack of modal sessions until we call processPostedEvents() again. However, it also means that when we clear the second modal session, that session keeps running although we just closed its window. The reason why it isn't stopped is because it wasn't the topmost modal session in the stack. This patch fixes the issue by stopping a modal session if any session above in the stack has been stopped. This makes it less problematic if we don't call processPostedEvents() in between ending modal sessions. Task-number: QTBUG-30504 Change-Id: I9f898250ae629947d066647f9d5a0b9f75cf0070 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 5c487b0bdd..2ac9a5dac9 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -741,11 +741,14 @@ void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window) // when we stop the _current_ modal session (which is the session on top of // the stack, and might not belong to 'window'). int stackSize = cocoaModalSessionStack.size(); + int endedSessions = 0; for (int i=stackSize-1; i>=0; --i) { QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; + if (!info.window) + endedSessions++; if (info.window == window) { info.window = 0; - if (i == stackSize-1) { + if (i + endedSessions == stackSize-1) { // The top sessions ended. Interrupt the event dispatcher to // start spinning the correct session immediately. Like in // beginModalSession(), we call interrupt() before clearing -- cgit v1.2.3 From f1e74c07410c47aa02fa9726421c0485412e2cf4 Mon Sep 17 00:00:00 2001 From: Ivan Romanov Date: Thu, 11 Apr 2013 17:08:19 +0600 Subject: fix padding periods in configure help text A gap after option name is needed to select it with double-click. Also I added padding periods for -testcocoon because it has no them before. Task-number: QTBUG-30589 Change-Id: Ib5b970f9b17cad43609fbc53dd05a995aaf29b45 Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- configure | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/configure b/configure index f0037479ab..d14fcdc3b8 100755 --- a/configure +++ b/configure @@ -3282,7 +3282,7 @@ Installation options: (default PREFIX/include) -libdir ......... Libraries will be installed to (default PREFIX/lib) - -archdatadir ..... Arch-dependent data used by Qt will be installed to + -archdatadir .... Arch-dependent data used by Qt will be installed to (default PREFIX) -plugindir ...... Plugins will be installed to (default ARCHDATADIR/plugins) @@ -3328,7 +3328,7 @@ Configure options: -opensource ........ Compile and link the Open-Source Edition of Qt. -commercial ........ Compile and link the Commercial Edition of Qt. - -confirm-license.... Automatically acknowledge the license (use with + -confirm-license ... Automatically acknowledge the license (use with either -opensource or -commercial) -no-c++11 .......... Do not compile Qt with C++11 support enabled. @@ -3377,8 +3377,8 @@ Configure options: -no-sse2 ........... Do not compile with use of SSE2 instructions. -no-sse3 ........... Do not compile with use of SSE3 instructions. -no-ssse3 .......... Do not compile with use of SSSE3 instructions. - -no-sse4.1.......... Do not compile with use of SSE4.1 instructions. - -no-sse4.2.......... Do not compile with use of SSE4.2 instructions. + -no-sse4.1 ......... Do not compile with use of SSE4.1 instructions. + -no-sse4.2 ......... Do not compile with use of SSE4.2 instructions. -no-avx ............ Do not compile with use of AVX instructions. -no-avx2 ........... Do not compile with use of AVX2 instructions. -no-neon ........... Do not compile with use of NEON instructions. @@ -3388,7 +3388,7 @@ Configure options: -qtnamespace Wraps all Qt library code in 'namespace {...}'. -qtlibinfix Renames all libQt*.so to libQt*.so. - -testcocoon Instrument Qt with the TestCocoon code coverage tool. + -testcocoon ........ Instrument Qt with the TestCocoon code coverage tool. -D ........ Add an explicit define to the preprocessor. -I ........ Add an explicit include path. @@ -3552,8 +3552,8 @@ EOF if [ "$XPLATFORM_MAEMO" = "yes" ]; then cat << EOF - $X2N -no-xinput2......... Do not compile XInput2 support. - $X2Y -xinput2............ Compile XInput2 support. + $X2N -no-xinput2 ........ Do not compile XInput2 support. + $X2Y -xinput2 ........... Compile XInput2 support. EOF -- cgit v1.2.3 From 01f3ef20502c09ae0b001aa06212b646223a2ddd Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Sat, 13 Apr 2013 00:01:09 +0900 Subject: Make qtbase compile with QT_NO_IMAGEFORMATPLUGIN qfeatures.h re-generated from qfeatures.txt because QT_NO_IMAGEFORMATPLUGIN was missing Change-Id: I1c9291529ec07f83f99c9cd08340cbfebda609b6 Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qfeatures.h | 7 ++++++- src/gui/image/qimagereader.cpp | 4 ++-- src/gui/image/qimagewriter.cpp | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index daf853b916..f2e5dc7633 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -238,7 +238,7 @@ // QWheelEvent //#define QT_NO_WHEELEVENT -// +// //#define QT_NO_XMLSTREAM // Animation @@ -301,6 +301,11 @@ #define QT_NO_IM #endif +// QImageIOPlugin +#if !defined(QT_NO_IMAGEFORMATPLUGIN) && (defined(QT_NO_LIBRARY)) +#define QT_NO_IMAGEFORMATPLUGIN +#endif + // QLocalServer #if !defined(QT_NO_LOCALSERVER) && (defined(QT_NO_TEMPORARYFILE)) #define QT_NO_LOCALSERVER diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index e612a2c374..5dd51843fb 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -1513,9 +1513,9 @@ QList QImageReader::supportedMimeTypes() for (int i = 0; i < _qt_NumFormats; ++i) mimeTypes << _qt_BuiltInFormats[i].mimeType; -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN supportedImageHandlerMimeTypes(loader(), QImageIOPlugin::CanRead, &mimeTypes); -#endif // QT_NO_LIBRARY +#endif // QT_NO_IMAGEFORMATPLUGIN QList sortedMimeTypes; for (QSet::ConstIterator it = mimeTypes.constBegin(); it != mimeTypes.constEnd(); ++it) diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index 8823f9293d..a27dc9d16f 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -789,9 +789,9 @@ QList QImageWriter::supportedMimeTypes() mimeTypes << "image/jpeg"; #endif -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN supportedImageHandlerMimeTypes(loader(), QImageIOPlugin::CanWrite, &mimeTypes); -#endif // QT_NO_LIBRARY +#endif // QT_NO_IMAGEFORMATPLUGIN QList sortedMimeTypes; for (QSet::ConstIterator it = mimeTypes.constBegin(); it != mimeTypes.constEnd(); ++it) -- cgit v1.2.3 From 6a0bb4206a2928b8364863fc88f25985374f6c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 15 Apr 2013 12:35:18 +0200 Subject: Add autorelease pools needed by Qt Creator. With these Qt Creator startup is now warning-free on 10.6. Change-Id: Ie29d360611c0e516258920163e4e94d174217299 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoamenu.mm | 2 ++ src/plugins/platforms/cocoa/qcocoamenubar.mm | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index e01af05ca9..5bd3a31427 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -386,6 +386,8 @@ QList QCocoaMenu::merged() const void QCocoaMenu::syncModalState(bool modal) { + QCocoaAutoReleasePool pool; + if (!m_enabled) modal = true; diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index c0c8caed05..b880db16a2 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -114,6 +114,8 @@ void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *befor void QCocoaMenuBar::removeMenu(QPlatformMenu *platformMenu) { + QCocoaAutoReleasePool pool; + QCocoaMenu *menu = static_cast(platformMenu); if (!m_menus.contains(menu)) { qWarning() << Q_FUNC_INFO << "Trying to remove a menu that does not belong to the menubar"; -- cgit v1.2.3 From 27d40fce12e274197e1e219845310575f0ec938a Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Mon, 15 Apr 2013 12:39:18 +0200 Subject: Add autorelease pool for cocoa plugin creation. Prevents mem leaks at startup on 10.6. Change-Id: I5f8b72c54ab396ee0ec2e47320163a6a342b78f1 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/main.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/cocoa/main.mm b/src/plugins/platforms/cocoa/main.mm index 0eb4edef72..6adcb27817 100644 --- a/src/plugins/platforms/cocoa/main.mm +++ b/src/plugins/platforms/cocoa/main.mm @@ -59,6 +59,9 @@ public: QPlatformIntegration * QCocoaIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); + + QCocoaAutoReleasePool pool; + if (system.toLower() == "cocoa") return new QCocoaIntegration; -- cgit v1.2.3 From c4611dc16841eadee9e6eba40d985411fc8ffb2c Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Fri, 12 Apr 2013 19:56:55 +0300 Subject: Fix incorrect compiler-from-mkspec selection in configure Semantic error in selection for MSVC 2010. Change-Id: I9ad97784cdb1a060df41bd1bb4e6c9f43adb387c Reviewed-by: Oswald Buddenhagen --- tools/configure/environment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index b7cbcc5cb9..1b4053ccdf 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -146,7 +146,7 @@ Compiler Environment::compilerFromQMakeSpec(const QString &qmakeSpec) { if (qmakeSpec == QLatin1String("win32-msvc2012")) return CC_NET2012; - if (qmakeSpec == QLatin1String("win32-msvc2012")) + if (qmakeSpec == QLatin1String("win32-msvc2010")) return CC_NET2010; if (qmakeSpec == QLatin1String("win32-msvc2008")) return CC_NET2008; -- cgit v1.2.3 From 72e9cad5602c2fe50d3978c6b3d05dc503135dfc Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 2 Apr 2013 12:19:24 +0200 Subject: Remove dead code Just some code that was commented out and only adds to the confusion. Change-Id: Icfdf81de9731eeb2c473a2f6e2723742601a2037 Reviewed-by: Paul Olav Tvete --- .../src/org/qtproject/qt5/android/QtActivityDelegate.java | 1 - .../jar/src/org/qtproject/qt5/android/QtSurface.java | 14 -------------- 2 files changed, 15 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index dedfc9d417..be618934df 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -616,7 +616,6 @@ public class QtActivityDelegate } catch (Exception e) { e.printStackTrace(); } -// setFullScreen(savedInstanceState.getBoolean("FullScreen")); m_started = savedInstanceState.getBoolean("Started"); if (m_started) m_surface.applicationStarted(true); 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 b994a43ac4..6cc2f1e333 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java @@ -107,20 +107,6 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback if (m_usesGL) holder.setFormat(PixelFormat.RGBA_8888); - -// if (!m_started) -// return; -// -// if (m_usesGL) -// QtApplication.setSurface(holder.getSurface()); -// else -// { -// QtApplication.lockSurface(); -// QtApplication.setSurface(null); -// m_bitmap=Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.RGB_565); -// QtApplication.setSurface(m_bitmap); -// QtApplication.unlockSurface(); -// } } @Override -- cgit v1.2.3 From c1ac77b34c20be797502551a9c57f7b4b2d20aae Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 2 Apr 2013 12:34:02 +0200 Subject: Remove code for Android API level < 9 We don't support API levels < 9, so we can simplify this code a little. Change-Id: I9823d4c5a44d265e03dec0ceedeeb3c34a1e1eab Reviewed-by: Paul Olav Tvete --- .../platforms/android/src/androidjnimain.cpp | 37 ++-------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp index 36d95b0816..cd7fa25da7 100644 --- a/src/plugins/platforms/android/src/androidjnimain.cpp +++ b/src/plugins/platforms/android/src/androidjnimain.cpp @@ -74,9 +74,7 @@ # include "qandroidopenglplatformwindow.h" #endif -#if __ANDROID_API__ > 8 -# include -#endif +#include static jmethodID m_redrawSurfaceMethodID = 0; @@ -543,32 +541,6 @@ static void terminateQt(JNIEnv *env, jclass /*clazz*/) env->DeleteGlobalRef(m_bitmapDrawableClass); } -#ifdef ANDROID_PLUGIN_OPENGL -#if __ANDROID_API__ < 9 -struct FakeNativeWindow -{ - long long dummyNativeWindow;// force 64 bits alignment -}; - -class FakeSurface: public FakeNativeWindow -{ -public: - virtual void FakeSurfaceMethod() - { - fakeSurface = 0; - } - - int fakeSurface; -}; - -EGLNativeWindowType ANativeWindow_fromSurface(JNIEnv *env, jobject jSurface) -{ - FakeSurface *surface = static_cast(env->GetIntField(jSurface, m_surfaceFieldID)); - return static_cast(static_cast(surface)); -} -#endif // __ANDROID_API__ < 9 -#endif // ANDROID_PLUGIN_OPENGL - static void setSurface(JNIEnv *env, jobject /*thiz*/, jobject jSurface) { #ifndef ANDROID_PLUGIN_OPENGL @@ -753,12 +725,7 @@ static int registerNatives(JNIEnv *env) #ifdef ANDROID_PLUGIN_OPENGL FIND_AND_CHECK_CLASS("android/view/Surface"); -#if __ANDROID_API__ < 9 -# define ANDROID_VIEW_SURFACE_JNI_ID "mSurface" -#else -# define ANDROID_VIEW_SURFACE_JNI_ID "mNativeSurface" -#endif - GET_AND_CHECK_FIELD(m_surfaceFieldID, clazz, ANDROID_VIEW_SURFACE_JNI_ID, "I"); + GET_AND_CHECK_FIELD(m_surfaceFieldID, clazz, "mNativeSurface", "I"); #endif jmethodID methodID; -- cgit v1.2.3 From 2b4dff8dc180db0d96904b8ebfe109b2698999a5 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 12 Apr 2013 15:07:12 +0200 Subject: Make surface and window accessible to subclasses We need to access these in the Android plugin. Change-Id: I8c7f279bbe0b7087260cceb1f965c833c0097984 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/eglfs/qeglfswindow.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h index a351b4a6f4..67a64973ce 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.h +++ b/src/plugins/platforms/eglfs/qeglfswindow.h @@ -68,10 +68,12 @@ public: virtual void invalidateSurface(); virtual void resetSurface(); -private: - WId m_winid; +protected: EGLSurface m_surface; EGLNativeWindowType m_window; + +private: + WId m_winid; EGLConfig m_config; QSurfaceFormat m_format; }; -- cgit v1.2.3 From 6e0f55495d84f5bfb4362847943c740ddedfb137 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Sun, 7 Apr 2013 16:58:42 +0100 Subject: Android: Implement a hack for qmake /dev/null usage on Windows. Neither /dev/null nor NUL work with Qt on Windows. For now, use an empty file for the cases where qmake is used with /dev/null. I filed a bug for this: https://bugreports.qt-project.org/browse/QTBUG-30562 Change-Id: If5351214ae5a0ebe50ae46b155c327ca0dc59f98 Reviewed-by: Alvaro Burnett Reviewed-by: Oswald Buddenhagen --- configure | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configure b/configure index d14fcdc3b8..422bd8efbf 100755 --- a/configure +++ b/configure @@ -440,9 +440,12 @@ if [ -d /System/Library/Frameworks/Carbon.framework ]; then fi BUILD_ON_MSYS=no HOST_DIRLIST_SEP=":" +DEV_NULL=/dev/null if [ "$OSTYPE" = "msys" ]; then HOST_DIRLIST_SEP=";" BUILD_ON_MSYS=yes + DEV_NULL=/tmp/empty-file + echo "" > $DEV_NULL fi #------------------------------------------------------------------------------- @@ -4053,7 +4056,7 @@ fi #------------------------------------------------------------------------------- # Verify makespec #------------------------------------------------------------------------------- -QMAKE_OUTPUT=`$outpath/bin/qmake -E -nocache -spec "$XQMAKESPEC" "QT=" /dev/null 2>&1 >/dev/null` +QMAKE_OUTPUT=`$outpath/bin/qmake -E -nocache -spec "$XQMAKESPEC" "QT=" $DEV_NULL 2>&1 >/dev/null` if [ $? != "0" ]; then echo "Failed to process makespec for platform '$XPLATFORM'" if [ "$OPT_VERBOSE" = "yes" ]; then @@ -4069,7 +4072,7 @@ 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'`" + PKG_CONFIG="`"$outpath/bin/qmake" -E -nocache -spec "$XQMAKESPEC" "CONFIG=" $DEV_NULL 2>&1 | sed -n -e 's,^PKG_CONFIG = \(.*\),\1,p'`" fi if [ -z "$PKG_CONFIG" ]; then PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null` -- cgit v1.2.3 From aec1bcf6a36a61ae7bad8f733ac4bd2211e6eb2b Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 12 Apr 2013 15:08:02 +0200 Subject: eglfs: Make sure virtual functions are not called from ctor We want to override some of them in a subclass. Change-Id: Ic7a22d7bc4589199b3f764157125094a4ff6ec28 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 3 ++- src/plugins/platforms/eglfs/qeglfswindow.cpp | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 64e11b4e07..615b69f7d9 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -145,7 +145,8 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWindow *window) const { - QPlatformWindow *w = new QEglFSWindow(window); + QEglFSWindow *w = new QEglFSWindow(window); + w->create(); w->requestActivateWindow(); return w; } diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index 68cef6253e..ebf8e4af85 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -59,10 +59,6 @@ QEglFSWindow::QEglFSWindow(QWindow *w) #ifdef QEGL_EXTRA_DEBUG qWarning("QEglWindow %p: %p 0x%x\n", this, w, uint(m_winid)); #endif - - setWindowState(Qt::WindowFullScreen); - - create(); } QEglFSWindow::~QEglFSWindow() @@ -72,6 +68,8 @@ QEglFSWindow::~QEglFSWindow() void QEglFSWindow::create() { + setWindowState(Qt::WindowFullScreen); + if (m_window) return; -- cgit v1.2.3 From c57dd789fd0a76a81499c9413203a46d1743e0f8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 21 Mar 2013 14:15:12 -0700 Subject: Mark as unused the private members that aren't and CANNOT be used Those members were left uninitialised by inline constructors and/or the destructor of those classes is/was also inline. Those members cannot be used to store pointers that need managing during the Qt 5.x lifetime. They can be used to store simple values, as if they were integers. Detected by Apple Clang 4.2. Change-Id: I20e2def7c4006668e2d6a7e332c89e2dc8c2a184 Reviewed-by: Konstantin Ritt Reviewed-by: Lars Knoll --- src/dbus/qdbuserror.cpp | 4 +++- src/xml/sax/qxml.cpp | 20 ++++++++++++++++++++ src/xml/sax/qxml.h | 8 ++++---- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/dbus/qdbuserror.cpp b/src/dbus/qdbuserror.cpp index f486c19fdc..ddc2be7c38 100644 --- a/src/dbus/qdbuserror.cpp +++ b/src/dbus/qdbuserror.cpp @@ -257,7 +257,9 @@ static inline QDBusError::ErrorType get(const char *name) QDBusError::QDBusError() : code(NoError) { - + // ### This class has an implicit (therefore inline) destructor + // so the following field cannot be used. + Q_UNUSED(unused); } #ifndef QT_BOOTSTRAPPED diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index 47e137976b..0e20041a62 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -985,12 +985,22 @@ void QXmlNamespaceSupport::reset() Constructs an empty attribute list. */ +QXmlAttributes::QXmlAttributes() +{ + // ### In Qt 5.0, this function was inlined and d was not initialized + // The member cannot be used until Qt 6.0 + Q_UNUSED(d); +} /*! \fn QXmlAttributes::~QXmlAttributes() Destroys the attributes object. */ +QXmlAttributes::~QXmlAttributes() +{ +} + /*! Looks up the index of an attribute by the qualified name \a qName. @@ -2400,11 +2410,21 @@ events are reported. Constructs a handler for use with subclasses of QXmlReader. */ +QXmlDefaultHandler::QXmlDefaultHandler() +{ + // ### In Qt 5.0, this function was inlined and d was not initialized + // The member cannot be used until Qt 6.0 + Q_UNUSED(d); +} + /*! \fn QXmlDefaultHandler::~QXmlDefaultHandler() Destroys the handler. */ +QXmlDefaultHandler::~QXmlDefaultHandler() +{ +} /*! \reimp diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h index 4ce2c26b05..743f8702af 100644 --- a/src/xml/sax/qxml.h +++ b/src/xml/sax/qxml.h @@ -117,8 +117,8 @@ private: class Q_XML_EXPORT QXmlAttributes { public: - QXmlAttributes() {} - virtual ~QXmlAttributes() {} + QXmlAttributes(); + virtual ~QXmlAttributes(); int index(const QString& qName) const; int index(QLatin1String qName) const; @@ -365,8 +365,8 @@ public: class Q_XML_EXPORT QXmlDefaultHandler : public QXmlContentHandler, public QXmlErrorHandler, public QXmlDTDHandler, public QXmlEntityResolver, public QXmlLexicalHandler, public QXmlDeclHandler { public: - QXmlDefaultHandler() { } - virtual ~QXmlDefaultHandler() { } + QXmlDefaultHandler(); + virtual ~QXmlDefaultHandler(); void setDocumentLocator(QXmlLocator* locator); bool startDocument(); -- cgit v1.2.3 From 7a536e1b7b8400141973fea9b79754a53f6a535d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 26 Feb 2013 15:37:14 -0800 Subject: Re-shuffle the configure output Keep options sorted and use indentation to group together related options (QPA backends, image formats and SQL drivers). Change-Id: I97d330a13a4daa4567ff741dc26e11f458ae7f53 Reviewed-by: Oswald Buddenhagen --- configure | 273 +++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 146 insertions(+), 127 deletions(-) diff --git a/configure b/configure index 422bd8efbf..85bab30ce6 100755 --- a/configure +++ b/configure @@ -6568,17 +6568,17 @@ fi #------------------------------------------------------------------------------- exec 3>&1 1>$outpath/config.summary # redirect output temporarily to config.summary +echo +echo " Configure summary" echo if [ "$XPLATFORM" = "$PLATFORM" ]; then - echo "Build type: $PLATFORM" + # the missing space before $CFG_FEATURES is intentional + echo "Build type: $PLATFORM ($CFG_ARCH, CPU features:${CFG_CPUFEATURES- none detected})" else - echo "Building on: $PLATFORM" - echo "Building for: $XPLATFORM" + echo "Building on: $PLATFORM ($CFG_HOST_ARCH, CPU features:${CFG_HOST_CPUFEATURES- none detected})" + echo "Building for: $XPLATFORM ($CFG_ARCH, CPU features:${CFG_CPUFEATURES- none detected})" fi -# the missing space before $CFG_FEATURES is intentional -echo "Architecture: $CFG_ARCH, features:$CFG_CPUFEATURES" -echo "Host architecture: $CFG_HOST_ARCH, features:$CFG_HOST_CPUFEATURES" if [ -n "$PLATFORM_NOTES" ]; then echo "Platform notes:" @@ -6591,150 +6591,169 @@ if [ "$OPT_VERBOSE" = "yes" ]; then echo $ECHO_N "qmake vars .......... $ECHO_C" cat "$QMAKE_VARS_FILE" | tr '\n' ' ' echo "qmake switches ......... $QMAKE_SWITCHES" + echo fi -echo "Build .................. $CFG_BUILD_PARTS" -echo "Configuration .......... $QMAKE_CONFIG $QT_CONFIG" +# Build configuration +echo "Build options:" +echo $ECHO_N " Configuration .......... $ECHO_C" +echo $QMAKE_CONFIG $QT_CONFIG | tr ' ' '\n' | sort | tr '\n' ' ' +echo +echo " Build parts ............ $CFG_BUILD_PARTS" +release="release" +[ "$CFG_FORCEDEBUGINFO" = "yes" ] && release="release (with debug info)" +[ "$CFG_DEBUG" = "yes" ] && build_mode="debug" || build_mode=$release if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then - echo "Debug .................. yes (combined)" - if [ "$CFG_DEBUG" = "yes" ]; then - echo "Default Link ........... debug" - else - echo "Default Link ........... release" - fi + echo " Mode ................... debug and $release; default link: $build_mode" else - echo "Debug .................. $CFG_DEBUG" + echo " Mode ................... $build_mode" fi -if [ "$CFG_RELEASE" = "yes" ] || [ "$CFG_DEBUG_RELEASE" = "yes" ]; then - echo "Force debug info ....... $CFG_FORCEDEBUGINFO" +unset build_mode release +echo " Using C++11 ............ $CFG_CXX11" +echo " Using PCH .............. $CFG_PRECOMPILE" +echo " Target compiler supports:" +if [ "$CFG_ARCH" = "i386" -o "$CFG_ARCH" = "x86_64" ]; then + echo " SSE2/SSE3/SSSE3 ...... ${CFG_SSE2}/${CFG_SSE3}/${CFG_SSSE3}" + echo " SSE4.1/SSE4.2 ........ ${CFG_SSE4_1}/${CFG_SSE4_2}" + echo " AVX/AVX2 ............. ${CFG_AVX}/${CFG_AVX2}" +elif [ "$CFG_ARCH" = "arm" ]; then + echo " iWMMXt/Neon .......... ${CFG_IWMMXT}/${CFG_NEON}" +elif [ "$CFG_ARCH" = "mips" ]; then + echo " DSP/DSPr2 ............ ${CFG_MIPS_DSP}/${CFG_MIPS_DSPR2}" fi -echo "C++11 support .......... $CFG_CXX11" -if [ -n "$PKG_CONFIG" ]; then - echo "pkg-config ............. yes" -else - echo "pkg-config ............. no" -fi -[ "$CFG_DBUS" = "no" ] && echo "Qt D-Bus module ........ no" -[ "$CFG_DBUS" = "yes" ] && echo "Qt D-Bus module ........ yes (run-time)" -[ "$CFG_DBUS" = "linked" ] && echo "Qt D-Bus module ........ yes (linked)" -echo "Qt Concurrent code ..... $CFG_CONCURRENT" -echo "Qt GUI module .......... $CFG_GUI" -echo "Qt Widgets module ...... $CFG_WIDGETS" + +# Qt modules +echo +echo "Qt modules and options:" +[ "$CFG_DBUS" = "no" ] && echo " Qt D-Bus ............... no" +[ "$CFG_DBUS" = "yes" ] && echo " Qt D-Bus ............... yes (loading dbus-1 at runtime)" +[ "$CFG_DBUS" = "linked" ] && echo " Qt D-Bus ............... yes (linked to dbus-1)" +echo " Qt Concurrent .......... $CFG_CONCURRENT" +echo " Qt GUI ................. $CFG_GUI" +echo " Qt Widgets ............. $CFG_WIDGETS" if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then - echo "JavaScriptCore JIT ..... To be decided by JavaScriptCore" + echo " JavaScriptCore JIT ..... To be decided by JavaScriptCore" else - echo "JavaScriptCore JIT ..... $CFG_JAVASCRIPTCORE_JIT" + echo " JavaScriptCore JIT ..... $CFG_JAVASCRIPTCORE_JIT" fi -echo "QML debugging .......... $CFG_QML_DEBUG" -echo "PCH support ............ $CFG_PRECOMPILE" -if [ "$CFG_ARCH" = "i386" -o "$CFG_ARCH" = "x86_64" ]; then - echo "SSE2/SSE3/SSSE3......... ${CFG_SSE2}/${CFG_SSE3}/${CFG_SSSE3}" - echo "SSE4.1/SSE4.2........... ${CFG_SSSE3}/${CFG_SSE4_1}/${CFG_SSE4_2}" - echo "AVX/AVX2................ ${CFG_AVX}/${CFG_AVX2}" -elif [ "$CFG_ARCH" = "arm" ]; then - echo "iWMMXt support ......... ${CFG_IWMMXT}" - echo "NEON support ........... ${CFG_NEON}" -fi -if [ "$CFG_ARCH" = "mips" ]; then - echo "MIPS_DSP/MIPS_DSPR2..... ${CFG_MIPS_DSP}/${CFG_MIPS_DSPR2}" -fi -echo "IPv6 ifname support .... $CFG_IPV6IFNAME" -echo "getaddrinfo support .... $CFG_GETADDRINFO" -echo "getifaddrs support ..... $CFG_GETIFADDRS" -echo "Accessibility .......... $CFG_ACCESSIBILITY" -echo "NIS support ............ $CFG_NIS" -echo "CUPS support ........... $CFG_CUPS" -echo "Iconv support .......... $CFG_ICONV" -echo "Glib support ........... $CFG_GLIB" -echo "GStreamer support ...... $CFG_GSTREAMER" -echo "PulseAudio support ..... $CFG_PULSEAUDIO" -echo "Large File support ..... $CFG_LARGEFILE" -echo "GIF support ............ $CFG_GIF" +echo " QML debugging .......... $CFG_QML_DEBUG" +echo " Use system proxies ..... $CFG_SYSTEM_PROXIES" + +# Other things +# Please keep sorted and properly grouped! The output is quite long, so it's +# hard to find something you're searching for if it's not sorted. +echo +echo "Support enabled for:" +echo " Accessibility .......... $CFG_ACCESSIBILITY" +echo " ALSA ................... $CFG_ALSA" +echo " CUPS ................... $CFG_CUPS" +[ "$XPLATFORM_MINGW" = "yes" ] && \ + echo " DirectWrite ............ $CFG_DIRECTWRITE" +echo " FontConfig ............. $CFG_FONTCONFIG" +echo " Iconv .................. $CFG_ICONV" +echo " ICU .................... $CFG_ICU" +echo " Image formats:" +echo " GIF .................. $CFG_GIF" if [ "$CFG_JPEG" = "no" ]; then - echo "JPEG support ........... $CFG_JPEG" + echo " JPEG ................. $CFG_JPEG" else - echo "JPEG support ........... $CFG_JPEG ($CFG_LIBJPEG)" + echo " JPEG ................. $CFG_JPEG ($CFG_LIBJPEG)" fi if [ "$CFG_PNG" = "no" ]; then - echo "PNG support ............ $CFG_PNG" + echo " PNG .................. $CFG_PNG" else - echo "PNG support ............ $CFG_PNG ($CFG_LIBPNG)" -fi -echo "zlib support ........... $CFG_ZLIB" -echo "Session management ..... $CFG_SM" -echo "libudev support ........ $CFG_LIBUDEV" - -if [ "$XPLATFORM_QNX" = "yes" ]; then - echo "SLOG2 support .......... $CFG_SLOG2" + echo " PNG .................. $CFG_PNG ($CFG_LIBPNG)" +fi +echo " Glib ................... $CFG_GLIB" +echo " GStreamer .............. $CFG_GSTREAMER" +echo " GTK theme .............. $CFG_QGTKSTYLE" +echo " Large Files ............ $CFG_LARGEFILE" +echo " Networking:" +[ "$BUILD_ON_MAC" = "yes" ] && \ + echo " CoreWlan ............. $CFG_COREWLAN" +echo " getaddrinfo .......... $CFG_GETADDRINFO" +echo " getifaddrs ........... $CFG_GETIFADDRS" +echo " IPv6 ifname .......... $CFG_IPV6IFNAME" +OPENSSL_LINKAGE="" +if [ "$CFG_OPENSSL" = "yes" ]; then + OPENSSL_LINKAGE="(loading libraries at run-time)" +elif [ "$CFG_OPENSSL" = "linked" ]; then + OPENSSL_LINKAGE="(linked to the libraries)" fi -echo "Use system proxies ..... $CFG_SYSTEM_PROXIES" - +echo " OpenSSL .............. $CFG_OPENSSL $OPENSSL_LINKAGE" +unset OPENSSL_LINKAGE +echo " NIS .................... $CFG_NIS" if [ "$CFG_OPENGL" = "desktop" ]; then - echo "OpenGL support ......... yes (Desktop OpenGL)" + echo " OpenGL ................. yes (Desktop OpenGL)" elif [ "$CFG_OPENGL" = "es2" ]; then - echo "OpenGL support ......... yes (OpenGL ES 2.x)" + echo " OpenGL ................. yes (OpenGL ES 2.x)" else - echo "OpenGL support ......... no" + echo " OpenGL ................. no" fi - if [ "$CFG_OPENVG" ]; then if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then - echo "OpenVG support ......... ShivaVG" + echo " OpenVG ................. ShivaVG" else - echo "OpenVG support ......... $CFG_OPENVG" - fi -fi - -echo "XShape support ......... $CFG_XSHAPE" -echo "XVideo support ......... $CFG_XVIDEO" -echo "XSync support .......... $CFG_XSYNC" -echo "Xinerama support ....... $CFG_XINERAMA" -echo "Xcursor support ........ $CFG_XCURSOR" -echo "Xfixes support ......... $CFG_XFIXES" -echo "Xrandr support ......... $CFG_XRANDR" -echo "Xi support ............. $CFG_XINPUT" -echo "Xi2 support ............ $CFG_XINPUT2" -echo "MIT-SHM support ........ $CFG_MITSHM" -echo "FontConfig support ..... $CFG_FONTCONFIG" -echo "XKB support ............ $CFG_XKB" -echo "GTK theme support ...... $CFG_QGTKSTYLE" - -if [ "$XPLATFORM_MINGW" = "yes" ] ; then - echo "DirectWrite support .... $CFG_DIRECTWRITE" -fi - -[ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support .......... $CFG_SQL_mysql" -[ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support ..... $CFG_SQL_psql" -[ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........... $CFG_SQL_odbc" -[ "$CFG_SQL_oci" != "no" ] && echo "OCI support ............ $CFG_SQL_oci" -[ "$CFG_SQL_tds" != "no" ] && echo "TDS support ............ $CFG_SQL_tds" -[ "$CFG_SQL_db2" != "no" ] && echo "DB2 support ............ $CFG_SQL_db2" -[ "$CFG_SQL_ibase" != "no" ] && echo "InterBase support ...... $CFG_SQL_ibase" -[ "$CFG_SQL_sqlite2" != "no" ] && echo "SQLite 2 support ....... $CFG_SQL_sqlite2" -[ "$CFG_SQL_sqlite" != "no" ] && echo "SQLite support ......... $CFG_SQL_sqlite ($CFG_SQLITE)" - -OPENSSL_LINKAGE="" -if [ "$CFG_OPENSSL" = "yes" ]; then - OPENSSL_LINKAGE="(run-time)" -elif [ "$CFG_OPENSSL" = "linked" ]; then - OPENSSL_LINKAGE="(linked)" + echo " OpenVG ................. $CFG_OPENVG" + fi fi -echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE" -echo "Alsa support ........... $CFG_ALSA" -if [ "$BUILD_ON_MAC" = "yes" ]; then - echo "CoreWlan support ....... $CFG_COREWLAN" -fi -echo "libICU support ......... $CFG_ICU" -echo "PCRE support ........... $CFG_PCRE" -echo "Xcb support ............ $CFG_XCB" -echo "Xrender support ........ $CFG_XRENDER" -if [ "$XPLATFORM_MAEMO" = "yes" ] && [ "$CFG_XCB" != "no" ]; then - echo "XInput2 support ........ $CFG_XINPUT2" -fi -echo "EGLFS support .......... $CFG_EGLFS" -echo "DirectFB support ....... $CFG_DIRECTFB" -echo "LinuxFB support ........ $CFG_LINUXFB" -echo "KMS support ............ $CFG_KMS" +if [ "$CFG_PCRE" = "no" ]; then + echo " PCRE ................... no" +else + pcre_sys=system + [ "$CFG_PCRE" = "qt" ] && pcre_sys=qt + echo " PCRE ................... yes ($pcre_sys)" + unset pcre_sys +fi +if [ -n "$PKG_CONFIG" ]; then + echo " pkg-config ............. yes" +else + echo " pkg-config ............. no" +fi +echo " PulseAudio ............. $CFG_PULSEAUDIO" +echo " QPA backends:" +echo " DirectFB ............. $CFG_DIRECTFB" +echo " EGLFS ................ $CFG_EGLFS" +echo " KMS .................. $CFG_KMS" +echo " LinuxFB .............. $CFG_LINUXFB" +echo " XCB .................. $CFG_XCB" +if [ "$CFG_XCB" != "no" ]; then + echo " MIT-SHM ............ $CFG_MITSHM" + echo " Xcursor ............ $CFG_XCURSOR" + echo " Xfixes ............. $CFG_XFIXES" + echo " Xi ................. $CFG_XINPUT" + echo " Xi2 ................ $CFG_XINPUT2" + echo " Xinerama ........... $CFG_XINERAMA" + echo " Xrandr ............. $CFG_XRANDR" + echo " Xrender ............ $CFG_XRENDER" + echo " XKB ................ $CFG_XKB" + echo " XShape ............. $CFG_XSHAPE" + echo " XSync .............. $CFG_XSYNC" + echo " XVideo ............. $CFG_XVIDEO" +fi +echo " Session management ..... $CFG_SM" +[ "$XPLATFORM_QNX" = "yes" ] && \ + echo " SLOG2 .................. $CFG_SLOG2" +echo " SQL drivers:" +echo " DB2 .................. $CFG_SQL_db2" +echo " InterBase ............ $CFG_SQL_ibase" +echo " MySQL ................ $CFG_SQL_mysql" +echo " OCI .................. $CFG_SQL_oci" +echo " ODBC ................. $CFG_SQL_odbc" +echo " PostgreSQL ........... $CFG_SQL_psql" +echo " SQLite 2 ............. $CFG_SQL_sqlite2" +echo " SQLite ............... $CFG_SQL_sqlite ($CFG_SQLITE)" +echo " TDS .................. $CFG_SQL_tds" +echo " udev ................... $CFG_LIBUDEV" +if [ "$CFG_ZLIB" = "no" ]; then + echo " zlib ................... no" +else + zlib_sys=system + [ "$CFG_ZLIB" = "yes" ] && zlib_sys=qt + echo " zlib ................... yes ($zlib_sys)" + unset zlib_sys +fi + echo # complain about not being able to use dynamic plugins if we are using a static build -- cgit v1.2.3 From 0e9b0fc1d425d6b586e20a51942565dd2a187f87 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 5 Apr 2013 10:45:30 -0700 Subject: Move the reporting of xkbcommon's warning closer to the bottom The warning is more likely to be seen if it's closer to the end of the output. Also report whether we found xkbcommon in the main output. Note that xkbcommon is used by Wayland too, so it's not dependent on QPA or on the XCB backend. Change-Id: I143327eea4e17fa06bc7c24c677ae0bd00e65711 Reviewed-by: Oswald Buddenhagen --- configure | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 85bab30ce6..55a643a4b0 100755 --- a/configure +++ b/configure @@ -901,6 +901,7 @@ CFG_USE_GNUMAKE=no CFG_XINPUT2=auto CFG_XINPUT=runtime CFG_XKB=auto +CFG_XKBCOMMON=no CFG_XCB=auto CFG_XCB_GLX=no CFG_EGLFS=auto @@ -5261,14 +5262,12 @@ if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xkbcommon >= 0.2.0" 2>/dev/null QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`" QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`" QT_CONFIG="$QT_CONFIG xkbcommon" + CFG_XKBCOMMON=yes elif [ "$CFG_XCB" != "no" ]; then - echo "WARNING: XCB support enabled but libxkbcommon 0.2.0 (or higher) not found." - echo "Not satisfying this requirement will disable the compose key functionality," - echo "which includes text input with dead keys." QMakeVar add DEFINES QT_NO_XKBCOMMON fi -if [ -n "$QMAKE_CFLAGS_XKBCOMMON" ] || [ -n "$QMAKE_LIBS_XKBCOMMON" ]; then +if [ "$CFG_XKBCOMMON" != "no" ]; then QMakeVar set QMAKE_CFLAGS_XKBCOMMON "$QMAKE_CFLAGS_XKBCOMMON" QMakeVar set QMAKE_LIBS_XKBCOMMON "$QMAKE_LIBS_XKBCOMMON" fi @@ -6745,6 +6744,7 @@ echo " SQLite 2 ............. $CFG_SQL_sqlite2" echo " SQLite ............... $CFG_SQL_sqlite ($CFG_SQLITE)" echo " TDS .................. $CFG_SQL_tds" echo " udev ................... $CFG_LIBUDEV" +echo " xkbcommon .............. $CFG_XKBCOMMON" if [ "$CFG_ZLIB" = "no" ]; then echo " zlib ................... no" else @@ -6772,6 +6772,11 @@ if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then echo " OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked" echo fi +if [ "$CFG_XCB" != no ] && [ "$CFG_XKBCOMMON" = "no" ]; then + echo "WARNING: XCB support enabled but libxkbcommon 0.2.0 (or higher) not found." + echo "Not satisfying this requirement will disable the compose key functionality," + echo "which includes text input with dead keys." +fi exec 1>&3 3>&- # restore stdout cat $outpath/config.summary # display config feedback to user -- cgit v1.2.3 From 59f1152ec7d154d6df1a178654747d13ecc434ec Mon Sep 17 00:00:00 2001 From: Bjoern Breitmeyer Date: Fri, 12 Apr 2013 15:20:54 +0200 Subject: added QMAKE_EXTENSION_STATICLIB to wince mkspec Qmake requires the information which extension is used for static libs on a platform. As the ci for windows ce is pretty new, this was not noticed before. Change-Id: I45b0c9c59980cd352371c00aa59502e5a394e337 Reviewed-by: Oswald Buddenhagen Reviewed-by: Janne Anttila Reviewed-by: Andreas Holzammer --- mkspecs/common/wince/qmake.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkspecs/common/wince/qmake.conf b/mkspecs/common/wince/qmake.conf index b006992702..5e6e6f0421 100644 --- a/mkspecs/common/wince/qmake.conf +++ b/mkspecs/common/wince/qmake.conf @@ -62,6 +62,7 @@ QMAKE_LFLAGS_LTCG = /LTCG QMAKE_LIBS_NETWORK = ws2.lib QMAKE_LIBS_OPENGL = QMAKE_LIBS_COMPAT = +QMAKE_EXTENSION_STATICLIB = lib QMAKE_LIBS_EGL = libEGL.lib QMAKE_LIBS_OPENGL_ES1 = libGLES_CM.lib -- cgit v1.2.3 From aa009e3dcc7ab47b27ec7e56a2b19fb835b04ee1 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 20 Mar 2013 10:16:24 +0200 Subject: Fix QFSFileEngine::renameOverwrite for Windows Embedded Compact 7. Windows Embedded Compact 7 does not have MoveFileEx, simulate it with the available file I/O functions [1]. For more details please check the comments in source code. [1] http://msdn.microsoft.com/en-us/library/ee490588.aspx Change-Id: Ib0fb0ba84e2d070dee2f633af1b81bec132f4c17 Reviewed-by: Oswald Buddenhagen Reviewed-by: Andreas Holzammer Reviewed-by: Johannes Oikarinen --- src/corelib/io/qfsfileengine_win.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 41526d1eac..fca1a446ce 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -520,9 +520,35 @@ bool QFSFileEngine::rename(const QString &newName) bool QFSFileEngine::renameOverwrite(const QString &newName) { Q_D(QFSFileEngine); +#if defined(Q_OS_WINCE) + // Windows Embedded Compact 7 does not have MoveFileEx, simulate it with the following sequence: + // 1. DeleteAndRenameFile (Should work on RAM FS when both files exist) + // 2. DeleteFile/MoveFile (Should work on all file systems) + // + // DeleteFile/MoveFile fallback implementation violates atomicity, but it is more acceptable than + // alternative CopyFile/DeleteFile sequence for the following reasons: + // + // 1. DeleteFile/MoveFile is way faster than CopyFile/DeleteFile and thus more atomic. + // 2. Given the intended use case of this function in QSaveFile, DeleteFile/MoveFile sequence will + // delete the old content, but leave a file "filename.ext.XXXXXX" in the same directory if MoveFile fails. + // With CopyFile/DeleteFile sequence, it can happen that new data is partially copied to target file + // (because CopyFile is not atomic either), thus leaving *some* content to target file. + // This makes the need for application level recovery harder to detect than in DeleteFile/MoveFile + // sequence where target file simply does not exist. + // + bool ret = ::DeleteAndRenameFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(), + (wchar_t*)d->fileEntry.nativeFilePath().utf16()) != 0; + if (!ret) { + ret = ::DeleteFile((wchar_t*)d->fileEntry.nativeFilePath().utf16()) != 0; + if (ret) + ret = ::MoveFile((wchar_t*)d->fileEntry.nativeFilePath().utf16(), + (wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0; + } +#else bool ret = ::MoveFileEx((wchar_t*)d->fileEntry.nativeFilePath().utf16(), (wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(), MOVEFILE_REPLACE_EXISTING) != 0; +#endif if (!ret) setError(QFile::RenameError, QSystemError(::GetLastError(), QSystemError::NativeError).toString()); return ret; -- cgit v1.2.3 From 8e127d9df868952d41c8aa622b6d4ead8139a835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 12 Apr 2013 16:08:41 +0200 Subject: Add default value for qHash's 'seed' argument for QOpenGLVersionProfile/Status Although template inline uint qHash(const T &t, uint seed) from qhash.h is never instantiated because we have the two-argument version of qHash() for both QOpenGLVersionProfile and QOpenGLVersionStatus, we need the default argument, as the template in qhash.h uses noexcept, which is evaluated regardless of instantiation, and uses qHash(t) without a seed. This behavior seems to not be the case with Apple clang 4.2, but has been observed with Apple clang 4.1, Clang 3.2, and GCC 4.8. Change-Id: If70e93f64eb9675a7c3ef7897ced2c6aebbec2d6 Reviewed-by: Eike Ziller Reviewed-by: Olivier Goffart --- src/gui/kernel/qopenglcontext.h | 2 +- src/gui/opengl/qopenglversionfunctions.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index 419fd541eb..bfdb8921af 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -101,7 +101,7 @@ private: QOpenGLVersionProfilePrivate* d; }; -inline uint qHash(const QOpenGLVersionProfile &v, uint seed) +inline uint qHash(const QOpenGLVersionProfile &v, uint seed = 0) { return qHash(static_cast(v.profile() * 1000) + v.version().first * 100 + v.version().second * 10, seed); diff --git a/src/gui/opengl/qopenglversionfunctions.h b/src/gui/opengl/qopenglversionfunctions.h index 833c5adf9f..304b944de8 100644 --- a/src/gui/opengl/qopenglversionfunctions.h +++ b/src/gui/opengl/qopenglversionfunctions.h @@ -91,7 +91,7 @@ struct QOpenGLVersionStatus OpenGLStatus status; }; -inline uint qHash(const QOpenGLVersionStatus &v, uint seed) +inline uint qHash(const QOpenGLVersionStatus &v, uint seed = 0) { return qHash(static_cast(v.status * 1000) + v.version.first * 100 + v.version.second * 10, seed); -- cgit v1.2.3 From 201bd2e59ac2ed19deb75809dbf41460dffad758 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 15 Apr 2013 21:22:33 +0300 Subject: QFontConfigDatabase: Fix performance regression ..introduced by 244cc5da55b92bf08f32da01d7557decbd9ba66c Symbol fonts usually don't have code ranges support except Latin. Don't load FT face for font that doesn't look like a symbol font. Change-Id: Iec46aa84e27227e0bda5d50f96a2b2f75f58e950 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../fontdatabases/fontconfig/qfontconfigdatabase.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 8d6f415fba..9c28c9fa63 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -491,8 +491,22 @@ void QFontconfigDatabase::populateFontDatabase() fontFile->fileName = QLatin1String((const char *)file_value); fontFile->indexValue = indexValue; - if (isSymbolFont(fontFile)) - writingSystems.setSupported(QFontDatabase::Other); + if (!writingSystems.supported(QFontDatabase::Symbol)) { + // Symbol encoding used to encode various crap in the 32..255 character + // code range, which belongs to Latin character code range. + // Symbol fonts usually don't have any other code ranges support. + bool mightBeSymbolFont = true; + for (int j = 2; j < QFontDatabase::WritingSystemsCount; ++j) { + if (writingSystems.supported(QFontDatabase::WritingSystem(j))) { + mightBeSymbolFont = false; + break; + } + } + if (mightBeSymbolFont && isSymbolFont(fontFile)) { + writingSystems.setSupported(QFontDatabase::Latin, false); + writingSystems.setSupported(QFontDatabase::Symbol); + } + } QFont::Style style = (slant_value == FC_SLANT_ITALIC) ? QFont::StyleItalic -- cgit v1.2.3 From 6300caf01fd79df48c516dd3882028a26b5fe4b4 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 16 Apr 2013 06:12:30 -0700 Subject: QGtkStyle: Remove widget dependency from GroupBox This patch makes it possible to draw a checkable groupbox without passing a widget pointer. Task-number: QTBUG-29867 Change-Id: I9b74bcffa0401c88f9dcbcd9816081b7f03a5173 Reviewed-by: J-P Nurmi --- src/widgets/styles/qgtkstyle.cpp | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp index 15fa00d8a6..2697afb077 100644 --- a/src/widgets/styles/qgtkstyle.cpp +++ b/src/widgets/styles/qgtkstyle.cpp @@ -3629,7 +3629,7 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple #ifndef QT_NO_GROUPBOX case CC_GroupBox: - if (qstyleoption_cast(option)) { + if (const QStyleOptionGroupBox * groupBox = qstyleoption_cast(option)) { rect = option->rect.adjusted(0, groupBoxTopMargin, 0, -groupBoxBottomMargin); int topMargin = 0; int topHeight = 0; @@ -3645,27 +3645,29 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple return frameRect.adjusted(leftMarginExtension + margin, margin + topHeight + groupBoxTitleMargin, -margin, -margin); } - if (const QGroupBox *groupBoxWidget = qobject_cast(widget)) { + QFontMetrics fontMetrics = option->fontMetrics; + if (qobject_cast(widget)) { //Prepare metrics for a bold font QFont font = widget->font(); font.setBold(true); - QFontMetrics fontMetrics(font); - QSize textRect = fontMetrics.boundingRect(groupBoxWidget->title()).size() + QSize(4, 4); - int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget); - int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget); - - if (subControl == SC_GroupBoxCheckBox) { - rect.setWidth(indicatorWidth); - rect.setHeight(indicatorHeight); - rect.moveTop((textRect.height() - indicatorHeight) / 2); - - } else if (subControl == SC_GroupBoxLabel) { - if (groupBoxWidget->isCheckable()) - rect.adjust(indicatorWidth + 4, 0, 0, 0); - rect.setSize(textRect); - } - rect = visualRect(option->direction, option->rect, rect); + fontMetrics = QFontMetrics(font); + } + + QSize textRect = fontMetrics.boundingRect(groupBox->text).size() + QSize(4, 4); + int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget); + int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget); + + if (subControl == SC_GroupBoxCheckBox) { + rect.setWidth(indicatorWidth); + rect.setHeight(indicatorHeight); + rect.moveTop((textRect.height() - indicatorHeight) / 2); + + } else if (subControl == SC_GroupBoxLabel) { + if (groupBox->subControls & SC_GroupBoxCheckBox) + rect.adjust(indicatorWidth + 4, 0, 0, 0); + rect.setSize(textRect); } + rect = visualRect(option->direction, option->rect, rect); } return rect; -- cgit v1.2.3 From ae6f9d00a65de227dfb908672aa01a406a1c5c43 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 3 Apr 2013 21:34:07 +0200 Subject: Accessibility Mac: Enable ignoring of children MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ignored children do not show up in the hierarchy, this should improve performance significantly. Previously the code would ignore the grouping property which seems to break QGroupBox. Change-Id: I4535af9c95bce76ded65f6d40fe07f17f3acffad Reviewed-by: Gabriel de Dietrich Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoaaccessibility.mm | 8 +++++--- src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index 34192e85b0..25780e79f4 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -180,7 +180,8 @@ bool shouldBeIgnored(QAccessibleInterface *interface) // state. Ignore interfaces with those flags set. const QAccessible::State state = interface->state(); if (state.invisible || - state.offscreen) + state.offscreen || + state.invalid) return true; // Some roles are not interesting. In particular, container roles should be @@ -189,12 +190,13 @@ bool shouldBeIgnored(QAccessibleInterface *interface) if (role == QAccessible::Border || // QFrame role == QAccessible::Application || // We use the system-provided application element. role == QAccessible::MenuItem || // The system also provides the menu items. - role == QAccessible::ToolBar) // Access the tool buttons directly. + role == QAccessible::ToolBar || // Access the tool buttons directly. + role == QAccessible::Pane || // Scroll areas. + role == QAccessible::Client) // The default for QWidget. return true; NSString *mac_role = macRole(interface); if (mac_role == NSAccessibilityWindowRole || // We use the system-provided window elements. - mac_role == NSAccessibilityGroupRole || mac_role == NSAccessibilityUnknownRole) return true; diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index 1d6797e51a..f7c945c50d 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -151,6 +151,7 @@ [kids addObject: element]; [element release]; } + // ### maybe we should use NSAccessibilityUnignoredChildren(kids); this needs more profiling return kids; } else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { @@ -256,7 +257,7 @@ // misc - (BOOL)accessibilityIsIgnored { - return false; //QCocoaAccessible::shouldBeIgnored(QAccessible::accessibleInterface(id)); + return QCocoaAccessible::shouldBeIgnored(QAccessible::accessibleInterface(axid)); } - (id)accessibilityHitTest:(NSPoint)point { -- cgit v1.2.3 From 0084272c5cab6e03999890956f238c2b62a3d818 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 15 Apr 2013 17:11:07 +0200 Subject: Don't use the CMake MinGW if cross-compiling. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way, the default generator is used when cross compiling for mingw. Change-Id: Ie536f1bca35ea38aec1232cdd95fc063c4f23e70 Reviewed-by: Oswald Buddenhagen Reviewed-by: Stephen Kelly Reviewed-by: Peter Kümmel --- mkspecs/features/ctest_testcase.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/ctest_testcase.prf b/mkspecs/features/ctest_testcase.prf index c88fc961cf..3045a21672 100644 --- a/mkspecs/features/ctest_testcase.prf +++ b/mkspecs/features/ctest_testcase.prf @@ -37,7 +37,7 @@ isEmpty(CMAKE_VERSION) { CMAKE_BUILD_TYPE = Debug CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release - win32-g++*:CMAKE_GENERATOR = -G \"MinGW Makefiles\" + win32-g++*:isEmpty(CROSS_COMPILE):CMAKE_GENERATOR = -G \"MinGW Makefiles\" win32:equals(QT_ARCH, x86_64) { win32-msvc2010:CMAKE_GENERATOR = -G \"Visual Studio 10 Win64\" win32-msvc2012:CMAKE_GENERATOR = -G \"Visual Studio 11 Win64\" -- cgit v1.2.3 From fb1649d30b0542a69a534218e96950d0533dec8b Mon Sep 17 00:00:00 2001 From: Bjoern Breitmeyer Date: Thu, 11 Apr 2013 17:09:40 +0200 Subject: Fixed CE build of sqlite3 The updated sqlite3 lacks a forward declaration of localtime. Depending on the CE version that forward declaration was sometimes available. Change-Id: Iec7de1167702ccec46b62f63b65a4710231c8534 Reviewed-by: Oswald Buddenhagen Reviewed-by: Friedemann Kleint --- src/3rdparty/sqlite/sqlite3.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c index 37ee4ad380..a22f57fbe1 100644 --- a/src/3rdparty/sqlite/sqlite3.c +++ b/src/3rdparty/sqlite/sqlite3.c @@ -14238,6 +14238,10 @@ static void clearYMD_HMS_TZ(DateTime *p){ #define HAVE_LOCALTIME_S 1 #endif +#if SQLITE_OS_WINCE >= 1 +struct tm *__cdecl localtime(const time_t *t); +#endif + #ifndef SQLITE_OMIT_LOCALTIME /* ** The following routine implements the rough equivalent of localtime_r() -- cgit v1.2.3 From b4ce49287f9f8407e89f1e4485cc166368306c77 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 11 Apr 2013 15:56:17 -0700 Subject: Make QBuffer::bytesAvailable() work We don't need to keep an internal QBuffer position, we can just use the one from QIODevice::pos(). It will keep track of goings ahead and backwards for us, plus it will make the default bytesAvailable() work out-of-the-box too. This error was reported on IRC. Change-Id: I8559e8ee56edaa01ca8732c1f1012082ebe3a3f2 Reviewed-by: Oswald Buddenhagen Reviewed-by: Robin Burchell --- src/corelib/io/qbuffer.cpp | 19 ++++--------------- tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp | 23 ++++++++++++++++++++++- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp index 5975e01e76..4b7edd8481 100644 --- a/src/corelib/io/qbuffer.cpp +++ b/src/corelib/io/qbuffer.cpp @@ -61,7 +61,6 @@ public: QByteArray *buf; QByteArray defaultBuf; - int ioIndex; virtual qint64 peek(char *data, qint64 maxSize); virtual QByteArray peek(qint64 maxSize); @@ -157,14 +156,12 @@ QBuffer::QBuffer() { Q_D(QBuffer); d->buf = &d->defaultBuf; - d->ioIndex = 0; } QBuffer::QBuffer(QByteArray *buf) : QIODevice(*new QBufferPrivate) { Q_D(QBuffer); d->buf = buf ? buf : &d->defaultBuf; - d->ioIndex = 0; d->defaultBuf.clear(); } #else @@ -180,7 +177,6 @@ QBuffer::QBuffer(QObject *parent) { Q_D(QBuffer); d->buf = &d->defaultBuf; - d->ioIndex = 0; } /*! @@ -206,7 +202,6 @@ QBuffer::QBuffer(QByteArray *byteArray, QObject *parent) Q_D(QBuffer); d->buf = byteArray ? byteArray : &d->defaultBuf; d->defaultBuf.clear(); - d->ioIndex = 0; } #endif @@ -253,7 +248,6 @@ void QBuffer::setBuffer(QByteArray *byteArray) d->buf = &d->defaultBuf; } d->defaultBuf.clear(); - d->ioIndex = 0; } /*! @@ -312,7 +306,6 @@ void QBuffer::setData(const QByteArray &data) return; } *d->buf = data; - d->ioIndex = 0; } /*! @@ -340,7 +333,6 @@ bool QBuffer::open(OpenMode flags) if ((flags & Truncate) == Truncate) d->buf->resize(0); - d->ioIndex = (flags & Append) == Append ? d->buf->size() : 0; return QIODevice::open(flags); } @@ -390,7 +382,6 @@ bool QBuffer::seek(qint64 pos) qWarning("QBuffer::seek: Invalid pos: %d", int(pos)); return false; } - d->ioIndex = int(pos); return QIODevice::seek(pos); } @@ -420,10 +411,9 @@ bool QBuffer::canReadLine() const qint64 QBuffer::readData(char *data, qint64 len) { Q_D(QBuffer); - if ((len = qMin(len, qint64(d->buf->size()) - d->ioIndex)) <= 0) + if ((len = qMin(len, qint64(d->buf->size()) - pos())) <= 0) return qint64(0); - memcpy(data, d->buf->constData() + d->ioIndex, len); - d->ioIndex += int(len); + memcpy(data, d->buf->constData() + pos(), len); return len; } @@ -433,7 +423,7 @@ qint64 QBuffer::readData(char *data, qint64 len) qint64 QBuffer::writeData(const char *data, qint64 len) { Q_D(QBuffer); - int extraBytes = d->ioIndex + len - d->buf->size(); + int extraBytes = pos() + len - d->buf->size(); if (extraBytes > 0) { // overflow int newSize = d->buf->size() + extraBytes; d->buf->resize(newSize); @@ -443,8 +433,7 @@ qint64 QBuffer::writeData(const char *data, qint64 len) } } - memcpy(d->buf->data() + d->ioIndex, (uchar *)data, int(len)); - d->ioIndex += int(len); + memcpy(d->buf->data() + pos(), (uchar *)data, int(len)); #ifndef QT_NO_QOBJECT d->writtenSinceLastEmit += len; diff --git a/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp b/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp index 4a43ea8201..3653fdb9e0 100644 --- a/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp +++ b/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp @@ -149,20 +149,25 @@ void tst_QBuffer::readBlock() const int arraySize = 10; char a[arraySize]; QBuffer b; + QCOMPARE(b.bytesAvailable(), (qint64) 0); // no data QCOMPARE(b.read(a, arraySize), (qint64) -1); // not opened QVERIFY(b.atEnd()); QByteArray ba; ba.resize(arraySize); b.setBuffer(&ba); + QCOMPARE(b.bytesAvailable(), (qint64) arraySize); b.open(QIODevice::WriteOnly); + QCOMPARE(b.bytesAvailable(), (qint64) arraySize); QTest::ignoreMessage(QtWarningMsg, "QIODevice::read: WriteOnly device"); QCOMPARE(b.read(a, arraySize), (qint64) -1); // no read access b.close(); b.open(QIODevice::ReadOnly); + QCOMPARE(b.bytesAvailable(), (qint64) arraySize); QCOMPARE(b.read(a, arraySize), (qint64) arraySize); QVERIFY(b.atEnd()); + QCOMPARE(b.bytesAvailable(), (qint64) 0); // up to 3.0.x reading beyond the end was an error while ok // this has been made consistent with other QIODevice sub classes in 3.1 @@ -172,10 +177,13 @@ void tst_QBuffer::readBlock() // read in two chunks b.close(); b.open(QIODevice::ReadOnly); + QCOMPARE(b.bytesAvailable(), (qint64) arraySize); QCOMPARE(b.read(a, arraySize/2), (qint64) arraySize/2); + QCOMPARE(b.bytesAvailable(), (qint64) arraySize/2); QCOMPARE(b.read(a + arraySize/2, arraySize - arraySize/2), (qint64)(arraySize - arraySize/2)); QVERIFY(b.atEnd()); + QCOMPARE(b.bytesAvailable(), (qint64) 0); } void tst_QBuffer::readBlockPastEnd() @@ -319,9 +327,12 @@ void tst_QBuffer::seekTest() buf.open(QIODevice::ReadWrite); QCOMPARE(buf.pos(), qint64(0)); + QCOMPARE(buf.bytesAvailable(), qint64(0)); QByteArray data = str.toLatin1(); QCOMPARE(buf.write( data.constData(), data.size() ), qint64(data.size())); + QCOMPARE(buf.bytesAvailable(), qint64(0)); // we're at the end + QCOMPARE(buf.size(), qint64(data.size())); QTest::ignoreMessage(QtWarningMsg, "QBuffer::seek: Invalid pos: -1"); DO_INVALID_SEEK(-1); @@ -336,6 +347,7 @@ void tst_QBuffer::seekTest() { char c = 'a'; QVERIFY(buf.seek(qint64(str.size()))); + QCOMPARE(buf.bytesAvailable(), qint64(0)); QCOMPARE(buf.read(&c, qint64(1)), qint64(0)); QCOMPARE(c, 'a'); QCOMPARE(buf.write(&c, qint64(1)), qint64(1)); @@ -347,6 +359,7 @@ void tst_QBuffer::seekTest() const int offset = 1; // any positive integer will do const qint64 pos = buf.size() + offset; QVERIFY(buf.seek(pos)); + QCOMPARE(buf.bytesAvailable(), qint64(0)); QCOMPARE(buf.pos(), pos); QVERIFY(!buf.getChar(&c)); QVERIFY(buf.seek(pos - 1)); @@ -533,7 +546,11 @@ void tst_QBuffer::readLineBoundaries() lineByLine.append(buffer.readLine()); buffer.seek(0); - QCOMPARE(lineByLine, buffer.readAll()); + QCOMPARE(buffer.bytesAvailable(), lineByLine.size()); + + QByteArray all = buffer.readAll(); + QCOMPARE(all.size(), lineByLine.size()); + QCOMPARE(all, lineByLine); } // Test that any character in a buffer can be read and pushed back. @@ -548,7 +565,9 @@ void tst_QBuffer::getAndUngetChar() // Take a copy of the data held in the buffer buffer.seek(0); + QCOMPARE(buffer.bytesAvailable(), buffer.size()); QByteArray data = buffer.readAll(); + QCOMPARE(buffer.bytesAvailable(), qint64(0)); // Get and unget each character in order for (qint64 i = 0; i < buffer.size(); ++i) { @@ -570,7 +589,9 @@ void tst_QBuffer::getAndUngetChar() // Verify that the state of the buffer still matches the original data. buffer.seek(0); + QCOMPARE(buffer.bytesAvailable(), data.size()); QCOMPARE(buffer.readAll(), data); + QCOMPARE(buffer.bytesAvailable(), qint64(0)); } void tst_QBuffer::writeAfterQByteArrayResize() -- cgit v1.2.3 From 0d1ab4e66797c57d31c8b56319219f4248a7c029 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Tue, 16 Apr 2013 10:08:06 +0200 Subject: [QNX] Fix build/runtime if QT_NO_OPENGL defined Change-Id: I38d511ac0a53b65abfe47baaa6333629df5b578d Reviewed-by: Kevin Krammer Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index f1bebee9b2..a351ec865a 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -172,6 +172,7 @@ void QQnxWindow::setGeometry(const QRect &rect) { const QRect oldGeometry = setGeometryHelper(rect); +#if !defined(QT_NO_OPENGL) // If this is an OpenGL window we need to request that the GL context updates // the EGLsurface on which it is rendering. The surface will be recreated the // next time QQnxGLContext::makeCurrent() is called. @@ -184,6 +185,7 @@ void QQnxWindow::setGeometry(const QRect &rect) if (m_platformOpenGLContext != 0 && bufferSize() != rect.size()) m_platformOpenGLContext->requestSurfaceChange(); } +#endif // Send a geometry change event to Qt (triggers resizeEvent() in QWindow/QWidget). @@ -353,13 +355,12 @@ void QQnxWindow::setBufferSize(const QSize &size) // Create window buffers if they do not exist if (m_bufferSize.isEmpty()) { + val[0] = m_screen->nativeFormat(); #if !defined(QT_NO_OPENGL) // Get pixel format from EGL config if using OpenGL; // otherwise inherit pixel format of window's screen if (m_platformOpenGLContext != 0) { val[0] = platformWindowFormatToNativeFormat(m_platformOpenGLContext->format()); - } else { - val[0] = m_screen->nativeFormat(); } #endif -- cgit v1.2.3 From 2ddbba9ba9709090de7ffbd00d0127cb3cca0869 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 11 Apr 2013 15:57:18 -0700 Subject: Make QBuffer unbuffered Sounds non-sense but it means that QIODevice will not try to copy from QBuffer's buffer onto its own. Eventually we should figure out to make QBuffer use the QIODevice::buffer member that is already there and avoid all of this mistake. Something for the future. Change-Id: Ib700c9cadb46cec20a8ea5a69a488ded7104ac76 Reviewed-by: Oswald Buddenhagen Reviewed-by: Robin Burchell --- src/corelib/io/qbuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp index 4b7edd8481..5748c5437a 100644 --- a/src/corelib/io/qbuffer.cpp +++ b/src/corelib/io/qbuffer.cpp @@ -334,7 +334,7 @@ bool QBuffer::open(OpenMode flags) if ((flags & Truncate) == Truncate) d->buf->resize(0); - return QIODevice::open(flags); + return QIODevice::open(flags | QIODevice::Unbuffered); } /*! -- cgit v1.2.3 From f5ea183cc6a6cd66fb3f804041fc112687e0a060 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 16 Apr 2013 17:51:33 +0200 Subject: Prevent recursions when triggering menus in QToolButton With a global shortcut set it would be possible to let the button re-open the menu again and again, each time spinning an event loop. Task-number: QTBUG-30399 Change-Id: If7eddc115c77fef3df3e751fd72e7414cedaf272 Reviewed-by: Gabriel de Dietrich --- src/widgets/widgets/qtoolbutton.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 88690f8bff..f08689cb9b 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -680,6 +680,10 @@ void QToolButton::showMenu() d->menuButtonDown = false; return; // no menu to show } + // prevent recursions spinning another event loop + if (d->menuButtonDown) + return; + d->menuButtonDown = true; repaint(); -- cgit v1.2.3 From 21f6ab28602dfc57cee46484dbb203cef5dd8723 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 15 Apr 2013 14:26:21 +0200 Subject: Cocoa: Make sure no invisible proxy icon button is created MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the icon is null, don't force creation. Task-number: QTBUG-30064 Change-Id: If639714f667fedfcc67a3393a7d75111a7dbff3f Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoawindow.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 161e2225a4..c5babae19e 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -471,6 +471,8 @@ void QCocoaWindow::setWindowIcon(const QIcon &icon) NSButton *iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton]; if (iconButton == nil) { + if (icon.isNull()) + return; NSString *title = QCFString::toNSString(window()->title()); [m_nsWindow setRepresentedURL:[NSURL fileURLWithPath:title]]; iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton]; -- cgit v1.2.3 From 2dbb73b54b0efe50f252e086b63d77e04fd8a2b2 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 16 Apr 2013 13:46:03 +0200 Subject: Cocoa: Fix menu popup, again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This time, popUpContextMenu:withEvent:forView: wouldn't respect the menu's minimum width setting. Change-Id: I7731851f2cf45d596d45a24dab5abe7b9239f07f Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoamenu.mm | 66 ++++++++++++++++++------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 5bd3a31427..732851ecf7 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -307,6 +307,8 @@ void QCocoaMenu::setVisible(bool visible) void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item) { + QCocoaAutoReleasePool pool; + QCocoaWindow *cocoaWindow = parentWindow ? static_cast(parentWindow->handle()) : 0; NSView *view = cocoaWindow ? cocoaWindow->contentView() : nil; NSMenuItem *nsItem = item ? ((QCocoaMenuItem *)item)->nsItem() : nil; @@ -315,36 +317,44 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf // However, this showed not to work with modal windows where the menu items // would appear disabled. So, we resort to a more artisanal solution. Note // that this implies several things. - // - // First, we need to transform 'pos' to window or screen coordinates. - NSPoint nsPos = NSMakePoint(pos.x() - 1, pos.y()); - if (view) { - nsPos.y = view.frame.size.height - nsPos.y; - } else if (!QGuiApplication::screens().isEmpty()) { - QScreen *screen = QGuiApplication::screens().at(0); - nsPos.y = screen->availableVirtualSize().height() - nsPos.y; - } if (nsItem) { - // Then, we need to position the menu ourselves to have the specified item - // at the specified position. This also means that we have to guess the menu - // item's height. (We could use HITheme to get it, but it looks like an overkill - // at this point). - CGFloat itemHeight = m_nativeMenu.font.pointSize == 13 ? 18.0 : 19.0; - nsPos.y += [m_nativeMenu indexOfItem:nsItem] * itemHeight; + // If we want to position the menu popup so that a specific item lies under + // the mouse cursor, we resort to NSPopUpButtonCell to do that. This is the + // typical use-case for a choice list, or non-editable combobox. We can't + // re-use the popUpContextMenu:withEvent:forView: logic below since it won't + // respect the menu's minimum width. + NSPopUpButtonCell *popupCell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]; + [popupCell setAltersStateOfSelectedItem:NO]; + [popupCell setTransparent:YES]; + [popupCell setMenu:m_nativeMenu]; + [popupCell selectItem:nsItem]; + NSRect cellFrame = NSMakeRect(pos.x(), pos.y(), m_nativeMenu.minimumWidth, 10); + [popupCell performClickWithFrame:cellFrame inView:view]; + } else { + // Else, we need to transform 'pos' to window or screen coordinates. + NSPoint nsPos = NSMakePoint(pos.x() - 1, pos.y()); + if (view) { + nsPos.y = view.frame.size.height - nsPos.y; + } else if (!QGuiApplication::screens().isEmpty()) { + QScreen *screen = QGuiApplication::screens().at(0); + nsPos.y = screen->availableVirtualSize().height() - nsPos.y; + } + + // Finally, we need to synthesize an event. + NSEvent *menuEvent = [NSEvent mouseEventWithType:NSRightMouseDown + location:nsPos + modifierFlags:0 + timestamp:0 + windowNumber:view ? view.window.windowNumber : 0 + context:nil + eventNumber:0 + clickCount:1 + pressure:1.0]; + NSSize size = m_nativeMenu.size; + [NSMenu popUpContextMenu:m_nativeMenu withEvent:menuEvent forView:view]; } - // Last, we need to synthesize an event. - NSEvent *menuEvent = [NSEvent mouseEventWithType:NSRightMouseDown - location:nsPos - modifierFlags:0 - timestamp:0 - windowNumber:view ? view.window.windowNumber : 0 - context:nil - eventNumber:0 - clickCount:1 - pressure:1.0]; - [NSMenu popUpContextMenu:m_nativeMenu withEvent:menuEvent forView:view]; - - // The call above blocks, and also swallows any mouse release event, + + // The calls above block, and also swallow any mouse release event, // so we need to clear any mouse button that triggered the menu popup. if ([view isKindOfClass:[QNSView class]]) [(QNSView *)view resetMouseButtons]; -- cgit v1.2.3 From d42e54c8626ee0d42d4df40e8f2a83df0698190a Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Sat, 13 Apr 2013 17:38:03 +0100 Subject: Fix typo in qWarning() Change-Id: I17aa0a1985c2da889bc602fd76dc07c890ed6f6b Reviewed-by: David Faure (KDE) --- src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index 8fa812eecb..1113194136 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -291,7 +291,7 @@ quint32 TableGenerator::stringToKeysym(QString keysymName) const char *name = keysymArray.constData(); if ((keysym = xkb_keysym_from_name(name, (xkb_keysym_flags)0)) == XKB_KEY_NoSymbol) - qWarning() << QString("Qt Warrning - invalid keysym: %1").arg(keysymName); + qWarning() << QString("Qt Warning - invalid keysym: %1").arg(keysymName); return keysym; } -- cgit v1.2.3 From 3ae271523ff7fb951df16cfccfaf84c0aa298e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 8 Apr 2013 14:12:43 +0200 Subject: Move Fusion styles palette into QtGui So that it can be used as the standard palette for QtGui applications instead of the absolutely useless black palette. Change-Id: Ie001439fcd8840a66275009c9f42cbf8bab4864a Reviewed-by: Shawn Rutledge --- src/gui/kernel/kernel.pri | 1 + src/gui/kernel/qguiapplication.cpp | 3 +- src/gui/kernel/qpalette.cpp | 34 ++++ src/gui/kernel/qplatformtheme.cpp | 36 +++- src/gui/kernel/qplatformtheme.h | 10 + src/gui/kernel/qplatformtheme_p.h | 74 +++++++ .../themes/genericunix/qgenericunixthemes.cpp | 219 +++++++++++++-------- .../themes/genericunix/qgenericunixthemes_p.h | 35 ++-- src/widgets/styles/qfusionstyle.cpp | 42 +--- 9 files changed, 312 insertions(+), 142 deletions(-) create mode 100644 src/gui/kernel/qplatformtheme_p.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index eb87a8c31b..91374fe2dd 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -21,6 +21,7 @@ HEADERS += \ kernel/qplatformintegrationfactory_p.h \ kernel/qplatformintegrationplugin.h \ kernel/qplatformtheme.h\ + kernel/qplatformtheme_p.h \ kernel/qplatformthemefactory_p.h \ kernel/qplatformthemeplugin.h \ kernel/qplatformwindow.h \ diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 432929fec5..b05ba28e48 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -180,7 +180,7 @@ static void initPalette() if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette()) QGuiApplicationPrivate::app_pal = new QPalette(*themePalette); if (!QGuiApplicationPrivate::app_pal) - QGuiApplicationPrivate::app_pal = new QPalette(Qt::black); + QGuiApplicationPrivate::app_pal = new QPalette(Qt::gray); } static inline void clearPalette() @@ -1014,6 +1014,7 @@ void QGuiApplicationPrivate::init() // and QImage conversion functions qInitImageConversions(); + initPalette(); QFont::initialize(); #ifndef QT_NO_CURSOR diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index f15559981b..df3d4dfef0 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -1096,6 +1096,40 @@ void QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBru setBrush(cg, ToolTipText, toolTipText); } +Q_GUI_EXPORT QPalette qt_fusionPalette() +{ + QColor backGround(239, 235, 231); + QColor light = backGround.lighter(150); + QColor mid(backGround.darker(130)); + QColor midLight = mid.lighter(110); + QColor base = Qt::white; + QColor disabledBase(backGround); + QColor dark = backGround.darker(150); + QColor darkDisabled = QColor(209, 200, 191).darker(110); + QColor text = Qt::black; + QColor hightlightedText = Qt::white; + QColor disabledText = QColor(190, 190, 190); + QColor button = backGround; + QColor shadow = dark.darker(135); + QColor disabledShadow = shadow.lighter(150); + + QPalette fusionPalette(Qt::black,backGround,light,dark,mid,text,base); + fusionPalette.setBrush(QPalette::Midlight, midLight); + fusionPalette.setBrush(QPalette::Button, button); + fusionPalette.setBrush(QPalette::Shadow, shadow); + fusionPalette.setBrush(QPalette::HighlightedText, hightlightedText); + + fusionPalette.setBrush(QPalette::Disabled, QPalette::Text, disabledText); + fusionPalette.setBrush(QPalette::Disabled, QPalette::Base, disabledBase); + fusionPalette.setBrush(QPalette::Disabled, QPalette::Dark, darkDisabled); + fusionPalette.setBrush(QPalette::Disabled, QPalette::Shadow, disabledShadow); + + fusionPalette.setBrush(QPalette::Active, QPalette::Highlight, QColor(48, 140, 198)); + fusionPalette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(145, 141, 126)); + fusionPalette.setBrush(QPalette::Disabled, QPalette::Highlight, QColor(145, 141, 126)); + return fusionPalette; +} + #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QPalette &) { diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp index 9f5c789a6e..b8bc72cf73 100644 --- a/src/gui/kernel/qplatformtheme.cpp +++ b/src/gui/kernel/qplatformtheme.cpp @@ -41,6 +41,8 @@ #include "qplatformtheme.h" +#include "qplatformtheme_p.h" + #include #include #include @@ -137,6 +139,33 @@ QT_BEGIN_NAMESPACE \sa themeHint(), QStyle::pixelMetric() */ +QPlatformThemePrivate::QPlatformThemePrivate() + : systemPalette(0) +{ } + +QPlatformThemePrivate::~QPlatformThemePrivate() +{ + delete systemPalette; +} + +Q_GUI_EXPORT QPalette qt_fusionPalette(); + +void QPlatformThemePrivate::initializeSystemPalette() +{ + Q_ASSERT(!systemPalette); + systemPalette = new QPalette(qt_fusionPalette()); +} + +QPlatformTheme::QPlatformTheme() + : d_ptr(new QPlatformThemePrivate) +{ + +} + +QPlatformTheme::QPlatformTheme(QPlatformThemePrivate *priv) + : d_ptr(priv) +{ } + QPlatformTheme::~QPlatformTheme() { @@ -156,7 +185,12 @@ QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(DialogType typ const QPalette *QPlatformTheme::palette(Palette type) const { - Q_UNUSED(type) + Q_D(const QPlatformTheme); + if (type == QPlatformTheme::SystemPalette) { + if (!d->systemPalette) + const_cast(this)->d_ptr->initializeSystemPalette(); + return d->systemPalette; + } return 0; } diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h index 0e95321102..ee12792547 100644 --- a/src/gui/kernel/qplatformtheme.h +++ b/src/gui/kernel/qplatformtheme.h @@ -52,6 +52,7 @@ // #include +#include QT_BEGIN_NAMESPACE @@ -63,6 +64,7 @@ class QPlatformMenu; class QPlatformMenuBar; class QPlatformDialogHelper; class QPlatformSystemTrayIcon; +class QPlatformThemePrivate; class QVariant; class QPalette; class QFont; @@ -72,6 +74,7 @@ class QFileInfo; class Q_GUI_EXPORT QPlatformTheme { + Q_DECLARE_PRIVATE(QPlatformTheme) public: enum ThemeHint { CursorFlashTime, @@ -249,6 +252,7 @@ public: AnimateToolBoxUiEffect = 0x40 }; + explicit QPlatformTheme(); virtual ~QPlatformTheme(); virtual QPlatformMenuItem* createPlatformMenuItem() const; @@ -274,6 +278,12 @@ public: virtual QIconEngine *createIconEngine(const QString &iconName) const; static QVariant defaultThemeHint(ThemeHint hint); + +protected: + explicit QPlatformTheme(QPlatformThemePrivate *priv); + QScopedPointer d_ptr; +private: + Q_DISABLE_COPY(QPlatformTheme) }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformtheme_p.h b/src/gui/kernel/qplatformtheme_p.h new file mode 100644 index 0000000000..2b965819c6 --- /dev/null +++ b/src/gui/kernel/qplatformtheme_p.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and 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 Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMTHEME_P_H +#define QPLATFORMTHEME_P_H + +// +// W A R N I N G +// ------------- +// +// This file is part of the QPA API and is not meant to be used +// in applications. Usage of this API may make your code +// source and binary incompatible with future versions of Qt. +// + +#include + +QT_BEGIN_NAMESPACE + +class QPalette; + +class Q_GUI_EXPORT QPlatformThemePrivate +{ +public: + QPlatformThemePrivate(); + + virtual ~QPlatformThemePrivate(); + + void initializeSystemPalette(); + + QPalette *systemPalette; +}; + +QT_END_NAMESPACE + +#endif // QPLATFORMTHEME_P_H diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index 6ea68397b6..4fc542c39a 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -42,6 +42,8 @@ #include "qgenericunixthemes_p.h" #include "../../services/genericunix/qgenericunixservices_p.h" +#include "qpa/qplatformtheme_p.h" + #include #include #include @@ -87,15 +89,27 @@ const char *QGenericUnixTheme::name = "generic"; static const char defaultSystemFontNameC[] = "Sans Serif"; enum { defaultSystemFontSize = 9 }; +class QGenericUnixThemePrivate : public QPlatformThemePrivate +{ +public: + QGenericUnixThemePrivate() + : QPlatformThemePrivate() + , systemFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize) + { } + + const QFont systemFont; +}; + QGenericUnixTheme::QGenericUnixTheme() - : m_systemFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize) + : QPlatformTheme(new QGenericUnixThemePrivate()) { } const QFont *QGenericUnixTheme::font(Font type) const { + Q_D(const QGenericUnixTheme); if (type == QPlatformTheme::SystemFont) - return &m_systemFont; + return &d->systemFont; return 0; } @@ -142,6 +156,93 @@ QVariant QGenericUnixTheme::themeHint(ThemeHint hint) const } #ifndef QT_NO_SETTINGS +class QKdeThemePrivate : public QPlatformThemePrivate +{ +public: + QKdeThemePrivate(const QString &kdeHome, int kdeVersion) + : kdeHome(kdeHome) + , kdeVersion(kdeVersion) + , toolButtonStyle(Qt::ToolButtonTextBesideIcon) + , toolBarIconSize(0) + { } + + QString globalSettingsFile() const + { + return kdeHome + QStringLiteral("/share/config/kdeglobals"); + } + + void refresh(); + static void readKdeSystemPalette(const QSettings &kdeSettings, QPalette *pal); + static QFont *readKdeFontSetting(const QSettings &settings, const QString &key); + static QStringList kdeIconThemeSearchPaths(const QString &kdeHome); + + + const QString kdeHome; + const int kdeVersion; + + ResourceHelper resources; + QString iconThemeName; + QString iconFallbackThemeName; + QStringList styleNames; + int toolButtonStyle; + int toolBarIconSize; +}; + +void QKdeThemePrivate::refresh() +{ + resources.clear(); + + toolButtonStyle = Qt::ToolButtonTextBesideIcon; + toolBarIconSize = 0; + styleNames.clear(); + styleNames << QStringLiteral("Oxygen") << QStringLiteral("fusion") << QStringLiteral("windows"); + iconFallbackThemeName = iconThemeName = QStringLiteral("oxygen"); + + // Read settings file. + const QString settingsFile = globalSettingsFile(); + if (!QFileInfo(settingsFile).isReadable()) + return; + + const QSettings kdeSettings(settingsFile, QSettings::IniFormat); + + QPalette systemPalette = QPalette(); + readKdeSystemPalette(kdeSettings, &systemPalette); + resources.palettes[QPlatformTheme::SystemPalette] = new QPalette(systemPalette); + //## TODO tooltip color + + const QVariant styleValue = kdeSettings.value(QStringLiteral("widgetStyle")); + if (styleValue.isValid()) { + const QString style = styleValue.toString(); + if (style != styleNames.front()) + styleNames.push_front(style); + } + + const QVariant themeValue = kdeSettings.value(QStringLiteral("Icons/Theme")); + if (themeValue.isValid()) + iconThemeName = themeValue.toString(); + + const QVariant toolBarIconSizeValue = kdeSettings.value(QStringLiteral("ToolbarIcons/Size")); + if (toolBarIconSizeValue.isValid()) + toolBarIconSize = toolBarIconSizeValue.toInt(); + + const QVariant toolbarStyleValue = kdeSettings.value(QStringLiteral("ToolButtonStyle")); + if (toolbarStyleValue.isValid()) { + const QString toolBarStyle = toolbarStyleValue.toString(); + if (toolBarStyle == QStringLiteral("TextBesideIcon")) + toolButtonStyle = Qt::ToolButtonTextBesideIcon; + else if (toolBarStyle == QStringLiteral("TextOnly")) + toolButtonStyle = Qt::ToolButtonTextOnly; + else if (toolBarStyle == QStringLiteral("TextUnderIcon")) + toolButtonStyle = Qt::ToolButtonTextUnderIcon; + } + + // Read system font, ignore 'fixed' 'smallestReadableFont' + if (QFont *systemFont = readKdeFontSetting(kdeSettings, QStringLiteral("font"))) { + resources.fonts[QPlatformTheme::SystemFont] = systemFont; + } else { + resources.fonts[QPlatformTheme::SystemFont] = new QFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize); + } +} // Reads the color from the KDE configuration, and store it in the // palette with the given color role if found. @@ -158,7 +259,7 @@ static inline bool kdeColor(QPalette *pal, QPalette::ColorRole role, return true; } -static inline void readKdeSystemPalette(const QSettings &kdeSettings, QPalette *pal) +void QKdeThemePrivate::readKdeSystemPalette(const QSettings &kdeSettings, QPalette *pal) { kdeColor(pal, QPalette::Button, kdeSettings, QStringLiteral("Colors:Button/BackgroundNormal")); kdeColor(pal, QPalette::Window, kdeSettings, QStringLiteral("Colors:Window/BackgroundNormal")); @@ -183,14 +284,13 @@ static inline void readKdeSystemPalette(const QSettings &kdeSettings, QPalette * const char *QKdeTheme::name = "kde"; -QKdeTheme::QKdeTheme(const QString &kdeHome, int kdeVersion) : - m_kdeHome(kdeHome), m_kdeVersion(kdeVersion), - m_toolButtonStyle(Qt::ToolButtonTextBesideIcon), m_toolBarIconSize(0) +QKdeTheme::QKdeTheme(const QString &kdeHome, int kdeVersion) + : QPlatformTheme(new QKdeThemePrivate(kdeHome,kdeVersion)) { - refresh(); + d_func()->refresh(); } -static inline QFont *readKdeFontSetting(const QSettings &settings, const QString &key) +QFont *QKdeThemePrivate::readKdeFontSetting(const QSettings &settings, const QString &key) { const QVariant fontValue = settings.value(key); if (fontValue.isValid()) { @@ -218,68 +318,8 @@ static inline QFont *readKdeFontSetting(const QSettings &settings, const QString return 0; } -void QKdeTheme::refresh() -{ - m_resources.clear(); - - m_toolButtonStyle = Qt::ToolButtonTextBesideIcon; - m_toolBarIconSize = 0; - m_styleNames.clear(); - m_styleNames << QStringLiteral("Oxygen") << QStringLiteral("fusion") << QStringLiteral("windows"); - m_iconFallbackThemeName = m_iconThemeName = QStringLiteral("oxygen"); - - // Read settings file. - const QString settingsFile = globalSettingsFile(); - if (!QFileInfo(settingsFile).isReadable()) - return; - - const QSettings kdeSettings(settingsFile, QSettings::IniFormat); - - QPalette systemPalette = QPalette(); - readKdeSystemPalette(kdeSettings, &systemPalette); - m_resources.palettes[SystemPalette] = new QPalette(systemPalette); - //## TODO tooltip color - - const QVariant styleValue = kdeSettings.value(QStringLiteral("widgetStyle")); - if (styleValue.isValid()) { - const QString style = styleValue.toString(); - if (style != m_styleNames.front()) - m_styleNames.push_front(style); - } - - const QVariant themeValue = kdeSettings.value(QStringLiteral("Icons/Theme")); - if (themeValue.isValid()) - m_iconThemeName = themeValue.toString(); - - const QVariant toolBarIconSizeValue = kdeSettings.value(QStringLiteral("ToolbarIcons/Size")); - if (toolBarIconSizeValue.isValid()) - m_toolBarIconSize = toolBarIconSizeValue.toInt(); - - const QVariant toolbarStyleValue = kdeSettings.value(QStringLiteral("ToolButtonStyle")); - if (toolbarStyleValue.isValid()) { - const QString toolBarStyle = toolbarStyleValue.toString(); - if (toolBarStyle == QStringLiteral("TextBesideIcon")) - m_toolButtonStyle = Qt::ToolButtonTextBesideIcon; - else if (toolBarStyle == QStringLiteral("TextOnly")) - m_toolButtonStyle = Qt::ToolButtonTextOnly; - else if (toolBarStyle == QStringLiteral("TextUnderIcon")) - m_toolButtonStyle = Qt::ToolButtonTextUnderIcon; - } - - // Read system font, ignore 'fixed' 'smallestReadableFont' - if (QFont *systemFont = readKdeFontSetting(kdeSettings, QStringLiteral("font"))) { - m_resources.fonts[SystemFont] = systemFont; - } else { - m_resources.fonts[SystemFont] = new QFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize); - } -} - -QString QKdeTheme::globalSettingsFile() const -{ - return m_kdeHome + QStringLiteral("/share/config/kdeglobals"); -} -static QStringList kdeIconThemeSearchPaths(const QString &kdeHome) +QStringList QKdeThemePrivate::kdeIconThemeSearchPaths(const QString &kdeHome) { QStringList candidates = QStringList(kdeHome); const QString kdeDirs = QFile::decodeName(qgetenv("KDEDIRS")); @@ -298,6 +338,7 @@ static QStringList kdeIconThemeSearchPaths(const QString &kdeHome) QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const { + Q_D(const QKdeTheme); switch (hint) { case QPlatformTheme::UseFullScreenForPopupMenu: return QVariant(true); @@ -306,17 +347,17 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const case QPlatformTheme::DialogButtonBoxLayout: return QVariant(2); // QDialogButtonBox::KdeLayout case QPlatformTheme::ToolButtonStyle: - return QVariant(m_toolButtonStyle); + return QVariant(d->toolButtonStyle); case QPlatformTheme::ToolBarIconSize: - return QVariant(m_toolBarIconSize); + return QVariant(d->toolBarIconSize); case QPlatformTheme::SystemIconThemeName: - return QVariant(m_iconThemeName); + return QVariant(d->iconThemeName); case QPlatformTheme::SystemIconFallbackThemeName: - return QVariant(m_iconFallbackThemeName); + return QVariant(d->iconFallbackThemeName); case QPlatformTheme::IconThemeSearchPaths: - return QVariant(kdeIconThemeSearchPaths(m_kdeHome)); + return QVariant(d->kdeIconThemeSearchPaths(d->kdeHome)); case QPlatformTheme::StyleNames: - return QVariant(m_styleNames); + return QVariant(d->styleNames); case QPlatformTheme::KeyboardScheme: return QVariant(int(KdeKeyboardScheme)); default: @@ -325,6 +366,18 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const return QPlatformTheme::themeHint(hint); } +const QPalette *QKdeTheme::palette(Palette type) const +{ + Q_D(const QKdeTheme); + return d->resources.palettes[type]; +} + +const QFont *QKdeTheme::font(Font type) const +{ + Q_D(const QKdeTheme); + return d->resources.fonts[type]; +} + QPlatformTheme *QKdeTheme::createKdeTheme() { // Check for version >= 4 and determine home folder from environment, @@ -361,8 +414,18 @@ QPlatformTheme *QKdeTheme::createKdeTheme() const char *QGnomeTheme::name = "gnome"; +class QGnomeThemePrivate : public QPlatformThemePrivate +{ +public: + QGnomeThemePrivate() + : systemFont(QLatin1Literal(defaultSystemFontNameC), defaultSystemFontSize) + {} + + const QFont systemFont; +}; + QGnomeTheme::QGnomeTheme() - : m_systemFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize) + : QPlatformTheme(new QGnomeThemePrivate()) { } @@ -393,8 +456,10 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const const QFont *QGnomeTheme::font(Font type) const { + Q_D(const QGnomeTheme); if (type == QPlatformTheme::SystemFont) - return &m_systemFont; + return &d->systemFont; + return 0; } diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h index b0ac13efe4..03445776f4 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h @@ -61,8 +61,11 @@ public: QFont *fonts[QPlatformTheme::NFonts]; }; +class QGenericUnixThemePrivate; + class QGenericUnixTheme : public QPlatformTheme { + Q_DECLARE_PRIVATE(QGenericUnixTheme) public: QGenericUnixTheme(); @@ -75,55 +78,39 @@ public: static QStringList xdgIconThemePaths(); static const char *name; - -private: - const QFont m_systemFont; }; #ifndef QT_NO_SETTINGS +class QKdeThemePrivate; + class QKdeTheme : public QPlatformTheme { + Q_DECLARE_PRIVATE(QKdeTheme) QKdeTheme(const QString &kdeHome, int kdeVersion); public: static QPlatformTheme *createKdeTheme(); virtual QVariant themeHint(ThemeHint hint) const; - virtual const QPalette *palette(Palette type = SystemPalette) const - { return m_resources.palettes[type]; } + virtual const QPalette *palette(Palette type = SystemPalette) const; - virtual const QFont *font(Font type) const - { return m_resources.fonts[type]; } + virtual const QFont *font(Font type) const; static const char *name; - -private: - QString globalSettingsFile() const; - void refresh(); - - const QString m_kdeHome; - const int m_kdeVersion; - - ResourceHelper m_resources; - QString m_iconThemeName; - QString m_iconFallbackThemeName; - QStringList m_styleNames; - int m_toolButtonStyle; - int m_toolBarIconSize; }; #endif // QT_NO_SETTINGS +class QGnomeThemePrivate; + class QGnomeTheme : public QPlatformTheme { + Q_DECLARE_PRIVATE(QGnomeTheme) public: QGnomeTheme(); virtual QVariant themeHint(ThemeHint hint) const; virtual const QFont *font(Font type) const; static const char *name; - -private: - const QFont m_systemFont; }; QPlatformTheme *qt_createUnixTheme(); diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index bfc22807a0..c4c964f451 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1896,50 +1896,14 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio } } +extern QPalette qt_fusionPalette(); + /*! \reimp */ QPalette QFusionStyle::standardPalette () const { - QPalette palette = QCommonStyle::standardPalette(); - palette.setBrush(QPalette::Active, QPalette::Highlight, QColor(48, 140, 198)); - palette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(145, 141, 126)); - palette.setBrush(QPalette::Disabled, QPalette::Highlight, QColor(145, 141, 126)); - - QColor backGround(239, 235, 231); - - QColor light = backGround.lighter(150); - QColor base = Qt::white; - QColor dark = QColor(170, 156, 143).darker(110); - dark = backGround.darker(150); - QColor darkDisabled = QColor(209, 200, 191).darker(110); - - //### Find the correct disabled text color - palette.setBrush(QPalette::Disabled, QPalette::Text, QColor(190, 190, 190)); - - palette.setBrush(QPalette::Window, backGround); - palette.setBrush(QPalette::Mid, backGround.darker(130)); - palette.setBrush(QPalette::Light, light); - - palette.setBrush(QPalette::Active, QPalette::Base, base); - palette.setBrush(QPalette::Inactive, QPalette::Base, base); - palette.setBrush(QPalette::Disabled, QPalette::Base, backGround); - - palette.setBrush(QPalette::Midlight, palette.mid().color().lighter(110)); - - palette.setBrush(QPalette::All, QPalette::Dark, dark); - palette.setBrush(QPalette::Disabled, QPalette::Dark, darkDisabled); - - QColor button = backGround; - - palette.setBrush(QPalette::Button, button); - - QColor shadow = dark.darker(135); - palette.setBrush(QPalette::Shadow, shadow); - palette.setBrush(QPalette::Disabled, QPalette::Shadow, shadow.lighter(150)); - palette.setBrush(QPalette::HighlightedText, QColor(QRgb(0xffffffff))); - - return palette; + return qt_fusionPalette(); } /*! -- cgit v1.2.3 From c77f7229d5c7e5017ddf90b1e9445251761878bf Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 16 Apr 2013 15:03:31 +0200 Subject: qdoc: Add index of obsolete members to obsolete page qdoc has been modified to emit a compact list of the classes that have one or more obsolete members. The command is: \generatelist obsoletecppmembers This generates an index of all such classes, where each class name is a link to the class's subpage of obsolete members. A class's subpage of obsolete members is also accessible from the class's reference page, but now it is also accessible from this index. Also, The command shown has been added to the page obsoleteclasses.html in the generated output. This page already contains the index of obsolete classes. Currently, no such output is generated for QML types and QML types with obsolete members. But qdoc does accept commands for those: \generatelist obsoleteqmltypes and \generatelist obsoleteqmlmembers ...but qdoc doesn't know what to do with those commands yet. Task-number: QTBUG-30270 Change-Id: If19a3b977f64c948e4bd6f14a9e0a287419baa8a Reviewed-by: Jerome Pasion --- src/tools/qdoc/codemarker.cpp | 33 ------------- src/tools/qdoc/codemarker.h | 4 -- src/tools/qdoc/codeparser.cpp | 2 +- src/tools/qdoc/ditaxmlgenerator.cpp | 37 ++++++++------ src/tools/qdoc/ditaxmlgenerator.h | 13 ++--- src/tools/qdoc/generator.cpp | 14 ++++-- src/tools/qdoc/generator.h | 7 ++- src/tools/qdoc/htmlgenerator.cpp | 58 +++++++++++++++------- src/tools/qdoc/htmlgenerator.h | 5 +- src/tools/qdoc/node.h | 15 +++++- src/tools/qdoc/qdocdatabase.cpp | 96 +++++++++++++++++++++++++++++++++++-- src/tools/qdoc/qdocdatabase.h | 7 +++ src/tools/qdoc/qdocindexfiles.cpp | 7 ++- src/tools/qdoc/qdocindexfiles.h | 1 + src/tools/qdoc/qmlvisitor.cpp | 2 +- 15 files changed, 209 insertions(+), 92 deletions(-) diff --git a/src/tools/qdoc/codemarker.cpp b/src/tools/qdoc/codemarker.cpp index 4e144d2f7d..e39ff203a5 100644 --- a/src/tools/qdoc/codemarker.cpp +++ b/src/tools/qdoc/codemarker.cpp @@ -455,39 +455,6 @@ void CodeMarker::insert(FastSection &fastSection, } } -void CodeMarker::insert(FastSection& fastSection, - Node* node, - SynopsisStyle style, - bool /* includeClassName */) -{ - if (node->status() == Node::Compat || node->status() == Node::Obsolete) - return; - - bool inheritedMember = false; - InnerNode* parent = node->parent(); - if (parent && (parent->type() == Node::Document) && - (parent->subType() == Node::QmlPropertyGroup)) { - parent = parent->parent(); - } - inheritedMember = (parent != fastSection.parent_); - - if (!inheritedMember || style == Subpage) { - QString key = sortName(node); - if (!fastSection.memberMap.contains(key)) - fastSection.memberMap.insert(key, node); - } - else { - if ((parent->type() == Node::Document) && (parent->subType() == Node::QmlClass)) { - if (fastSection.inherited.isEmpty() - || fastSection.inherited.last().first != parent) { - QPair p(parent, 0); - fastSection.inherited.append(p); - } - fastSection.inherited.last().second++; - } - } -} - /*! Returns true if \a node represents a reimplemented member function in the class of the FastSection \a fs. If it is diff --git a/src/tools/qdoc/codemarker.h b/src/tools/qdoc/codemarker.h index c31b43e875..02caedf9b8 100644 --- a/src/tools/qdoc/codemarker.h +++ b/src/tools/qdoc/codemarker.h @@ -178,10 +178,6 @@ protected: Node *node, SynopsisStyle style, Status status); - void insert(FastSection& fastSection, - Node* node, - SynopsisStyle style, - bool includeClassName = false); bool insertReimpFunc(FastSection& fs, Node* node, Status status); void append(QList
& sectionList, const FastSection& fastSection, bool includeKeys = false); diff --git a/src/tools/qdoc/codeparser.cpp b/src/tools/qdoc/codeparser.cpp index 65eeda604f..557a6f08fa 100644 --- a/src/tools/qdoc/codeparser.cpp +++ b/src/tools/qdoc/codeparser.cpp @@ -237,7 +237,7 @@ void CodeParser::processCommonMetaCommand(const Location& location, node->setStatus(Node::Compat); } else if (command == COMMAND_DEPRECATED) { - node->setStatus(Node::Deprecated); + node->setStatus(Node::Obsolete); } else if ((command == COMMAND_INGROUP) || (command == COMMAND_INPUBLICGROUP)) { // Note: \ingroup and \inpublicgroup are now the same. diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index 21bbdafaf5..a828101551 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -473,8 +473,6 @@ DitaXmlGenerator::DitaXmlGenerator() inTableBody(false), noLinks(false), obsoleteLinks(false), - offlineDocs(true), - codeIndent(0), divNestingLevel(0), sectionNestingLevel(0), tableColumnCount(0), @@ -573,8 +571,6 @@ void DitaXmlGenerator::initializeGenerator(const Config &config) customHeadElements = config.getStringList(DitaXmlGenerator::format() + Config::dot + DITAXMLGENERATOR_CUSTOMHEADELEMENTS); - // The following line was changed to fix QTBUG-27798 - //codeIndent = config.getInt(CONFIG_CODEINDENT); version = config.getString(CONFIG_VERSION); vrm = version.split(QLatin1Char('.')); } @@ -1024,10 +1020,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, generateAnnotatedList(relative, marker, qdb_->getCppClasses()); } else if (atom->string() == "classes") { - generateCompactList(relative, qdb_->getCppClasses(), true); + generateCompactList(Generic, relative, qdb_->getCppClasses(), true); } else if (atom->string() == "qmlclasses") { - generateCompactList(relative, qdb_->getQmlTypes(), true); + generateCompactList(Generic, relative, qdb_->getQmlTypes(), true); } else if (atom->string().contains("classesbymodule")) { QString arg = atom->string().trimmed(); @@ -1046,10 +1042,19 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, generateClassHierarchy(relative, qdb_->getCppClasses()); } else if (atom->string() == "compatclasses") { - generateCompactList(relative, qdb_->getCompatibilityClasses(), false); + generateCompactList(Generic, relative, qdb_->getCompatibilityClasses(), false); } else if (atom->string() == "obsoleteclasses") { - generateCompactList(relative, qdb_->getObsoleteClasses(), false); + generateCompactList(Generic, relative, qdb_->getObsoleteClasses(), false); + } + else if (atom->string() == "obsoleteqmltypes") { + generateCompactList(Generic, relative, qdb_->getObsoleteQmlTypes(), false); + } + else if (atom->string() == "obsoletecppmembers") { + generateCompactList(Obsolete, relative, qdb_->getClassesWithObsoleteMembers(), false); + } + else if (atom->string() == "obsoleteqmlmembers") { + generateCompactList(Obsolete, relative, qdb_->getQmlTypesWithObsoleteMembers(), false); } else if (atom->string() == "functionindex") { generateFunctionIndex(relative); @@ -1058,10 +1063,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, generateLegaleseList(relative, marker); } else if (atom->string() == "mainclasses") { - generateCompactList(relative, qdb_->getMainClasses(), true); + generateCompactList(Generic, relative, qdb_->getMainClasses(), true); } else if (atom->string() == "services") { - generateCompactList(relative, qdb_->getServiceClasses(), false); + generateCompactList(Generic, relative, qdb_->getServiceClasses(), false); } else if (atom->string() == "overviews") { generateOverviewList(relative); @@ -1176,9 +1181,9 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writeCharacters(protectEnc((*s).name)); writeEndTag(); //

if (idx == Class) - generateCompactList(0, ncmap, false, QString("Q")); + generateCompactList(Generic, 0, ncmap, false, QString("Q")); else if (idx == QmlClass) - generateCompactList(0, nqcmap, false, QString("Q")); + generateCompactList(Generic, 0, nqcmap, false, QString("Q")); else if (idx == MemberFunction) { ParentMaps parentmaps; ParentMaps::iterator pmap; @@ -2599,7 +2604,7 @@ void DitaXmlGenerator::generateTableOfContents(const Node* node, inLink_ = false; } -void DitaXmlGenerator::generateLowStatusMembers(const InnerNode* inner, +void DitaXmlGenerator::generateLowStatusMembers(InnerNode* inner, CodeMarker* marker, CodeMarker::Status status) { @@ -2620,6 +2625,9 @@ void DitaXmlGenerator::generateLowStatusMembers(const InnerNode* inner, if (sections.isEmpty()) return; + if (status == CodeMarker::Obsolete) + inner->setObsoleteLink(fileBase(inner) + "-obsolete." + fileExtension()); + QList
::ConstIterator s = sections.constBegin(); while (s != sections.constEnd()) { if ((*s).name == "Member Function Documentation") { @@ -2779,7 +2787,8 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, normally you let it figure it out itself by looking at the name of the first and last classes in \a classMap. */ -void DitaXmlGenerator::generateCompactList(const Node* relative, +void DitaXmlGenerator::generateCompactList(ListType , // currently not needed for DITA + const Node* relative, const NodeMap& classMap, bool includeAlphabet, QString commonPrefix) diff --git a/src/tools/qdoc/ditaxmlgenerator.h b/src/tools/qdoc/ditaxmlgenerator.h index c096829cae..15ef4260b2 100644 --- a/src/tools/qdoc/ditaxmlgenerator.h +++ b/src/tools/qdoc/ditaxmlgenerator.h @@ -46,7 +46,6 @@ #include #include #include "codemarker.h" -#include "config.h" #include "generator.h" QT_BEGIN_NAMESPACE @@ -374,16 +373,12 @@ private: Doc::Sections sectioningUnit, int numColumns, const Node* relative = 0); - void generateLowStatusMembers(const InnerNode* inner, - CodeMarker* marker, - CodeMarker::Status status); - QString generateLowStatusMemberFile(const InnerNode* inner, - CodeMarker* marker, - CodeMarker::Status status); + void generateLowStatusMembers(InnerNode* inner, CodeMarker* marker, CodeMarker::Status status); void generateClassHierarchy(const Node* relative, NodeMap& classMap); void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMap& nodeMap); void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeList& nodes); - void generateCompactList(const Node* relative, + void generateCompactList(ListType listType, + const Node* relative, const NodeMap& classMap, bool includeAlphabet, QString commonPrefix = QString()); @@ -484,9 +479,7 @@ private: bool noLinks; bool obsoleteLinks; - bool offlineDocs; - int codeIndent; int divNestingLevel; int sectionNestingLevel; int tableColumnCount; diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 47ebded1b1..dfa49e8563 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -68,6 +68,7 @@ QStringList Generator::imageDirs; QStringList Generator::imageFiles; QMap Generator::imgFileExts; QString Generator::outDir_; +QString Generator::outSubdir_; QSet Generator::outputFormats; QHash Generator::outputPrefixes; QString Generator::project; @@ -1474,10 +1475,13 @@ void Generator::initialize(const Config &config) outputFormats = config.getOutputFormats(); if (!outputFormats.isEmpty()) { outDir_ = config.getOutputDir(); - - if (outDir_.isEmpty()) + if (outDir_.isEmpty()) { config.lastLocation().fatal(tr("No output directory specified in " "configuration file or on the command line")); + } + else { + outSubdir_ = outDir_.mid(outDir_.lastIndexOf('/') + 1); + } QDir dirInfo; if (dirInfo.exists(outDir_)) { @@ -1622,8 +1626,12 @@ void Generator::augmentImageDirs(QSet& moreImageDirs) } } -void Generator::initializeGenerator(const Config & /* config */) +/*! + Sets the generator's pointer to the Config instance. + */ +void Generator::initializeGenerator(const Config& config) { + config_ = &config; } bool Generator::matchAhead(const Atom *atom, Atom::Type expectedAtomType) diff --git a/src/tools/qdoc/generator.h b/src/tools/qdoc/generator.h index e4bc85b2bc..28a9ae5ce8 100644 --- a/src/tools/qdoc/generator.h +++ b/src/tools/qdoc/generator.h @@ -50,7 +50,7 @@ #include #include #include - +#include "config.h" #include "node.h" #include "text.h" @@ -70,6 +70,7 @@ class Generator public: enum Passes { Both, Prepare, Generate }; + enum ListType { Generic, Obsolete }; Generator(); virtual ~Generator(); @@ -81,11 +82,13 @@ public: virtual void terminateGenerator(); QString fullDocumentLocation(const Node *node, bool subdir = false); + const Config* config() { return config_; } static Generator *currentGenerator() { return currentGenerator_; } static Generator *generatorForFormat(const QString& format); static void initialize(const Config& config); static const QString& outputDir() { return outDir_; } + static const QString& outputSubdir() { return outSubdir_; } static void terminate(); static void writeOutFileNames(); static void augmentImageDirs(QSet& moreImageDirs); @@ -192,6 +195,7 @@ private: static QMap imgFileExts; static QString project; static QString outDir_; + static QString outSubdir_; static QSet outputFormats; static QHash outputPrefixes; static QStringList scriptDirs; @@ -221,6 +225,7 @@ private: QRegExp tag; protected: + const Config* config_; QDocDatabase* qdb_; bool inLink_; bool inContents_; diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 7d7f9e811a..e49f083e5b 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -470,10 +470,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark generateAnnotatedList(relative, marker, qdb_->getCppClasses()); } else if (atom->string() == "classes") { - generateCompactList(relative, qdb_->getCppClasses(), true); + generateCompactList(Generic, relative, qdb_->getCppClasses(), true); } else if (atom->string() == "qmlclasses") { - generateCompactList(relative, qdb_->getQmlTypes(), true); + generateCompactList(Generic, relative, qdb_->getQmlTypes(), true); } else if (atom->string().contains("classesbymodule")) { QString arg = atom->string().trimmed(); @@ -492,10 +492,19 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark generateClassHierarchy(relative, qdb_->getCppClasses()); } else if (atom->string() == "compatclasses") { - generateCompactList(relative, qdb_->getCompatibilityClasses(), false); + generateCompactList(Generic, relative, qdb_->getCompatibilityClasses(), false); } else if (atom->string() == "obsoleteclasses") { - generateCompactList(relative, qdb_->getObsoleteClasses(), false); + generateCompactList(Generic, relative, qdb_->getObsoleteClasses(), false); + } + else if (atom->string() == "obsoleteqmltypes") { + generateCompactList(Generic, relative, qdb_->getObsoleteQmlTypes(), false); + } + else if (atom->string() == "obsoletecppmembers") { + generateCompactList(Obsolete, relative, qdb_->getClassesWithObsoleteMembers(), false); + } + else if (atom->string() == "obsoleteqmlmembers") { + generateCompactList(Obsolete, relative, qdb_->getQmlTypesWithObsoleteMembers(), false); } else if (atom->string() == "functionindex") { generateFunctionIndex(relative); @@ -504,10 +513,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark generateLegaleseList(relative, marker); } else if (atom->string() == "mainclasses") { - generateCompactList(relative, qdb_->getMainClasses(), true); + generateCompactList(Generic, relative, qdb_->getMainClasses(), true); } else if (atom->string() == "services") { - generateCompactList(relative, qdb_->getServiceClasses(), false); + generateCompactList(Generic, relative, qdb_->getServiceClasses(), false); } else if (atom->string() == "overviews") { generateOverviewList(relative); @@ -640,9 +649,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark << "\">\n"; out() << "

" << protectEnc((*s).name) << "

\n"; if (idx == Class) - generateCompactList(0, ncmap, false, QString("Q")); + generateCompactList(Generic, 0, ncmap, false, QString("Q")); else if (idx == QmlClass) - generateCompactList(0, nqcmap, false, QString("Q")); + generateCompactList(Generic, 0, nqcmap, false, QString("Q")); else if (idx == MemberFunction) { ParentMaps parentmaps; ParentMaps::iterator pmap; @@ -1131,9 +1140,10 @@ void HtmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker) QString obsoleteLink = generateLowStatusMemberFile(inner, marker, CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) + if (!obsoleteLink.isEmpty()) { out() << "
  • " << "Obsolete members
  • \n"; + } QString compatLink = generateLowStatusMemberFile(inner, marker, @@ -1481,9 +1491,10 @@ void HtmlGenerator::generateDocNode(DocNode* dn, CodeMarker* marker) QString obsoleteLink = generateLowStatusMemberFile(dn, marker, CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) + if (!obsoleteLink.isEmpty()) { out() << "
  • " << "Obsolete members
  • \n"; + } QString compatLink = generateLowStatusMemberFile(dn, marker, @@ -2105,7 +2116,7 @@ QString HtmlGenerator::generateAllQmlMembersFile(const QmlClassNode* qml_cn, return fileName; } -QString HtmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, +QString HtmlGenerator::generateLowStatusMemberFile(InnerNode *inner, CodeMarker *marker, CodeMarker::Status status) { @@ -2133,6 +2144,10 @@ QString HtmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, title = "Obsolete Members for " + inner->name(); fileName = fileBase(inner) + "-obsolete." + fileExtension(); } + if (status == CodeMarker::Obsolete) { + QString link = QString("../" + Generator::outputSubdir() + QLatin1Char('/')) + fileName; + inner->setObsoleteLink(link); + } beginSubPage(inner, fileName); generateHeader(title, inner, marker); @@ -2292,7 +2307,8 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, normally you let it figure it out itself by looking at the name of the first and last classes in \a classMap. */ -void HtmlGenerator::generateCompactList(const Node *relative, +void HtmlGenerator::generateCompactList(ListType listType, + const Node *relative, const NodeMap &classMap, bool includeAlphabet, QString commonPrefix) @@ -2452,11 +2468,19 @@ void HtmlGenerator::generateCompactList(const Node *relative, for (int i=0; i"; + if (listType == Generic) { + /* + Previously, we used generateFullName() for this, but we + require some special formatting. + */ + out() << ""; + } + else if (listType == Obsolete) { + QString fileName = fileBase(it.value()) + "-obsolete." + fileExtension(); + QString link = QString("../" + it.value()->outputSubdirectory() + + QLatin1Char('/')) + fileName; + out() << ""; + } QStringList pieces; if (it.value()->subType() == Node::QmlClass) diff --git a/src/tools/qdoc/htmlgenerator.h b/src/tools/qdoc/htmlgenerator.h index f2efab78a1..cdf296e783 100644 --- a/src/tools/qdoc/htmlgenerator.h +++ b/src/tools/qdoc/htmlgenerator.h @@ -150,13 +150,14 @@ private: CodeMarker *marker); QString generateAllQmlMembersFile(const QmlClassNode* qml_cn, CodeMarker* marker); - QString generateLowStatusMemberFile(const InnerNode *inner, + QString generateLowStatusMemberFile(InnerNode *inner, CodeMarker *marker, CodeMarker::Status status); void generateClassHierarchy(const Node *relative, NodeMap &classMap); void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMap& nodeMap); void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeList& nodes); - void generateCompactList(const Node *relative, + void generateCompactList(ListType listType, + const Node *relative, const NodeMap &classMap, bool includeAlphabet, QString commonPrefix = QString()); diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index 642bcec06a..d1a95358f0 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -167,7 +167,11 @@ public: void setAccess(Access access) { access_ = access; } void setLocation(const Location& location) { loc = location; } void setDoc(const Doc& doc, bool replace = false); - void setStatus(Status status) { status_ = status; } + void setStatus(Status status) { + if (status_ == Obsolete && status == Deprecated) + return; + status_ = status; + } void setThreadSafeness(ThreadSafeness safeness) { safeness_ = safeness; } void setSince(const QString &since); void setRelates(InnerNode* pseudoParent); @@ -218,6 +222,8 @@ public: QString url() const; virtual QString nameForLists() const { return name_; } virtual QString outputFileName() const { return QString(); } + virtual QString obsoleteLink() const { return QString(); } + virtual void setObsoleteLink(const QString& ) { }; Access access() const { return access_; } QString accessString() const; @@ -253,6 +259,7 @@ public: QmlClassNode* qmlClassNode(); ClassNode* declarativeCppNode(); const QString& outputSubdirectory() const { return outSubDir_; } + void setOutputSubdirectory(const QString& t) { outSubDir_ = t; } QString fullDocumentName() const; static QString cleanId(QString str); QString idForNode() const; @@ -430,6 +437,8 @@ public: ClassNode(InnerNode* parent, const QString& name); virtual ~ClassNode() { } virtual bool isClass() const { return true; } + virtual QString obsoleteLink() const { return obsoleteLink_; } + virtual void setObsoleteLink(const QString& t) { obsoleteLink_ = t; }; void addBaseClass(Access access, ClassNode* node, @@ -455,6 +464,7 @@ private: QList ignoredBases; bool abstract_; QString sname; + QString obsoleteLink_; QmlClassNode* qmlelement; }; @@ -561,6 +571,8 @@ public: virtual void setAbstract(bool b) { abstract_ = b; } virtual bool isInternal() const { return (status() == Internal); } virtual QString qmlFullBaseName() const; + virtual QString obsoleteLink() const { return obsoleteLink_; } + virtual void setObsoleteLink(const QString& t) { obsoleteLink_ = t; }; const ImportList& importList() const { return importList_; } void setImportList(const ImportList& il) { importList_ = il; } const QString& qmlBaseName() const { return baseName_; } @@ -582,6 +594,7 @@ private: bool cnodeRequired_; ClassNode* cnode_; QString baseName_; + QString obsoleteLink_; QmlClassNode* baseNode_; ImportList importList_; }; diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index 30a9efaada..674917f6dc 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -430,6 +430,7 @@ void QDocDatabase::buildCollections() findAllLegaleseTexts(treeRoot()); findAllNamespaces(treeRoot()); findAllSince(treeRoot()); + findAllObsoleteThings(treeRoot()); } /*! @@ -451,9 +452,6 @@ void QDocDatabase::findAllClasses(const InnerNode* node) if ((*c)->status() == Node::Compat) { compatClasses_.insert(className, *c); } - else if ((*c)->status() == Node::Obsolete) { - obsoleteClasses_.insert(className, *c); - } else { nonCompatClasses_.insert(className, *c); if ((*c)->status() == Node::Main) @@ -547,6 +545,98 @@ void QDocDatabase::findAllNamespaces(const InnerNode* node) } } +/*! + Finds all nodes with status = Obsolete and sorts them into + maps. They can be C++ classes, QML types, or they can be + functions, enum types, typedefs, methods, etc. + */ +void QDocDatabase::findAllObsoleteThings(const InnerNode* node) +{ + NodeList::const_iterator c = node->childNodes().constBegin(); + while (c != node->childNodes().constEnd()) { + if ((*c)->access() != Node::Private) { + QString name = (*c)->name(); + if ((*c)->status() == Node::Obsolete) { + if ((*c)->type() == Node::Class) { + if ((*c)->parent() && (*c)->parent()->type() == Node::Namespace && + !(*c)->parent()->name().isEmpty()) + name = (*c)->parent()->name() + "::" + name; + obsoleteClasses_.insert(name, *c); + } + else if ((*c)->type() == Node::Document && (*c)->subType() == Node::QmlClass) { + if (name.startsWith(QLatin1String("QML:"))) + name = name.mid(4); + name = (*c)->qmlModuleIdentifier() + "::" + name; + obsoleteQmlTypes_.insert(name,*c); + } + } + else if ((*c)->type() == Node::Class) { + InnerNode* n = static_cast(*c); + bool inserted = false; + NodeList::const_iterator p = n->childNodes().constBegin(); + while (p != n->childNodes().constEnd()) { + if ((*p)->access() != Node::Private) { + switch ((*p)->type()) { + case Node::Enum: + case Node::Typedef: + case Node::Function: + case Node::Property: + case Node::Variable: + if ((*p)->status() == Node::Obsolete) { + if ((*c)->parent() && (*c)->parent()->type() == Node::Namespace && + !(*c)->parent()->name().isEmpty()) + name = (*c)->parent()->name() + "::" + name; + classesWithObsoleteMembers_.insert(name, *c); + inserted = true; + } + break; + default: + break; + } + } + if (inserted) + break; + ++p; + } + } + else if ((*c)->type() == Node::Document && (*c)->subType() == Node::QmlClass) { + InnerNode* n = static_cast(*c); + bool inserted = false; + NodeList::const_iterator p = n->childNodes().constBegin(); + while (p != n->childNodes().constEnd()) { + if ((*p)->access() != Node::Private) { + switch ((*c)->type()) { + case Node::QmlProperty: + case Node::QmlSignal: + case Node::QmlSignalHandler: + case Node::QmlMethod: + if ((*c)->parent()) { + Node* parent = (*c)->parent(); + if (parent->subType() == Node::QmlPropertyGroup && parent->parent()) + parent = parent->parent(); + if (parent && parent->subType() == Node::QmlClass && !parent->name().isEmpty()) + name = parent->name() + "::" + name; + } + qmlTypesWithObsoleteMembers_.insert(name,*c); + inserted = true; + break; + default: + break; + } + } + if (inserted) + break; + ++p; + } + } + else if ((*c)->isInnerNode()) { + findAllObsoleteThings(static_cast(*c)); + } + } + ++c; + } +} + /*! Finds all the nodes where a \e{since} command appeared in the qdoc comment and sorts them into maps according to the kind of diff --git a/src/tools/qdoc/qdocdatabase.h b/src/tools/qdoc/qdocdatabase.h index 19dde361f8..d97fb3809a 100644 --- a/src/tools/qdoc/qdocdatabase.h +++ b/src/tools/qdoc/qdocdatabase.h @@ -113,6 +113,7 @@ class QDocDatabase void findAllFunctions(const InnerNode *node); void findAllLegaleseTexts(const InnerNode *node); void findAllNamespaces(const InnerNode *node); + void findAllObsoleteThings(const InnerNode* node); void findAllSince(const InnerNode *node); void buildCollections(); @@ -121,6 +122,9 @@ class QDocDatabase NodeMap& getMainClasses() { return mainClasses_; } NodeMap& getCompatibilityClasses() { return compatClasses_; } NodeMap& getObsoleteClasses() { return obsoleteClasses_; } + NodeMap& getClassesWithObsoleteMembers() { return classesWithObsoleteMembers_; } + NodeMap& getObsoleteQmlTypes() { return obsoleteQmlTypes_; } + NodeMap& getQmlTypesWithObsoleteMembers() { return qmlTypesWithObsoleteMembers_; } NodeMap& getNamespaces() { return namespaceIndex_; } NodeMap& getServiceClasses() { return serviceClasses_; } NodeMap& getQmlTypes() { return qmlClasses_; } @@ -223,6 +227,9 @@ class QDocDatabase NodeMap mainClasses_; NodeMap compatClasses_; NodeMap obsoleteClasses_; + NodeMap classesWithObsoleteMembers_; + NodeMap obsoleteQmlTypes_; + NodeMap qmlTypesWithObsoleteMembers_; NodeMap namespaceIndex_; NodeMap serviceClasses_; NodeMap qmlClasses_; diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index d7a51da952..59adc63c9e 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -136,6 +136,7 @@ void QDocIndexFiles::readIndexFile(const QString& path) QDir installDir(path.section('/', 0, -3) + "/outputdir"); indexUrl = installDir.relativeFilePath(path).section('/', 0, -2); } + project_ = indexElement.attribute("project", QString()); basesList_.clear(); relatedList_.clear(); @@ -459,7 +460,7 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, else if (status == "obsolete") node->setStatus(Node::Obsolete); else if (status == "deprecated") - node->setStatus(Node::Deprecated); + node->setStatus(Node::Obsolete); else if (status == "preliminary") node->setStatus(Node::Preliminary); else if (status == "commendable") @@ -503,6 +504,7 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, Doc doc(location, location, " ", emptySet); // placeholder node->setDoc(doc); node->setIndexNodeFlag(); + node->setOutputSubdirectory(project_.toLower()); if (node->isInnerNode()) { InnerNode* inner = static_cast(node); @@ -712,7 +714,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, status = "obsolete"; break; case Node::Deprecated: - status = "deprecated"; + status = "obsolete"; break; case Node::Preliminary: status = "preliminary"; @@ -1203,6 +1205,7 @@ void QDocIndexFiles::generateIndex(const QString& fileName, writer.writeAttribute("url", url); writer.writeAttribute("title", title); writer.writeAttribute("version", qdb_->version()); + writer.writeAttribute("project", g->config()->getString(CONFIG_PROJECT)); generateIndexSections(writer, qdb_->treeRoot(), generateInternalNodes); diff --git a/src/tools/qdoc/qdocindexfiles.h b/src/tools/qdoc/qdocindexfiles.h index 2b1eb1951e..e4a83176a2 100644 --- a/src/tools/qdoc/qdocindexfiles.h +++ b/src/tools/qdoc/qdocindexfiles.h @@ -86,6 +86,7 @@ class QDocIndexFiles static QDocIndexFiles* qdocIndexFiles_; QDocDatabase* qdb_; Generator* gen_; + QString project_; QList > basesList_; QList > relatedList_; diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp index ffe1afe28b..ac659720b2 100644 --- a/src/tools/qdoc/qmlvisitor.cpp +++ b/src/tools/qdoc/qmlvisitor.cpp @@ -316,7 +316,7 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation, } } else if (command == COMMAND_DEPRECATED) { - node->setStatus(Node::Deprecated); + node->setStatus(Node::Obsolete); } else if (command == COMMAND_INQMLMODULE) { qdb->addToQmlModule(args[0].first,node); -- cgit v1.2.3 From 9557cc6536866a9809241ad3bf541e7b1ac84edf Mon Sep 17 00:00:00 2001 From: Cyril Oblikov Date: Wed, 10 Apr 2013 16:18:52 +0300 Subject: Correct dir entries caching in QFileDialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using QFileSystemWatcher to update cache when directory is changed. It is needed to correctly filter files created after the dialog opening. Task-number: QTBUG-30604 Change-Id: I5479f9a54095de59ca2ba36b2bd4906de0907ac8 Reviewed-by: Morten Johan Sørvig --- .../platforms/cocoa/qcocoafiledialoghelper.mm | 42 ++++++++++++++++------ 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 7093d27efe..071edb5b60 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -61,6 +61,8 @@ #include #include #include "qcocoaautoreleasepool.h" +#include +#include #include @@ -72,6 +74,30 @@ QT_FORWARD_DECLARE_CLASS(QFileInfo) QT_FORWARD_DECLARE_CLASS(QWindow) QT_USE_NAMESPACE +class CachedEntries: public QObject { +public: + CachedEntries(QDir::Filters filters) : mFilters(filters) { + QObject::connect(&mFSWatcher, &QFileSystemWatcher::directoryChanged, this, &CachedEntries::updateDirCache); + } + QString directory() const { + const QStringList &dirs = mFSWatcher.directories(); + return (dirs.count() ? dirs[0] : QString()); + } + QStringList entries() const { + return mQDirFilterEntryList; + } + void updateDirCache(const QString &path) { + mFSWatcher.removePaths(mFSWatcher.directories()); + mFSWatcher.addPath(path); + mQDirFilterEntryList = QDir(path).entryList(mFilters); + } + +private: + QFileSystemWatcher mFSWatcher; + QStringList mQDirFilterEntryList; + QDir::Filters mFilters; +}; + typedef QSharedPointer SharedPointerFileDialogOptions; @class QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate); @@ -91,9 +117,8 @@ typedef QSharedPointer SharedPointerFileDialogOptions; int mReturnCode; SharedPointerFileDialogOptions mOptions; - QString *mLastFilterCheckPath; + CachedEntries *mCachedEntries; QString *mCurrentSelection; - QStringList *mQDirFilterEntryList; QStringList *mNameFilterDropDownList; QStringList *mSelectedNameFilter; } @@ -137,8 +162,7 @@ typedef QSharedPointer SharedPointerFileDialogOptions; [mSavePanel setDelegate:self]; mReturnCode = -1; mHelper = helper; - mLastFilterCheckPath = new QString; - mQDirFilterEntryList = new QStringList; + mCachedEntries = new CachedEntries(mOptions->filter()); mNameFilterDropDownList = new QStringList(mOptions->nameFilters()); QString selectedVisualNameFilter = mOptions->initiallySelectedNameFilter(); mSelectedNameFilter = new QStringList([self findStrippedFilterWithVisualFilterName:selectedVisualNameFilter]); @@ -171,8 +195,7 @@ typedef QSharedPointer SharedPointerFileDialogOptions; - (void)dealloc { - delete mLastFilterCheckPath; - delete mQDirFilterEntryList; + delete mCachedEntries; delete mNameFilterDropDownList; delete mSelectedNameFilter; delete mCurrentSelection; @@ -303,12 +326,11 @@ static QString strippedText(QString s) QString qtFileName = QT_PREPEND_NAMESPACE(QCFString::toQString)(filename); QFileInfo info(qtFileName.normalized(QT_PREPEND_NAMESPACE(QString::NormalizationForm_C))); QString path = info.absolutePath(); - if (path != *mLastFilterCheckPath){ - *mLastFilterCheckPath = path; - *mQDirFilterEntryList = info.dir().entryList(mOptions->filter()); + if (mCachedEntries->directory() != path) { + mCachedEntries->updateDirCache(path); } // Check if the QDir filter accepts the file: - if (!mQDirFilterEntryList->contains(info.fileName())) + if (!mCachedEntries->entries().contains(info.fileName())) return NO; // No filter means accept everything -- cgit v1.2.3 From 5a05d0716ffe707d0e918916328aa1c7206259f9 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 17 Apr 2013 08:40:54 +0200 Subject: Emit animation driver signals after we change the state. Change-Id: I4d5d6efdcb519cd4bb53626ae9412a4f5f130689 Reviewed-by: Friedemann Kleint --- src/corelib/animation/qabstractanimation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index f650e58c5a..c58dfdbda1 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -827,8 +827,8 @@ void QAnimationDriver::start() { Q_D(QAnimationDriver); if (!d->running) { - emit started(); d->running = true; + emit started(); } } @@ -837,8 +837,8 @@ void QAnimationDriver::stop() { Q_D(QAnimationDriver); if (d->running) { - emit stopped(); d->running = false; + emit stopped(); } } -- cgit v1.2.3 From 428efd2ebe886871b614c5995420fe0967307a73 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 17 Apr 2013 11:06:42 +0300 Subject: Fix tst_qfile build for WEC7. Windows Embedded Compact does not have drive letters like desktop Windows => do not try to build drive letter related test code for WEC7. Change-Id: I2c3659220a001510c0555e2dd773b4dd68e9c2cc Reviewed-by: Andreas Holzammer Reviewed-by: Friedemann Kleint --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 929865d4d6..cca4655f58 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -1057,7 +1057,7 @@ void tst_QFile::ungetChar() QCOMPARE(buf[2], '4'); } -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) QString driveLetters() { wchar_t volumeName[MAX_PATH]; @@ -1094,7 +1094,9 @@ void tst_QFile::invalidFile_data() #if !defined(Q_OS_WIN) QTest::newRow( "x11" ) << QString( "qwe//" ); #else +#if !defined(Q_OS_WINCE) QTest::newRow( "colon2" ) << invalidDriveLetter() + QString::fromLatin1(":ail:invalid"); +#endif QTest::newRow( "colon3" ) << QString( ":failinvalid" ); QTest::newRow( "forwardslash" ) << QString( "fail/invalid" ); QTest::newRow( "asterisk" ) << QString( "fail*invalid" ); -- cgit v1.2.3 From 0775f88c6638411893749042bfe88e0ef789cf9c Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 17 Apr 2013 11:15:31 +0300 Subject: Reduce qmetatype autotest build time for Windows CE. qmetatype autotest build for WEC7 took several hours [1] See timestamps 03:51:13 and 07:44:52. The timestamped Jenkins log is only available in Digia network. The corresponding log without timestamps is available from [2]. Use same workaround for all Windows CE / WEC7 builds as currently used for desktop MSVC2012. [1]: http://qt-ci.digia.com/job/QtBase_stable_Integration/cfg=wince70embedded-armv4i-msvc2008_Windows_7/940/consoleFull [2]: http://testresults.qt-project.org/ci/QtBase_stable_Integration/build_00940/ Change-Id: Ia21be8972d82c8d37073c9097b8d4094261e4126 Reviewed-by: Andreas Holzammer Reviewed-by: Friedemann Kleint --- tests/auto/corelib/kernel/qmetatype/qmetatype.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro index 561b7ed9cc..5009fedc4f 100644 --- a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro +++ b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro @@ -5,11 +5,11 @@ SOURCES = tst_qmetatype.cpp TESTDATA=./typeFlags.bin DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -win32-msvc* { +win32-msvc*|wince { # Prevents "fatal error C1128: number of sections exceeded object file format limit". QMAKE_CXXFLAGS += /bigobj # Reduce compile time - win32-msvc2012 { + win32-msvc2012|wince { QMAKE_CXXFLAGS_RELEASE -= -O2 QMAKE_CFLAGS_RELEASE -= -O2 } -- cgit v1.2.3 From 2d73648c716f9375cdf5ae80771f5ead0d11eedf Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 17 Apr 2013 15:05:41 +0300 Subject: Fix tst_networkselftest build for WEC7. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WEC7 does not have time() function. Let's use Qt APIs to query time and initialize random number generator, Qt APIs have already been adapted to work on all supported platforms. In addition use QByteArray instead of QString to avoid unnecessary type conversions later on with toLatin1(). Change-Id: I1ae3729397b0f4a1bd138022a4e122021e10f1e9 Reviewed-by: Björn Breitmeyer Reviewed-by: Friedemann Kleint Reviewed-by: Andreas Holzammer --- .../other/networkselftest/tst_networkselftest.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp index 2932387bdb..108ec466c9 100644 --- a/tests/auto/other/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp @@ -41,8 +41,7 @@ #include #include - -#include +#include #ifndef QT_NO_BEARERMANAGEMENT #include @@ -531,13 +530,9 @@ void tst_NetworkSelfTest::imapServer() void tst_NetworkSelfTest::httpServer() { - QString uniqueExtension; - qsrand(time(0)); -#ifndef Q_OS_WINCE - uniqueExtension = QString("%1%2%3").arg((qulonglong)this).arg(qrand()).arg((qulonglong)time(0)); -#else - uniqueExtension = QString("%1%2").arg((qulonglong)this).arg(qrand()); -#endif + QByteArray uniqueExtension = QByteArray::number((qulonglong)this) + + QByteArray::number((qulonglong)qrand()) + + QByteArray::number((qulonglong)QDateTime::currentDateTime().toTime_t()); netChat(80, QList() // HTTP/0.9 chat: @@ -603,7 +598,7 @@ void tst_NetworkSelfTest::httpServer() // HTTP/1.0 PUT << Chat::Reconnect - << Chat::send("PUT /dav/networkselftest-" + uniqueExtension.toLatin1() + ".txt HTTP/1.0\r\n" + << Chat::send("PUT /dav/networkselftest-" + uniqueExtension + ".txt HTTP/1.0\r\n" "Content-Length: 5\r\n" "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" "Connection: close\r\n" @@ -616,7 +611,7 @@ void tst_NetworkSelfTest::httpServer() // check that the file did get uploaded << Chat::Reconnect - << Chat::send("HEAD /dav/networkselftest-" + uniqueExtension.toLatin1() + ".txt HTTP/1.0\r\n" + << Chat::send("HEAD /dav/networkselftest-" + uniqueExtension + ".txt HTTP/1.0\r\n" "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" "Connection: close\r\n" "\r\n") @@ -628,7 +623,7 @@ void tst_NetworkSelfTest::httpServer() // HTTP/1.0 DELETE << Chat::Reconnect - << Chat::send("DELETE /dav/networkselftest-" + uniqueExtension.toLatin1() + ".txt HTTP/1.0\r\n" + << Chat::send("DELETE /dav/networkselftest-" + uniqueExtension + ".txt HTTP/1.0\r\n" "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" "Connection: close\r\n" "\r\n") -- cgit v1.2.3 From 4f0770eaabb8abf4de94dfbff1b691d32a305392 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 17 Apr 2013 15:56:16 +0300 Subject: Fix tst_qstyle autotest build for WEC7. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently testAllFunctions method has been changed to take pointer, but code inside different WinCE defines was not updated. Change-Id: Id15380ecc1e85650d679cb7437923ff9c77057ae Reviewed-by: Björn Breitmeyer Reviewed-by: Friedemann Kleint Reviewed-by: Andreas Holzammer --- tests/auto/widgets/styles/qstyle/tst_qstyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index ef91d6d3d2..fc94f95f8e 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -548,7 +548,7 @@ void tst_QStyle::testMacStyle() void tst_QStyle::testWindowsCEStyle() { QStyle *cstyle = QStyleFactory::create("WindowsCE"); - QVERIFY(testAllFunctions(&cstyle)); + QVERIFY(testAllFunctions(cstyle)); delete cstyle; } #endif @@ -558,7 +558,7 @@ void tst_QStyle::testWindowsCEStyle() void tst_QStyle::testWindowsMobileStyle() { QStyle *cstyle = QStyleFactory::create("WindowsMobile"); - QVERIFY(testAllFunctions(&cstyle)); + QVERIFY(testAllFunctions(cstyle)); delete cstyle; } #endif -- cgit v1.2.3 From 52afd781ad1ea61c6f0daf6633f5c65c006198fb Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 17 Apr 2013 15:58:38 +0300 Subject: Fix qprocess benchmark test build for WEC7. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use Q_OS_WINCE ifdef in both method declaration and definition, in addition combine QT_NO_PROCESS and Q_OS_WINCE ifdefs to one line. Change-Id: I0787e4341c41b46a5fc089f24a538c0ad40a0875 Reviewed-by: Björn Breitmeyer Reviewed-by: Friedemann Kleint Reviewed-by: Andreas Holzammer --- tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp index 0b569cc49d..8d388751d5 100644 --- a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp +++ b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp @@ -46,7 +46,7 @@ class tst_QProcess : public QObject { Q_OBJECT -#ifndef QT_NO_PROCESS +#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE) private slots: void echoTest_performance(); @@ -54,8 +54,7 @@ private slots: #endif // QT_NO_PROCESS }; -#ifndef QT_NO_PROCESS -#ifndef Q_OS_WINCE +#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE) // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::echoTest_performance() { @@ -101,9 +100,8 @@ void tst_QProcess::echoTest_performance() process.closeWriteChannel(); QVERIFY(process.waitForFinished()); } -#endif // Q_OS_WINCE -#endif // QT_NO_PROCESS +#endif // QT_NO_PROCESS && Q_OS_WINCE QTEST_MAIN(tst_QProcess) #include "tst_bench_qprocess.moc" -- cgit v1.2.3 From c6612de314ff149b5d331b589c8f277274706ddf Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 17 Apr 2013 16:02:08 +0300 Subject: Fix qsqlquery benchmark test build for WEC7. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WEC7 does not have ws2_32 lib. The lib is needed for gethostname symbol, instead of using hard coded platform specific libs, rely on QMAKE_NETWORK_LIBS variable containing network libs. Change-Id: Ice39ca3f2d176cc5df88beded4b64d2b92f4f3ba Reviewed-by: Björn Breitmeyer Reviewed-by: Friedemann Kleint Reviewed-by: Andreas Holzammer --- tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro b/tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro index bfea404980..abfebad2aa 100644 --- a/tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro +++ b/tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro @@ -3,5 +3,5 @@ TARGET = tst_bench_qsqlquery SOURCES += main.cpp QT = core sql testlib core-private sql-private -win32: LIBS += -lws2_32 +LIBS += $$QMAKE_LIBS_NETWORK DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -- cgit v1.2.3 From 453e4da6d1c2b5e8212ef9c5f0c68471e9c81d08 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 17 Apr 2013 16:05:24 +0300 Subject: Fix qgraphicsview autotest build for WEC7. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit logicalDotsPerInchX returns qreal, and qreal in WEC7 is defined to float instead double. There is no required overload: qFuzzyCompare(float,double) And for that reason build fails. Ensure qreal is casted to double which is default type used by compilers for floating point literals such as '96.0'. Change-Id: I24c701715b3dcf1a2137256a1c251c19d0c1dbe9 Reviewed-by: Björn Breitmeyer Reviewed-by: Friedemann Kleint Reviewed-by: Andreas Holzammer --- tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp index eebfdfac65..e215fd1086 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp @@ -661,7 +661,7 @@ void _scrollBarRanges_data() } const QScreen *screen = QGuiApplication::primaryScreen(); - if (screen && qFuzzyCompare(screen->logicalDotsPerInchX(), 96.0)) { + if (screen && qFuzzyCompare((double)screen->logicalDotsPerInchX(), 96.0)) { _scrollBarRanges_addTestData(QString("motif"), false); _scrollBarRanges_addTestData(QString("motif"), true); } -- cgit v1.2.3 From e345b35ee4d8afb489cd4b5ee0f74c02d310c1cc Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Sun, 7 Apr 2013 16:48:47 +0100 Subject: Android: Fixes for building under MSYS. Need to set MINGW_IN_SHELL to 1 and QMAKE_DIR_SEP to / Change-Id: If470f1a4617555d6bc551e8cdf917779d0e64e62 Reviewed-by: Oswald Buddenhagen --- mkspecs/android-g++/qmake.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mkspecs/android-g++/qmake.conf b/mkspecs/android-g++/qmake.conf index c780e2f0d5..7e78725858 100644 --- a/mkspecs/android-g++/qmake.conf +++ b/mkspecs/android-g++/qmake.conf @@ -18,10 +18,15 @@ contains(QMAKE_HOST.os,Windows) { # Not having sh.exe in your path causes this condition to pass # To build Android Qt on Windows, this block must not be evaluated. isEmpty(QMAKE_SH) { + # Override values from previously loaded shell-unix.conf + # (via unix.conf, via linux.conf). include(../common/shell-win32.conf) QMAKE_DEL_TREE = rmdir /s /q QMAKE_INSTALL_FILE = copy /y QMAKE_INSTALL_PROGRAM = copy /y + } else { + MINGW_IN_SHELL = 1 + QMAKE_DIR_SEP = / } } -- cgit v1.2.3 From 9a89d614f26262fcb6895d1dab93519d732ba011 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 17 Apr 2013 13:21:24 +0200 Subject: Windows: Fix compile with -directwrite. Task-number: QTBUG-30643 Change-Id: I3a2a0e767a92bc2ff9d7d241dfad6771034e6ad4 Reviewed-by: Oliver Wolff Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 5fa954cb12..7fedc27951 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1173,7 +1173,7 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal fontFile->Release(); fontEngine = new QWindowsFontEngineDirectWrite(directWriteFontFace, pixelSize, - m_fontEngineData); + sharedFontData()); // Get font family from font data fontEngine->fontDef.family = font.familyName(); -- cgit v1.2.3 From 333817b9cf1304cca7c1dbd45880115cd128f60e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 26 Feb 2013 14:31:01 +0100 Subject: Do not send clipboard message to application under debugger. Fix Qt Creator hang when copying a stack trace from an application showing a runtime assert. Change-Id: I874bd48643ebce1a3551644dc850cb7cf5869522 Reviewed-by: Kai Koehne Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsclipboard.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp index b66a16ae58..cf6cb199c7 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.cpp +++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp @@ -178,6 +178,20 @@ void QWindowsClipboard::unregisterViewer() } } +static bool isProcessBeingDebugged(HWND hwnd) +{ + DWORD pid = 0; + if (!GetWindowThreadProcessId(hwnd, &pid) || !pid) + return false; + const HANDLE processHandle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); + if (!processHandle) + return false; + BOOL debugged = FALSE; + CheckRemoteDebuggerPresent(processHandle, &debugged); + CloseHandle(processHandle); + return debugged != FALSE; +} + void QWindowsClipboard::propagateClipboardMessage(UINT message, WPARAM wParam, LPARAM lParam) const { if (!m_nextClipboardViewer) @@ -189,6 +203,12 @@ void QWindowsClipboard::propagateClipboardMessage(UINT message, WPARAM wParam, L qWarning("%s: Cowardly refusing to send clipboard message to hung application...", Q_FUNC_INFO); return; } + // Also refuse if the process is being debugged, specifically, if it is + // displaying a runtime assert, which is not caught by isHungAppWindow(). + if (isProcessBeingDebugged(m_nextClipboardViewer)) { + qWarning("%s: Cowardly refusing to send clipboard message to application under debugger...", Q_FUNC_INFO); + return; + } SendMessage(m_nextClipboardViewer, message, wParam, lParam); } -- cgit v1.2.3 From bcc14954d3f13f3d32ab974344d243b175a162e1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 17 Apr 2013 14:41:29 +0200 Subject: Update test exclusion following bug fix in recent cmake versions. Change-Id: I8174ca78b4e2d8b4344278acf8ca4b0db3115d1a Reviewed-by: Alexander Neundorf Reviewed-by: Stephen Kelly --- tests/auto/cmake/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index ad31956f62..77cf81989a 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -70,8 +70,8 @@ if (NOT NO_DBUS) expect_pass(test_dbus_module) endif() expect_pass(test_multiple_find_package) -if (NOT WIN32) - # Currently broken on windows. Reported upstream: +if (NOT WIN32 OR (WIN32 AND NOT CMAKE_VERSION VERSION_LESS 2.8.11)) + # Broken on windows on earlier CMake versions. # http://public.kitware.com/Bug/view.php?id=13392 expect_pass(test_add_resources_delayed_file) endif() -- cgit v1.2.3 From 7c791171a15c9192f4b025a810dde11b7dae2e51 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 17 Apr 2013 08:38:19 +0200 Subject: Calling wglMakeCurrent on an already current context gives 100% cpu load The problem occurs at least with nvidia cards when vsync is enabled in the control panel. Task-number: QTBUG-29686 Change-Id: I6fd2a3560a5baeeac7c3fe0440db85904c45026d Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsglcontext.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index da3e2a6a6a..ae66ef8a3d 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -1052,8 +1052,16 @@ bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface) // Do we already have a DC entry for that window? QWindowsWindow *window = static_cast(surface); const HWND hwnd = window->handle(); - if (const QOpenGLContextData *contextData = findByHWND(m_windowContexts, hwnd)) + if (const QOpenGLContextData *contextData = findByHWND(m_windowContexts, hwnd)) { + // Repeated calls to wglMakeCurrent when vsync is enabled in the driver will + // often result in 100% cpuload. This check is cheap and avoids the problem. + // This is reproducable on NVidia cards and Intel onboard chips. + if (wglGetCurrentContext() == contextData->renderingContext + && wglGetCurrentDC() == contextData->hdc) { + return true; + } return wglMakeCurrent(contextData->hdc, contextData->renderingContext); + } // Create a new entry. const QOpenGLContextData newContext(m_renderingContext, hwnd, GetDC(hwnd)); if (!newContext.hdc) -- cgit v1.2.3 From 4c7881396edbb513b15f7f46af9553a3d7478dab Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 17 Apr 2013 10:48:55 +0200 Subject: An RTL submenu should be right-aligned Task-number: QTBUG-30595 Change-Id: Iac54cae70b5a2ac6be5a750279fb390bb158776a Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qmenu.cpp | 4 +-- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 36 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index dfa906d2ea..6b02e7371f 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1967,8 +1967,8 @@ void QMenu::popup(const QPoint &p, QAction *atAction) pos.setX(mouse.x() - size.width()); #ifndef QT_NO_MENUBAR - // if in a menubar, it should be right-aligned - if (qobject_cast(d->causedPopup.widget)) + // if the menu is in a menubar or is a submenu, it should be right-aligned + if (qobject_cast(d->causedPopup.widget) || qobject_cast(d->causedPopup.widget)) pos.rx() -= size.width(); #endif //QT_NO_MENUBAR diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index e48316fd19..9fdb8de4b8 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -101,6 +101,7 @@ private slots: void pushButtonPopulateOnAboutToShow(); void QTBUG7907_submenus_autoselect(); void QTBUG7411_submenus_activate(); + void QTBUG30595_rtl_submenu(); void QTBUG20403_nested_popup_on_shortcut_trigger(); void QTBUG_10735_crashWithDialog(); protected slots: @@ -896,6 +897,41 @@ void tst_QMenu::QTBUG7411_submenus_activate() QTRY_VERIFY(sub1.isVisible()); } +class LayoutDirectionSaver +{ + Q_DISABLE_COPY(LayoutDirectionSaver) +public: + explicit LayoutDirectionSaver(Qt::LayoutDirection direction) + : m_oldDirection(qApp->layoutDirection()) + { + qApp->setLayoutDirection(direction); + } + + ~LayoutDirectionSaver() + { + qApp->setLayoutDirection(m_oldDirection); + } + +private: + const Qt::LayoutDirection m_oldDirection; +}; + +void tst_QMenu::QTBUG30595_rtl_submenu() +{ + LayoutDirectionSaver directionSaver(Qt::RightToLeft); + QMenu menu("Test Menu"); + QMenu sub("&sub"); + sub.addAction("bar"); + sub.setTitle("&sub"); + menu.addMenu(&sub); + menu.move(200, 20); + menu.show(); + QVERIFY(QTest::qWaitForWindowExposed(&menu)); + QTest::mouseClick(&menu, Qt::LeftButton, Qt::NoModifier, QPoint(5,5) ); + QTRY_VERIFY(sub.isVisible()); + QVERIFY(sub.pos().x() < menu.pos().x()); +} + void tst_QMenu::QTBUG20403_nested_popup_on_shortcut_trigger() { QMenu menu("Test Menu"); -- cgit v1.2.3 From acfccd048368ccbd8466c4332db62807712dd288 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 17 Apr 2013 13:54:10 +0200 Subject: Fusion & GTK styles need to check direction from style option not qapp An RTL menu containing a menu item which opens a submenu was showing the wrong arrow if the application's direction was not also RTL. So now the test for QTBUG-30595 can be simplified: no need to set the application direction, and therefore less chance of failure. Change-Id: Id140656206c6fefea3649289477dc54c77e2dd5e Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qfusionstyle.cpp | 2 +- src/widgets/styles/qgtkstyle.cpp | 4 ++-- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 21 +-------------------- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index c4c964f451..41046a1254 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1681,7 +1681,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow int dim = (menuItem->rect.height() - 4) / 2; PrimitiveElement arrow; - arrow = QApplication::isRightToLeft() ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight; + arrow = option->direction == Qt::RightToLeft ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight; int xpos = menuItem->rect.left() + menuItem->rect.width() - 3 - dim; QRect vSubMenuRect = visualRect(option->direction, menuItem->rect, QRect(xpos, menuItem->rect.top() + menuItem->rect.height() / 2 - dim / 2, dim, dim)); diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp index 2697afb077..b981aef98b 100644 --- a/src/widgets/styles/qgtkstyle.cpp +++ b/src/widgets/styles/qgtkstyle.cpp @@ -2985,7 +2985,7 @@ void QGtkStyle::drawControl(ControlElement element, GtkStyle *gtkStatusbarStyle = d->gtk_widget_get_style(gtkStatusbar); QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbarStyle->xthickness, -gtkStatusbarStyle->ythickness); gtkPainter->paintResizeGrip(gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL, - GTK_SHADOW_OUT, QApplication::isRightToLeft() ? + GTK_SHADOW_OUT, option->direction == Qt::RightToLeft ? GDK_WINDOW_EDGE_SOUTH_WEST : GDK_WINDOW_EDGE_SOUTH_EAST, gtkStatusbarStyle); } @@ -3366,7 +3366,7 @@ void QGtkStyle::drawControl(ControlElement element, menuItem->rect.height() / 2 - dim / 2, dim, dim)); GtkStateType state = enabled ? (act ? GTK_STATE_PRELIGHT: GTK_STATE_NORMAL) : GTK_STATE_INSENSITIVE; GtkShadowType shadowType = (state == GTK_STATE_PRELIGHT) ? GTK_SHADOW_OUT : GTK_SHADOW_IN; - gtkPainter->paintArrow(gtkMenuItem, "menuitem", vSubMenuRect, QApplication::isRightToLeft() ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT, state, + gtkPainter->paintArrow(gtkMenuItem, "menuitem", vSubMenuRect, option->direction == Qt::RightToLeft ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT, state, shadowType, false, style); } } diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 9fdb8de4b8..3c32b8a476 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -897,29 +897,10 @@ void tst_QMenu::QTBUG7411_submenus_activate() QTRY_VERIFY(sub1.isVisible()); } -class LayoutDirectionSaver -{ - Q_DISABLE_COPY(LayoutDirectionSaver) -public: - explicit LayoutDirectionSaver(Qt::LayoutDirection direction) - : m_oldDirection(qApp->layoutDirection()) - { - qApp->setLayoutDirection(direction); - } - - ~LayoutDirectionSaver() - { - qApp->setLayoutDirection(m_oldDirection); - } - -private: - const Qt::LayoutDirection m_oldDirection; -}; - void tst_QMenu::QTBUG30595_rtl_submenu() { - LayoutDirectionSaver directionSaver(Qt::RightToLeft); QMenu menu("Test Menu"); + menu.setLayoutDirection(Qt::RightToLeft); QMenu sub("&sub"); sub.addAction("bar"); sub.setTitle("&sub"); -- cgit v1.2.3 From e25db968846432f087ca800048f5337fd534c159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 16 Apr 2013 16:02:14 +0200 Subject: QOpenGLPaintDevice: correct painting on retina. Make QOpenGLPaintDevice::metric(PdmDevicePixelRatio) return d->devicePixelRatio instead of 1. Change-Id: I4cf9dd552a700b958212edc8efb990a45e77fd66 Reviewed-by: Richard Moe Gustavsen --- src/gui/opengl/qopenglpaintdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp index 1e427c9dd6..f0e7e4953f 100644 --- a/src/gui/opengl/qopenglpaintdevice.cpp +++ b/src/gui/opengl/qopenglpaintdevice.cpp @@ -286,7 +286,7 @@ int QOpenGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const case PdmPhysicalDpiY: return qRound(d_ptr->dpmy * 0.0254); case PdmDevicePixelRatio: - return 1; + return d_ptr->devicePixelRatio; default: qWarning("QOpenGLPaintDevice::metric() - metric %d not known", metric); return 0; -- cgit v1.2.3 From 1770f25857c7cfe21c36c0bda8a80a54b199bafe Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 17 Apr 2013 13:32:44 +0200 Subject: Fix GroupBox painting on Windows when not using widgets This is simply removing some slow and rather ugly hacks that tried to reconstruct broken data from the windows xp theme. After testing without these hacks on both XP and Windows 7, I believe we can conclude that these workarounds are no longer required and even breaks our look and feel in several places. Task-number: QTBUG-29888 Change-Id: Ifaffd660e8d9ed6dfd43657745c3fa1606d33a7c Reviewed-by: J-P Nurmi Reviewed-by: Jens Bache-Wiig Reviewed-by: Gunnar Sletta --- src/widgets/styles/qwindowsxpstyle.cpp | 47 ++------------------------------ src/widgets/styles/qwindowsxpstyle_p_p.h | 4 +-- 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 64569cfd9b..31cf329262 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -569,30 +569,6 @@ void QWindowsXPStylePrivate::setTransparency(QWidget *widget, XPThemeData &theme SetWindowRgn(winId(widget), hrgn, true); } -/*! \internal - Returns true if the native doublebuffer contains a pixel which - has a non-0xFF alpha value. Should only be use when its - guaranteed that data painted into the buffer wasn't a proper - alpha pixmap. -*/ -bool QWindowsXPStylePrivate::hasAnyData(const QRect &rect) -{ - const int startX = rect.left(); - const int startY = rect.top(); - const int w = rect.width(); - const int h = rect.height(); - - for (int y = startY; y < h; ++y) { - register DWORD *buffer = (DWORD*)bufferPixels + (y * bufferW); - for (int x = startX; x < w; ++x, ++buffer) { - int alpha = (*buffer) >> 24; - if (alpha != 0xFF) // buffer has been touched - return true; - } - } - return false; -} - /*! \internal Returns true if the native doublebuffer contains pixels with varying alpha value. @@ -857,7 +833,6 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa bool stateHasData = true; // We assume so; bool hasAlpha = false; bool partIsTransparent; - bool inspectData; bool potentialInvalidAlpha; QString pixmapCacheKey = QStringLiteral("$qt_xp_"); @@ -882,9 +857,6 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa bool haveCachedPixmap = false; bool isCached = data.dataValid; if (isCached) { - if (!(stateHasData = data.hasAnyData)) - return; // Cached NOOP - inspectData = data.wasAlphaSwapped; partIsTransparent = data.partIsTransparent; hasAlpha = data.hasAlphaChannel; alphaType = data.alphaType; @@ -907,13 +879,6 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa pGetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERONLY, &tmt_borderonly); pGetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, TMT_TRANSPARENTCOLOR, &tmt_transparentcolor); pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_CAPTIONMARGINS, &proporigin); - inspectData = (tmt_transparentcolor != 0 || tmt_borderonly || proporigin == PO_PART || proporigin == PO_STATE); - - // ### This is a vista-specific workaround for broken alpha in titlebar pixmaps - if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { - if (themeData.partId == WP_CAPTION || themeData.partId == WP_SMALLCAPTION) - inspectData = false; - } partIsTransparent = isTransparent(themeData); @@ -922,14 +887,13 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa if (proporigin == PO_PART || proporigin == PO_STATE) { int tmt_glyphtype = GT_NONE; pGetThemeEnumValue(themeData.handle(), themeData.partId, themeData.stateId, TMT_GLYPHTYPE, &tmt_glyphtype); - potentialInvalidAlpha = partIsTransparent && !inspectData && tmt_glyphtype == GT_IMAGEGLYPH; + potentialInvalidAlpha = partIsTransparent && tmt_glyphtype == GT_IMAGEGLYPH; } #ifdef DEBUG_XP_STYLE printf("---[ NOT CACHED ]-----------------------> Name(%-10s) Part(%d) State(%d)\n", qPrintable(themeData.name), themeData.partId, themeData.stateId); printf("-->partIsTransparen = %d\n", partIsTransparent); - printf("-->inspectData = %d\n", inspectData); printf("-->potentialInvalidAlpha = %d\n", potentialInvalidAlpha); showProperties(themeData); #endif @@ -979,7 +943,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa // Clear the buffer if (alphaType != NoAlpha) { // Consider have separate "memset" function for small chunks for more speedup - memset(bufferPixels, inspectData ? 0xFF : 0x00, bufferW * h * 4); + memset(bufferPixels, 0x00, bufferW * h * 4); } // Difference between area and rect @@ -1021,8 +985,6 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa // If not cached, analyze the buffer data to figure // out alpha type, and if it contains data if (!isCached) { - if (inspectData) - stateHasData = hasAnyData(rect); // SHORTCUT: If the part's state has no data, cache it for NOOP later if (!stateHasData) { memset(&data, 0, sizeof(data)); @@ -1038,10 +1000,6 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa #endif } - // Swap alpha values, if needed - if (inspectData) - wasAlphaSwapped = swapAlphaChannel(rect); - // Fix alpha values, if needed if (potentialInvalidAlpha) wasAlphaFixed = fixAlphaChannel(rect); @@ -1143,7 +1101,6 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa data.partIsTransparent = partIsTransparent; data.alphaType = alphaType; data.hasAlphaChannel = hasAlpha; - data.hasAnyData = stateHasData; data.wasAlphaSwapped = wasAlphaSwapped; data.hadInvalidAlpha = wasAlphaFixed; alphaCache.insert(key, data); diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h index 783adc3085..27d9c9acc9 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p_p.h @@ -274,12 +274,11 @@ struct ThemeMapData { bool dataValid : 1; // Only used to detect if hash value is ok bool partIsTransparent : 1; - bool hasAnyData : 1; // False = part & state has not data, NOP bool hasAlphaChannel : 1; // True = part & state has real Alpha bool wasAlphaSwapped : 1; // True = alpha channel needs to be swapped bool hadInvalidAlpha : 1; // True = alpha channel contained invalid alpha values - ThemeMapData() : dataValid(false), partIsTransparent(false), hasAnyData(false), + ThemeMapData() : dataValid(false), partIsTransparent(false), hasAlphaChannel(false), wasAlphaSwapped(false), hadInvalidAlpha(false) {} }; @@ -339,7 +338,6 @@ public: void drawBackgroundThruNativeBuffer(XPThemeData &themeData); void drawBackgroundDirectly(XPThemeData &themeData); - bool hasAnyData(const QRect &rect); bool hasAlphaChannel(const QRect &rect); bool fixAlphaChannel(const QRect &rect); bool swapAlphaChannel(const QRect &rect, bool allPixels = false); -- cgit v1.2.3 From eb95685556143eb71323742bfcdaa20541b01375 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 15 Apr 2013 11:23:04 +0200 Subject: Android: Don't crash when displaying multiple top-levels While the raster platform plugin supports multiple top level windows, this is not supported on the GL plugin, so if you use GL or QtQuick2 in your app and use several top levels, the app would crash with an error message. A problem is that the top-level SurfaceView is a special overlay View and does not support being stacked in a layout. So instead, we let all windows share the same GL surface and draw on top of each other. This works fine for simple use cases. We implement a new platform capability to make sure no top level windows (even combobox popups and dialogs) get non-fullscreen geometries. That has never worked properly with the eglfs plugin. Task-number: QTBUG-30473 Change-Id: Ia1438019638fc739cc93ffe79b46b81631254df2 Reviewed-by: Paul Olav Tvete --- src/gui/kernel/qplatformintegration.cpp | 8 ++- src/gui/kernel/qplatformintegration.h | 3 +- .../platforms/android/src/androidjnimain.cpp | 19 ++++--- .../android/src/opengl/qandroidopenglcontext.cpp | 14 +++--- .../src/opengl/qandroidopenglplatformwindow.cpp | 58 +++++++++++++++++++++- .../src/opengl/qandroidopenglplatformwindow.h | 13 +++++ .../android/src/opengl/qeglfshooks_android.cpp | 1 + .../android/src/qandroidplatformintegration.cpp | 33 ++++++------ .../android/src/qandroidplatformintegration.h | 3 -- src/widgets/kernel/qwidget_qpa.cpp | 13 ++++- 10 files changed, 128 insertions(+), 37 deletions(-) diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 70de75072c..8a0540efc2 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -210,6 +210,11 @@ QPlatformServices *QPlatformIntegration::services() const \value ForeignWindows The platform allows creating QWindows which represent native windows created by other processes or anyway created by using native libraries. + + \value NonFullScreenWindows The platform supports top-level windows which do not + fill the screen. The default implementation returns true. Returning false for + this will cause all windows, including dialogs and popups, to be resized to fill the + screen. */ @@ -227,8 +232,7 @@ QPlatformServices *QPlatformIntegration::services() const bool QPlatformIntegration::hasCapability(Capability cap) const { - Q_UNUSED(cap); - return false; + return cap == NonFullScreenWindows; } QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index ddee6f05c8..bee2ba0caf 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -90,7 +90,8 @@ public: WindowMasks, MultipleWindows, ApplicationState, - ForeignWindows + ForeignWindows, + NonFullScreenWindows }; virtual ~QPlatformIntegration() { } diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp index cd7fa25da7..162a8aa977 100644 --- a/src/plugins/platforms/android/src/androidjnimain.cpp +++ b/src/plugins/platforms/android/src/androidjnimain.cpp @@ -559,7 +559,6 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jobject jSurface) m_surfaceMutex.unlock(); m_androidPlatformIntegration->surfaceChanged(); } else if (m_androidPlatformIntegration && sameNativeWindow) { - QAndroidOpenGLPlatformWindow *window = m_androidPlatformIntegration->primaryWindow(); QPlatformScreen *screen = m_androidPlatformIntegration->screen(); QSize size = QtAndroid::nativeWindowSize(); @@ -567,13 +566,19 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jobject jSurface) QWindowSystemInterface::handleScreenAvailableGeometryChange(screen->screen(), geometry); QWindowSystemInterface::handleScreenGeometryChange(screen->screen(), geometry); - if (window != 0) { - window->lock(); - window->scheduleResize(size); + // Resize all top level windows, since they share the same surface + foreach (QWindow *w, QGuiApplication::topLevelWindows()) { + QAndroidOpenGLPlatformWindow *window = + static_cast(w->handle()); - QWindowSystemInterface::handleExposeEvent(window->window(), - QRegion(window->window()->geometry())); - window->unlock(); + if (window != 0) { + window->lock(); + window->scheduleResize(size); + + QWindowSystemInterface::handleExposeEvent(window->window(), + QRegion(window->window()->geometry())); + window->unlock(); + } } m_surfaceMutex.unlock(); diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp index aa8ee57341..4d741807d0 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp @@ -62,16 +62,16 @@ void QAndroidOpenGLContext::swapBuffers(QPlatformSurface *surface) { QEglFSContext::swapBuffers(surface); - QAndroidOpenGLPlatformWindow *primaryWindow = m_platformIntegration->primaryWindow(); - if (primaryWindow == surface) { - primaryWindow->lock(); - QSize size = primaryWindow->scheduledResize(); + if (surface->surface()->surfaceClass() == QSurface::Window) { + QAndroidOpenGLPlatformWindow *window = static_cast(surface); + window->lock(); + QSize size = window->scheduledResize(); if (size.isValid()) { QRect geometry(QPoint(0, 0), size); - primaryWindow->setGeometry(geometry); - primaryWindow->scheduleResize(QSize()); + window->setGeometry(geometry); + window->scheduleResize(QSize()); } - primaryWindow->unlock(); + window->unlock(); } } diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp index 15c6559157..5362906e0e 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp @@ -45,11 +45,21 @@ QT_BEGIN_NAMESPACE +EGLSurface QAndroidOpenGLPlatformWindow::m_staticSurface = 0; +EGLNativeWindowType QAndroidOpenGLPlatformWindow::m_staticNativeWindow = 0; +QReadWriteLock QAndroidOpenGLPlatformWindow::m_staticSurfaceLock; +QBasicAtomicInt QAndroidOpenGLPlatformWindow::m_referenceCount = Q_BASIC_ATOMIC_INITIALIZER(0); + QAndroidOpenGLPlatformWindow::QAndroidOpenGLPlatformWindow(QWindow *window) : QEglFSWindow(window) { } +QAndroidOpenGLPlatformWindow::~QAndroidOpenGLPlatformWindow() +{ + destroy(); +} + bool QAndroidOpenGLPlatformWindow::isExposed() const { return QtAndroid::nativeWindow(false) != 0 && QEglFSWindow::isExposed(); @@ -60,11 +70,57 @@ void QAndroidOpenGLPlatformWindow::invalidateSurface() QWindowSystemInterface::handleExposeEvent(window(), QRegion()); // Obscure event QWindowSystemInterface::flushWindowSystemEvents(); QEglFSWindow::invalidateSurface(); + + m_window = 0; + m_surface = 0; + + if (!m_referenceCount.deref()){ + QWriteLocker locker(&m_staticSurfaceLock); + + EGLDisplay display = (static_cast(window()->screen()->handle()))->display(); + eglDestroySurface(display, m_staticSurface); + + m_staticSurface = 0; + m_staticNativeWindow = 0; + } } void QAndroidOpenGLPlatformWindow::resetSurface() { - QEglFSWindow::resetSurface(); + m_referenceCount.ref(); + if (m_staticSurface == 0) { + QWriteLocker locker(&m_staticSurfaceLock); + QEglFSWindow::resetSurface(); + m_staticSurface = m_surface; + m_staticNativeWindow = m_window; + } else { + QReadLocker locker(&m_staticSurfaceLock); + Q_ASSERT(m_staticSurface != m_surface); + m_window = m_staticNativeWindow; + m_surface = m_staticSurface; + } + + QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event + QWindowSystemInterface::flushWindowSystemEvents(); +} + +void QAndroidOpenGLPlatformWindow::destroy() +{ + if (!m_referenceCount.deref()) { + QEglFSWindow::destroy(); + } else { + m_window = 0; + m_surface = 0; + } +} + +void QAndroidOpenGLPlatformWindow::raise() +{ +} + +void QAndroidOpenGLPlatformWindow::setVisible(bool visible) +{ + QEglFSWindow::setVisible(visible); QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event QWindowSystemInterface::flushWindowSystemEvents(); } diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h index b835cb3246..36a110e1a8 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h @@ -44,6 +44,7 @@ #include "qeglfswindow.h" #include +#include QT_BEGIN_NAMESPACE @@ -51,6 +52,7 @@ class QAndroidOpenGLPlatformWindow : public QEglFSWindow { public: QAndroidOpenGLPlatformWindow(QWindow *window); + ~QAndroidOpenGLPlatformWindow(); QSize scheduledResize() const { return m_scheduledResize; } void scheduleResize(const QSize &size) { m_scheduledResize = size; } @@ -60,12 +62,23 @@ public: bool isExposed() const; + void raise(); + void invalidateSurface(); void resetSurface(); + void setVisible(bool visible); + + void destroy(); + private: QSize m_scheduledResize; QMutex m_lock; + + static QReadWriteLock m_staticSurfaceLock; + static EGLSurface m_staticSurface; + static EGLNativeWindowType m_staticNativeWindow; + static QBasicAtomicInt m_referenceCount; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp index 4734d47eb3..005758d83d 100644 --- a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp +++ b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp @@ -96,6 +96,7 @@ QDpi QEglFSAndroidHooks::logicalDpi() const EGLNativeWindowType QEglFSAndroidHooks::createNativeWindow(const QSize &size, const QSurfaceFormat &format) { + Q_UNUSED(size); ANativeWindow *window = QtAndroid::nativeWindow(); if (window != 0) ANativeWindow_acquire(window); diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp index cbd0f26835..3de6c47ad0 100644 --- a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp @@ -43,6 +43,7 @@ #include "qabstracteventdispatcher.h" #include "androidjnimain.h" #include +#include #include #include #include @@ -85,9 +86,6 @@ void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteA QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶mList) : m_touchDevice(0) -#ifdef ANDROID_PLUGIN_OPENGL - , m_primaryWindow(0) -#endif { Q_UNUSED(paramList); @@ -116,6 +114,7 @@ bool QAndroidPlatformIntegration::hasCapability(Capability cap) const { switch (cap) { case ThreadedPixmaps: return true; + case NonFullScreenWindows: return false; default: #ifndef ANDROID_PLUGIN_OPENGL return QPlatformIntegration::hasCapability(cap); @@ -143,28 +142,32 @@ QAbstractEventDispatcher *QAndroidPlatformIntegration::guiThreadEventDispatcher( #else // !ANDROID_PLUGIN_OPENGL QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *window) const { - if (m_primaryWindow != 0) { - qWarning("QAndroidPlatformIntegration::createPlatformWindow: Unsupported case: More than " - "one top-level window created."); - } - - m_primaryWindow = new QAndroidOpenGLPlatformWindow(window); - m_primaryWindow->requestActivateWindow(); + QAndroidOpenGLPlatformWindow *platformWindow = new QAndroidOpenGLPlatformWindow(window); + platformWindow->create(); + platformWindow->requestActivateWindow(); QtAndroidMenu::setActiveTopLevelWindow(window); - return m_primaryWindow; + return platformWindow; } void QAndroidPlatformIntegration::invalidateNativeSurface() { - if (m_primaryWindow != 0) - m_primaryWindow->invalidateSurface(); + foreach (QWindow *w, QGuiApplication::topLevelWindows()) { + QAndroidOpenGLPlatformWindow *window = + static_cast(w->handle()); + if (window != 0) + window->invalidateSurface(); + } } void QAndroidPlatformIntegration::surfaceChanged() { - if (m_primaryWindow != 0) - m_primaryWindow->resetSurface(); + foreach (QWindow *w, QGuiApplication::topLevelWindows()) { + QAndroidOpenGLPlatformWindow *window = + static_cast(w->handle()); + if (window != 0) + window->resetSurface(); + } } QPlatformOpenGLContext *QAndroidPlatformIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.h b/src/plugins/platforms/android/src/qandroidplatformintegration.h index 3f8cc5a809..8da9fb2ff4 100644 --- a/src/plugins/platforms/android/src/qandroidplatformintegration.h +++ b/src/plugins/platforms/android/src/qandroidplatformintegration.h @@ -95,7 +95,6 @@ public: QPlatformWindow *createPlatformWindow(QWindow *window) const; void invalidateNativeSurface(); void surfaceChanged(); - QAndroidOpenGLPlatformWindow *primaryWindow() const { return m_primaryWindow; } QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; #endif @@ -138,8 +137,6 @@ private: #ifndef ANDROID_PLUGIN_OPENGL QAbstractEventDispatcher *m_eventDispatcher; QAndroidPlatformScreen *m_primaryScreen; -#else - mutable QAndroidOpenGLPlatformWindow *m_primaryWindow; #endif QThread *m_mainThread; diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 8c31d4ad26..fdc72ee23c 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -52,6 +52,7 @@ #include #include #include "QtGui/private/qwindow_p.h" +#include "QtGui/private/qguiapplication_p.h" #include #include @@ -675,6 +676,16 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) h = qMax(h,extra->minh); } + if (q->isWindow() && q->windowHandle()) { + QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration(); + if (!integration->hasCapability(QPlatformIntegration::NonFullScreenWindows)) { + x = 0; + y = 0; + w = q->windowHandle()->width(); + h = q->windowHandle()->height(); + } + } + QPoint oldp = q->geometry().topLeft(); QSize olds = q->size(); QRect r(x, y, w, h); @@ -720,7 +731,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) q->windowHandle()->setGeometry(QRect(posInNativeParent,r.size())); } const QWidgetBackingStore *bs = maybeBackingStore(); - if (bs->store) { + if (bs && bs->store) { if (isResize) bs->store->resize(r.size()); } -- cgit v1.2.3 From 9ec493fa41d06a618d3983c02d9a1141d9d306df Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 15 Apr 2013 13:18:11 +0200 Subject: Convert the new filename to native separators before checking it If a native separator was put in the new name when renaming a file name via the file dialog then it would correctly fail. But if a non-native one was used on Windows then it would cause the file to be moved instead if the directory existed. Change-Id: If01760b8c54a69b600c9a44c7509017be70d33e3 Reviewed-by: Stephen Kelly --- src/widgets/dialogs/qfilesystemmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 9556c0ed15..8e3ecc3e0e 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -850,7 +850,7 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in return true; if (newName.isEmpty() - || newName.contains(QDir::separator()) + || QDir::toNativeSeparators(newName).contains(QDir::separator()) || !QDir(filePath(parent(idx))).rename(oldName, newName)) { #ifndef QT_NO_MESSAGEBOX QMessageBox::information(0, QFileSystemModel::tr("Invalid filename"), -- cgit v1.2.3 From 8cbc7ef05cbf8da8a3f3d39c22900c18ac32465e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 16 Apr 2013 06:40:04 +0200 Subject: Fix the QTouchEventSequence code snippet so that it compiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The release() function also requires the QPoint to be set which was missing from the code snippet. Change-Id: I4a5cd2bed0915eb1fbaac3a34fb229eac9c284df Reviewed-by: Topi Reiniö Reviewed-by: Geir Vattekar --- src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp index ab6ca63f40..a17628155a 100644 --- a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp +++ b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp @@ -229,8 +229,8 @@ QTest::touchEvent(&widget) .move(0, QPoint(12, 12)) .move(1, QPoint(45, 5)); QTest::touchEvent(&widget) - .release(0) - .release(1); + .release(0, QPoint(12, 12)) + .release(1, QPoint(45, 5)); //! [25] -- cgit v1.2.3 From 2bd846f8da8c6e8c61539f2cc986df4602e5d80e Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 17 Apr 2013 17:39:15 +0200 Subject: Cocoa Menu: Remove unnecessary retain, release/retain in the right order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also, make sure platform menu item is deleted on ActionRemoved event. Change-Id: Ic07a81cb77833bdffd1464abf1c81ebdee4d16e9 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoamenuitem.mm | 7 ++----- src/widgets/widgets/qmenu.cpp | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index dd99a6f3bc..350ef8a16a 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -218,8 +218,6 @@ NSMenuItem *QCocoaMenuItem::sync() mergeItem = [loader aboutMenuItem]; else mergeItem = [loader aboutQtMenuItem]; - - m_merged = true; } else if (m_text.startsWith(tr("Config"), Qt::CaseInsensitive) || m_text.startsWith(tr("Preference"), Qt::CaseInsensitive) || m_text.startsWith(tr("Options"), Qt::CaseInsensitive) @@ -240,9 +238,9 @@ NSMenuItem *QCocoaMenuItem::sync() if (mergeItem) { m_merged = true; + [mergeItem retain]; [m_native release]; m_native = mergeItem; - [m_native retain]; // balance out release! [m_native setTag:reinterpret_cast(this)]; } else if (m_merged) { // was previously merged, but no longer @@ -256,13 +254,12 @@ NSMenuItem *QCocoaMenuItem::sync() m_native = [[NSMenuItem alloc] initWithTitle:QCFString::toNSString(m_text) action:nil keyEquivalent:@""]; - [m_native retain]; [m_native setTag:reinterpret_cast(this)]; } // [m_native setHidden:YES]; // [m_native setHidden:NO]; - [m_native setHidden: !m_isVisible]; + [m_native setHidden: !m_isVisible]; [m_native setEnabled: m_enabled]; QString text = m_text; QKeySequence accel = m_shortcut; diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 6b02e7371f..aaedd7ffee 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -3004,6 +3004,7 @@ void QMenu::actionEvent(QActionEvent *e) } else if (e->type() == QEvent::ActionRemoved) { QPlatformMenuItem *menuItem = d->platformMenu->menuItemForTag(reinterpret_cast(e->action())); d->platformMenu->removeMenuItem(menuItem); + delete menuItem; } else if (e->type() == QEvent::ActionChanged) { QPlatformMenuItem *menuItem = d->platformMenu->menuItemForTag(reinterpret_cast(e->action())); copyActionToPlatformItem(e->action(), menuItem); -- cgit v1.2.3 From b381581579e2e49f5f8211bf4260a141e0642cd2 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 17 Apr 2013 11:27:43 +0200 Subject: Mac: Fix various memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id554be11ffcf9a506c217b0dc5b96cb37c4dd57c Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoaintegration.mm | 4 +++- src/plugins/platforms/cocoa/qcocoamenu.mm | 4 ++-- src/plugins/platforms/cocoa/qcocoasystemsettings.mm | 4 ++-- src/widgets/styles/qmacstyle_mac.mm | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index e2d867e623..821e10de52 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -122,7 +122,9 @@ void QCocoaScreen::updateGeometry() m_physicalSize = QSizeF(size.width, size.height); m_logicalDpi.first = 72; m_logicalDpi.second = 72; - float refresh = CGDisplayModeGetRefreshRate(CGDisplayCopyDisplayMode(dpy)); + CGDisplayModeRef displayMode = CGDisplayCopyDisplayMode(dpy); + float refresh = CGDisplayModeGetRefreshRate(displayMode); + CGDisplayModeRelease(displayMode); if (refresh > 0) m_refreshRate = refresh; diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 732851ecf7..bde9ded14f 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -323,7 +323,8 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf // typical use-case for a choice list, or non-editable combobox. We can't // re-use the popUpContextMenu:withEvent:forView: logic below since it won't // respect the menu's minimum width. - NSPopUpButtonCell *popupCell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]; + NSPopUpButtonCell *popupCell = [[[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO] + autorelease]; [popupCell setAltersStateOfSelectedItem:NO]; [popupCell setTransparent:YES]; [popupCell setMenu:m_nativeMenu]; @@ -350,7 +351,6 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf eventNumber:0 clickCount:1 pressure:1.0]; - NSSize size = m_nativeMenu.size; [NSMenu popUpContextMenu:m_nativeMenu withEvent:menuEvent forView:view]; } diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm index e613dbbd1b..af817bd4c5 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm @@ -176,7 +176,7 @@ QHash qt_mac_createRolePalettes() QHash palettes; QColor qc; for (int i = 0; mac_widget_colors[i].paletteRole != QPlatformTheme::NPalettes; i++) { - QPalette pal = *qt_mac_createSystemPalette(); + QPalette &pal = *qt_mac_createSystemPalette(); if (mac_widget_colors[i].active != 0) { qc = qt_mac_colorForThemeTextColor(mac_widget_colors[i].active); pal.setColor(QPalette::Active, QPalette::Text, qc); @@ -223,7 +223,7 @@ QHash qt_mac_createRolePalettes() pal.setBrush(QPalette::Disabled, QPalette::Base, pal.brush(QPalette::Active, QPalette::Base)); } - palettes.insert(mac_widget_colors[i].paletteRole, new QPalette(pal)); + palettes.insert(mac_widget_colors[i].paletteRole, &pal); } return palettes; } diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 04fea3ec47..c9cc56b101 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1785,6 +1785,7 @@ QMacStyle::~QMacStyle() NotificationReceiver *receiver = static_cast(d->receiver); [[NSNotificationCenter defaultCenter] removeObserver:receiver]; + [receiver release]; } #endif -- cgit v1.2.3 From 8ddcc18ac100c010ac8bdfe809656f2e8f39e30e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 15 Apr 2013 14:23:52 +0200 Subject: Remove nativeResourceForWindow warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The warning is useful for pointing out the the return value will be null. However, code that correctly checks the return value (such as qt_macWindowIsTextured), still causes the warning to be printed. Change-Id: I3828992b3d5e7b08451cf0e051b937fa9d9536d3 Reviewed-by: Jan Arve Sæther --- src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 5368b2f938..84261ad273 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -85,10 +85,8 @@ void *QCocoaNativeInterface::nativeResourceForContext(const QByteArray &resource void *QCocoaNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) { - if (!window->handle()) { - qWarning("QCocoaNativeInterface::nativeResourceForWindow: Native window has not been created."); + if (!window->handle()) return 0; - } if (resourceString == "nsopenglcontext") { return static_cast(window->handle())->currentContext()->nsOpenGLContext(); -- cgit v1.2.3 From 67bd27fee2991d91c6aa7098a5842d1737964cad Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 18 Apr 2013 11:14:47 +0200 Subject: List the Qt5::WinMain Release configuration before the Debug one. Apply the logic from commit d7ae34fdfde61838ce1e4fb13a945832841f61ab (List the Release library before the Debug library in cmake files., 2013-02-21) to the Qt5::WinMain library too. Task-number: QTBUG-29186 Change-Id: Ie465fef1cc0fc842d86c5bc69ab84ec65ec652d9 Reviewed-by: Andy Shaw --- src/corelib/Qt5CoreConfigExtras.cmake.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 379fb5d10e..3932c9e2c7 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -85,24 +85,24 @@ set(Qt5Core_QTMAIN_LIBRARIES Qt5::WinMain) if (NOT TARGET Qt5::WinMain) add_library(Qt5::WinMain STATIC IMPORTED) -!!IF !isEmpty(CMAKE_DEBUG_TYPE) - set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) +!!IF !isEmpty(CMAKE_RELEASE_TYPE) + set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_target_properties(Qt5::WinMain PROPERTIES !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - IMPORTED_LOCATION_DEBUG \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\" + IMPORTED_LOCATION_RELEASE \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\" !!ELSE - IMPORTED_LOCATION_DEBUG \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\" + IMPORTED_LOCATION_RELEASE \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\" !!ENDIF ) !!ENDIF -!!IF !isEmpty(CMAKE_RELEASE_TYPE) - set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +!!IF !isEmpty(CMAKE_DEBUG_TYPE) + set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) set_target_properties(Qt5::WinMain PROPERTIES !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - IMPORTED_LOCATION_RELEASE \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\" + IMPORTED_LOCATION_DEBUG \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\" !!ELSE - IMPORTED_LOCATION_RELEASE \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\" + IMPORTED_LOCATION_DEBUG \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\" !!ENDIF ) !!ENDIF -- cgit v1.2.3 From cbde509965a30bbcfb7930b84f22bdb7835c104e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Fri, 12 Apr 2013 20:27:16 +0100 Subject: Fix memory leak. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7d308a869fdc729bd46ace336b71c7e30556d65d Reviewed-by: Sean Harmer Reviewed-by: Samuel Rødal --- src/gui/opengl/qopenglbuffer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp index 87cb4cd93d..d70f326415 100644 --- a/src/gui/opengl/qopenglbuffer.cpp +++ b/src/gui/opengl/qopenglbuffer.cpp @@ -316,6 +316,8 @@ void QOpenGLBuffer::destroy() d->guard->free(); d->guard = 0; } + delete d->funcs; + d->funcs = 0; } /*! -- cgit v1.2.3 From a7fd8696dd303ab09328a916aa2a98e4d88db38d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 16 Apr 2013 15:26:38 +0200 Subject: Hide "invalid" accessibility interfaces. Those with a null object pointer and those with a null rect. Change-Id: I40e0c435ee768fc8c58098fec131eb65e89d76f2 Reviewed-by: Frederik Gladhorn --- .../accessibilityinspector/accessibilityscenemanager.cpp | 16 ++++++++++++++-- util/accessibilityinspector/optionswidget.h | 16 ++++++++++++++++ util/accessibilityinspector/screenreader.cpp | 3 ++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/util/accessibilityinspector/accessibilityscenemanager.cpp b/util/accessibilityinspector/accessibilityscenemanager.cpp index 80bc3f4ba8..6ecf30c163 100644 --- a/util/accessibilityinspector/accessibilityscenemanager.cpp +++ b/util/accessibilityinspector/accessibilityscenemanager.cpp @@ -253,9 +253,21 @@ void AccessibilitySceneManager::updateItemFlags(QGraphicsRectItem *item, QAccess } } + if (m_optionsWidget->hideNullObjectItems()) { + if (interface->object() == 0) { + shouldShow = false; + } + } + + if (m_optionsWidget->hideNullRectItems()) { + if (interface->rect().isNull()) { + shouldShow = false; + } + } + item->setVisible(shouldShow); - if (interface->object() == m_selectedObject) + if (interface->object() && interface->object() == m_selectedObject) item->setBrush(QColor(Qt::yellow)); else item->setBrush(QColor(Qt::white)); @@ -392,7 +404,7 @@ void AccessibilitySceneManager::addGraphicsItems(AccessibilitySceneManager::Tree graphicsItem->setRect(0, 0, m_treeItemWidth, m_treeItemHeight); graphicsItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape); - if (item.object == m_selectedObject) + if (item.object && item.object == m_selectedObject) graphicsItem->setBrush(QColor(Qt::yellow)); else graphicsItem->setBrush(QColor(Qt::white)); diff --git a/util/accessibilityinspector/optionswidget.h b/util/accessibilityinspector/optionswidget.h index 95c7fdf44a..9283122af7 100644 --- a/util/accessibilityinspector/optionswidget.h +++ b/util/accessibilityinspector/optionswidget.h @@ -77,6 +77,18 @@ public: m_hidePaneItems->setChecked(true); connect(m_hidePaneItems, SIGNAL(toggled(bool)), SIGNAL(optionsChanged())); + m_hideNullObjectItems = new QCheckBox(this); + m_layout->addWidget(m_hideNullObjectItems); + m_hideNullObjectItems->setText("Hide Items with a null QObject pointer"); + m_hideNullObjectItems->setChecked(true); + connect(m_hideNullObjectItems, SIGNAL(toggled(bool)), SIGNAL(optionsChanged())); + + m_hideNullRectItems = new QCheckBox(this); + m_layout->addWidget(m_hideNullRectItems); + m_hideNullRectItems->setText("Hide Items with a null rect"); + m_hideNullRectItems->setChecked(true); + connect(m_hideNullRectItems, SIGNAL(toggled(bool)), SIGNAL(optionsChanged())); + m_enableTextToSpeach = new QCheckBox(this); m_layout->addWidget(m_enableTextToSpeach); m_enableTextToSpeach->setText("Enable Text To Speech"); @@ -96,6 +108,8 @@ public: bool hideInvisibleItems() { return m_hideInvisibleItems->isChecked(); } bool hideOffscreenItems() { return m_hideOffscreenItems->isChecked(); } bool hidePaneItems() { return m_hidePaneItems->isChecked(); } + bool hideNullObjectItems() { return m_hideNullObjectItems->isChecked(); } + bool hideNullRectItems() { return m_hideNullRectItems->isChecked(); } bool enableTextToSpeach() { return m_enableTextToSpeach->isChecked(); } signals: void optionsChanged(); @@ -109,6 +123,8 @@ private: QCheckBox *m_hideInvisibleItems; QCheckBox *m_hideOffscreenItems; QCheckBox *m_hidePaneItems; + QCheckBox *m_hideNullObjectItems; + QCheckBox *m_hideNullRectItems; QCheckBox *m_enableTextToSpeach; QSlider *m_scale; }; diff --git a/util/accessibilityinspector/screenreader.cpp b/util/accessibilityinspector/screenreader.cpp index 8b627b1454..262c8db986 100644 --- a/util/accessibilityinspector/screenreader.cpp +++ b/util/accessibilityinspector/screenreader.cpp @@ -107,7 +107,8 @@ void ScreenReader::processTouchPoint() } m_selectedInterface = currentInterface; - emit selected(m_selectedInterface->object()); + if (m_selectedInterface->object()) + emit selected(m_selectedInterface->object()); if (m_optionsWidget->enableTextToSpeach()) speak(m_selectedInterface->text(QAccessible::Name) /*+ "," + translateRole(m_selectedInterface->role(0)) */); -- cgit v1.2.3 From b9450734c9bc2811fd6e04379ce8290ca041b4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 16 Apr 2013 13:34:18 +0200 Subject: Compile with changes to the accessibility API. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I72e7636a02ad2fba984f4a96cbb33d441a7f8be7 Reviewed-by: Jan Arve Sæther --- .../accessibilityinspector.cpp | 6 ++-- .../accessibilityscenemanager.cpp | 38 +++++++--------------- .../accessibilityscenemanager.h | 2 +- util/accessibilityinspector/screenreader.cpp | 3 +- 4 files changed, 17 insertions(+), 32 deletions(-) diff --git a/util/accessibilityinspector/accessibilityinspector.cpp b/util/accessibilityinspector/accessibilityinspector.cpp index b7cc9919a4..bf55c36df9 100644 --- a/util/accessibilityinspector/accessibilityinspector.cpp +++ b/util/accessibilityinspector/accessibilityinspector.cpp @@ -62,7 +62,7 @@ void MouseInterceptingGraphicsScene::mouseDoubleClickEvent(QGraphicsSceneMouseEv AccessibilitySceneManager *sceneManager = 0; QAccessible::UpdateHandler previousUpdateHandler = 0; bool updateHandlerRecursion = false; -void accessibilityUpdateHandler(QObject *object, int who, QAccessible::Event reason) +void accessibilityUpdateHandler(QAccessibleEvent *event) { if (updateHandlerRecursion) return; @@ -70,13 +70,13 @@ void accessibilityUpdateHandler(QObject *object, int who, QAccessible::Event rea updateHandlerRecursion = true; if (sceneManager) { - sceneManager->handleUpdate(object, reason); + sceneManager->handleUpdate(event); //qDebug() << "update"; } if (previousUpdateHandler) // call prev just to be sure. - previousUpdateHandler(object, who, reason); + previousUpdateHandler(event); updateHandlerRecursion = false; } diff --git a/util/accessibilityinspector/accessibilityscenemanager.cpp b/util/accessibilityinspector/accessibilityscenemanager.cpp index 6ecf30c163..1a9cf12e00 100644 --- a/util/accessibilityinspector/accessibilityscenemanager.cpp +++ b/util/accessibilityinspector/accessibilityscenemanager.cpp @@ -73,7 +73,6 @@ void AccessibilitySceneManager::updateAccessibilitySceneItemFlags() if (!interface) continue; updateItemFlags(m_graphicsItems.value(object), interface); - delete interface; } } @@ -89,15 +88,18 @@ void AccessibilitySceneManager::populateAccessibilityTreeScene() populateAccessibilityTreeScene(rootInterface); } -void AccessibilitySceneManager::handleUpdate(QObject *object, QAccessible::Event reason) +void AccessibilitySceneManager::handleUpdate(QAccessibleEvent *event) { + QObject *object = event->object(); + QAccessible::Event type = event->type(); + QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(object); if (!interface) return; QString name = interface->text(QAccessible::Name); - if (reason == QAccessible::ObjectCreated) { + if (type == QAccessible::ObjectCreated) { // qDebug() << "ObjectCreated" << object << name; populateAccessibilityScene(interface, m_scene); } @@ -109,7 +111,7 @@ void AccessibilitySceneManager::handleUpdate(QObject *object, QAccessible::Event return; } - if (reason == QAccessible::LocationChanged) { + if (type == QAccessible::LocationChanged) { //if (name.startsWith("List")) qDebug() << "locationChange" << object << name << interface->rect(); @@ -119,12 +121,10 @@ void AccessibilitySceneManager::handleUpdate(QObject *object, QAccessible::Event QAccessibleInterface *child = interface->child(i); if (child) { updateItem(m_graphicsItems.value(child->object()), child); - delete child; } } - delete interface; - } else if (reason == QAccessible::ObjectDestroyed) { + } else if (type == QAccessible::ObjectDestroyed) { // qDebug() << "ObjectDestroyed" << object << name; delete m_graphicsItems.value(object); m_graphicsItems.remove(object); @@ -132,28 +132,25 @@ void AccessibilitySceneManager::handleUpdate(QObject *object, QAccessible::Event if (object == m_selectedObject) { m_selectedObject = 0; } - } else if (reason == QAccessible::ObjectHide) { + } else if (type == QAccessible::ObjectHide) { // qDebug() << "ObjectCreated Hide" << object; updateItemFlags(item, interface); - } else if (reason == QAccessible::ObjectShow) { + } else if (type == QAccessible::ObjectShow) { // qDebug() << "ObjectCreated Show" << object; updateItemFlags(item, interface); - } else if (reason == QAccessible::ScrollingStart) { + } else if (type == QAccessible::ScrollingStart) { qDebug() << "ObjectCreated ScrollingStart" << object; - QAccessibleInterface *child = 0; for (int i = 0; i < interface->childCount(); ++i) { QAccessibleInterface *child = interface->child(i); if (child) { m_animatedObjects.insert(child->object()); - delete child; } } - } else if (reason == QAccessible::ScrollingEnd) { + } else if (type == QAccessible::ScrollingEnd) { // qDebug() << "ObjectCreated ScrollingEnd" << object; foreach (QObject *object, m_animatedObjects) { updateItem(m_graphicsItems.value(object), interface); } - delete interface; m_animatedObjects.clear(); } else { @@ -197,10 +194,7 @@ void AccessibilitySceneManager::updateItems(QObject *root) for (int i = 0; i < interface->childCount(); ++i) { QAccessibleInterface *child = interface->child(i); updateItems(child->object()); - delete child; } - - delete interface; } void AccessibilitySceneManager::updateItem(QObject *object) @@ -213,8 +207,6 @@ void AccessibilitySceneManager::updateItem(QObject *object) return; updateItem(m_graphicsItems.value(object), interface); - - delete interface; } void AccessibilitySceneManager::updateItem(QGraphicsRectItem *item, QAccessibleInterface *interface) @@ -332,7 +324,6 @@ void AccessibilitySceneManager::populateAccessibilityScene(QAccessibleInterface QAccessibleInterface *child = interface->child(i); updateItems(child->object()); populateAccessibilityScene(child, scene); - delete child; } } @@ -351,7 +342,6 @@ AccessibilitySceneManager::TreeItem AccessibilitySceneManager::computeLevels(QAc TreeItem childLevel = computeLevels(child, level + 1); currentLevel.children.append(childLevel); currentLevel.width += childLevel.width + m_treeItemHorizontalPadding; - delete child; } } @@ -485,11 +475,7 @@ bool AccessibilitySceneManager::isHidden(QAccessibleInterface *interface) return true; } - QAccessibleInterface *parent = current->parent(); - - if (current != interface) - delete current; - current = parent; + current = current->parent(); } return false; diff --git a/util/accessibilityinspector/accessibilityscenemanager.h b/util/accessibilityinspector/accessibilityscenemanager.h index 3abc5d1b37..7467cbd0d4 100644 --- a/util/accessibilityinspector/accessibilityscenemanager.h +++ b/util/accessibilityinspector/accessibilityscenemanager.h @@ -63,7 +63,7 @@ public slots: void populateAccessibilityScene(); void updateAccessibilitySceneItemFlags(); void populateAccessibilityTreeScene(); - void handleUpdate(QObject *object, QAccessible::Event reason); + void handleUpdate(QAccessibleEvent *event); void setSelected(QObject *object); void changeScale(int scale); diff --git a/util/accessibilityinspector/screenreader.cpp b/util/accessibilityinspector/screenreader.cpp index 262c8db986..5dcf52ef09 100644 --- a/util/accessibilityinspector/screenreader.cpp +++ b/util/accessibilityinspector/screenreader.cpp @@ -42,6 +42,7 @@ #include "screenreader.h" #include "optionswidget.h" #include "accessibilityscenemanager.h" +#include #include ScreenReader::ScreenReader(QObject *parent) : @@ -54,8 +55,6 @@ ScreenReader::ScreenReader(QObject *parent) : ScreenReader::~ScreenReader() { - delete m_selectedInterface; - delete m_rootInterface; } void ScreenReader::setRootObject(QObject *rootObject) -- cgit v1.2.3 From 8e27fcb3fe68e4c285807eb02e3603abb5f1a0fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 18 Apr 2013 13:06:46 +0200 Subject: Harden check for SDK platform name on Mac OS We now use an absolute path, to prevent picking up the wrong plutil binary. In addition we pipe the possible stderr output of plutil and xpath to the null device, so that the final QMAKE_MAC_PLATFORM_NAME will be empty in case of any errors, and caught by the isEmpty() check below. Change-Id: I8ad24bf63162a76410c2ae223dd2fc48e7886bbf Reviewed-by: Oswald Buddenhagen --- mkspecs/features/mac/sdk.prf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index ece0e27536..f5b1639a5d 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -31,9 +31,9 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_ } # We use xml as the output format instead of json since plutil on 10.6 does not have that option -QMAKE_MAC_PLATFORM_NAME = $$system("plutil -convert xml1 \"$$QMAKE_MAC_SDK_PATH/SDKSettings.plist\" -o - | " \ +QMAKE_MAC_PLATFORM_NAME = $$system("/usr/bin/plutil -convert xml1 \"$$QMAKE_MAC_SDK_PATH/SDKSettings.plist\" -o - 2>/dev/null | " \ "sed '/^&1 | " \ + "PERL5LIB= xpath 'string(//key[.=\"PLATFORM_NAME\"]/following-sibling::*[1])' 2>/dev/null | " \ "sed 's/.*Value: \\(.*\\)/\\1/'") isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK '$$QMAKE_MAC_SDK'") -- cgit v1.2.3 From b9826799405293ee5969015eed37957daad198ee Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 17 Apr 2013 09:59:52 +0200 Subject: Mac: Fix warnings about non-existing native Windows on startup. Shown for example by Qt Designer. Change-Id: Ia866a93a781a027aa3703f44314954888d75d436 Reviewed-by: Richard Moe Gustavsen --- src/widgets/styles/qmacstyle_mac.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index c9cc56b101..ed721e06c4 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -661,11 +661,11 @@ static CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget) bool qt_macWindowIsTextured(const QWidget *window) { - NSWindow *nswindow = static_cast( - QApplication::platformNativeInterface()->nativeResourceForWindow("NSWindow", window->windowHandle())); - if (!nswindow) - return false; - return ([nswindow styleMask] & NSTexturedBackgroundWindowMask) ? true : false; + if (QWindow *w = window->windowHandle()) + if (w->handle()) + if (NSWindow *nswindow = static_cast(QGuiApplication::platformNativeInterface()->nativeResourceForWindow(QByteArrayLiteral("NSWindow"), w))) + return ([nswindow styleMask] & NSTexturedBackgroundWindowMask) ? true : false; + return false; } /***************************************************************************** -- cgit v1.2.3 From b3bed2c8deb8c4f09ac7b5023cfc24a69a95ad46 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 18 Apr 2013 13:43:31 +0200 Subject: Fix format for alpha drawing. Task-number: QTBUG-28531 Change-Id: Ie97953950cad26776724848adc5751c861903cf7 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/windows/qwindowsbackingstore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index b40aefa225..dfbbe3069c 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -146,7 +146,7 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion ®ion) #endif QImage::Format format = QWindowsNativeImage::systemFormat(); if (format == QImage::Format_RGB32 && rasterWindow()->window()->format().hasAlpha()) - format = QImage::Format_ARGB32; + format = QImage::Format_ARGB32_Premultiplied; m_image.reset(new QWindowsNativeImage(size.width(), size.height(), format)); } } -- cgit v1.2.3 From 835e720c7e47e3e5ea70875bf26b0b71d6729b57 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 17 Apr 2013 17:42:32 +0200 Subject: SSL internals: fix memory corruption using QSslConfigurationPrivate We are passing a QSslConfigurationPrivate that is allocated on the stack (in QSslSocketBackendPrivate::initSslContext()) to QSslConfiguration::QSslConfiguration(QSslConfigurationPrivate *dd). When the SSL context is destroyed, this object is not there any more. So now we create a deep copy of the configuration like we do in QSslSocket::sslConfiguration(). Task-number: QTBUG-30648 Change-Id: Iaefaa9c00fd6bfb707eba5ac59e9508bf951f8a5 Reviewed-by: Richard J. Moore --- src/network/ssl/qsslsocket_openssl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 2b9c4b5bd2..3b2de7a05b 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -325,9 +325,13 @@ bool QSslSocketBackendPrivate::initSslContext() Q_Q(QSslSocket); // If no external context was set (e.g. bei QHttpNetworkConnection) we will create a default context - if (!sslContextPointer) + if (!sslContextPointer) { + // create a deep copy of our configuration + QSslConfigurationPrivate *configurationCopy = new QSslConfigurationPrivate(configuration); + configurationCopy->ref.store(0); // the QSslConfiguration constructor refs up sslContextPointer = QSharedPointer( - QSslContext::fromConfiguration(mode, QSslConfiguration(&configuration), allowRootCertOnDemandLoading)); + QSslContext::fromConfiguration(mode, configurationCopy, allowRootCertOnDemandLoading)); + } if (sslContextPointer->error() != QSslError::NoError) { q->setErrorString(sslContextPointer->errorString()); -- cgit v1.2.3 From 6e73061c58236c2300f471dffea2e2606158fbac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 18 Apr 2013 09:41:23 +0200 Subject: Actually set devicePixelRatio on copy. Followup to 7b9d4531 - the second part refactors to call setDevicePixelRatio but the call itself was left out. Change-Id: I3e36452603fe1d7d53fa1a74d87169efea1c2e78 Reviewed-by: Gabriel de Dietrich --- src/gui/image/qpixmap_raster.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index c80ccd8b1d..f9a017c281 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -244,6 +244,7 @@ QImage QRasterPlatformPixmap::toImage(const QRect &rect) const QImage newImage(image.scanLine(clipped.y()) + clipped.x() * (du / 8), clipped.width(), clipped.height(), image.bytesPerLine(), image.format()); + newImage.setDevicePixelRatio(image.devicePixelRatio()); return newImage; } else { return image.copy(clipped); -- cgit v1.2.3 From e34dccc9e563966caafb113bd8cacb70cf5d57fd Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 10 Apr 2013 12:14:13 +0200 Subject: Allow using Ctrl+C to copy selected text from DetailedText in QMessageBox Task-number: QTBUG-21895 Change-Id: Ib28f064295493595263945bc72907bf95d2cb909 Reviewed-by: Stephen Kelly --- src/widgets/dialogs/qmessagebox.cpp | 40 +++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index a485a55609..e08b321289 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -90,6 +90,7 @@ enum DetailButtonLabel { ShowLabel = 0, HideLabel = 1 }; #ifndef QT_NO_TEXTEDIT class QMessageBoxDetailsText : public QWidget { + Q_OBJECT public: class TextEdit : public QTextEdit { @@ -109,6 +110,7 @@ public: QMessageBoxDetailsText(QWidget *parent=0) : QWidget(parent) + , copyAvailable(false) { QVBoxLayout *layout = new QVBoxLayout; layout->setMargin(0); @@ -122,10 +124,29 @@ public: textEdit->setReadOnly(true); layout->addWidget(textEdit); setLayout(layout); + + connect(textEdit, SIGNAL(copyAvailable(bool)), + this, SLOT(textCopyAvailable(bool))); } void setText(const QString &text) { textEdit->setPlainText(text); } QString text() const { return textEdit->toPlainText(); } + + bool copy() + { + if (!copyAvailable) + return false; + textEdit->copy(); + return true; + } + +private slots: + void textCopyAvailable(bool available) + { + copyAvailable = available; + } + private: + bool copyAvailable; TextEdit *textEdit; }; #endif // QT_NO_TEXTEDIT @@ -1362,7 +1383,19 @@ void QMessageBox::keyPressEvent(QKeyEvent *e) return; } -#if defined (Q_OS_WIN) && !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT) + +#if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT) + +#if !defined(QT_NO_TEXTEDIT) + if (e == QKeySequence::Copy) { + if (d->detailsText->isVisible() && d->detailsText->copy()) { + e->setAccepted(true); + return; + } + } +#endif // !QT_NO_TEXTEDIT + +#if defined(Q_OS_WIN) if (e == QKeySequence::Copy) { QString separator = QString::fromLatin1("---------------------------\n"); QString textToCopy = separator; @@ -1383,7 +1416,9 @@ void QMessageBox::keyPressEvent(QKeyEvent *e) QApplication::clipboard()->setText(textToCopy); return; } -#endif //QT_NO_SHORTCUT QT_NO_CLIPBOARD Q_OS_WIN +#endif // Q_OS_WIN + +#endif // !QT_NO_CLIPBOARD && !QT_NO_SHORTCUT #ifndef QT_NO_SHORTCUT if (!(e->modifiers() & Qt::AltModifier)) { @@ -2634,5 +2669,6 @@ QPixmap QMessageBox::standardIcon(Icon icon) QT_END_NAMESPACE #include "moc_qmessagebox.cpp" +#include "qmessagebox.moc" #endif // QT_NO_MESSAGEBOX -- cgit v1.2.3 From 96134c6f585963c9d449db17589f21e67519a2a8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Apr 2013 14:41:50 -0700 Subject: Make sure to also check for null CFPropertyLists. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In 1b08e0307dfebe561fbb0819a2d6b53edd8e8e93, I removed the null check by accident. It's possible for the Darwin API to return a null property list. Task-number: QTBUG-30760 Change-Id: Iaf0125767fe4b47c19810b70483a5219e94e4305 Reviewed-by: Morten Johan Sørvig --- src/corelib/tools/qlocale_mac.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm index 8594cfd40d..9292dccf19 100644 --- a/src/corelib/tools/qlocale_mac.mm +++ b/src/corelib/tools/qlocale_mac.mm @@ -438,6 +438,9 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const kCFPreferencesCurrentUser, kCFPreferencesAnyHost); QStringList result; + if (!languages) + return QVariant(result); + CFTypeID typeId = CFGetTypeID(languages); if (typeId == CFArrayGetTypeID()) { const int cnt = CFArrayGetCount(languages.as()); -- cgit v1.2.3 From e9b2d029f978a4a55197af82f97f7c302207eb01 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 17 Apr 2013 11:44:40 +0200 Subject: iOS: QIOSBackingStore: enable FBO depth and stencil buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unless we enable those buffers for the FBO that backs the backingstore, setting a clip region on an associated QPainter will not work. One apparent bug from this was the menubar. Without this patch it appeared to never be drawn. The reason was that we ended up drawing the menubar background over the whole menubar instead of inside the clip region. Change-Id: I25660cec6ce9e43fe4cd693127dca6afeb8dcf65 Reviewed-by: Samuel Rødal --- src/plugins/platforms/ios/qiosbackingstore.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/ios/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm index 566ff3a672..f3c1af2b2d 100644 --- a/src/plugins/platforms/ios/qiosbackingstore.mm +++ b/src/plugins/platforms/ios/qiosbackingstore.mm @@ -52,7 +52,11 @@ QIOSBackingStore::QIOSBackingStore(QWindow *window) , m_context(new QOpenGLContext) , m_device(0) { - m_context->setFormat(window->requestedFormat()); + QSurfaceFormat fmt = window->requestedFormat(); + fmt.setDepthBufferSize(16); + fmt.setStencilBufferSize(8); + + m_context->setFormat(fmt); m_context->setScreen(window->screen()); m_context->create(); } -- cgit v1.2.3 From 8597458cebf1df64b5559426ec5c1d14567b2a83 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 16 Apr 2013 14:29:14 +0200 Subject: qdoc: Include words from the module name as tags in example manifest This change adds words from the module name (QHP 'project' name defined in .qdocconf files) as tags for the module's examples. This makes searching for examples easier in Qt Creator: For example, typing 'multimedia' will list all examples in Qt Multimedia and Qt Multimedia Widgets modules. Other minor changes: - Exclude 'qt' as a tag (not needed) - Exclude one-character strings as tags Task-number: QTBUG-28720 Change-Id: I53751b7a87ff39ee7b648f865c9090c52444de76 Reviewed-by: Martin Smith --- src/tools/qdoc/htmlgenerator.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index e49f083e5b..c5dc7d17c9 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -4182,15 +4182,28 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element) else writer.writeCDATA(QString("No description available")); writer.writeEndElement(); // description + + // Add words from module name as tags (QtQuickControls -> qt,quick,controls) + QRegExp re("([A-Z][a-z0-9]+)"); + int pos = 0; + while ((pos = re.indexIn(project, pos)) != -1) { + tags << re.cap(1).toLower(); + pos += re.matchedLength(); + } tags += QSet::fromList(en->title().toLower().split(QLatin1Char(' '))); if (!tags.isEmpty()) { writer.writeStartElement("tags"); bool wrote_one = false; + // Exclude invalid and common words foreach (QString tag, tags) { + if (tag.length() < 2) + continue; if (tag.at(0).isDigit()) continue; if (tag.at(0) == '-') continue; + if (tag == QStringLiteral("qt")) + continue; if (tag.startsWith("example")) continue; if (tag.startsWith("chapter")) -- cgit v1.2.3 From f3612f39ff5fb07f83b89732e8b7a643ee6d5cd3 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 13 Mar 2013 14:32:08 +0100 Subject: Make password mask characters themeable. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-29871 Change-Id: I3cf739a321d7917f8f8431992e29bba0871b1934 Reviewed-by: Morten Johan Sørvig Reviewed-by: Friedemann Kleint --- src/gui/kernel/qplatformintegration.cpp | 2 ++ src/gui/kernel/qplatformintegration.h | 3 ++- src/gui/kernel/qplatformtheme.cpp | 2 ++ src/gui/kernel/qplatformtheme.h | 3 ++- src/gui/kernel/qstylehints.cpp | 9 +++++++++ src/gui/kernel/qstylehints.h | 1 + .../themes/genericunix/qgenericunixthemes.cpp | 2 ++ src/plugins/platforms/cocoa/qcocoatheme.mm | 2 ++ src/widgets/styles/qcommonstyle.cpp | 16 ++++------------ src/widgets/styles/qmacstyle_mac.mm | 3 --- src/widgets/styles/qwindowsstyle.cpp | 15 --------------- src/widgets/widgets/qlineedit.cpp | 13 +++++++------ 12 files changed, 33 insertions(+), 38 deletions(-) diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 8a0540efc2..e82e30df80 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -313,6 +313,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const return false; case PasswordMaskDelay: return QPlatformTheme::defaultThemeHint(QPlatformTheme::PasswordMaskDelay); + case PasswordMaskCharacter: + return QPlatformTheme::defaultThemeHint(QPlatformTheme::PasswordMaskCharacter); case FontSmoothingGamma: return qreal(1.7); case StartDragVelocity: diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index bee2ba0caf..b7a44b13de 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -140,7 +140,8 @@ public: FontSmoothingGamma, StartDragVelocity, UseRtlExtensions, - SynthesizeMouseFromTouchEvents + SynthesizeMouseFromTouchEvents, + PasswordMaskCharacter }; virtual QVariant styleHint(StyleHint hint) const; diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp index b8bc72cf73..02b69bcb4d 100644 --- a/src/gui/kernel/qplatformtheme.cpp +++ b/src/gui/kernel/qplatformtheme.cpp @@ -238,6 +238,8 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint) return QVariant(500); case QPlatformTheme::PasswordMaskDelay: return QVariant(int(0)); + case QPlatformTheme::PasswordMaskCharacter: + return QVariant(QChar(0x25CF)); case QPlatformTheme::StartDragVelocity: return QVariant(int(0)); // no limit case QPlatformTheme::UseFullScreenForPopupMenu: diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h index ee12792547..80ba29a028 100644 --- a/src/gui/kernel/qplatformtheme.h +++ b/src/gui/kernel/qplatformtheme.h @@ -103,7 +103,8 @@ public: UiEffects, SpellCheckUnderlineStyle, TabAllWidgets, - IconPixmapSizes + IconPixmapSizes, + PasswordMaskCharacter }; enum DialogType { diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index 23bc165edd..30b12835f7 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -192,6 +192,15 @@ int QStyleHints::passwordMaskDelay() const return themeableHint(QPlatformTheme::PasswordMaskDelay, QPlatformIntegration::PasswordMaskDelay).toInt(); } +/*! + Returns the character used to mask the characters typed into text input + fields in password mode. +*/ +QChar QStyleHints::passwordMaskCharacter() const +{ + return themeableHint(QPlatformTheme::PasswordMaskCharacter, QPlatformIntegration::PasswordMaskCharacter).toChar(); +} + /*! Returns the gamma value used in font smoothing. */ diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h index 7a447aae67..64ef182aab 100644 --- a/src/gui/kernel/qstylehints.h +++ b/src/gui/kernel/qstylehints.h @@ -62,6 +62,7 @@ public: int cursorFlashTime() const; bool showIsFullScreen() const; int passwordMaskDelay() const; + QChar passwordMaskCharacter() const; qreal fontSmoothingGamma() const; bool useRtlExtensions() const; diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index 4fc542c39a..cabddcc815 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -448,6 +448,8 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const } case QPlatformTheme::KeyboardScheme: return QVariant(int(GnomeKeyboardScheme)); + case QPlatformTheme::PasswordMaskCharacter: + return QVariant(QChar(0x2022)); default: break; } diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index f8eed0ebf1..8337e00eb6 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -290,6 +290,8 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const sizes << 16 << 32 << 64 << 128; return QVariant::fromValue(sizes); } + case QPlatformTheme::PasswordMaskDelay: + return QVariant(QChar(kBulletUnicode)); default: break; } diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index f7ae667a82..c6edbee67d 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -4905,20 +4905,12 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = -1; break; case SH_LineEdit_PasswordCharacter: { - const QFontMetrics &fm = opt ? opt->fontMetrics - : (widget ? widget->fontMetrics() : QFontMetrics(QFont())); - ret = 0; - if (fm.inFont(QChar(0x25CF))) { - ret = 0x25CF; - } else if (fm.inFont(QChar(0x2022))) { - ret = 0x2022; - } else { - ret = '*'; - } + const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme(); + const QPlatformTheme::ThemeHint hintType = QPlatformTheme::PasswordMaskCharacter; + const QVariant hint = theme ? theme->themeHint(hintType) : QPlatformTheme::defaultThemeHint(hintType); + ret = hint.toChar().unicode(); break; } - - case SH_ToolBox_SelectedPageTitleBold: ret = 1; break; diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index ed721e06c4..b2bf2c5565 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -2466,9 +2466,6 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_TabBar_PreferNoArrows: ret = true; break; - case SH_LineEdit_PasswordCharacter: - ret = kBulletUnicode; - break; /* case SH_DialogButtons_DefaultButton: ret = QDialogButtons::Reject; diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 86fccabcbc..0acd6052c8 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -602,21 +602,6 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid } break; #endif // QT_NO_RUBBERBAND - case SH_LineEdit_PasswordCharacter: - { -#ifdef Q_OS_WIN - if (widget && (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { - const QFontMetrics &fm = widget->fontMetrics(); - if (fm.inFont(QChar(0x25CF))) - ret = 0x25CF; - else if (fm.inFont(QChar(0x2022))) - ret = 0x2022; - } -#endif - if (!ret) - ret = '*'; - } - break; #ifndef QT_NO_WIZARD case SH_WizardStyle: ret = QWizard::ModernStyle; diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index ea58ec1429..abef6e8832 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -360,9 +360,9 @@ void QLineEdit::setPlaceholderText(const QString& placeholderText) \brief the displayed text If \l echoMode is \l Normal this returns the same as text(); if - \l EchoMode is \l Password or \l PasswordEchoOnEdit it returns a string of asterisks - text().length() characters long, e.g. "******"; if \l EchoMode is - \l NoEcho returns an empty string, "". + \l EchoMode is \l Password or \l PasswordEchoOnEdit it returns a string of + platform-dependent password mask characters text().length() in size, + e.g. "******"; if \l EchoMode is \l NoEcho returns an empty string, "". By default, this property contains an empty string. @@ -440,10 +440,11 @@ void QLineEdit::setFrame(bool enable) \value NoEcho Do not display anything. This may be appropriate for passwords where even the length of the password should be kept secret. - \value Password Display asterisks instead of the characters - actually entered. + \value Password Display platform-dependent password mask characters instead + of the characters actually entered. \value PasswordEchoOnEdit Display characters as they are entered - while editing otherwise display asterisks. + while editing otherwise display characters as with + \c Password. \sa setEchoMode(), echoMode() */ -- cgit v1.2.3 From 02713994bf9c72a3cf1ab55b780ab23916d6f79b Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Sat, 13 Apr 2013 00:50:38 +0900 Subject: Make qtbase compile with QT_NO_DRAGANDDROP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id1a74c6b22b388d20103b4e73f83c8345ec70ba6 Reviewed-by: Oswald Buddenhagen Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind --- src/plugins/platforms/offscreen/qoffscreencommon.h | 2 ++ src/plugins/platforms/offscreen/qoffscreenintegration.cpp | 4 ++++ src/plugins/platforms/offscreen/qoffscreenintegration.h | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.h b/src/plugins/platforms/offscreen/qoffscreencommon.h index a5df7d05d3..28546aed88 100644 --- a/src/plugins/platforms/offscreen/qoffscreencommon.h +++ b/src/plugins/platforms/offscreen/qoffscreencommon.h @@ -73,12 +73,14 @@ public: QScopedPointer m_cursor; }; +#ifndef QT_NO_DRAGANDDROP class QOffscreenDrag : public QPlatformDrag { public: QMimeData *platformDropData() { return 0; } Qt::DropAction drag(QDrag *) { return Qt::IgnoreAction; } }; +#endif class QOffscreenBackingStore : public QPlatformBackingStore { diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp index e3fcc7ebb0..5b74ad3b8d 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp @@ -106,7 +106,9 @@ QOffscreenIntegration::QOffscreenIntegration() m_fontDatabase.reset(new QBasicFontDatabase()); #endif +#ifndef QT_NO_DRAGANDDROP m_drag.reset(new QOffscreenDrag); +#endif m_services.reset(new QPlatformServices); QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher); @@ -149,10 +151,12 @@ QPlatformFontDatabase *QOffscreenIntegration::fontDatabase() const return m_fontDatabase.data(); } +#ifndef QT_NO_DRAGANDDROP QPlatformDrag *QOffscreenIntegration::drag() const { return m_drag.data(); } +#endif QPlatformServices *QOffscreenIntegration::services() const { diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.h b/src/plugins/platforms/offscreen/qoffscreenintegration.h index eb03100ec9..b403ce83b3 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration.h +++ b/src/plugins/platforms/offscreen/qoffscreenintegration.h @@ -60,7 +60,9 @@ public: QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; +#ifndef QT_NO_DRAGANDDROP QPlatformDrag *drag() const; +#endif QPlatformServices *services() const; QPlatformFontDatabase *fontDatabase() const; @@ -71,7 +73,9 @@ public: private: QAbstractEventDispatcher *m_eventDispatcher; QScopedPointer m_fontDatabase; +#ifndef QT_NO_DRAGANDDROP QScopedPointer m_drag; +#endif QScopedPointer m_services; }; -- cgit v1.2.3 From 963b8dabef3b82f6d7cdda0669373ceae1629699 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 15 Apr 2013 14:43:30 +0200 Subject: Doc: Fix \group and \ingroup usage for a number of examples A number for groups, including 'all-examples' was defined multiple times by some examples. This change fixes the incorrect definitions. Change-Id: I2fb5da11e8762698942a076e0f0576033ce3cabc Reviewed-by: Jerome Pasion --- examples/widgets/doc/orientation.qdoc | 1 - examples/widgets/doc/src/applicationicon.qdoc | 1 - examples/widgets/doc/src/echoplugin.qdoc | 2 +- examples/widgets/doc/src/elidedlabel.qdoc | 1 - examples/widgets/doc/src/syntaxhighlighter.qdoc | 2 +- 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/widgets/doc/orientation.qdoc b/examples/widgets/doc/orientation.qdoc index c224f42e4b..df84595885 100644 --- a/examples/widgets/doc/orientation.qdoc +++ b/examples/widgets/doc/orientation.qdoc @@ -26,7 +26,6 @@ ****************************************************************************/ /*! \example widgets/orientation - \group all-examples \title Orientation Example \brief The example shows a simple way to use different UIs depending on the screen diff --git a/examples/widgets/doc/src/applicationicon.qdoc b/examples/widgets/doc/src/applicationicon.qdoc index 3c01c34a66..8f9e133e9c 100644 --- a/examples/widgets/doc/src/applicationicon.qdoc +++ b/examples/widgets/doc/src/applicationicon.qdoc @@ -26,7 +26,6 @@ ****************************************************************************/ /*! \example widgets/applicationicon - \group all-examples \title Application Icon Example \brief The example shows how to add an application icon to a mobile application. diff --git a/examples/widgets/doc/src/echoplugin.qdoc b/examples/widgets/doc/src/echoplugin.qdoc index 7b7aa9b868..2c56a2f53b 100644 --- a/examples/widgets/doc/src/echoplugin.qdoc +++ b/examples/widgets/doc/src/echoplugin.qdoc @@ -28,7 +28,7 @@ /*! \example tools/echoplugin \title Echo Plugin Example - \group examples-widgets-tools + \ingroup examples-widgets-tools \brief This example shows how to create a Qt plugin. diff --git a/examples/widgets/doc/src/elidedlabel.qdoc b/examples/widgets/doc/src/elidedlabel.qdoc index 8020c0aa56..5a4d384de8 100644 --- a/examples/widgets/doc/src/elidedlabel.qdoc +++ b/examples/widgets/doc/src/elidedlabel.qdoc @@ -27,7 +27,6 @@ /*! \example widgets/elidedlabel - \group all-examples \title Elided Label Example \brief This example creates a widget similar to QLabel, that elides the last diff --git a/examples/widgets/doc/src/syntaxhighlighter.qdoc b/examples/widgets/doc/src/syntaxhighlighter.qdoc index 3ebfcad380..6c343a47fb 100644 --- a/examples/widgets/doc/src/syntaxhighlighter.qdoc +++ b/examples/widgets/doc/src/syntaxhighlighter.qdoc @@ -28,7 +28,7 @@ /*! \example richtext/syntaxhighlighter \title Syntax Highlighter Example - \group examples-richtext + \ingroup examples-richtext \brief The Syntax Highligher example shows how to perform simple syntax highlighing. -- cgit v1.2.3 From 5ea3845bd0bf4dec9828270ab18e7c94d596975e Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 15 Apr 2013 15:15:36 +0200 Subject: iOS: use an explicit pointer to qiosViewController MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As it stood, we always relied on the root view controller being a QIOSViewController if isQtApplication() returned true. For mixed application, this might not always be true as native code can choose to replace the root view controller at times, or even rip it out, and place it as a child of another (e.g UISplitViewController). This change will give an extra protection against that. Change-Id: I0cb85796a8b82f9037c32f9e85e04e1dc7aad8e2 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosapplicationdelegate.h | 3 +++ src/plugins/platforms/ios/qiosapplicationdelegate.mm | 2 ++ src/plugins/platforms/ios/qiosglobal.h | 2 +- src/plugins/platforms/ios/qiosglobal.mm | 8 ++++++-- src/plugins/platforms/ios/qiosscreen.mm | 2 +- src/plugins/platforms/ios/qioswindow.mm | 4 ++-- src/plugins/platforms/ios/qtmain.mm | 3 ++- 7 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.h b/src/plugins/platforms/ios/qiosapplicationdelegate.h index 442b37f1b3..3d3ba58049 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.h +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.h @@ -42,9 +42,12 @@ #import #import +#import "qiosviewcontroller.h" + @interface QIOSApplicationDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; +@property (strong, nonatomic) QIOSViewController *qiosViewController; @end diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index 41a3fff84f..10cbe529c4 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -46,6 +46,7 @@ @implementation QIOSApplicationDelegate @synthesize window; +@synthesize qiosViewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { @@ -85,6 +86,7 @@ - (void)dealloc { + [qiosViewController release]; [window release]; [super dealloc]; } diff --git a/src/plugins/platforms/ios/qiosglobal.h b/src/plugins/platforms/ios/qiosglobal.h index 3be9f8bb21..fd328c9171 100644 --- a/src/plugins/platforms/ios/qiosglobal.h +++ b/src/plugins/platforms/ios/qiosglobal.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QPlatformScreen; bool isQtApplication(); -QIOSViewController *rootViewController(); +QIOSViewController *qiosViewController(); CGRect toCGRect(const QRect &rect); QRect fromCGRect(const CGRect &rect); diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm index 5860078372..d26eca54e5 100644 --- a/src/plugins/platforms/ios/qiosglobal.mm +++ b/src/plugins/platforms/ios/qiosglobal.mm @@ -58,10 +58,14 @@ bool isQtApplication() return isQt; } -QIOSViewController *rootViewController() +QIOSViewController *qiosViewController() { + // If Qt controls the application, we have created a root view controller were we place top-level + // QWindows. Note that in a mixed native application, our view controller might later be removed or + // added as a child of another controller. To protect against that, we keep an explicit pointer to the + // view controller in cases where this is the controller we need to access. static QIOSViewController *c = isQtApplication() ? - static_cast([UIApplication sharedApplication].delegate.window.rootViewController) : nil; + static_cast([UIApplication sharedApplication].delegate).qiosViewController : nil; return c; } diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index d86ed5f090..b73f9c3cbc 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -142,7 +142,7 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex) if (isQtApplication()) { // When in a non-mixed environment, let QScreen follow the current interface orientation: - setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation(rootViewController().interfaceOrientation))); + setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation(qiosViewController().interfaceOrientation))); } [pool release]; diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index d7a2fa1a75..5edf81af93 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -375,7 +375,7 @@ void QIOSWindow::setVisible(bool visible) requestActivateWindow(); } else { // Activate top-most visible QWindow: - NSArray *subviews = rootViewController().view.subviews; + NSArray *subviews = qiosViewController().view.subviews; for (int i = int(subviews.count) - 1; i >= 0; --i) { UIView *view = [subviews objectAtIndex:i]; if (!view.hidden) { @@ -431,7 +431,7 @@ void QIOSWindow::setParent(const QPlatformWindow *parentWindow) UIView *parentView = reinterpret_cast(parentWindow->winId()); [parentView addSubview:m_view]; } else if (isQtApplication()) { - [rootViewController().view addSubview:m_view]; + [qiosViewController().view addSubview:m_view]; } } diff --git a/src/plugins/platforms/ios/qtmain.mm b/src/plugins/platforms/ios/qtmain.mm index 916224f936..19c98f2c59 100644 --- a/src/plugins/platforms/ios/qtmain.mm +++ b/src/plugins/platforms/ios/qtmain.mm @@ -56,7 +56,8 @@ extern int qt_main(int argc, char *argv[]); - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; - self.window.rootViewController = [[[QIOSViewController alloc] init] autorelease]; + self.qiosViewController = [[[QIOSViewController alloc] init] autorelease]; + self.window.rootViewController = self.qiosViewController; #ifdef QT_DEBUG self.window.backgroundColor = [UIColor cyanColor]; -- cgit v1.2.3 From 5aa349628e2d4913e5aeddd6557d578f34e31fc0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 17 Apr 2013 14:55:36 +0200 Subject: Handle usr-move without forcing absolute paths In qtbase commit 7ac58d1ff0815566ba1de09519299b5119e5ee91 (Make cmake packages installed to /usr non-relocatable., 2013-02-11), we made cmake config files non-relocatable if they were installed to the /usr prefix. That was assumed to mean that this was a distro or platform package, and was a workaround for the usr-move problem on Fedora and ArchLinux. However, cmake bug http://public.kitware.com/Bug/view.php?id=14041 showed that forcing absolute paths in this situation is not desirable in cross compiling scenarios. CMake commit 6c613b433c45efb0bb013a6bd668cbb8ac740259 (Handle usr-move without forcing absolute paths (#14041), 2013-04-03) addressed the problem in CMake, and this commit is an equivalent. Change-Id: I065a6230bc618aa980fae6ca511ae10df4cd62c2 Reviewed-by: Stephen Kelly --- mkspecs/features/cmake_functions.prf | 7 +++++++ mkspecs/features/create_cmake.prf | 19 +++++++++++-------- mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in | 16 +++++++++++++++- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/mkspecs/features/cmake_functions.prf b/mkspecs/features/cmake_functions.prf index 62634d9b88..5816dfe1d0 100644 --- a/mkspecs/features/cmake_functions.prf +++ b/mkspecs/features/cmake_functions.prf @@ -24,3 +24,10 @@ defineReplace(cmakeModuleList) { } return ($$join(out, ";")) } + +defineReplace(cmakeTargetPath) { + SYSR = $$[QT_SYSROOT] + !isEmpty(SYSR): path = $$relative_path($$1, $$[QT_SYSROOT]) + else: path = $$1 + return(/$$path) +} diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index cf0acaf4b7..a9757acd17 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -27,19 +27,22 @@ CMAKE_PARTIAL_MODULE_DEPS = $$replace(CMAKE_MODULE_DEPS, ";", ";Qt5::") # The /lib paths are made symlinks to the /usr/lib paths. If someone searching # for a Qt 5 package finds it in /lib/cmake/Qt5Core, although it has been # installed in /usr/lib/cmake/Qt5Core, relative paths to the includes and -# executables will not work. So, we treat installations to /usr as non-relocatable -# packages with absolute paths. -CMAKE_INSTALL_LIBS_DIR = $$[QT_INSTALL_LIBS] -contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_FORCE_ABSOLUTE_PATHS = True +# executables will not work. +# To work around this, we insert code into the generated config files to check +# at cmake time whether package has been found via a symlink, and correct +# that to an absolute path. This is only done for installations to +# the /usr or / prefix. +CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$[QT_INSTALL_LIBS]) +contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND = $$CMAKE_INSTALL_LIBS_DIR CMAKE_INCLUDE_DIR = $$cmakeRelativePath($$[QT_INSTALL_HEADERS], $$[QT_INSTALL_PREFIX]) -!isEmpty(CMAKE_FORCE_ABSOLUTE_PATHS)|contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") { +contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") { CMAKE_INCLUDE_DIR = $$[QT_INSTALL_HEADERS]/ CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True } CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX]) -!isEmpty(CMAKE_FORCE_ABSOLUTE_PATHS)|contains(CMAKE_LIB_DIR,"^\\.\\./.*") { +contains(CMAKE_LIB_DIR,"^\\.\\./.*") { CMAKE_LIB_DIR = $$[QT_INSTALL_LIBS]/ CMAKE_LIB_DIR_IS_ABSOLUTE = True } else { @@ -50,13 +53,13 @@ CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX]) } CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX]) -!isEmpty(CMAKE_FORCE_ABSOLUTE_PATHS)|contains(CMAKE_BIN_DIR, "^\\.\\./.*") { +contains(CMAKE_BIN_DIR, "^\\.\\./.*") { CMAKE_BIN_DIR = $$[QT_HOST_BINS]/ CMAKE_BIN_DIR_IS_ABSOLUTE = True } CMAKE_HOST_DATA_DIR = $$cmakeRelativePath($$[QT_HOST_DATA], $$[QT_INSTALL_PREFIX]) -!isEmpty(CMAKE_FORCE_ABSOLUTE_PATHS)|contains(CMAKE_HOST_DATA_DIR, "^\\.\\./.*") { +contains(CMAKE_HOST_DATA_DIR, "^\\.\\./.*") { CMAKE_HOST_DATA_DIR = $$[QT_HOST_DATA]/ CMAKE_HOST_DATA_DIR_IS_ABSOLUTE = True } diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in index d88f6e1224..a77a6bd22d 100644 --- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in @@ -3,7 +3,21 @@ if (CMAKE_VERSION VERSION_LESS 2.8.3) message(FATAL_ERROR \"Qt 5 requires at least CMake version 2.8.3\") endif() -!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) +!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND) +get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH) +# Use original install prefix when loaded through a +# cross-prefix symbolic link such as /lib -> /usr/lib. +get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH) +get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5$${CMAKE_MODULE_NAME}\" REALPATH) +if(_realCurr STREQUAL _realOrig) + get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR\" PATH) +else() + get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE) +endif() +unset(_realOrig) +unset(_realCurr) +unset(_IMPORT_PREFIX) +!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE) !!ELSE set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\") -- cgit v1.2.3 From a680fe609f9b8cbccee1acd7391a725cf4b7b523 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 11 Apr 2013 22:45:14 +0200 Subject: Add the GL headers to cmake variables. If building angle ourselves, that's just the basic Qt include dir, and if using an external gl, look for it in the places specified in the mkspec. As the qopengl.h header includes the gl header, this is a 'public include dependency' of QtGui, so it is added to the relevant variable and the INTERFACE_INCLUDE_DIRECTORIES of Qt5::Gui. Change-Id: I8c2c1782e0a2600032771175444b087da28433fc Reviewed-by: Volker Krause Reviewed-by: Stephen Kelly --- mkspecs/features/cmake_functions.prf | 9 +++++++++ src/gui/Qt5GuiConfigExtras.cmake.in | 20 ++++++++++++++++++++ src/gui/gui.pro | 16 ++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 src/gui/Qt5GuiConfigExtras.cmake.in diff --git a/mkspecs/features/cmake_functions.prf b/mkspecs/features/cmake_functions.prf index 5816dfe1d0..1285990206 100644 --- a/mkspecs/features/cmake_functions.prf +++ b/mkspecs/features/cmake_functions.prf @@ -31,3 +31,12 @@ defineReplace(cmakeTargetPath) { else: path = $$1 return(/$$path) } + +defineReplace(cmakeTargetPaths) { + variable = $$1 + out = + for(v, variable) { + out += \"$$cmakeTargetPath($$v)\" + } + return ($$join(out, " ")) +} diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in new file mode 100644 index 0000000000..d9313d4364 --- /dev/null +++ b/src/gui/Qt5GuiConfigExtras.cmake.in @@ -0,0 +1,20 @@ + +!!IF !contains(QT_CONFIG, angle) + +!!IF !isEmpty(CMAKE_GL_INCDIRS) + +find_path(_qt5gui_OPENGL_INCLUDE_DIR $$CMAKE_GL_HEADER_NAME + PATHS $$CMAKE_GL_INCDIRS + NO_DEFAULT_PATH) +if (NOT _qt5gui_OPENGL_INCLUDE_DIR) + message(FATAL_ERROR \"Failed to find \\\"$$CMAKE_GL_HEADER_NAME\\\" in \\\"$$CMAKE_GL_INCDIRS\\\", using the CMAKE_FIND_ROOT_PATH \\\"${CMAKE_FIND_ROOT_PATH}\\\".\") +endif() + +list(APPEND Qt5Gui_INCLUDE_DIRS ${_qt5gui_OPENGL_INCLUDE_DIR}) +set_property(TARGET Qt5::Gui APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5gui_OPENGL_INCLUDE_DIR}) + +unset(_qt5gui_OPENGL_INCLUDE_DIR CACHE) + +!!ENDIF + +!!ENDIF diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 14c267df70..9238fd91a4 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -35,4 +35,20 @@ include(itemmodels/itemmodels.pri) QMAKE_LIBS += $$QMAKE_LIBS_GUI +load(cmake_functions) + +!contains(QT_CONFIG, angle) { + contains(QT_CONFIG, opengles1) { + CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL_ES1) + CMAKE_GL_HEADER_NAME = GLES/gl.h + } else:contains(QT_CONFIG, opengles2) { + CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL_ES2) + CMAKE_GL_HEADER_NAME = GLES2/gl2.h + } else { + CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL) + CMAKE_GL_HEADER_NAME = GL/gl.h + mac: CMAKE_GL_HEADER_NAME = gl.h + } +} + QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist -- cgit v1.2.3 From 526eaeea09c0c48cea60d39be40aed782961883c Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 11 Apr 2013 15:48:38 +0200 Subject: qprocessordetection: add armv7s MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Xcode builds projects for armv7s if a compatible device is set as target device. If trying to include into such projects, the build fails complaining about "the usage of sizeof missing QMutexData definition in qgenericatomic.h" The reason is that qprocessdetection.h fails to pick up that we're building for ARM, and includes qatomic_gcc.h instead of qatomic_armv7.h. So we need to check for __ARM_ARCH_7S__ as well. In addition, iPhoneOS6.1.sdk/usr/include/arm/arch.h will define _ARM_ARCH_7 if any of the more specic ARM defines are defined, so I add this check as well to more easy support new version of ARM7. Change-Id: Ic51a4d7ac99f7f6ba1065f870b3ef82d1250b56c Reviewed-by: Tor Arne Vestbø Reviewed-by: Thiago Macieira --- src/corelib/global/qprocessordetection.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index 178afb1db6..21f9c8f44f 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -101,6 +101,8 @@ || defined(__ARM_ARCH_7A__) \ || defined(__ARM_ARCH_7R__) \ || defined(__ARM_ARCH_7M__) \ + || defined(__ARM_ARCH_7S__) \ + || defined(_ARM_ARCH_7) \ || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7) \ || (defined(_M_ARM) && _M_ARM-0 >= 7) # define Q_PROCESSOR_ARM_V7 -- cgit v1.2.3 From ca0e350183903ebe9d665ebab1028b3510982967 Mon Sep 17 00:00:00 2001 From: Jonathan Liu Date: Wed, 10 Apr 2013 22:28:11 +1000 Subject: QMessageBox/Win: Include detailed text using Ctrl+C to copy Task-number: QTBUG-21150 Change-Id: I14c214e9f96892f0da4369e7253e363b7313c252 Reviewed-by: Kai Koehne Reviewed-by: Stephen Kelly --- src/widgets/dialogs/qmessagebox.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index e08b321289..833320da16 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1412,7 +1412,10 @@ void QMessageBox::keyPressEvent(QKeyEvent *e) buttonTexts += buttons[i]->text() + QLatin1String(" "); } textToCopy += buttonTexts + separator; - +#ifndef QT_NO_TEXTEDIT + if (d->detailsText) + textToCopy += d->detailsText->text() + separator; +#endif QApplication::clipboard()->setText(textToCopy); return; } -- cgit v1.2.3 From c2059ac80db30d0322f53bf0c224263a934c49bc Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 15 Apr 2013 17:15:15 +0200 Subject: Doc: added details for QRegisterStaticFunction(plugin) Added reference to macro Q_IMPORT_PLUGIN() Task-number: QTBUG-30548 Change-Id: Ibc20ad52cd57d497f5a7fb5c4dd4a4c778e4a660 Reviewed-by: Jerome Pasion --- src/corelib/plugin/qpluginloader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index fa0162be82..5a59942aad 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -396,7 +396,8 @@ QLibrary::LoadHints QPluginLoader::loadHints() const \relates QPluginLoader \since 5.0 - Registers the given \a plugin with the plugin loader. + Registers the \a plugin specified with the plugin loader, and is used + by Q_IMPORT_PLUGIN(). */ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin plugin) { -- cgit v1.2.3 From 0d57da067b47eac51ea725d267069d6e616cf586 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 25 Mar 2013 18:07:17 +0100 Subject: Let platform plugin decide if accessibility is active MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I881a8ff3fedf3db73ee37046a4363c70960a92a6 Reviewed-by: Jan Arve Sæther --- src/3rdparty/atspi2/atspi2.pri | 2 +- src/3rdparty/atspi2/xml/Bus.xml | 17 ++++++++ src/gui/accessible/qaccessible.cpp | 21 +++++---- src/gui/accessible/qplatformaccessibility.cpp | 1 + src/gui/accessible/qplatformaccessibility.h | 5 +++ src/platformsupport/linuxaccessibility/bridge.cpp | 8 ++-- src/platformsupport/linuxaccessibility/bridge_p.h | 1 - .../linuxaccessibility/dbusconnection.cpp | 51 ++++++++++------------ .../linuxaccessibility/dbusconnection_p.h | 2 - src/plugins/platforms/cocoa/qnsview.h | 1 - src/plugins/platforms/cocoa/qnsview.mm | 5 +-- .../platforms/cocoa/qnsviewaccessibility.mm | 19 +++++--- .../windows/accessible/qwindowsaccessibility.cpp | 4 ++ tests/auto/other/qaccessibility/qaccessibility.pro | 2 +- .../other/qaccessibility/tst_qaccessibility.cpp | 5 +++ .../tst_qaccessibilitylinux.cpp | 8 +++- 16 files changed, 94 insertions(+), 58 deletions(-) create mode 100644 src/3rdparty/atspi2/xml/Bus.xml diff --git a/src/3rdparty/atspi2/atspi2.pri b/src/3rdparty/atspi2/atspi2.pri index 1b2ac51b85..5a6dc6d839 100644 --- a/src/3rdparty/atspi2/atspi2.pri +++ b/src/3rdparty/atspi2/atspi2.pri @@ -2,7 +2,7 @@ DBUS_ADAPTORS = $$PWD/xml/Cache.xml $$PWD/xml/DeviceEventController.xml QDBUSXML2CPP_ADAPTOR_HEADER_FLAGS = -i struct_marshallers_p.h -DBUS_INTERFACES = $$PWD/xml/Socket.xml +DBUS_INTERFACES = $$PWD/xml/Socket.xml $$PWD/xml/Bus.xml QDBUSXML2CPP_INTERFACE_HEADER_FLAGS = -i struct_marshallers_p.h INCLUDEPATH += $$PWD diff --git a/src/3rdparty/atspi2/xml/Bus.xml b/src/3rdparty/atspi2/xml/Bus.xml new file mode 100644 index 0000000000..5a33e335a1 --- /dev/null +++ b/src/3rdparty/atspi2/xml/Bus.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 4fd595ed5a..18157f8e2f 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -441,7 +441,6 @@ Q_GLOBAL_STATIC(QAccessiblePluginsHash, qAccessiblePlugins); QAccessible::UpdateHandler QAccessible::updateHandler = 0; QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0; -static bool accessibility_active = false; static bool cleanupAdded = false; #ifndef QT_NO_ACCESSIBILITY @@ -584,7 +583,6 @@ Q_GLOBAL_STATIC(QAccessibleCache, qAccessibleCache) */ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) { - accessibility_active = true; if (!object) return 0; @@ -699,19 +697,26 @@ QAccessibleInterface *QAccessible::accessibleInterface(Id id) /*! - Returns true if an accessibility implementation has been requested - during the runtime of the application; otherwise returns false. + Returns true if the platform requested accessibility information. - Use this function to prevent potentially expensive notifications via - updateAccessibility(). + This function will return false until a tool such as a screen reader + accessed the accessibility framework. It is still possible to use + \l QAccessible::queryAccessibleInterface even if accessibility is not + active. But there will be no notifications sent to the platform. + + It is recommended to use this function to prevent expensive notifications + via updateAccessibility() when they are not needed. */ bool QAccessible::isActive() { - return accessibility_active; +#ifndef QT_NO_ACCESSIBILITY + if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) + return pfAccessibility->isActive(); +#endif + return false; } - /*! Sets the root object of the accessible objects of this application to \a object. All other accessible objects are reachable using object diff --git a/src/gui/accessible/qplatformaccessibility.cpp b/src/gui/accessible/qplatformaccessibility.cpp index 2e36e5ac71..490fb7a407 100644 --- a/src/gui/accessible/qplatformaccessibility.cpp +++ b/src/gui/accessible/qplatformaccessibility.cpp @@ -73,6 +73,7 @@ Q_GLOBAL_STATIC(QVector, bridges) \sa QAccessible */ QPlatformAccessibility::QPlatformAccessibility() + : m_active(false) { } diff --git a/src/gui/accessible/qplatformaccessibility.h b/src/gui/accessible/qplatformaccessibility.h index 26a22e492d..f86a9b6157 100644 --- a/src/gui/accessible/qplatformaccessibility.h +++ b/src/gui/accessible/qplatformaccessibility.h @@ -69,6 +69,11 @@ public: virtual void initialize(); virtual void cleanup(); + inline bool isActive() const { return m_active; } + inline void setActive(bool active) { m_active = active; } + +private: + bool m_active; }; QT_END_NAMESPACE diff --git a/src/platformsupport/linuxaccessibility/bridge.cpp b/src/platformsupport/linuxaccessibility/bridge.cpp index 181feeba6a..350c67f1ed 100644 --- a/src/platformsupport/linuxaccessibility/bridge.cpp +++ b/src/platformsupport/linuxaccessibility/bridge.cpp @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE */ QSpiAccessibleBridge::QSpiAccessibleBridge() - : cache(0), dec(0), dbusAdaptor(0), m_enabled(false) + : cache(0), dec(0), dbusAdaptor(0) { dbusConnection = new DBusConnection(); connect(dbusConnection, SIGNAL(enabledChanged(bool)), this, SLOT(enabledChanged(bool))); @@ -70,7 +70,7 @@ QSpiAccessibleBridge::QSpiAccessibleBridge() void QSpiAccessibleBridge::enabledChanged(bool enabled) { - m_enabled = enabled; + setActive(enabled); updateStatus(); } @@ -87,7 +87,7 @@ QDBusConnection QSpiAccessibleBridge::dBusConnection() const void QSpiAccessibleBridge::updateStatus() { // create the adaptor to handle everything if we are in enabled state - if (!dbusAdaptor && m_enabled) { + if (!dbusAdaptor && isActive()) { qSpiInitializeStructTypes(); initializeConstantMappings(); @@ -106,7 +106,7 @@ void QSpiAccessibleBridge::notifyAccessibilityUpdate(QAccessibleEvent *event) { if (!dbusAdaptor) return; - if (m_enabled) + if (isActive()) dbusAdaptor->notify(event); } diff --git a/src/platformsupport/linuxaccessibility/bridge_p.h b/src/platformsupport/linuxaccessibility/bridge_p.h index 8a02847d3d..0e1624c522 100644 --- a/src/platformsupport/linuxaccessibility/bridge_p.h +++ b/src/platformsupport/linuxaccessibility/bridge_p.h @@ -76,7 +76,6 @@ private: DeviceEventControllerAdaptor *dec; AtSpiAdaptor *dbusAdaptor; DBusConnection* dbusConnection; - bool m_enabled; }; QT_END_NAMESPACE diff --git a/src/platformsupport/linuxaccessibility/dbusconnection.cpp b/src/platformsupport/linuxaccessibility/dbusconnection.cpp index a37b99c105..18915f8e08 100644 --- a/src/platformsupport/linuxaccessibility/dbusconnection.cpp +++ b/src/platformsupport/linuxaccessibility/dbusconnection.cpp @@ -48,6 +48,7 @@ #include #include +#include "bus_interface.h" QT_BEGIN_NAMESPACE @@ -81,21 +82,24 @@ void DBusConnection::serviceRegistered() { // listen to enabled changes QDBusConnection c = QDBusConnection::sessionBus(); - // FXIME check for changes of enabled state -// if (!c.connect(A11Y_SERVICE, A11Y_PATH, QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("PropertiesChanged"), this, SLOT(enabledStateChanged(QDBusVariant)))) -// qWarning() << "Could not listen to accessibility enabled state changes."; - - // check if it's enabled right away - QDBusMessage enabledMessage = QDBusMessage::createMethodCall(A11Y_SERVICE, A11Y_PATH, QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("Get")); - QList args; - args << QStringLiteral("org.a11y.Status") << QStringLiteral("IsEnabled"); - enabledMessage.setArguments(args); - c.callWithCallback(enabledMessage, this, SLOT(enabledStateCallback(QDBusVariant)), SLOT(dbusError(QDBusError))); -} + OrgA11yStatusInterface *a11yStatus = new OrgA11yStatusInterface(A11Y_SERVICE, A11Y_PATH, c, this); + + // a11yStatus->isEnabled() returns always true (since Gnome 3.6) + bool enabled = a11yStatus->screenReaderEnabled(); + if (enabled != m_enabled) { + m_enabled = enabled; + if (m_a11yConnection.isConnected()) { + emit enabledChanged(m_enabled); + } else { + QDBusConnection c = QDBusConnection::sessionBus(); + QDBusMessage m = QDBusMessage::createMethodCall(QLatin1String("org.a11y.Bus"), + QLatin1String("/org/a11y/bus"), + QLatin1String("org.a11y.Bus"), QLatin1String("GetAddress")); + c.callWithCallback(m, this, SLOT(connectA11yBus(QString)), SLOT(dbusError(QDBusError))); + } + } -void DBusConnection::dbusError(const QDBusError &error) -{ - qWarning() << "Accessibility encountered a DBus error:" << error; + // connect(a11yStatus, ); QtDbus doesn't support notifications for property changes yet } void DBusConnection::serviceUnregistered() @@ -103,20 +107,6 @@ void DBusConnection::serviceUnregistered() emit enabledChanged(false); } -void DBusConnection::enabledStateCallback(const QDBusVariant &enabled) -{ - m_enabled = enabled.variant().toBool(); - if (m_a11yConnection.isConnected()) { - emit enabledChanged(m_enabled); - } else { - QDBusConnection c = QDBusConnection::sessionBus(); - QDBusMessage m = QDBusMessage::createMethodCall(QLatin1String("org.a11y.Bus"), - QLatin1String("/org/a11y/bus"), - QLatin1String("org.a11y.Bus"), QLatin1String("GetAddress")); - c.callWithCallback(m, this, SLOT(connectA11yBus(QString)), SLOT(dbusError(QDBusError))); - } -} - void DBusConnection::connectA11yBus(const QString &address) { if (address.isEmpty()) { @@ -129,6 +119,11 @@ void DBusConnection::connectA11yBus(const QString &address) emit enabledChanged(true); } +void DBusConnection::dbusError(const QDBusError &error) +{ + qWarning() << "Accessibility encountered a DBus error:" << error; +} + /*! Returns the DBus connection that got established. Or an invalid connection if not yet connected. diff --git a/src/platformsupport/linuxaccessibility/dbusconnection_p.h b/src/platformsupport/linuxaccessibility/dbusconnection_p.h index 2d55ccb547..70f6fb80ac 100644 --- a/src/platformsupport/linuxaccessibility/dbusconnection_p.h +++ b/src/platformsupport/linuxaccessibility/dbusconnection_p.h @@ -67,8 +67,6 @@ Q_SIGNALS: private Q_SLOTS: void serviceRegistered(); void serviceUnregistered(); - void enabledStateCallback(const QDBusVariant &enabled); -// void enabledStateChanged(const QDBusVariant &); void connectA11yBus(const QString &address); void dbusError(const QDBusError &error); diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index e7ea3d8f8d..68145ec914 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -63,7 +63,6 @@ QT_END_NAMESPACE QWindow *m_window; QCocoaWindow *m_platformWindow; Qt::MouseButtons m_buttons; - QAccessibleInterface *m_accessibleRoot; QString m_composingText; bool m_sendKeyEvent; QStringList *currentCustomDragTypes; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 568cc4bebf..52e2d781ee 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -121,7 +121,6 @@ static QTouchDevice *touchDevice = 0; m_window = window; m_platformWindow = platformWindow; - m_accessibleRoot = 0; m_sendKeyEvent = false; #ifdef QT_COCOA_ENABLE_ACCESSIBILITY_INSPECTOR @@ -130,15 +129,13 @@ static QTouchDevice *touchDevice = 0; static bool skipAccessibilityForInspectorWindows = false; if (!skipAccessibilityForInspectorWindows) { - m_accessibleRoot = window->accessibleRoot(); + // m_accessibleRoot = window->accessibleRoot(); AccessibilityInspector *inspector = new AccessibilityInspector(window); skipAccessibilityForInspectorWindows = true; inspector->inspectWindow(window); skipAccessibilityForInspectorWindows = false; } -#else - m_accessibleRoot = window->accessibleRoot(); #endif [self registerDragTypes]; diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm index e3b8cf6532..c43c0b5068 100644 --- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm +++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm @@ -45,6 +45,7 @@ #include "qcocoahelpers.h" #include "qcocoaaccessibility.h" #include "qcocoaaccessibilityelement.h" +#include #include #include @@ -60,22 +61,26 @@ } - (id)accessibilityAttributeValue:(NSString *)attribute { + + // activate accessibility updates + QGuiApplicationPrivate::platformIntegration()->accessibility()->setActive(true); + if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) { - if (m_accessibleRoot) - return QCocoaAccessible::macRole(m_accessibleRoot); + if (m_window->accessibleRoot()) + return QCocoaAccessible::macRole(m_window->accessibleRoot()); return NSAccessibilityUnknownRole; } else if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) { return NSAccessibilityRoleDescriptionForUIElement(self); } else if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) { - if (!m_accessibleRoot) + if (!m_window->accessibleRoot()) return [super accessibilityAttributeValue:attribute]; // Create QCocoaAccessibleElements for each child if the // root accessible interface. - int numKids = m_accessibleRoot->childCount(); + int numKids = m_window->accessibleRoot()->childCount(); NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; for (int i = 0; i < numKids; ++i) { - QAccessibleInterface *child = m_accessibleRoot->child(i); + QAccessibleInterface *child = m_window->accessibleRoot()->child(i); Q_ASSERT(child); QAccessible::Id childAxid = QAccessible::uniqueId(child); QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId:childAxid parent:self]; @@ -90,10 +95,10 @@ } - (id)accessibilityHitTest:(NSPoint)point { - if (!m_accessibleRoot) + if (!m_window->accessibleRoot()) return [super accessibilityHitTest:point]; - QAccessibleInterface *childInterface = m_accessibleRoot->childAt(point.x, qt_mac_flipYCoordinate(point.y)); + QAccessibleInterface *childInterface = m_window->accessibleRoot()->childAt(point.x, qt_mac_flipYCoordinate(point.y)); // No child found, meaning we hit the NSView if (!childInterface) { return [super accessibilityHitTest:point]; diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp index f222deeeac..63b4370dc2 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp @@ -52,7 +52,9 @@ #include #include #include +#include #include +#include #include #include @@ -245,6 +247,8 @@ bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, W if (static_cast(lParam) == static_cast(UiaRootObjectId)) { /* For UI Automation */ } else if ((DWORD)lParam == DWORD(OBJID_CLIENT)) { + // Start handling accessibility internally + QGuiApplicationPrivate::platformIntegration()->accessibility()->setActive(true); #if 1 // Ignoring all requests while starting up // ### Maybe QPA takes care of this??? diff --git a/tests/auto/other/qaccessibility/qaccessibility.pro b/tests/auto/other/qaccessibility/qaccessibility.pro index 071b0bb66c..70f6633195 100644 --- a/tests/auto/other/qaccessibility/qaccessibility.pro +++ b/tests/auto/other/qaccessibility/qaccessibility.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qaccessibility requires(contains(QT_CONFIG,accessibility)) -QT += testlib gui-private widgets-private +QT += testlib core-private gui-private widgets-private SOURCES += tst_qaccessibility.cpp unix:!mac:LIBS+=-lm diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 4e0b3298fc..af8e4472ed 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -63,6 +63,9 @@ #include #include #include +#include +#include +#include #if defined(Q_OS_WIN) && defined(interface) # undef interface @@ -311,6 +314,8 @@ void tst_QAccessibility::onClicked() void tst_QAccessibility::initTestCase() { QTestAccessibility::initialize(); + QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration(); + pfIntegration->accessibility()->setActive(true); } void tst_QAccessibility::cleanupTestCase() diff --git a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp index 15b8089525..79fd29f2a1 100644 --- a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp +++ b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp @@ -55,6 +55,7 @@ #include #include "atspi/atspi-constants.h" +#include "bus_interface.h" #include "dbusconnection_p.h" #include "struct_marshallers_p.h" @@ -154,16 +155,21 @@ QDBusInterface *tst_QAccessibilityLinux::getInterface(const QString &path, const return new QDBusInterface(address, path, interfaceName, dbus.connection(), this); } - void tst_QAccessibilityLinux::initTestCase() { // Oxygen style creates many extra items, it's simply unusable here qApp->setStyle("fusion"); qApp->setApplicationName("tst_QAccessibilityLinux app"); + // Pretend we are a screen reader + QDBusConnection c = QDBusConnection::sessionBus(); + OrgA11yStatusInterface *a11yStatus = new OrgA11yStatusInterface(QStringLiteral("org.a11y.Bus"), QStringLiteral("/org/a11y/bus"), c, this); + a11yStatus->setScreenReaderEnabled(true); + QTRY_VERIFY(dbus.isEnabled()); QTRY_VERIFY(dbus.connection().isConnected()); address = dbus.connection().baseService().toLatin1().data(); + QVERIFY(!address.isEmpty()); m_window = new AccessibleTestWindow(); m_window->show(); -- cgit v1.2.3 From 52cad781d39ee47b3e918f39900f4e11cc88b9fa Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Apr 2013 14:57:09 +0200 Subject: restore compat with older perl versions the // operator is a tad too new. Task-number: QTBUG-30637 Change-Id: I3672d41a4a17937ffea251f0937b09045d6c386d Reviewed-by: Thiago Macieira --- bin/syncqt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/syncqt b/bin/syncqt index 306c4df57a..a579cad41d 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -1180,7 +1180,7 @@ if($check_includes) { } } } elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_BEGIN_NAMESPACE(_[A-Z_]+)?\s*$/) { - $qt_namespace_suffix = $1 // ""; + $qt_namespace_suffix = defined($1) ? $1 : ""; $qt_begin_namespace_found = 1; } elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_END_NAMESPACE$qt_namespace_suffix\s*$/) { $qt_end_namespace_found = 1; -- cgit v1.2.3 From ed2068063aae3e7346e63a73aa222ef8532a816f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 18 Apr 2013 11:22:42 +0200 Subject: don't install the project file twice somehow this was missed when the source installs were automated. Change-Id: Ic842fd9ac221cb3748b5a6369eacf8a55f8d8d4d Reviewed-by: Joerg Bornemann --- examples/widgets/tools/tools.pro | 5 ----- 1 file changed, 5 deletions(-) diff --git a/examples/widgets/tools/tools.pro b/examples/widgets/tools/tools.pro index f08f7fd6d2..b5d52356f9 100644 --- a/examples/widgets/tools/tools.pro +++ b/examples/widgets/tools/tools.pro @@ -17,8 +17,3 @@ SUBDIRS = \ contains(DEFINES, QT_NO_TRANSLATION): SUBDIRS -= i18n plugandpaint.depends = plugandpaintplugins - -# install -sources.files = tools.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools -INSTALLS += sources -- cgit v1.2.3 From ecb2c0c24cc1ce61d4252debd9e7beffe59d0681 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 18 Apr 2013 11:23:33 +0200 Subject: fix processing order for qmake -r the plugandpaint example statically links to one of the plugins, so there is a build-time dependency. Change-Id: I9c77b5641028e6b958ceeea56c606bda59f396b4 Reviewed-by: Joerg Bornemann --- examples/widgets/tools/tools.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/widgets/tools/tools.pro b/examples/widgets/tools/tools.pro index b5d52356f9..7178411110 100644 --- a/examples/widgets/tools/tools.pro +++ b/examples/widgets/tools/tools.pro @@ -5,8 +5,8 @@ SUBDIRS = \ customcompleter \ echoplugin \ i18n \ - plugandpaint \ plugandpaintplugins \ + plugandpaint \ regexp \ settingseditor \ styleplugin \ -- cgit v1.2.3 From 561e39a8457e68f000c4d99faed6c93583adf92b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 18 Apr 2013 11:51:10 +0200 Subject: purge obsolete files the warnings should have been acted upon before 5.0. Change-Id: I20a4673d7ec80e0252aa39289c6718fe80799de7 Reviewed-by: Joerg Bornemann --- mkspecs/features/module.prf | 1 - mkspecs/features/qt_module_config.prf | 2 -- 2 files changed, 3 deletions(-) delete mode 100644 mkspecs/features/module.prf delete mode 100644 mkspecs/features/qt_module_config.prf diff --git a/mkspecs/features/module.prf b/mkspecs/features/module.prf deleted file mode 100644 index 916430d493..0000000000 --- a/mkspecs/features/module.prf +++ /dev/null @@ -1 +0,0 @@ -warning("CONFIG+=module is obsolete. load(qt_module) is sufficient.") diff --git a/mkspecs/features/qt_module_config.prf b/mkspecs/features/qt_module_config.prf deleted file mode 100644 index 79b939a217..0000000000 --- a/mkspecs/features/qt_module_config.prf +++ /dev/null @@ -1,2 +0,0 @@ -warning("load(qt_module_config) is obsolete. Use load(qt_module) instead.") -load(qt_module) -- cgit v1.2.3 From 926086b9e37d45d09d5ce7d632a07583b40a8f70 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 18 Apr 2013 16:50:19 +0200 Subject: Cocoa: Disable QTBUG-30266 hack in full screen That would set the full screen window in a weird state, where is was full screen (but unable to exit that mode) and showing the title bar at the same time. Change-Id: I3ac913876f3b326504dd5af18c34181d002509d0 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/cocoa/qcocoawindow.mm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index c5babae19e..5ff1bf83ae 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -283,6 +283,10 @@ void QCocoaWindow::setVisible(bool visible) parentCocoaWindow->m_activePopupWindow = window(); // QTBUG-30266: a window should not be resizable while a transient popup is open // Since this isn't a native popup, the window manager doesn't close the popup when you click outside +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7 + && !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask)) +#endif [parentCocoaWindow->m_nsWindow setStyleMask: (parentCocoaWindow->windowStyleMask(parentCocoaWindow->m_windowFlags) & ~NSResizableWindowMask)]; } @@ -346,7 +350,12 @@ void QCocoaWindow::setVisible(bool visible) } else { [m_contentView setHidden:YES]; } - if (parentCocoaWindow && window()->type() == Qt::Popup) + if (parentCocoaWindow && window()->type() == Qt::Popup +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + && QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7 + && !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask) +#endif + ) // QTBUG-30266: a window should not be resizable while a transient popup is open [parentCocoaWindow->m_nsWindow setStyleMask:parentCocoaWindow->windowStyleMask(parentCocoaWindow->m_windowFlags)]; } -- cgit v1.2.3 From da01deb0ac01b37656e021b9d5d696c5de7b0afb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 10 Apr 2013 13:55:50 +0200 Subject: Implement alertion state for windows. Add QWindow::alert() and QPlatformWindow::setAlertState(). Add logic to clear alertion state when the window becomes active. The platform plugins then only need to implement a setter and a cheap getter and need not handle activation. Prototypically implement X11 and Windows. Task-number: QTBUG-30416 Change-Id: Ia70c4722d812462a21f4034b7d52735c9f2bc49c Reviewed-by: Jerome Pasion Reviewed-by: Gunnar Sletta --- src/gui/kernel/qguiapplication.cpp | 5 ++++ src/gui/kernel/qplatformwindow.cpp | 26 ++++++++++++++++++++ src/gui/kernel/qplatformwindow.h | 3 +++ src/gui/kernel/qwindow.cpp | 30 ++++++++++++++++++++++++ src/gui/kernel/qwindow.h | 3 +++ src/gui/kernel/qwindow_p.h | 1 + src/plugins/platforms/windows/qwindowswindow.cpp | 13 ++++++++++ src/plugins/platforms/windows/qwindowswindow.h | 5 +++- src/plugins/platforms/xcb/qxcbwindow.cpp | 14 +++++++++++ src/plugins/platforms/xcb/qxcbwindow.h | 5 +++- src/widgets/kernel/qapplication_qpa.cpp | 12 +++++++++- 11 files changed, 114 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index b05ba28e48..fba516c135 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1592,6 +1592,11 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate if (previous == newFocus) return; + if (newFocus) + if (QPlatformWindow *platformWindow = newFocus->handle()) + if (platformWindow->isAlertState()) + platformWindow->setAlertState(false); + QObject *previousFocusObject = previous ? previous->focusObject() : 0; if (previous) { diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index bfb6ab5a68..1e8ac60cca 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -462,6 +462,32 @@ QString QPlatformWindow::formatWindowTitle(const QString &title, const QString & return fullTitle; } +/*! + Reimplement this method to set whether the window demands attention + (for example, by flashing the taskbar icon) depending on \a enabled. + + \sa isAlertState() + \since 5.1 +*/ + +void QPlatformWindow::setAlertState(bool enable) +{ + Q_UNUSED(enable) +} + +/*! + Reimplement this method return whether the window is in + an alert state. + + \sa setAlertState() + \since 5.1 +*/ + +bool QPlatformWindow::isAlertState() const +{ + return false; +} + /*! Helper function to get initial geometry on windowing systems which do not do smart positioning and also do not provide a means of centering a diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h index 7ade461890..7dfbae036f 100644 --- a/src/gui/kernel/qplatformwindow.h +++ b/src/gui/kernel/qplatformwindow.h @@ -128,6 +128,9 @@ public: virtual void setFrameStrutEventsEnabled(bool enabled); virtual bool frameStrutEventsEnabled() const; + virtual void setAlertState(bool enabled); + virtual bool isAlertState() const; + static QRect initialGeometry(const QWindow *w, const QRect &initialGeometry, int defaultWidth, int defaultHeight); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 2307df37ac..8c9bc575bd 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -58,6 +58,7 @@ #include +#include #include #include @@ -2150,6 +2151,33 @@ QWindow *QWindow::fromWinId(WId id) return window; } +/*! + Causes an alert to be shown for \a msec miliseconds. If \a msec is \c 0 (the + default), then the alert is shown indefinitely until the window becomes + active again. + + In alert state, the window indicates that it demands attention, for example by + flashing or bouncing the taskbar entry. + + \since 5.1 +*/ + +void QWindow::alert(int msec) +{ + Q_D(QWindow); + if (!d->platformWindow || d->platformWindow->isAlertState()) + return; + d->platformWindow->setAlertState(true); + if (d->platformWindow->isAlertState() && msec) + QTimer::singleShot(msec, this, SLOT(_q_clearAlert())); +} + +void QWindowPrivate::_q_clearAlert() +{ + if (platformWindow && platformWindow->isAlertState()) + platformWindow->setAlertState(false); +} + #ifndef QT_NO_CURSOR /*! \brief set the cursor shape for this window @@ -2233,3 +2261,5 @@ void QWindowPrivate::applyCursor() #endif // QT_NO_CURSOR QT_END_NAMESPACE + +#include "moc_qwindow.cpp" diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 1b63e185f8..9b1ed2c702 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -290,6 +290,8 @@ public Q_SLOTS: Q_REVISION(1) void setMaximumWidth(int w); Q_REVISION(1) void setMaximumHeight(int h); + void alert(int msec); + Q_SIGNALS: void screenChanged(QScreen *screen); void modalityChanged(Qt::WindowModality modality); @@ -346,6 +348,7 @@ protected: QWindow(QWindowPrivate &dd, QWindow *parent); private: + Q_PRIVATE_SLOT(d_func(), void _q_clearAlert()) QPlatformSurface *surfaceHandle() const; Q_DISABLE_COPY(QWindow) diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index e32d45acca..ea2cb722ab 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -125,6 +125,7 @@ public: virtual QWindow *eventReceiver() { Q_Q(QWindow); return q; } void updateVisibility(); + void _q_clearAlert(); QWindow::SurfaceType surfaceType; Qt::WindowFlags windowFlags; diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 9b2b67619d..2a5e08cf41 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1802,6 +1802,19 @@ QWindowsWindow *QWindowsWindow::childAt(const QPoint &clientPoint, unsigned cwex } #ifndef Q_OS_WINCE +void QWindowsWindow::setAlertState(bool enabled) +{ + if (isAlertState() == enabled) + return; + if (enabled) { + alertWindow(0); + setFlag(AlertState); + } else { + stopAlertWindow(); + clearFlag(AlertState); + } +} + void QWindowsWindow::alertWindow(int durationMs) { DWORD timeOutMs = GetCaretBlinkTime(); diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 1148440f05..2117ca50b8 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -132,7 +132,8 @@ public: SynchronousGeometryChangeEvent = 0x400, WithinSetStyle = 0x800, WithinDestroy = 0x1000, - TouchRegistered = 0x2000 + TouchRegistered = 0x2000, + AlertState = 0x4000 }; struct WindowData @@ -255,6 +256,8 @@ public: void setWindowIcon(const QIcon &icon); #ifndef Q_OS_WINCE + void setAlertState(bool enabled); + bool isAlertState() const { return testFlag(AlertState); } void alertWindow(int durationMs = 0); void stopAlertWindow(); #endif diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 5af6a9ec9d..68ccbfb8c0 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -189,6 +189,7 @@ QXcbWindow::QXcbWindow(QWindow *window) , m_usingSyncProtocol(false) , m_deferredActivation(false) , m_embedded(false) + , m_alertState(false) , m_netWmUserTimeWindow(XCB_NONE) , m_dirtyFrameMargins(false) #if defined(XCB_USE_EGL) @@ -2047,4 +2048,17 @@ void QXcbWindow::setMask(const QRegion ®ion) #endif // !QT_NO_SHAPE +void QXcbWindow::setAlertState(bool enabled) +{ + if (m_alertState == enabled) + return; + const NetWmStates oldState = netWmStates(); + m_alertState = enabled; + if (enabled) { + setNetWmStates(oldState | NetWmStateDemandsAttention); + } else { + setNetWmStates(oldState & ~NetWmStateDemandsAttention); + } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index f4bd2d96ff..300596845e 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -56,7 +56,6 @@ QT_BEGIN_NAMESPACE class QXcbScreen; class QXcbEGLSurface; class QIcon; - class QXcbWindow : public QXcbObject, public QPlatformWindow { public: @@ -120,6 +119,9 @@ public: void setMask(const QRegion ®ion); #endif // !QT_NO_SHAPE + void setAlertState(bool enabled); + bool isAlertState() const { return m_alertState; } + xcb_window_t xcb_window() const { return m_window; } uint depth() const { return m_depth; } QImage::Format imageFormat() const { return m_imageFormat; } @@ -194,6 +196,7 @@ private: bool m_deferredExpose; bool m_configureNotifyPending; bool m_embedded; + bool m_alertState; xcb_window_t m_netWmUserTimeWindow; QSurfaceFormat m_format; diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp index 54eb443c43..0d929f367b 100644 --- a/src/widgets/kernel/qapplication_qpa.cpp +++ b/src/widgets/kernel/qapplication_qpa.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -410,8 +411,17 @@ void QApplication::beep() { } -void QApplication::alert(QWidget *, int) +void QApplication::alert(QWidget *widget, int duration) { + if (widget) { + if (widget->window()->isActiveWindow()&& !widget->window()->windowState() & Qt::WindowMinimized) + return; + if (QWindow *window= QApplicationPrivate::windowForWidget(widget)) + window->alert(duration); + } else { + foreach (QWidget *topLevel, topLevelWidgets()) + QApplication::alert(topLevel, duration); + } } void qt_init(QApplicationPrivate *priv, int type) -- cgit v1.2.3 From 155ff13bb6340101f8dcc28b5c48105dca9403cb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 10 Apr 2013 14:43:07 +0200 Subject: Implement QApplication::beep(). Invoke slot "beep" on QPlatformNativeInterface. Implement for Windows and X11. Task-number: QTBUG-30416 Change-Id: I2be651165b899e5147818a012001d354827bb090 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/windows/qwindowsintegration.cpp | 2 ++ src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 14 ++++++++++++++ src/plugins/platforms/xcb/qxcbnativeinterface.h | 3 +++ src/widgets/kernel/qapplication_qpa.cpp | 1 + 4 files changed, 20 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 03e4925c3b..73df3ec032 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -113,6 +113,8 @@ public: Q_INVOKABLE QString registerWindowClass(const QString &classNameIn, void *eventProc) const; + Q_INVOKABLE void beep() { MessageBeep(MB_OK); } // For QApplication + bool asyncExpose() const; void setAsyncExpose(bool value); diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 08e72ed5ce..6241898462 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -57,6 +57,10 @@ #include "qglxintegration.h" #endif +#ifndef XCB_USE_XLIB +# include +#endif + QT_BEGIN_NAMESPACE class QXcbResourceMap : public QMap @@ -84,6 +88,16 @@ QXcbNativeInterface::QXcbNativeInterface() : { } +void QXcbNativeInterface::beep() // For QApplication::beep() +{ +#ifdef XCB_USE_XLIB + ::Display *display = (::Display *)nativeResourceForScreen(QByteArrayLiteral("display"), QGuiApplication::primaryScreen()); + XBell(display, 0); +#else + fputc(7, stdout); +#endif +} + void *QXcbNativeInterface::nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) { QByteArray lowerCaseResource = resourceString.toLower(); diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index 75d42ac6b0..db0fa3e2ca 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -53,6 +53,7 @@ class QXcbConnection; class QXcbNativeInterface : public QPlatformNativeInterface { + Q_OBJECT public: enum ResourceType { Display, @@ -89,6 +90,8 @@ public: static void *eglContextForContext(QOpenGLContext *context); static void *glxContextForContext(QOpenGLContext *context); + Q_INVOKABLE void beep(); + private: const QByteArray m_genericEventFilterType; diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp index 0d929f367b..6567ef5c2f 100644 --- a/src/widgets/kernel/qapplication_qpa.cpp +++ b/src/widgets/kernel/qapplication_qpa.cpp @@ -409,6 +409,7 @@ QWidget *QApplication::topLevelAt(const QPoint &pos) void QApplication::beep() { + QMetaObject::invokeMethod(QGuiApplication::platformNativeInterface(), "beep"); } void QApplication::alert(QWidget *widget, int duration) -- cgit v1.2.3 From 0631caf55560a650d386978713955599362068d5 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Sat, 13 Apr 2013 09:51:35 +0200 Subject: update bundled sqlite to 3.7.16.2 Change-Id: Iae9b3012e93af3399e482e32e4bc201213567496 Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- src/3rdparty/sqlite/sqlite3.c | 8 ++++---- src/3rdparty/sqlite/sqlite3.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c index a22f57fbe1..53f68627bb 100644 --- a/src/3rdparty/sqlite/sqlite3.c +++ b/src/3rdparty/sqlite/sqlite3.c @@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.7.16.1. By combining all the individual C code files into this +** version 3.7.16.2. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -678,9 +678,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.7.16.1" +#define SQLITE_VERSION "3.7.16.2" #define SQLITE_VERSION_NUMBER 3007016 -#define SQLITE_SOURCE_ID "2013-03-29 13:44:34 527231bc67285f01fb18d4451b28f61da3c4e39d" +#define SQLITE_SOURCE_ID "2013-04-12 11:52:43 cbea02d93865ce0e06789db95fd9168ebac970c7" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -32796,7 +32796,7 @@ static int winCheckReservedLock(sqlite3_file *id, int *pResOut){ rc = 1; OSTRACE(("TEST WR-LOCK %d %d (local)\n", pFile->h, rc)); }else{ - rc = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS, RESERVED_BYTE, 0, 1, 0); + rc = winLockFile(&pFile->h, SQLITE_LOCKFILEEX_FLAGS,RESERVED_BYTE, 0, 1, 0); if( rc ){ winUnlockFile(&pFile->h, RESERVED_BYTE, 0, 1, 0); } diff --git a/src/3rdparty/sqlite/sqlite3.h b/src/3rdparty/sqlite/sqlite3.h index 1332eb1628..69b4586a3f 100644 --- a/src/3rdparty/sqlite/sqlite3.h +++ b/src/3rdparty/sqlite/sqlite3.h @@ -107,9 +107,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.7.16.1" +#define SQLITE_VERSION "3.7.16.2" #define SQLITE_VERSION_NUMBER 3007016 -#define SQLITE_SOURCE_ID "2013-03-29 13:44:34 527231bc67285f01fb18d4451b28f61da3c4e39d" +#define SQLITE_SOURCE_ID "2013-04-12 11:52:43 cbea02d93865ce0e06789db95fd9168ebac970c7" /* ** CAPI3REF: Run-Time Library Version Numbers -- cgit v1.2.3 From 1b289379dc9d2ee1afee535d5db286e7f1eade60 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 17 Apr 2013 15:14:05 +0200 Subject: Don't bootstrap QT_EVAL code For most bootstrapped tools, the QT_EVAL code will not have any effect, because most of the tools don't instantiate a QCoreApplication. However, qdoc is bootstrapped for cross compilation, and will instantiate QCoreApplication which calls the QT_EVAL code. Since the QT_EVAL code requires QObject, and QObject requires moc, it does not make sense to compile the eval code into the bootstrap library. Instead, we simply disable it to make sure the build succeeds. Change-Id: I472803572b070df041014d337c23d3f3dc0749e4 Reviewed-by: Oswald Buddenhagen --- src/tools/bootstrap/bootstrap.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 4819dbdd07..972f57260e 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -28,6 +28,8 @@ DEFINES += \ QT_CRYPTOGRAPHICHASH_ONLY_SHA1 \ QT_NO_CAST_FROM_ASCII +DEFINES -= QT_EVAL + MODULE_PRIVATE_INCLUDES = \ \$\$QT_MODULE_INCLUDE_BASE \ \$\$QT_MODULE_INCLUDE_BASE/QtCore \ -- cgit v1.2.3 From a27877c8e9e3bad148b394552862b90011f2a535 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Sat, 20 Apr 2013 12:13:58 +0300 Subject: Handle more drive fix situations in syncqt Normalize paths that begin with :/ as well. Task-number: QTBUG-30638 Change-Id: Icdc7ee9782a358771d06ae2500d32e59e6bbe866 Reviewed-by: Oswald Buddenhagen --- bin/syncqt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/syncqt b/bin/syncqt index a579cad41d..ce07af4895 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -69,7 +69,7 @@ my $normalizePath_fixDrive = ($^O eq "msys" ? 1 : 0); sub normalizePath { my $s = shift; $$s =~ s=\\=/=g; - if ($normalizePath_fixDrive && $$s =~ m,^/([a-zA-Z])/(.*),) { + if ($normalizePath_fixDrive && ($$s =~ m,^/([a-zA-Z])/(.*), || $$s =~ m,^([a-zA-Z]):/(.*),)) { $$s = lc($1) . ":/$2"; } } -- cgit v1.2.3 From 51ee309a7946f5377e26da23ae52171711e59461 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 19 Apr 2013 17:49:45 -0700 Subject: Mark that GCC 4.8.1 has support for C++11 member reference qualifiers This also marks it feature-complete for C++11 (at least, language features). See http://gcc.gnu.org/gcc-4.8/cxx0x_status.html and http://gcc.gnu.org/projects/cxx0x.html. Support for the C++11 features in the Standard Library is still incomplete, but we don't try to detect those features anyway (see http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2011). Change-Id: I55702ef48f757b536ebbf17e921442ff5bfc29f8 Reviewed-by: Olivier Goffart --- 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 e547d58c2e..ab84adacce 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -658,7 +658,11 @@ # define Q_COMPILER_ALIGNOF # define Q_COMPILER_INHERITING_CONSTRUCTORS # define Q_COMPILER_THREAD_LOCAL +# if (__GNUC__ * 100 + __GNUC_MINOR__) > 408 || __GNUC_PATCHLEVEL__ > 1 +# define Q_COMPILER_REF_QUALIFIERS +# endif # endif + /* C++11 features are complete as of GCC 4.8.1 */ # endif #endif -- cgit v1.2.3 From f78842abe429dc9b42fd15dc8e9e842ab72dcf2b Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 17 Apr 2013 09:31:49 +0200 Subject: Ensure the QLineEdit::returnPressed() signal is still emitted The signal needs to be emitted directly as the event is not passed to the QLineEdit if the QSpinBox gets the Key_Return. Since this signal may be relied upon then we ensure it is emitted directly. Change-Id: I17cdec62c9f995bacfd7d3cc66d6324f26c84c67 Reviewed-by: Stephen Kelly --- src/widgets/widgets/qabstractspinbox.cpp | 1 + tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 765dcb8981..288375fe28 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -990,6 +990,7 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) selectAll(); event->ignore(); emit editingFinished(); + emit d->edit->returnPressed(); return; #ifdef QT_KEYPAD_NAVIGATION diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index 89b7bc6790..a64b34c56a 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -138,7 +138,7 @@ private slots: void integerOverflow(); void taskQTBUG_5008_textFromValueAndValidate(); - + void lineEditReturnPressed(); public slots: void valueChangedHelper(const QString &); void valueChangedHelper(int); @@ -1044,5 +1044,14 @@ void tst_QSpinBox::integerOverflow() QCOMPARE(sb.value(), INT_MIN); } +void tst_QSpinBox::lineEditReturnPressed() +{ + SpinBox spinBox; + QSignalSpy spyCurrentChanged(spinBox.lineEdit(), SIGNAL(returnPressed())); + spinBox.show(); + QTest::keyClick(&spinBox, Qt::Key_Return); + QCOMPARE(spyCurrentChanged.count(), 1); +} + QTEST_MAIN(tst_QSpinBox) #include "tst_qspinbox.moc" -- cgit v1.2.3 From d672ef07681a959d9559dd1e11e70db1f448a7f1 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 17 Apr 2013 14:29:49 +0200 Subject: Convert the CGImage into a QPixmap after reading from clipboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that the relevant function is available we can do the conversion inside QMacPasteboardMimeTiff when obtaining an image from the clipboard Change-Id: Ie41b0fffedf4dd3f8ef49431482bd075a69722b1 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qmacmime.mm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/cocoa/qmacmime.mm b/src/plugins/platforms/cocoa/qmacmime.mm index 89539de331..51c39357ea 100644 --- a/src/plugins/platforms/cocoa/qmacmime.mm +++ b/src/plugins/platforms/cocoa/qmacmime.mm @@ -553,10 +553,8 @@ QVariant QMacPasteboardMimeTiff::convertToMime(const QString &mime, QList imageSource = CGImageSourceCreateWithData(tiffData, 0); image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0); - - // ### TODO (msorvig) QPixmap conversion - //if (image != 0) - // ret = QVariant(QPixmap::fromMacCGImageRef(image).toImage()); + if (image != 0) + ret = QVariant(qt_mac_toQImage(image)); return ret; } -- cgit v1.2.3