From 296142ba053309820ab25568e234dd24b15b3a91 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 12 Aug 2014 14:22:04 +0200 Subject: OSX MenuRole detection: remove ampersand before looking for keywords The chosen shortcut should not affect the menu role. Task-number: QTBUG-40181 Change-Id: I5a77d0109999b2fb8d40f8c526e0bbcfa31ad5e7 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/messages.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/cocoa/messages.cpp b/src/plugins/platforms/cocoa/messages.cpp index 8fc8b312f5..4f7b038c6f 100644 --- a/src/plugins/platforms/cocoa/messages.cpp +++ b/src/plugins/platforms/cocoa/messages.cpp @@ -76,27 +76,29 @@ QString qt_mac_applicationmenu_string(int type) QPlatformMenuItem::MenuRole detectMenuRole(const QString &caption) { + QString captionNoAmpersand(caption); + captionNoAmpersand.remove(QChar('&')); const QString aboutString = QCoreApplication::translate("QCocoaMenuItem", "About"); - if (caption.startsWith(aboutString, Qt::CaseInsensitive) || caption.endsWith(aboutString, Qt::CaseInsensitive)) + if (captionNoAmpersand.startsWith(aboutString, Qt::CaseInsensitive) || caption.endsWith(aboutString, Qt::CaseInsensitive)) return QPlatformMenuItem::AboutRole; - if (caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Config"), Qt::CaseInsensitive) - || caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Preference"), Qt::CaseInsensitive) - || caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Options"), Qt::CaseInsensitive) - || caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setting"), Qt::CaseInsensitive) - || caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setup"), Qt::CaseInsensitive)) { + if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Config"), Qt::CaseInsensitive) + || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Preference"), Qt::CaseInsensitive) + || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Options"), Qt::CaseInsensitive) + || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setting"), Qt::CaseInsensitive) + || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setup"), Qt::CaseInsensitive)) { return QPlatformMenuItem::PreferencesRole; } - if (caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Quit"), Qt::CaseInsensitive) - || caption.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Exit"), Qt::CaseInsensitive)) { + if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Quit"), Qt::CaseInsensitive) + || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Exit"), Qt::CaseInsensitive)) { return QPlatformMenuItem::QuitRole; } - if (!caption.compare(QCoreApplication::translate("QCocoaMenuItem", "Cut"), Qt::CaseInsensitive)) + if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Cut"), Qt::CaseInsensitive)) return QPlatformMenuItem::CutRole; - if (!caption.compare(QCoreApplication::translate("QCocoaMenuItem", "Copy"), Qt::CaseInsensitive)) + if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Copy"), Qt::CaseInsensitive)) return QPlatformMenuItem::CopyRole; - if (!caption.compare(QCoreApplication::translate("QCocoaMenuItem", "Paste"), Qt::CaseInsensitive)) + if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Paste"), Qt::CaseInsensitive)) return QPlatformMenuItem::PasteRole; - if (!caption.compare(QCoreApplication::translate("QCocoaMenuItem", "Select All"), Qt::CaseInsensitive)) + if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Select All"), Qt::CaseInsensitive)) return QPlatformMenuItem::SelectAllRole; return QPlatformMenuItem::NoRole; } -- cgit v1.2.3 From 9f486efcbe5ca0f5bb8ba895c4931a5e30748ed6 Mon Sep 17 00:00:00 2001 From: Marcel Krems Date: Tue, 12 Aug 2014 13:10:08 +0200 Subject: Show the correct cursor for QLineEdit's side buttons. Task-number: QTBUG-40708 Change-Id: I5869f42bab3a27085b5572a4b83b16c39a67f733 Reviewed-by: Marc Mutz --- src/widgets/widgets/qlineedit_p.cpp | 3 +-- tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 10689b2fc3..d19fe43eb2 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -309,7 +309,6 @@ QLineEditIconButton::QLineEditIconButton(QWidget *parent) : QToolButton(parent) , m_opacity(0) { - updateCursor(); setFocusPolicy(Qt::NoFocus); } @@ -333,6 +332,7 @@ void QLineEditIconButton::setOpacity(qreal value) { if (!qFuzzyCompare(m_opacity, value)) { m_opacity = value; + updateCursor(); update(); } } @@ -340,7 +340,6 @@ void QLineEditIconButton::setOpacity(qreal value) void QLineEditIconButton::startOpacityAnimation(qreal endValue) { QPropertyAnimation *animation = new QPropertyAnimation(this, QByteArrayLiteral("opacity")); - connect(animation, &QAbstractAnimation::finished, this, &QLineEditIconButton::updateCursor); animation->setDuration(160); animation->setEndValue(endValue); animation->start(QAbstractAnimation::DeleteWhenStopped); diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 36f14cb1ba..2d050cd5fa 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -4182,10 +4182,12 @@ void tst_QLineEdit::clearButton() QVERIFY(clearButton); QCOMPARE(filterModel->rowCount(), 3); QTest::keyClick(filterLineEdit, 'a'); + QTRY_COMPARE(clearButton->cursor().shape(), Qt::ArrowCursor); QTRY_COMPARE(filterModel->rowCount(), 2); // matches 'aa', 'ab' QTest::keyClick(filterLineEdit, 'b'); QTRY_COMPARE(filterModel->rowCount(), 1); // matches 'ab' QTest::mouseClick(clearButton, Qt::LeftButton, 0, QRect(QPoint(0, 0), clearButton->size()).center()); + QTRY_COMPARE(clearButton->cursor().shape(), filterLineEdit->cursor().shape()); QTRY_COMPARE(filterModel->rowCount(), 3); filterLineEdit->setReadOnly(true); // QTBUG-34315 @@ -4215,6 +4217,8 @@ void tst_QLineEdit::sideWidgets() testWidget.move(300, 300); testWidget.show(); QVERIFY(QTest::qWaitForWindowExposed(&testWidget)); + foreach (QToolButton *button, lineEdit->findChildren()) + QCOMPARE(button->cursor().shape(), Qt::ArrowCursor); // Arbitrarily add/remove actions, trying to detect crashes. Add QTRY_VERIFY(false) to view the result. delete label3Action; lineEdit->removeAction(label2Action); -- cgit v1.2.3 From f2c7ea717874664ee4927f500efc244fde585d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Tue, 12 Aug 2014 17:09:36 +0100 Subject: Fix build with QT_NO_MDIAREA Change-Id: I456fea53f641476ea63cbe170cc65811c92eb290 Reviewed-by: Marc Mutz --- src/widgets/kernel/qwindowcontainer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 1770e60c2e..dc35dee1a9 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -92,8 +92,11 @@ public: Q_Q(QWindowContainer); QWidget *p = q->parentWidget(); while (p) { - if (qobject_cast(p) != 0 - || qobject_cast(p) != 0) { + if ( +#ifndef QT_NO_MDIAREA + qobject_cast(p) != 0 || +#endif + qobject_cast(p) != 0) { q->winId(); usesNativeWidgets = true; break; -- cgit v1.2.3 From bf9a4ef8b4210bd1f434828911361008ea2350ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Mon, 11 Aug 2014 19:28:23 +0100 Subject: Fix QT_NO_ANIMATION build Change-Id: Ia589e703206d6ca675a392e634e2a445dcf4cca3 Reviewed-by: Marc Mutz --- src/gui/kernel/qguiapplication.cpp | 4 ++++ src/widgets/styles/qcommonstyle.cpp | 2 ++ src/widgets/styles/qcommonstyle.h | 2 ++ src/widgets/styles/qcommonstyle_p.h | 4 ++++ src/widgets/styles/qstyleanimation.cpp | 5 +++++ src/widgets/styles/qstyleanimation_p.h | 4 ++++ src/widgets/widgets/qlineedit_p.cpp | 4 ++++ src/widgets/widgets/qlineedit_p.h | 4 ++++ 8 files changed, 29 insertions(+) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index e5cf48dd6b..7648233608 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -175,7 +175,9 @@ bool QGuiApplicationPrivate::noGrab = false; static qreal fontSmoothingGamma = 1.7; extern void qRegisterGuiVariant(); +#ifndef QT_NO_ANIMATION extern void qRegisterGuiGetInterpolator(); +#endif extern void qInitDrawhelperAsm(); extern void qInitImageConversions(); @@ -1288,8 +1290,10 @@ void QGuiApplicationPrivate::init() // trigger registering of QVariant's GUI types qRegisterGuiVariant(); +#ifndef QT_NO_ANIMATION // trigger registering of animation interpolators qRegisterGuiGetInterpolator(); +#endif QWindowSystemInterfacePrivate::eventTime.start(); diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index d7030c5d72..27fef46772 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1136,6 +1136,7 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTabV3 *opt, const QWidget } #endif //QT_NO_TABBAR +#ifndef QT_NO_ANIMATION /*! \internal */ QList QCommonStylePrivate::animationTargets() const { @@ -1176,6 +1177,7 @@ void QCommonStylePrivate::_q_removeAnimation() if (animation) animations.remove(animation->parent()); } +#endif /*! \reimp diff --git a/src/widgets/styles/qcommonstyle.h b/src/widgets/styles/qcommonstyle.h index 942721a6a3..ef5634a94d 100644 --- a/src/widgets/styles/qcommonstyle.h +++ b/src/widgets/styles/qcommonstyle.h @@ -98,7 +98,9 @@ protected: private: Q_DECLARE_PRIVATE(QCommonStyle) Q_DISABLE_COPY(QCommonStyle) +#ifndef QT_NO_ANIMATION Q_PRIVATE_SLOT(d_func(), void _q_removeAnimation()) +#endif }; QT_END_NAMESPACE diff --git a/src/widgets/styles/qcommonstyle_p.h b/src/widgets/styles/qcommonstyle_p.h index 8f8a97a2dc..1f5d8b8a81 100644 --- a/src/widgets/styles/qcommonstyle_p.h +++ b/src/widgets/styles/qcommonstyle_p.h @@ -77,7 +77,9 @@ public: ~QCommonStylePrivate() { +#ifndef QT_NO_ANIMATION qDeleteAll(animations); +#endif #ifndef QT_NO_ITEMVIEWS delete cachedOption; #endif @@ -114,6 +116,7 @@ public: #endif int animationFps; +#ifndef QT_NO_ANIMATION void _q_removeAnimation(); QList animationTargets() const; @@ -123,6 +126,7 @@ public: private: mutable QHash animations; +#endif // QT_NO_ANIMATION }; QT_END_NAMESPACE diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp index 85dc357ab5..6668be8307 100644 --- a/src/widgets/styles/qstyleanimation.cpp +++ b/src/widgets/styles/qstyleanimation.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qstyleanimation_p.h" + +#ifndef QT_NO_ANIMATION + #include #include #include @@ -344,3 +347,5 @@ void QScrollbarStyleAnimation::updateCurrentTime(int time) } QT_END_NAMESPACE + +#endif //QT_NO_ANIMATION diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h index c344858812..33868a3440 100644 --- a/src/widgets/styles/qstyleanimation_p.h +++ b/src/widgets/styles/qstyleanimation_p.h @@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_ANIMATION + // // W A R N I N G // ------------- @@ -184,6 +186,8 @@ private: bool _active; }; +#endif // QT_NO_ANIMATION + QT_END_NAMESPACE #endif // QSTYLEANIMATION_P_H diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index d19fe43eb2..a4394ae92b 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -337,6 +337,7 @@ void QLineEditIconButton::setOpacity(qreal value) } } +#ifndef QT_NO_ANIMATION void QLineEditIconButton::startOpacityAnimation(qreal endValue) { QPropertyAnimation *animation = new QPropertyAnimation(this, QByteArrayLiteral("opacity")); @@ -344,6 +345,7 @@ void QLineEditIconButton::startOpacityAnimation(qreal endValue) animation->setEndValue(endValue); animation->start(QAbstractAnimation::DeleteWhenStopped); } +#endif void QLineEditIconButton::updateCursor() { @@ -358,6 +360,7 @@ void QLineEditPrivate::_q_textChanged(const QString &text) const int newTextSize = text.size(); if (!newTextSize || !lastTextSize) { lastTextSize = newTextSize; +#ifndef QT_NO_ANIMATION const bool fadeIn = newTextSize > 0; foreach (const SideWidgetEntry &e, leadingSideWidgets) { if (e.flags & SideWidgetFadeInWithText) @@ -367,6 +370,7 @@ void QLineEditPrivate::_q_textChanged(const QString &text) if (e.flags & SideWidgetFadeInWithText) static_cast(e.widget)->animateShow(fadeIn); } +#endif } } } diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index db8edee005..7749d9902a 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -84,7 +84,9 @@ public: qreal opacity() const { return m_opacity; } void setOpacity(qreal value); +#ifndef QT_NO_ANIMATION void animateShow(bool visible) { startOpacityAnimation(visible ? 1.0 : 0.0); } +#endif protected: void paintEvent(QPaintEvent *event); @@ -93,7 +95,9 @@ private slots: void updateCursor(); private: +#ifndef QT_NO_ANIMATION void startOpacityAnimation(qreal endValue); +#endif qreal m_opacity; }; -- cgit v1.2.3 From 10b9e1b6b4deadfa35caefb0c8fdc5b69c63fe0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Tue, 12 Aug 2014 18:00:53 +0100 Subject: Fix QT_NO_REGULAREXPRESSION build Change-Id: Ibf1358733d7c5aa2c14cf46c23a24ba4da14143c Reviewed-by: Marc Mutz --- src/corelib/tools/qregularexpression.cpp | 4 ++++ src/testlib/qtestcase.cpp | 2 ++ src/testlib/qtestcase.h | 2 ++ src/testlib/qtestlog.cpp | 8 ++++++++ src/testlib/qtestlog_p.h | 2 ++ 5 files changed, 18 insertions(+) diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index e1cf82bb8c..257141efdc 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -43,6 +43,8 @@ #include "qregularexpression.h" +#ifndef QT_NO_REGULAREXPRESSION + #include #include #include @@ -2495,3 +2497,5 @@ static const char *pcreCompileErrorCodes[] = #endif // #if 0 QT_END_NAMESPACE + +#endif // QT_NO_REGULAREXPRESSION diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 5d2014b0c5..83cba0d672 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -2617,10 +2617,12 @@ void QTest::ignoreMessage(QtMsgType type, const char *message) \since 5.3 */ +#ifndef QT_NO_REGULAREXPRESSION void QTest::ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern) { QTestLog::ignoreMessage(type, messagePattern); } +#endif /*! \internal */ diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index d9c8a43a2a..2b9acabf95 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -248,7 +248,9 @@ namespace QTest const char *file, int line); Q_TESTLIB_EXPORT void qWarn(const char *message, const char *file = 0, int line = 0); Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message); +#ifndef QT_NO_REGULAREXPRESSION Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern); +#endif Q_TESTLIB_EXPORT QString qFindTestData(const char* basepath, const char* file = 0, int line = 0, const char* builddir = 0); Q_TESTLIB_EXPORT QString qFindTestData(const QString& basepath, const char* file = 0, int line = 0, const char* builddir = 0); diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 8cca892a4d..4ef1113641 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -133,7 +133,11 @@ namespace QTest { return tp == type && (pattern.type() == QVariant::String ? stringsMatch(pattern.toString(), message) : +#ifndef QT_NO_REGULAREXPRESSION pattern.toRegularExpression().match(message).hasMatch()); +#else + false); +#endif } QtMsgType type; @@ -359,7 +363,9 @@ void QTestLog::printUnhandledIgnoreMessages() if (list->pattern.type() == QVariant::String) { message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"'); } else { +#ifndef QT_NO_REGULAREXPRESSION message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"'); +#endif } QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, message); @@ -512,12 +518,14 @@ void QTestLog::ignoreMessage(QtMsgType type, const char *msg) QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QString::fromLocal8Bit(msg)); } +#ifndef QT_NO_REGULAREXPRESSION void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expression) { QTEST_ASSERT(expression.isValid()); QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QVariant(expression)); } +#endif void QTestLog::setMaxWarnings(int m) { diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h index a987c45806..0ed6750f63 100644 --- a/src/testlib/qtestlog_p.h +++ b/src/testlib/qtestlog_p.h @@ -76,7 +76,9 @@ public: static void addBenchmarkResult(const QBenchmarkResult &result); static void ignoreMessage(QtMsgType type, const char *msg); +#ifndef QT_NO_REGULAREXPRESSION static void ignoreMessage(QtMsgType type, const QRegularExpression &expression); +#endif static int unhandledIgnoreMessages(); static void printUnhandledIgnoreMessages(); static void clearIgnoreMessages(); -- cgit v1.2.3 From c6718f01c20779da00689b3ef66ede7af5fe8ce5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 12 Aug 2014 09:47:41 -0700 Subject: Correct the SYNC hint for the release barrier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MIPS32 manual I have says 0x11 is SYNC_ACQUIRE and 0x12 is SYNC_RELEASE. The change was an unintentional mistake in commit 60b6b28c213a420ee40e254ff1823876098e0a04. Thanks to Spencer Schumann for spotting this. Change-Id: I16885e4e86e8befa8931733d0b5a54ac9942f176 Reviewed-by: Spencer Schumann Reviewed-by: Olivier Goffart Reviewed-by: Lisandro Damián Nicanor Pérez Meyer --- src/corelib/arch/qatomic_mips.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/arch/qatomic_mips.h b/src/corelib/arch/qatomic_mips.h index 7bfe16a450..33e7053234 100644 --- a/src/corelib/arch/qatomic_mips.h +++ b/src/corelib/arch/qatomic_mips.h @@ -121,7 +121,7 @@ void QBasicAtomicOps::releaseMemoryFence(const T &) Q_DECL_NOTHROW { asm volatile (".set push\n" ".set mips32\n" - "sync 0x11\n" + "sync 0x12\n" ".set pop\n" ::: "memory"); } -- cgit v1.2.3 From 4848796f3e2f4aeebb8cbc0782853f27f93afeec Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 20 Jun 2014 10:37:51 -0700 Subject: Make sure we don't cache old file sizes prior to new writes If we write to a file, its size changes. We should drop previous size caches. Change-Id: Ib687c91e5fc88cab588c89023f23da9622160da9 Reviewed-by: Olivier Goffart Reviewed-by: Rafael Roquetto --- src/corelib/io/qfsfileengine.cpp | 3 +++ tests/auto/corelib/io/qfile/tst_qfile.cpp | 40 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 998a3334c9..1ae182a4c1 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -742,6 +742,9 @@ qint64 QFSFileEnginePrivate::writeFdFh(const char *data, qint64 len) if (len && writtenBytes == 0) { writtenBytes = -1; q->setError(errno == ENOSPC ? QFile::ResourceError : QFile::WriteError, qt_error_string(errno)); + } else { + // reset the cached size, if any + metaData.clearFlags(QFileSystemMetaData::SizeAttribute); } return writtenBytes; diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 60d1517ed3..1afe629dac 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -234,6 +234,8 @@ private slots: void mapResource(); void mapOpenMode_data(); void mapOpenMode(); + void mapWrittenFile_data(); + void mapWrittenFile(); #ifndef Q_OS_WINCE void openStandardStreamsFileDescriptors(); @@ -3079,6 +3081,44 @@ void tst_QFile::mapOpenMode() file.close(); } +void tst_QFile::mapWrittenFile_data() +{ + QTest::addColumn("mode"); + QTest::newRow("buffered") << 0; + QTest::newRow("unbuffered") << int(QIODevice::Unbuffered); +} + +void tst_QFile::mapWrittenFile() +{ + static const char data[128] = "Some data padded with nulls\n"; + QFETCH(int, mode); + + QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile"; + +#ifdef Q_OS_WINCE + fileName = QFileInfo(fileName).absoluteFilePath(); +#endif + + if (QFile::exists(fileName)) { + QVERIFY(QFile::setPermissions(fileName, + QFile::WriteOwner | QFile::ReadOwner | QFile::WriteUser | QFile::ReadUser)); + QFile::remove(fileName); + } + QFile file(fileName); + QVERIFY(file.open(QIODevice::ReadWrite | QFile::OpenMode(mode))); + QCOMPARE(file.write(data, sizeof data), qint64(sizeof data)); + if ((mode & QIODevice::Unbuffered) == 0) + file.flush(); + + // test that we can read the data we've just written, without closing the file + uchar *memory = file.map(0, sizeof data); + QVERIFY(memory); + QVERIFY(memcmp(memory, data, sizeof data) == 0); + + file.close(); + file.remove(); +} + void tst_QFile::openDirectory() { QFile f1(m_resourcesDir); -- cgit v1.2.3 From 509d6770d90074f34a95c0b9c75149f0d531f03e Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 12 Aug 2014 10:25:16 +0200 Subject: Let QImage::mirrored() retain dots-per-meter settings Task-number: QTBUG-40582 Change-Id: Iffeba44fa6d1f34331bb69ff9aabce88efe279a7 Reviewed-by: Laszlo Agocs Reviewed-by: Gunnar Sletta --- src/gui/image/qimage.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 273c1c922e..3c25aa848d 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2836,6 +2836,8 @@ QImage QImage::mirrored_helper(bool horizontal, bool vertical) const result.d->colortable = d->colortable; result.d->has_alpha_clut = d->has_alpha_clut; result.d->devicePixelRatio = d->devicePixelRatio; + result.d->dpmx = d->dpmx; + result.d->dpmy = d->dpmy; do_mirror(result.d, d, horizontal, vertical); -- cgit v1.2.3 From 319cbb7597100f3b65792dc6a0ce2885ce6c0e8c Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 12 Aug 2014 13:54:17 +0200 Subject: Fix QPainter::drawPolyline() painting errors with cosmetic pen Task-number: QTBUG-31579 Change-Id: I8fd2c03ff9a22e4963bfcbcfe196ae4c61b9e10f Reviewed-by: Gunnar Sletta --- src/gui/painting/qcosmeticstroker.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index a2301e3cd8..926a1696b0 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -533,8 +533,8 @@ void QCosmeticStroker::drawPath(const QVectorPath &path) QPointF p = QPointF(points[0], points[1]) * state->matrix; patternOffset = state->lastPen.dashOffset()*64; - lastPixel.x = -1; - lastPixel.y = -1; + lastPixel.x = INT_MIN; + lastPixel.y = INT_MIN; bool closed; const QPainterPath::ElementType *e = subPath(type, end, points, &closed); @@ -588,8 +588,8 @@ void QCosmeticStroker::drawPath(const QVectorPath &path) QPointF p = QPointF(points[0], points[1]) * state->matrix; QPointF movedTo = p; patternOffset = state->lastPen.dashOffset()*64; - lastPixel.x = -1; - lastPixel.y = -1; + lastPixel.x = INT_MIN; + lastPixel.y = INT_MIN; const qreal *begin = points; const qreal *end = points + 2*path.elementCount(); -- cgit v1.2.3 From 347be657b72b7f335de89d2d545073ef7a12263a Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Mon, 31 Mar 2014 16:36:35 +0300 Subject: Set iMX device specific compiler flags to QMAKE_CFLAGS Device specific compiler flags need to go to QMAKE_CFLAGS, so that they are used also when --force-debug-info is used. Removed separate _DEBUG and _RELEASE, since the gcc-base provides same defaults. Change-Id: I6ce0133a1acf419261b7756525185f43581d2a9c Reviewed-by: Oswald Buddenhagen --- mkspecs/devices/linux-imx53qsb-g++/qmake.conf | 7 ++----- mkspecs/devices/linux-imx6-g++/qmake.conf | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/mkspecs/devices/linux-imx53qsb-g++/qmake.conf b/mkspecs/devices/linux-imx53qsb-g++/qmake.conf index 3a9766c4cb..937bbf2416 100644 --- a/mkspecs/devices/linux-imx53qsb-g++/qmake.conf +++ b/mkspecs/devices/linux-imx53qsb-g++/qmake.conf @@ -26,11 +26,8 @@ QMAKE_LIBS_OPENVG += -lOpenVG -lEGL QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib IMX5_CFLAGS = -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -Wno-psabi -IMX5_CFLAGS_RELEASE = -O2 $$IMX5_CFLAGS -QMAKE_CFLAGS_RELEASE += $$IMX5_CFLAGS_RELEASE -QMAKE_CXXFLAGS_RELEASE += $$IMX5_CFLAGS_RELEASE -QMAKE_CFLAGS_DEBUG += $$IMX5_CFLAGS -QMAKE_CXXFLAGS_DEBUG += $$IMX5_CFLAGS +QMAKE_CFLAGS += $$IMX5_CFLAGS +QMAKE_CXXFLAGS += $$IMX5_CFLAGS include(../common/linux_arm_device_post.conf) diff --git a/mkspecs/devices/linux-imx6-g++/qmake.conf b/mkspecs/devices/linux-imx6-g++/qmake.conf index 2b8dbf6b67..4f464ffa83 100644 --- a/mkspecs/devices/linux-imx6-g++/qmake.conf +++ b/mkspecs/devices/linux-imx6-g++/qmake.conf @@ -28,11 +28,8 @@ QMAKE_LIBS_OPENVG += -lOpenVG -lEGL -lGAL QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib IMX6_CFLAGS = -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -IMX6_CFLAGS_RELEASE = -O2 $$IMX6_CFLAGS -QMAKE_CFLAGS_RELEASE += $$IMX6_CFLAGS_RELEASE -QMAKE_CXXFLAGS_RELEASE += $$IMX6_CFLAGS_RELEASE -QMAKE_CFLAGS_DEBUG += $$IMX6_CFLAGS -QMAKE_CXXFLAGS_DEBUG += $$IMX6_CFLAGS +QMAKE_CFLAGS += $$IMX6_CFLAGS +QMAKE_CXXFLAGS += $$IMX6_CFLAGS include(../common/linux_arm_device_post.conf) -- cgit v1.2.3 From b3431a9553ec11b85b5e91c67b1ebaa6e1bfd59b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 8 Aug 2014 14:38:22 +0200 Subject: QFusionStyle paints sliders outside of clip When painting a slider the QFusionStyle overrides the existing clip on QPainter thereby causing itself to be painting unclipped. Changes replace clipping with intersection clipping. Task-number: QTBUG-40530 Change-Id: I0135928c36ca1d23c906cf82c584ded01720b1cc Reviewed-by: Gunnar Sletta --- src/widgets/styles/qfusionstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 82c53def7d..012f5ea18f 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -2890,7 +2890,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption clipRect = QRect(groove.left(), groove.top(), groove.width(), handle.top() - groove.top()); } painter->save(); - painter->setClipRect(clipRect.adjusted(0, 0, 1, 1)); + painter->setClipRect(clipRect.adjusted(0, 0, 1, 1), Qt::IntersectClip); painter->drawPixmap(groove.topLeft(), cache); painter->restore(); } -- cgit v1.2.3 From a0b021d1366c772cd9c2cefcb1c47b47c35b5517 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 13 Aug 2014 14:17:33 +0200 Subject: Fix selection of fonts based on styleName By carrying the styleName through from QFontDef to bestFoundry and giving it to bestStyle that can use it we can accurately match fonts based on styleName. This makes it possible to match styles such as DejaVu Sans Condensed and Ubuntu Medium. The example fontsampler is updated so it can actually sample all the different styles it lists. Change-Id: I381effc74130311f98794cd07d30be10dee4fe45 Reviewed-by: Shawn Rutledge --- examples/widgets/painting/fontsampler/mainwindow.cpp | 6 +++++- src/gui/text/qfontdatabase.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/widgets/painting/fontsampler/mainwindow.cpp b/examples/widgets/painting/fontsampler/mainwindow.cpp index 516ba5e2bc..bb7b7c7c28 100644 --- a/examples/widgets/painting/fontsampler/mainwindow.cpp +++ b/examples/widgets/painting/fontsampler/mainwindow.cpp @@ -143,7 +143,9 @@ void MainWindow::showFont(QTreeWidgetItem *item) QString oldText = textEdit->toPlainText().trimmed(); bool modified = textEdit->document()->isModified(); textEdit->clear(); - textEdit->document()->setDefaultFont(QFont(family, 32, weight, italic)); + QFont font(family, 32, weight, italic); + font.setStyleName(style); + textEdit->document()->setDefaultFont(font); QTextCursor cursor = textEdit->textCursor(); QTextBlockFormat blockFormat; @@ -324,6 +326,7 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer) // Calculate the maximum width and total height of the text. foreach (int size, sampleSizes) { QFont font(family, size, weight, italic); + font.setStyleName(style); font = QFont(font, painter->device()); QFontMetricsF fontMetrics(font); QRectF rect = fontMetrics.boundingRect( @@ -357,6 +360,7 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer) // Draw each line of text. foreach (int size, sampleSizes) { QFont font(family, size, weight, italic); + font.setStyleName(style); font = QFont(font, painter->device()); QFontMetricsF fontMetrics(font); QRectF rect = fontMetrics.boundingRect(QString("%1 %2").arg( diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 86a0bf1066..7aa5af8a98 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -931,7 +931,7 @@ static unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, const QtFontFamily *family, const QString &foundry_name, QtFontStyle::Key styleKey, int pixelSize, char pitch, - QtFontDesc *desc, int force_encoding_id) + QtFontDesc *desc, int force_encoding_id, QString styleName = QString()) { Q_UNUSED(force_encoding_id); Q_UNUSED(script); @@ -953,7 +953,7 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, FM_DEBUG(" looking for matching style in foundry '%s' %d", foundry->name.isEmpty() ? "-- none --" : foundry->name.toLatin1().constData(), foundry->count); - QtFontStyle *style = bestStyle(foundry, styleKey); + QtFontStyle *style = bestStyle(foundry, styleKey, styleName); if (!style->smoothScalable && (styleStrategy & QFont::ForceOutline)) { FM_DEBUG(" ForceOutline set, but not smoothly scalable"); @@ -1140,13 +1140,13 @@ static int match(int script, const QFontDef &request, unsigned int newscore = bestFoundry(script, score, request.styleStrategy, test.family, foundry_name, styleKey, request.pixelSize, pitch, - &test, force_encoding_id); + &test, force_encoding_id, request.styleName); if (test.foundry == 0) { // the specific foundry was not found, so look for // any foundry matching our requirements newscore = bestFoundry(script, score, request.styleStrategy, test.family, QString(), styleKey, request.pixelSize, - pitch, &test, force_encoding_id); + pitch, &test, force_encoding_id, request.styleName); } if (newscore < score) { -- cgit v1.2.3 From 91e103d7571e3df88c70e0f043ccac0670191b62 Mon Sep 17 00:00:00 2001 From: Julien Brianceau Date: Thu, 14 Aug 2014 11:47:47 +0200 Subject: Fix x86/32-bit build when using an old version of gcc Versions prior to 4.3 don't define __SIZEOF_POINTER__ macro. Change-Id: I3144329778acd276e2fb885cb197a4532a15da70 Reviewed-by: Thiago Macieira --- src/corelib/global/qprocessordetection.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index c9fb728593..47d6dcd7f6 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -169,6 +169,7 @@ #elif defined(__i386) || defined(__i386__) || defined(_M_IX86) # define Q_PROCESSOR_X86_32 # define Q_BYTE_ORDER Q_LITTLE_ENDIAN +# define Q_PROCESSOR_WORDSIZE 4 /* * We define Q_PROCESSOR_X86 == 6 for anything above a equivalent or better -- cgit v1.2.3 From a128347c9b51fc9fa629662a14b77e1489537276 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 13 Aug 2014 18:44:24 +0200 Subject: Fix rendering of fonts matched based on stretch If the fontdatabase matches a font based on the stretch aka width then the stretch factor on the font-engine needs to be 100 to avoid the fontengine doing manual stretching. Without this a font requested with 75 stretch and matched with a font of 75 stretch would be further condensed 25% by the fontengine. Change-Id: Ib85ff027420c0ce891b0808dab13d25417d22df1 Reviewed-by: Shawn Rutledge --- src/gui/text/qfontdatabase.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 7aa5af8a98..c3be9da2f7 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -822,6 +822,13 @@ QFontEngine *loadSingleEngine(int script, QFontCache::Key key(def,script); QFontEngine *engine = QFontCache::instance()->findEngine(key); if (!engine) { + // If the font data's native stretch matches the requested stretch we need to set stretch to 100 + // to avoid the fontengine synthesizing stretch. If they didn't match exactly we need to calculate + // the new stretch factor. This only done if not matched by styleName. + bool styleNameMatch = !request.styleName.isEmpty() && request.styleName == style->styleName; + if (!styleNameMatch && style->key.stretch != 0 && request.stretch != 0) + def.stretch = (request.stretch * 100 + 50) / style->key.stretch; + engine = pfdb->fontEngine(def, size->handle); if (engine) { Q_ASSERT(engine->type() != QFontEngine::Multi); -- cgit v1.2.3 From cd912ce0673f7626094add3951b1dcfae5cc10f5 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 14 Aug 2014 12:19:22 +0200 Subject: Fix mistake in function extraTryFontsForFamily Taiwan and mainland China were inverted in the extraTryFontsForFamily method. This patch fixes it and makes sure to match the rest of the Chinese LANGIDs. Task-number: QTBUG-33307 Change-Id: I45048ff5e9c00d20f8e922902701129e80ed459d Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 696dc06cee..f30dcbaa32 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1582,11 +1582,11 @@ QStringList QWindowsFontDatabase::extraTryFontsForFamily(const QString &family) if (!tryFonts) { LANGID lid = GetUserDefaultLangID(); switch (lid&0xff) { - case LANG_CHINESE: // Chinese (Taiwan) - if ( lid == 0x0804 ) // Taiwan - tryFonts = ch_TW_tryFonts; - else + case LANG_CHINESE: // Chinese + if ( lid == 0x0804 || lid == 0x1004) // China mainland and Singapore tryFonts = ch_CN_tryFonts; + else + tryFonts = ch_TW_tryFonts; // Taiwan, Hong Kong and Macau break; case LANG_JAPANESE: tryFonts = jp_tryFonts; -- cgit v1.2.3 From f630eb1120e64d7bda8b2e69e24f65f0de592b5d Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Fri, 15 Aug 2014 15:23:58 +0300 Subject: Remove reference to gdb_dwarf_index from the freebsd-clang mkspec. Follow-up to 9de2853a ("Remove automated generation of dwarf index"): gdb_dwarf_index.prf does not exist anymore, so stop referencing it. Change-Id: I22464d5b81a50a2f58218d74a424f3a790aa1df0 Reviewed-by: Gabriel de Dietrich --- mkspecs/unsupported/freebsd-clang/qmake.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/mkspecs/unsupported/freebsd-clang/qmake.conf b/mkspecs/unsupported/freebsd-clang/qmake.conf index 0769983097..f48f44bbb3 100644 --- a/mkspecs/unsupported/freebsd-clang/qmake.conf +++ b/mkspecs/unsupported/freebsd-clang/qmake.conf @@ -4,7 +4,6 @@ MAKEFILE_GENERATOR = UNIX QMAKE_PLATFORM = freebsd bsd -CONFIG += gdb_dwarf_index QMAKE_CFLAGS_THREAD = -pthread -D_THREAD_SAFE -- cgit v1.2.3 From 45cbbe56bc13216b83215ea148590eccf81f420a Mon Sep 17 00:00:00 2001 From: Matt Broadstone Date: Fri, 15 Aug 2014 09:26:04 -0400 Subject: refactor disconnectFromFtp to remove cached entries when necessary In cases where a cached ftp connection fails to connect, or a file transfer has failed, we should removed the cached connection. Since qnam has an idea of a single internal QFtp per full operation, when file transfers failed previously the cached connection would be reused for subsequent connections and thus fail. [ChangeLog][QtNetwork][QNetworkAccessManager] QNetworkAccessManager now properly handles FTP transfer failures by removing failed cached ftp connections. Task-number: QTBUG-40797 Change-Id: Ie090a39ceddd7e58a0d8baf7d01f2a08c70162e5 Reviewed-by: Richard J. Moore --- src/network/access/qnetworkaccessftpbackend.cpp | 20 +++++++++----------- src/network/access/qnetworkaccessftpbackend_p.h | 7 ++++++- .../access/qnetworkreply/tst_qnetworkreply.cpp | 21 +++++++++++++++++++++ 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp index 246eb41657..e8695f9b56 100644 --- a/src/network/access/qnetworkaccessftpbackend.cpp +++ b/src/network/access/qnetworkaccessftpbackend.cpp @@ -211,7 +211,7 @@ void QNetworkAccessFtpBackend::ftpConnectionReady(QNetworkAccessCache::Cacheable // no, defer the actual operation until after we've logged in } -void QNetworkAccessFtpBackend::disconnectFromFtp() +void QNetworkAccessFtpBackend::disconnectFromFtp(CacheCleanupMode mode) { state = Disconnecting; @@ -219,7 +219,12 @@ void QNetworkAccessFtpBackend::disconnectFromFtp() disconnect(ftp, 0, this, 0); QByteArray key = makeCacheKey(url()); - QNetworkAccessManagerPrivate::getObjectCache(this)->releaseEntry(key); + if (mode == RemoveCachedConnection) { + QNetworkAccessManagerPrivate::getObjectCache(this)->removeEntry(key); + ftp->dispose(); + } else { + QNetworkAccessManagerPrivate::getObjectCache(this)->releaseEntry(key); + } ftp = 0; } @@ -274,14 +279,7 @@ void QNetworkAccessFtpBackend::ftpDone() } // we're not connected, so remove the cache entry: - QByteArray key = makeCacheKey(url()); - QNetworkAccessManagerPrivate::getObjectCache(this)->removeEntry(key); - - disconnect(ftp, 0, this, 0); - ftp->dispose(); - ftp = 0; - - state = Disconnecting; + disconnectFromFtp(RemoveCachedConnection); finished(); return; } @@ -301,7 +299,7 @@ void QNetworkAccessFtpBackend::ftpDone() else error(QNetworkReply::ContentAccessDenied, msg); - disconnectFromFtp(); + disconnectFromFtp(RemoveCachedConnection); finished(); } diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h index c006d450b8..534efad676 100644 --- a/src/network/access/qnetworkaccessftpbackend_p.h +++ b/src/network/access/qnetworkaccessftpbackend_p.h @@ -90,7 +90,12 @@ public: virtual void downstreamReadyWrite(); - void disconnectFromFtp(); + enum CacheCleanupMode { + ReleaseCachedConnection, + RemoveCachedConnection + }; + + void disconnectFromFtp(CacheCleanupMode mode = ReleaseCachedConnection); public slots: void ftpConnectionReady(QNetworkAccessCache::CacheableObject *object); diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 480eeecb63..9988db74c7 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -206,6 +206,7 @@ private Q_SLOTS: void getFromFileSpecial(); void getFromFtp_data(); void getFromFtp(); + void getFromFtpAfterError(); // QTBUG-40797 void getFromHttp_data(); void getFromHttp(); void getErrors_data(); @@ -1753,6 +1754,26 @@ void tst_QNetworkReply::getFromFtp() QCOMPARE(reply->readAll(), reference.readAll()); } +void tst_QNetworkReply::getFromFtpAfterError() +{ + QNetworkRequest invalidRequest(QUrl("ftp://" + QtNetworkSettings::serverName() + "/qtest/invalid.txt")); + QNetworkReplyPtr invalidReply; + invalidReply.reset(manager.get(invalidRequest)); + QSignalSpy spy(invalidReply.data(), SIGNAL(error(QNetworkReply::NetworkError))); + QVERIFY(spy.wait()); + QCOMPARE(invalidReply->error(), QNetworkReply::ContentNotFoundError); + + QFile reference(testDataDir + "/rfc3252.txt"); + QVERIFY(reference.open(QIODevice::ReadOnly)); + QNetworkRequest validRequest(QUrl("ftp://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt")); + QNetworkReplyPtr validReply; + RUN_REQUEST(runSimpleRequest(QNetworkAccessManager::GetOperation, validRequest, validReply)); + QCOMPARE(validReply->url(), validRequest.url()); + QCOMPARE(validReply->error(), QNetworkReply::NoError); + QCOMPARE(validReply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), reference.size()); + QCOMPARE(validReply->readAll(), reference.readAll()); +} + void tst_QNetworkReply::getFromHttp_data() { QTest::addColumn("referenceName"); -- cgit v1.2.3 From 231da210eacee58caa844f43d919a80ba2c63a92 Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Fri, 15 Aug 2014 15:53:42 +0300 Subject: Do not set QMAKE_{INC,LIB}DIR_{OPENGL,X11} in the freebsd mkspecs. X11 and the GL libraries are installed into /usr/local like other software, and this has been the case for many years. Change-Id: Ied4d9d61154014db3861bdbd6a5bdbe68e76f878 Reviewed-by: Gabriel de Dietrich --- mkspecs/freebsd-g++/qmake.conf | 4 ---- mkspecs/freebsd-g++46/qmake.conf | 4 ---- mkspecs/unsupported/freebsd-clang/qmake.conf | 4 ---- 3 files changed, 12 deletions(-) diff --git a/mkspecs/freebsd-g++/qmake.conf b/mkspecs/freebsd-g++/qmake.conf index f736e183ec..3d2a0e9090 100644 --- a/mkspecs/freebsd-g++/qmake.conf +++ b/mkspecs/freebsd-g++/qmake.conf @@ -12,10 +12,6 @@ QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD # Addon software goes into /usr/local on the BSDs, by default we will look there QMAKE_INCDIR = /usr/local/include QMAKE_LIBDIR = /usr/local/lib -QMAKE_INCDIR_X11 = /usr/X11R6/include -QMAKE_LIBDIR_X11 = /usr/X11R6/lib -QMAKE_INCDIR_OPENGL = /usr/X11R6/include -QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib QMAKE_LFLAGS_THREAD = -pthread diff --git a/mkspecs/freebsd-g++46/qmake.conf b/mkspecs/freebsd-g++46/qmake.conf index b94b1393e6..b15e689cde 100644 --- a/mkspecs/freebsd-g++46/qmake.conf +++ b/mkspecs/freebsd-g++46/qmake.conf @@ -12,10 +12,6 @@ QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD # Addon software goes into /usr/local on the BSDs, by default we will look there QMAKE_INCDIR = /usr/local/include QMAKE_LIBDIR = /usr/local/lib -QMAKE_INCDIR_X11 = /usr/X11R6/include -QMAKE_LIBDIR_X11 = /usr/X11R6/lib -QMAKE_INCDIR_OPENGL = /usr/X11R6/include -QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib QMAKE_LFLAGS_THREAD = -pthread diff --git a/mkspecs/unsupported/freebsd-clang/qmake.conf b/mkspecs/unsupported/freebsd-clang/qmake.conf index f48f44bbb3..ad4fa3487e 100644 --- a/mkspecs/unsupported/freebsd-clang/qmake.conf +++ b/mkspecs/unsupported/freebsd-clang/qmake.conf @@ -12,10 +12,6 @@ QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD # Addon software goes into /usr/local on the BSDs, by default we will look there QMAKE_INCDIR = /usr/local/include QMAKE_LIBDIR = /usr/local/lib -QMAKE_INCDIR_X11 = /usr/X11R6/include -QMAKE_LIBDIR_X11 = /usr/X11R6/lib -QMAKE_INCDIR_OPENGL = /usr/X11R6/include -QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib QMAKE_LFLAGS_THREAD = -pthread -- cgit v1.2.3 From 2289f3ee2955f783baa6e18c7fe3418c302b011c Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 15 Aug 2014 22:15:34 +0200 Subject: Fix a memory leak in QFseventsFileSystemWatcherEngine Add a missing NSAutoReleasePool Task-number: QTBUG-38637 Change-Id: Ib69d92b6e9c4327cbb74f7814a45773bfc2ee526 Reviewed-by: Erik Verbruggen --- src/corelib/io/qfilesystemwatcher_fsevents.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm index 085396da6d..e713769735 100644 --- a/src/corelib/io/qfilesystemwatcher_fsevents.mm +++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm @@ -496,6 +496,7 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat bool QFseventsFileSystemWatcherEngine::startStream() { Q_ASSERT(stream == 0); + Q_AUTORELEASE_POOL(pool) if (stream) // This shouldn't happen, but let's be nice and handle it. stopStream(); -- cgit v1.2.3 From cf32311d7473019f5c13fcc596601d84ac0987a3 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Mon, 23 Jun 2014 16:29:36 +0200 Subject: fingerpaint example: be sensitive to pressure only when supported Fix fingerpaint example for platforms that don't support touch device area and pressure by setting default size of drawn ellipse. Change-Id: I884c688aa8ef98debf24876dbefaa4cff43a86a2 Reviewed-by: Fabian Bumberger Reviewed-by: Shawn Rutledge --- examples/touch/fingerpaint/scribblearea.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/touch/fingerpaint/scribblearea.cpp b/examples/touch/fingerpaint/scribblearea.cpp index 0d13e4579d..1630f6f112 100644 --- a/examples/touch/fingerpaint/scribblearea.cpp +++ b/examples/touch/fingerpaint/scribblearea.cpp @@ -46,6 +46,9 @@ #include "scribblearea.h" +static const qreal MinimumDiameter = 3.0; +static const qreal MaximumDiameter = 50.0; + //! [0] ScribbleArea::ScribbleArea(QWidget *parent) : QWidget(parent) @@ -179,6 +182,7 @@ bool ScribbleArea::event(QEvent *event) case QEvent::TouchUpdate: case QEvent::TouchEnd: { + QTouchEvent *touch = static_cast(event); QList touchPoints = static_cast(event)->touchPoints(); foreach (const QTouchEvent::TouchPoint &touchPoint, touchPoints) { switch (touchPoint.state()) { @@ -189,7 +193,9 @@ bool ScribbleArea::event(QEvent *event) { QRectF rect = touchPoint.rect(); if (rect.isEmpty()) { - qreal diameter = qreal(50) * touchPoint.pressure(); + qreal diameter = MinimumDiameter; + if (touch->device()->capabilities() & QTouchDevice::Pressure) + diameter = MinimumDiameter + (MaximumDiameter - MinimumDiameter) * touchPoint.pressure(); rect.setSize(QSizeF(diameter, diameter)); } -- cgit v1.2.3 From 6b6e51e5abf56f938c27d194701e2bb20f3459dd Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 19 Aug 2014 15:00:30 +0200 Subject: OS X - QCollator::compare() returns wrong results. kUCCollateDigitsAsNumberMask works only if kUCCollateDigitsOverrideMask is also set. Update 0: - test added. Task-number: QTBUG-40777 Change-Id: I48bfec78f5f8439a51f8d749f0fc4397a72b29f2 Reviewed-by: Lars Knoll --- src/corelib/tools/qcollator_macx.cpp | 4 +- .../auto/corelib/tools/qcollator/tst_qcollator.cpp | 62 +++++++++++++--------- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/src/corelib/tools/qcollator_macx.cpp b/src/corelib/tools/qcollator_macx.cpp index 877510489a..b9477afedb 100644 --- a/src/corelib/tools/qcollator_macx.cpp +++ b/src/corelib/tools/qcollator_macx.cpp @@ -96,9 +96,9 @@ void QCollator::setNumericMode(bool on) detach(); if (on) - d->collator.options |= kUCCollateDigitsAsNumberMask; + d->collator.options |= kUCCollateDigitsAsNumberMask | kUCCollateDigitsOverrideMask; else - d->collator.options &= ~kUCCollateDigitsAsNumberMask; + d->collator.options &= ~(kUCCollateDigitsAsNumberMask | kUCCollateDigitsOverrideMask); d->init(); } diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp index 3a00ebd505..fc4d51a302 100644 --- a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp +++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp @@ -98,6 +98,7 @@ void tst_QCollator::compare_data() QTest::addColumn("s2"); QTest::addColumn("result"); QTest::addColumn("caseInsensitiveResult"); + QTest::addColumn("numericMode"); /* A few tests below are commented out on the mac. It's unclear why they fail, @@ -112,57 +113,63 @@ void tst_QCollator::compare_data() comparison of Latin-1 values, although I'm not sure. So I just test digits to make sure that it's not totally broken. */ - QTest::newRow("english1") << QString("en_US") << QString("5") << QString("4") << 1 << 1; - QTest::newRow("english2") << QString("en_US") << QString("4") << QString("6") << -1 << -1; - QTest::newRow("english3") << QString("en_US") << QString("5") << QString("6") << -1 << -1; - QTest::newRow("english4") << QString("en_US") << QString("a") << QString("b") << -1 << -1; + QTest::newRow("english1") << QString("en_US") << QString("5") << QString("4") << 1 << 1 << false; + QTest::newRow("english2") << QString("en_US") << QString("4") << QString("6") << -1 << -1 << false; + QTest::newRow("english3") << QString("en_US") << QString("5") << QString("6") << -1 << -1 << false; + QTest::newRow("english4") << QString("en_US") << QString("a") << QString("b") << -1 << -1 << false; + QTest::newRow("english5") << QString("en_US") << QString("test 9") << QString("test 19") << -1 << -1 << true; + /* In Swedish, a with ring above (E5) comes before a with diaresis (E4), which comes before o diaresis (F6), which all come after z. */ #if !defined(Q_OS_WIN) || defined(QT_USE_ICU) - QTest::newRow("swedish1") << QString("sv_SE") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << -1 << -1; + QTest::newRow("swedish1") << QString("sv_SE") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << -1 << -1 << false; #endif - QTest::newRow("swedish2") << QString("sv_SE") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1 << -1; - QTest::newRow("swedish3") << QString("sv_SE") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1 << -1; + QTest::newRow("swedish2") << QString("sv_SE") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1 << -1 << false; + QTest::newRow("swedish3") << QString("sv_SE") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1 << -1 << false; #if !defined(Q_OS_OSX) && (!defined(Q_OS_WIN) || defined(QT_USE_ICU)) - QTest::newRow("swedish4") << QString("sv_SE") << QString::fromLatin1("z") << QString::fromLatin1("\xe5") << -1 << -1; + QTest::newRow("swedish4") << QString("sv_SE") << QString::fromLatin1("z") << QString::fromLatin1("\xe5") << -1 << -1 << false; #endif + QTest::newRow("swedish5") << QString("sv_SE") << QString("9") << QString("19") << -1 << -1 << true; /* In Norwegian, ae (E6) comes before o with stroke (D8), which comes before a with ring above (E5). */ - QTest::newRow("norwegian1") << QString("no_NO") << QString::fromLatin1("\xe6") << QString::fromLatin1("\xd8") << -1 << -1; + QTest::newRow("norwegian1") << QString("no_NO") << QString::fromLatin1("\xe6") << QString::fromLatin1("\xd8") << -1 << -1 << false; #if !defined(Q_OS_WIN) || defined(QT_USE_ICU) # ifndef Q_OS_OSX - QTest::newRow("norwegian2") << QString("no_NO") << QString::fromLatin1("\xd8") << QString::fromLatin1("\xe5") << -1 << -1; + QTest::newRow("norwegian2") << QString("no_NO") << QString::fromLatin1("\xd8") << QString::fromLatin1("\xe5") << -1 << -1 << false; # endif - QTest::newRow("norwegian3") << QString("no_NO") << QString::fromLatin1("\xe6") << QString::fromLatin1("\xe5") << -1 << -1; + QTest::newRow("norwegian3") << QString("no_NO") << QString::fromLatin1("\xe6") << QString::fromLatin1("\xe5") << -1 << -1 << false; #endif // !Q_OS_WIN || QT_USE_ICU + QTest::newRow("norwegian4") << QString("no_NO") << QString("9") << QString("19") << -1 << -1 << true; + /* In German, z comes *after* a with diaresis (E4), which comes before o diaresis (F6). */ - QTest::newRow("german1") << QString("de_DE") << QString::fromLatin1("a") << QString::fromLatin1("\xe4") << -1 << -1; - QTest::newRow("german2") << QString("de_DE") << QString::fromLatin1("b") << QString::fromLatin1("\xe4") << 1 << 1; - QTest::newRow("german3") << QString("de_DE") << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1 << 1; - QTest::newRow("german4") << QString("de_DE") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1 << -1; - QTest::newRow("german5") << QString("de_DE") << QString::fromLatin1("z") << QString::fromLatin1("\xf6") << 1 << 1; - QTest::newRow("german6") << QString("de_DE") << QString::fromLatin1("\xc0") << QString::fromLatin1("\xe0") << 1 << 0; - QTest::newRow("german7") << QString("de_DE") << QString::fromLatin1("\xd6") << QString::fromLatin1("\xf6") << 1 << 0; - QTest::newRow("german8") << QString("de_DE") << QString::fromLatin1("oe") << QString::fromLatin1("\xf6") << 1 << 1; - QTest::newRow("german9") << QString("de_DE") << QString("A") << QString("a") << 1 << 0; + QTest::newRow("german1") << QString("de_DE") << QString::fromLatin1("a") << QString::fromLatin1("\xe4") << -1 << -1 << false; + QTest::newRow("german2") << QString("de_DE") << QString::fromLatin1("b") << QString::fromLatin1("\xe4") << 1 << 1 << false; + QTest::newRow("german3") << QString("de_DE") << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1 << 1 << false; + QTest::newRow("german4") << QString("de_DE") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1 << -1 << false; + QTest::newRow("german5") << QString("de_DE") << QString::fromLatin1("z") << QString::fromLatin1("\xf6") << 1 << 1 << false; + QTest::newRow("german6") << QString("de_DE") << QString::fromLatin1("\xc0") << QString::fromLatin1("\xe0") << 1 << 0 << false; + QTest::newRow("german7") << QString("de_DE") << QString::fromLatin1("\xd6") << QString::fromLatin1("\xf6") << 1 << 0 << false; + QTest::newRow("german8") << QString("de_DE") << QString::fromLatin1("oe") << QString::fromLatin1("\xf6") << 1 << 1 << false; + QTest::newRow("german9") << QString("de_DE") << QString("A") << QString("a") << 1 << 0 << false; + QTest::newRow("german10") << QString("de_DE") << QString("9") << QString("19") << -1 << -1 << true; /* French sorting of e and e with accent */ - QTest::newRow("french1") << QString("fr_FR") << QString::fromLatin1("\xe9") << QString::fromLatin1("e") << 1 << 1; - QTest::newRow("french2") << QString("fr_FR") << QString::fromLatin1("\xe9t") << QString::fromLatin1("et") << 1 << 1; - QTest::newRow("french3") << QString("fr_FR") << QString::fromLatin1("\xe9") << QString::fromLatin1("d") << 1 << 1; - QTest::newRow("french4") << QString("fr_FR") << QString::fromLatin1("\xe9") << QString::fromLatin1("f") << -1 << -1; - + QTest::newRow("french1") << QString("fr_FR") << QString::fromLatin1("\xe9") << QString::fromLatin1("e") << 1 << 1 << false; + QTest::newRow("french2") << QString("fr_FR") << QString::fromLatin1("\xe9t") << QString::fromLatin1("et") << 1 << 1 << false; + QTest::newRow("french3") << QString("fr_FR") << QString::fromLatin1("\xe9") << QString::fromLatin1("d") << 1 << 1 << false; + QTest::newRow("french4") << QString("fr_FR") << QString::fromLatin1("\xe9") << QString::fromLatin1("f") << -1 << -1 << false; + QTest::newRow("french5") << QString("fr_FR") << QString("9") << QString("19") << -1 << -1 << true; } @@ -173,8 +180,13 @@ void tst_QCollator::compare() QFETCH(QString, s2); QFETCH(int, result); QFETCH(int, caseInsensitiveResult); + QFETCH(bool, numericMode); QCollator collator(locale); + + if (numericMode) + collator.setNumericMode(true); + QCOMPARE(collator.compare(s1, s2), result); collator.setCaseSensitivity(Qt::CaseInsensitive); QCOMPARE(collator.compare(s1, s2), caseInsensitiveResult); -- cgit v1.2.3 From b8989f937aa931113845dcd65b5d1a7e5fd8bee4 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 19 Aug 2014 12:55:04 +0200 Subject: Properly null-terminate ifreq::irf_name It's unclear whether it has to be, but there are a lot of patches floating around on the net that indicate that Coverty requires this, and the SIOCGIFADDR micro-howto also NUL-terminates the string. So who is Qt to differ? Change-Id: I1aa5a2de47a58b1d9b73556d5a6ddc48b2c40ce3 Reviewed-by: Thiago Macieira --- src/plugins/bearer/generic/qgenericengine.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index d2579372c7..d687539d84 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -165,6 +165,7 @@ static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interf ifreq request; strncpy(request.ifr_name, interface.toLocal8Bit().data(), sizeof(request.ifr_name)); + request.ifr_name[sizeof(request.ifr_name) - 1] = '\0'; int result = ioctl(sock, SIOCGIFHWADDR, &request); close(sock); -- cgit v1.2.3 From 90ed77c0448b2104d3235f9d064ad57d95f1a976 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 19 Aug 2014 15:55:32 +0200 Subject: Use correct size in fullscreen mode Android does not report the full screen size in display metrics. However, it does report the correct size for layouts, which we use to get the available geometry. Since by definition, the available geometry should always be inside the screen geometry, it is safe to use the maximum of the two sizes. Task-number: QTBUG-39977 Change-Id: I78d974f12274ca67eada43f5e1d80e70149efe3f Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/androidjnimain.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index e7e0375adf..6031739efb 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -554,6 +554,12 @@ static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/, jint desktopWidthPixels, jint desktopHeightPixels, jdouble xdpi, jdouble ydpi, jdouble scaledDensity) { + // Android does not give us the correct screen size for immersive mode, but + // the surface does have the right size + + widthPixels = qMax(widthPixels, desktopWidthPixels); + heightPixels = qMax(heightPixels, desktopHeightPixels); + m_desktopWidthPixels = desktopWidthPixels; m_desktopHeightPixels = desktopHeightPixels; m_scaledDensity = scaledDensity; -- cgit v1.2.3 From 97384030efd6465de42e786779cf80b309e763e3 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 19 Aug 2014 15:47:50 +0200 Subject: Resize correctly on orientation change. Make sure that the screen geometry is updated before the available geometry, since Qt uses available geometry change as the trigger for updating the application. Task-number: QTBUG-39965 Change-Id: Icb660f2de739367cf1fa99ddfe600f37eb6174eb Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/androidjnimain.cpp | 2 +- src/plugins/platforms/android/qandroidplatformintegration.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 6031739efb..c571e16062 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -574,8 +574,8 @@ static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/, } else { m_androidPlatformIntegration->setDisplayMetrics(qRound(double(widthPixels) / xdpi * 25.4), qRound(double(heightPixels) / ydpi * 25.4)); - m_androidPlatformIntegration->setDesktopSize(desktopWidthPixels, desktopHeightPixels); m_androidPlatformIntegration->setScreenSize(widthPixels, heightPixels); + m_androidPlatformIntegration->setDesktopSize(desktopWidthPixels, desktopHeightPixels); } } diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp index d6d7d3b173..baf905f6d2 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp @@ -123,8 +123,8 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶ m_primaryScreen = new QAndroidPlatformScreen(); screenAdded(m_primaryScreen); m_primaryScreen->setPhysicalSize(QSize(m_defaultPhysicalSizeWidth, m_defaultPhysicalSizeHeight)); - m_primaryScreen->setAvailableGeometry(QRect(0, 0, m_defaultGeometryWidth, m_defaultGeometryHeight)); m_primaryScreen->setSize(QSize(m_defaultScreenWidth, m_defaultScreenHeight)); + m_primaryScreen->setAvailableGeometry(QRect(0, 0, m_defaultGeometryWidth, m_defaultGeometryHeight)); m_mainThread = QThread::currentThread(); QtAndroid::setAndroidPlatformIntegration(this); -- cgit v1.2.3 From 1bae226076b37ba925bf810639e1674130ad622a Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 18 Aug 2014 14:13:44 +0200 Subject: Make QWindowContainer handle drag'n'drop Drag'n'drop events were not propagated by a the QWindowContainer to the embedded QWindow. This patch makes the widget accept the events and pass them on Task-number: QTBUG-40603 Change-Id: I97320fbcad27f7c6aa48c95c90bb42dda634764e Reviewed-by: Gunnar Sletta --- src/gui/kernel/qwindow.h | 2 ++ src/widgets/kernel/qwindowcontainer.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 0d13cfa648..40bfad908f 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -85,6 +85,7 @@ class QPlatformWindow; class QBackingStore; class QScreen; class QAccessibleInterface; +class QWindowContainer; class Q_GUI_EXPORT QWindow : public QObject, public QSurface { @@ -359,6 +360,7 @@ private: friend class QGuiApplication; friend class QGuiApplicationPrivate; + friend class QWindowContainer; friend Q_GUI_EXPORT QWindowPrivate *qt_window_private(QWindow *window); }; diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index dc35dee1a9..206a265761 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -206,6 +206,7 @@ QWindowContainer::QWindowContainer(QWindow *embeddedWindow, QWidget *parent, Qt: d->window = embeddedWindow; d->window->setParent(&d->fakeParent); + setAcceptDrops(true); connect(QGuiApplication::instance(), SIGNAL(focusWindowChanged(QWindow*)), this, SLOT(focusWindowChanged(QWindow*))); } @@ -298,6 +299,13 @@ bool QWindowContainer::event(QEvent *e) } } break; +#ifndef QT_NO_DRAGANDDROP + case QEvent::Drop: + case QEvent::DragEnter: + case QEvent::DragMove: + case QEvent::DragLeave: + return d->window->event(e); +#endif default: break; } -- cgit v1.2.3 From 29787ec29cfa579e5bbf896dee093931a9f1385f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 19 Aug 2014 14:45:45 +0200 Subject: Detect wrongly labelled wheel buttons A mouse device with both missing labels and a wrongly placed label on the mouse wheel buttons have been spotted. This patch makes the XInput2 code even more lenient to better match legacy systems that always assumed button 4 and 5 are mapped that way. Task-number: QTBUG-40806 Change-Id: I7cc52f3d9c54e15e6f3ddcc2bdeb1bb8e0ac9eca Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index e21db89a20..4986e85728 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -164,7 +164,10 @@ void QXcbConnection::xi2SetupDevices() if (bci->num_buttons >= 5) { Atom label4 = bci->labels[3]; Atom label5 = bci->labels[4]; - if ((!label4 || qatom(label4) == QXcbAtom::ButtonWheelUp) && (!label5 || qatom(label5) == QXcbAtom::ButtonWheelDown)) + // Some drivers have no labels on the wheel buttons, some have no label on just one and some have no label on + // button 4 and the wrong one on button 5. So we just check that they are not labelled with unrelated buttons. + if ((!label4 || qatom(label4) == QXcbAtom::ButtonWheelUp || qatom(label4) == QXcbAtom::ButtonWheelDown) && + (!label5 || qatom(label5) == QXcbAtom::ButtonWheelUp || qatom(label5) == QXcbAtom::ButtonWheelDown)) scrollingDevice.legacyOrientations |= Qt::Vertical; } if (bci->num_buttons >= 7) { -- cgit v1.2.3 From 198009db79a85d3cab7fe3a6432635d36123a2d6 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 15 Aug 2014 15:55:12 +0200 Subject: Fix several regressions in font selection In Qt 5.3.0 a change was added which automatically adapts Common script to surrounding scripts in accordance with the Unicode tr#24. This broke *a lot* of cases of font selection because the font selection algorithm is not prepared for handling characters with adapted scripts. We need to disable this change for now and redo it later with patches to font selection to avoid the regressions. [ChangeLog][Text] Fixed several regressions in font selection when combining different writing systems in the same text. Task-number: QTBUG-39930 Task-number: QTBUG-39860 Change-Id: Id02b5ae2403c06542ed5d81e7c4deb2e0c7d816e Reviewed-by: Konstantin Ritt --- src/corelib/tools/qunicodetools.cpp | 6 ++++++ src/gui/text/qtextengine.cpp | 2 +- tests/auto/gui/text/qglyphrun/test.ttf | Bin 3712 -> 2008 bytes tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp | 20 ++++++++++++++++++- .../qtextscriptengine/tst_qtextscriptengine.cpp | 22 ++++++++++++++------- 5 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/corelib/tools/qunicodetools.cpp b/src/corelib/tools/qunicodetools.cpp index fc36d07a4a..bb2c032e57 100644 --- a/src/corelib/tools/qunicodetools.cpp +++ b/src/corelib/tools/qunicodetools.cpp @@ -710,6 +710,7 @@ Q_CORE_EXPORT void initScripts(const ushort *string, int length, uchar *scripts) script = QChar::Script(prop->script); } +#if 0 // ### Disabled due to regressions. The font selection algorithm is not prepared for this change. if (Q_LIKELY(script != QChar::Script_Common)) { // override preceding Common-s while (sor > 0 && scripts[sor - 1] == QChar::Script_Common) @@ -719,6 +720,7 @@ Q_CORE_EXPORT void initScripts(const ushort *string, int length, uchar *scripts) if (sor > 0) script = scripts[sor - 1]; } +#endif while (sor < eor) scripts[sor++] = script; @@ -726,6 +728,8 @@ Q_CORE_EXPORT void initScripts(const ushort *string, int length, uchar *scripts) script = prop->script; } eor = length; + +#if 0 // ### Disabled due to regressions. The font selection algorithm is not prepared for this change. if (Q_LIKELY(script != QChar::Script_Common)) { // override preceding Common-s while (sor > 0 && scripts[sor - 1] == QChar::Script_Common) @@ -735,6 +739,8 @@ Q_CORE_EXPORT void initScripts(const ushort *string, int length, uchar *scripts) if (sor > 0) script = scripts[sor - 1]; } +#endif + while (sor < eor) scripts[sor++] = script; } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index a3059008be..fcf1a1468c 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -124,7 +124,7 @@ private: for (int i = start + 1; i < end; ++i) { if (m_analysis[i].bidiLevel == m_analysis[start].bidiLevel && m_analysis[i].flags == m_analysis[start].flags - && m_analysis[i].script == m_analysis[start].script + && (m_analysis[i].script == m_analysis[start].script || m_string[i] == QLatin1Char('.')) && m_analysis[i].flags < QScriptAnalysis::SpaceTabOrObject && i - start < MaxItemLength) continue; diff --git a/tests/auto/gui/text/qglyphrun/test.ttf b/tests/auto/gui/text/qglyphrun/test.ttf index 9043a576ef..382b2547b0 100644 Binary files a/tests/auto/gui/text/qglyphrun/test.ttf and b/tests/auto/gui/text/qglyphrun/test.ttf differ diff --git a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp index f576627745..8d1ec51c26 100644 --- a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp +++ b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp @@ -77,6 +77,7 @@ private slots: void setRawData(); void setRawDataAndGetAsVector(); void boundingRect(); + void mixedScripts(); private: int m_testFontId; @@ -399,7 +400,7 @@ void tst_QGlyphRun::setRawDataAndGetAsVector() void tst_QGlyphRun::drawNonExistentGlyphs() { QVector glyphIndexes; - glyphIndexes.append(3); + glyphIndexes.append(4); QVector glyphPositions; glyphPositions.append(QPointF(0, 0)); @@ -725,6 +726,23 @@ void tst_QGlyphRun::boundingRect() QCOMPARE(glyphs.boundingRect(), boundingRect); } +void tst_QGlyphRun::mixedScripts() +{ + QString s; + s += QChar(0x31); // The character '1' + s += QChar(0xbc14); // Hangul character + + QTextLayout layout; + layout.setFont(m_testFont); + layout.setText(s); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + + QList glyphRuns = layout.glyphRuns(); + QCOMPARE(glyphRuns.size(), 2); +} + #endif // QT_NO_RAWFONT QTEST_MAIN(tst_QGlyphRun) diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp index 74eb58670b..5dfb025510 100644 --- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp @@ -1258,21 +1258,29 @@ void tst_QTextScriptEngine::thaiWithZWJ() QTextLayout layout(s, font); QTextEngine *e = layout.engine(); e->itemize(); - QCOMPARE(e->layoutData->items.size(), 3); + QCOMPARE(e->layoutData->items.size(), 11); for (int item = 0; item < e->layoutData->items.size(); ++item) e->shape(item); - QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(15)); // Thai: The ZWJ and ZWNJ characters are inherited, so should be part of the thai script - QCOMPARE(e->layoutData->items[1].num_glyphs, ushort(1)); // Han: Kanji for tree - QCOMPARE(e->layoutData->items[2].num_glyphs, ushort(2)); // Thai: Thai character followed by superscript "a" which is of inherited type + QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(7)); // Thai: The ZWJ and ZWNJ characters are inherited, so should be part of the thai script + QCOMPARE(e->layoutData->items[1].num_glyphs, ushort(1)); // Common: The smart quotes cannot be handled by thai, so should be a separate item + QCOMPARE(e->layoutData->items[2].num_glyphs, ushort(1)); // Thai: Thai character + QCOMPARE(e->layoutData->items[3].num_glyphs, ushort(1)); // Common: Ellipsis + QCOMPARE(e->layoutData->items[4].num_glyphs, ushort(1)); // Thai: Thai character + QCOMPARE(e->layoutData->items[5].num_glyphs, ushort(1)); // Common: Smart quote + QCOMPARE(e->layoutData->items[6].num_glyphs, ushort(1)); // Thai: Thai character + QCOMPARE(e->layoutData->items[7].num_glyphs, ushort(1)); // Common: \xA0 = non-breaking space. Could be useful to have in thai, but not currently implemented + QCOMPARE(e->layoutData->items[8].num_glyphs, ushort(1)); // Thai: Thai character + QCOMPARE(e->layoutData->items[9].num_glyphs, ushort(1)); // Japanese: Kanji for tree + QCOMPARE(e->layoutData->items[10].num_glyphs, ushort(2)); // Thai: Thai character followed by superscript "a" which is of inherited type //A quick sanity check - check all the characters are individual clusters unsigned short *logClusters = e->layoutData->logClustersPtr; - for (int i = 0; i <= 14; i++) + for (int i = 0; i < 7; i++) QCOMPARE(logClusters[i], ushort(i)); - QCOMPARE(logClusters[15], ushort(0)); - QCOMPARE(logClusters[16], ushort(0)); + for (int i = 0; i < 10; i++) + QCOMPARE(logClusters[i+7], ushort(0)); #ifndef Q_OS_MAC // ### Result differs for HarfBuzz-NG QCOMPARE(logClusters[17], ushort(1)); -- cgit v1.2.3 From 9b11f0bac8f4a6b3c0b960e40bf74830eb5c1056 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 20 Aug 2014 12:18:37 +0200 Subject: Fix invalid memcpy(dst, src) calls where dst == src The convert_generic_inline method was not correctly handling the case where both the conversion methods were passthrough and the last store is therefore not needed and may trigger an invalid memcpy call. Change-Id: Ic88780f50e1ff9dedc04b8ff1ab3527dd0c8150c Reviewed-by: Gunnar Sletta --- src/gui/image/qimage_conversions.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 629a7c9b69..f2f71b4bad 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -163,7 +163,9 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im const uint *ptr = fetch(buffer, srcData, x, l); ptr = srcLayout->convertToARGB32PM(buffer, ptr, l, srcLayout, 0); ptr = destLayout->convertFromARGB32PM(buffer, ptr, l, destLayout, 0); - store(srcData, ptr, x, l); + // The conversions might be passthrough and not use the buffer, in that case we are already done. + if (srcData != (const uchar*)ptr) + store(srcData, ptr, x, l); x += l; } srcData += data->bytes_per_line; -- cgit v1.2.3 From 8688dfcd7ce148a8e7fcd16521d458417eadcbf8 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 20 Aug 2014 12:21:30 +0200 Subject: Android: use correct size when leaving fullscreen On Android, fullscreen means enabling "immersive mode", which results in the screen available geometry changing. When restoring normal mode, oldAvailableGeometry == oldGeometry, which means that the fullscreen branch would be chosen even though the state is not fullscreen. By doing the maximized test first, we will default to non-fullscreen geometry for non-fullscreen windows. Task-number: QTBUG-39977 Change-Id: Ifc7e8b4de7e96d8c00603ce0cd136b95f58012bb Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/kernel/qplatformscreen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp index 05d04ae4ee..6bf7915425 100644 --- a/src/gui/kernel/qplatformscreen.cpp +++ b/src/gui/kernel/qplatformscreen.cpp @@ -314,10 +314,10 @@ void QPlatformScreen::resizeMaximizedWindows() if (platformScreenForWindow(w) != this) continue; - if (w->windowState() & Qt::WindowFullScreen || w->geometry() == oldGeometry) - w->setGeometry(newGeometry); - else if (w->windowState() & Qt::WindowMaximized || w->geometry() == oldAvailableGeometry) + if (w->windowState() & Qt::WindowMaximized || w->geometry() == oldAvailableGeometry) w->setGeometry(newAvailableGeometry); + else if (w->windowState() & Qt::WindowFullScreen || w->geometry() == oldGeometry) + w->setGeometry(newGeometry); } } -- cgit v1.2.3 From 07c34fcc8a721ffe989eb8882b75ecb95600516c Mon Sep 17 00:00:00 2001 From: Dyami Caliri Date: Wed, 18 Jun 2014 22:20:05 -0700 Subject: xcb: use keyboard event source window to determine auto-repeat value The xcb auto-repeat checking code checks for queued events on the target (focused) window. This breaks down if you have a native child widget, and QKeyEvent::autoRepeat is never true. Task-number: QTBUG-21500 Change-Id: Ia979edfa8a3afce07a3e1cbaa778541ffb9ce5dc Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbconnection.cpp | 2 +- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 27 ++++++++++++++------------- src/plugins/platforms/xcb/qxcbkeyboard.h | 6 +++--- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 7f23c84cb9..5345d930a8 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -466,7 +466,7 @@ break; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)) { \ handled = eventListener->handleGenericEvent(event, &result); \ if (!handled) \ - m_keyboard->handler(m_focusWindow ? m_focusWindow : eventListener, e); \ + m_keyboard->handler(e); \ } \ } \ break; diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 4c84b19f82..af75b650d1 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -1295,7 +1295,7 @@ private: bool m_release; }; -void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycode_t code, +void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time) { Q_XCB_NOOP(connection()); @@ -1303,6 +1303,13 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod if (!m_config) return; + QXcbWindow *source = connection()->platformWindowFromId(sourceWindow); + QXcbWindow *targetWindow = connection()->focusWindow() ? connection()->focusWindow() : source; + if (!targetWindow || !source) + return; + if (type == QEvent::KeyPress) + targetWindow->updateNetWmUserTime(time); + // It is crucial the order of xkb_state_key_get_one_sym & xkb_state_update_key operations is not reversed! xcb_keysym_t sym = xkb_state_key_get_one_sym(xkb_state, code); @@ -1343,7 +1350,7 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod } } else { // look ahead for auto-repeat - KeyChecker checker(((QXcbWindow *)window->handle())->xcb_window(), code, time); + KeyChecker checker(source->xcb_window(), code, time); xcb_generic_event_t *event = connection()->checkEvent(checker); if (event) { isAutoRepeat = true; @@ -1359,6 +1366,7 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod filtered = inputContext->filterEvent(&event); } + QWindow *window = targetWindow->window(); if (!filtered) { if (type == QEvent::KeyPress && qtcode == Qt::Key_Menu) { const QPoint globalPos = window->screen()->handle()->cursor()->pos(); @@ -1401,21 +1409,14 @@ QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code) return QString::fromUtf8(chars); } -void QXcbKeyboard::handleKeyPressEvent(QXcbWindowEventListener *eventListener, const xcb_key_press_event_t *event) +void QXcbKeyboard::handleKeyPressEvent(const xcb_key_press_event_t *event) { - QXcbWindow *window = eventListener->toWindow(); - if (!window) - return; - window->updateNetWmUserTime(event->time); - handleKeyEvent(window->window(), QEvent::KeyPress, event->detail, event->state, event->time); + handleKeyEvent(event->event, QEvent::KeyPress, event->detail, event->state, event->time); } -void QXcbKeyboard::handleKeyReleaseEvent(QXcbWindowEventListener *eventListener, const xcb_key_release_event_t *event) +void QXcbKeyboard::handleKeyReleaseEvent(const xcb_key_release_event_t *event) { - QXcbWindow *window = eventListener->toWindow(); - if (!window) - return; - handleKeyEvent(window->window(), QEvent::KeyRelease, event->detail, event->state, event->time); + handleKeyEvent(event->event, QEvent::KeyRelease, event->detail, event->state, event->time); } void QXcbKeyboard::handleMappingNotifyEvent(const void *event) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index 11b7429aca..e816d3c003 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -64,8 +64,8 @@ public: ~QXcbKeyboard(); - void handleKeyPressEvent(QXcbWindowEventListener *eventListener, const xcb_key_press_event_t *event); - void handleKeyReleaseEvent(QXcbWindowEventListener *eventListener, const xcb_key_release_event_t *event); + void handleKeyPressEvent(const xcb_key_press_event_t *event); + void handleKeyReleaseEvent(const xcb_key_release_event_t *event); void handleMappingNotifyEvent(const void *event); Qt::KeyboardModifiers translateModifiers(int s) const; @@ -83,7 +83,7 @@ public: #endif protected: - void handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time); + void handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time); void resolveMaskConflicts(); QString lookupString(struct xkb_state *state, xcb_keycode_t code) const; -- cgit v1.2.3 From 4a6772a587c8fe86f3f674a1d1164ad6659fbfca Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Thu, 21 Aug 2014 14:52:45 +0300 Subject: Fix handling QT_IM_MODULE=none Was added with 19a39a4 to allow no input context to be created. Broken by commit 24c10b0. Especially if compose input context didn't get compiled, the first input context found was loaded. Also made Xcb integration use compose plugin by default. Change-Id: I992eaa8b383320e4ab725bb7b79f561f4f841458 Reviewed-by: Gatis Paeglis --- src/gui/kernel/qplatforminputcontextfactory.cpp | 2 +- src/plugins/platforms/xcb/qxcbconnection.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qplatforminputcontextfactory.cpp b/src/gui/kernel/qplatforminputcontextfactory.cpp index ee80a70939..3e2f234d99 100644 --- a/src/gui/kernel/qplatforminputcontextfactory.cpp +++ b/src/gui/kernel/qplatforminputcontextfactory.cpp @@ -83,7 +83,7 @@ QPlatformInputContext *QPlatformInputContextFactory::create() QString icString = QString::fromLatin1(qgetenv("QT_IM_MODULE")); if (icString == QLatin1String("none")) - icString = QStringLiteral("compose"); + return 0; ic = create(icString); if (ic && ic->isValid()) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 5345d930a8..f100f2d2e9 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -384,6 +384,9 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra qunsetenv("DESKTOP_STARTUP_ID"); sync(); + + if (qEnvironmentVariableIsEmpty("QT_IM_MODULE")) + qputenv("QT_IM_MODULE", QByteArray("compose")); } QXcbConnection::~QXcbConnection() -- cgit v1.2.3 From 38621713150b663355ebeb799a5a50d8e39a3c38 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Fri, 22 Aug 2014 20:08:15 +1000 Subject: remove always ask option. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Jolla removed the always ask option in the UI, which is the reason for all this code. Now, if mobile data is autoconnectable, whether roaming or home, it will be connected. Change-Id: I6a86315262e8c4c5551b2b2097389559096f14d5 Reviewed-by: Pasi Sjöholm Reviewed-by: Robin Burchell --- src/plugins/bearer/connman/connman.pro | 1 - src/plugins/bearer/connman/qconnmanengine.cpp | 56 +++------------------------ src/plugins/bearer/connman/qconnmanengine.h | 5 --- 3 files changed, 5 insertions(+), 57 deletions(-) diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro index 0da2dfacf6..bc4efe8b62 100644 --- a/src/plugins/bearer/connman/connman.pro +++ b/src/plugins/bearer/connman/connman.pro @@ -6,7 +6,6 @@ load(qt_plugin) QT = core network-private dbus CONFIG += link_pkgconfig -packagesExist(connectionagent) { DEFINES += QT_HAS_CONNECTIONAGENT } HEADERS += qconnmanservice_linux_p.h \ qofonoservice_linux_p.h \ diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index 797c30c7c6..ee219f00ac 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -54,11 +54,6 @@ #include #include #include -#ifdef QT_HAS_CONNECTIONAGENT -#include -#include -#include -#endif #ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_DBUS @@ -78,9 +73,6 @@ QConnmanEngine::QConnmanEngine(QObject *parent) QConnmanEngine::~QConnmanEngine() { -#ifdef QT_HAS_CONNECTIONAGENT - qt_safe_close(inotifyFileDescriptor); -#endif } bool QConnmanEngine::connmanAvailable() const @@ -108,16 +100,6 @@ void QConnmanEngine::initialize() addServiceConfiguration(servPath); } Q_EMIT updateCompleted(); -#ifdef QT_HAS_CONNECTIONAGENT - QSettings confFile(QStringLiteral("nemomobile"),QStringLiteral("connectionagent")); - - inotifyFileDescriptor = ::inotify_init(); - inotifyWatcher = ::inotify_add_watch(inotifyFileDescriptor, QFile::encodeName(confFile.fileName()), IN_MODIFY); - if (inotifyWatcher > 0) { - QSocketNotifier *notifier = new QSocketNotifier(inotifyFileDescriptor, QSocketNotifier::Read, this); - connect(notifier, SIGNAL(activated(int)), this, SLOT(inotifyActivated())); - } -#endif } void QConnmanEngine::changedModem() @@ -257,12 +239,11 @@ QNetworkSession::State QConnmanEngine::sessionStateForId(const QString &id) return QNetworkSession::Disconnected; } - if (servState == QLatin1String("association") || servState == QLatin1String("configuration") - || servState == QLatin1String("ready")) { + if (servState == QLatin1String("association") || servState == QLatin1String("configuration")) { return QNetworkSession::Connecting; } - if (servState == QLatin1String("online")) { + if (servState == QLatin1String("online") || servState == QLatin1String("ready")) { return QNetworkSession::Connected; } @@ -402,9 +383,8 @@ QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QStri if (serv->type() == QLatin1String("cellular")) { - if (!serv->autoConnect() - || (serv->roaming() - && (isAlwaysAskRoaming() || !isRoamingAllowed(serv->path())))) { + if (!serv->autoConnect()|| (serv->roaming() + && !isRoamingAllowed(serv->path()))) { flag = (flag | QNetworkConfiguration::Defined); } else { flag = (flag | QNetworkConfiguration::Discovered); @@ -418,7 +398,7 @@ QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QStri flag = QNetworkConfiguration::Undefined; } } - if (state == QLatin1String("online")) { + if (state == QLatin1String("online") || state == QLatin1String("ready")) { flag = (flag | QNetworkConfiguration::Active); } @@ -557,17 +537,6 @@ bool QConnmanEngine::requiresPolling() const return false; } -bool QConnmanEngine::isAlwaysAskRoaming() -{ -#ifdef QT_HAS_CONNECTIONAGENT - QSettings confFile(QStringLiteral("nemomobile"),QStringLiteral("connectionagent")); - confFile.beginGroup(QStringLiteral("Connectionagent")); - return confFile.value(QStringLiteral("askForRoaming")).toBool(); -#else - return false; -#endif -} - void QConnmanEngine::reEvaluateCellular() { Q_FOREACH (const QString &servicePath, connmanManager->getServices()) { @@ -577,21 +546,6 @@ void QConnmanEngine::reEvaluateCellular() } } -void QConnmanEngine::inotifyActivated() -{ -#ifdef QT_HAS_CONNECTIONAGENT - - char buffer[1024]; - int len = qt_safe_read(inotifyFileDescriptor, (void *)buffer, sizeof(buffer)); - if (len > 0) { - struct inotify_event *event = (struct inotify_event *)buffer; - if (event->wd == inotifyWatcher && (event->mask & IN_MODIFY) == 0) { - QTimer::singleShot(1000, this, SLOT(reEvaluateCellular())); //give this time to finish write - } - } -#endif -} - QT_END_NAMESPACE #endif // QT_NO_DBUS diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h index 4a4e91659b..4d5495ae86 100644 --- a/src/plugins/bearer/connman/qconnmanengine.h +++ b/src/plugins/bearer/connman/qconnmanengine.h @@ -108,7 +108,6 @@ private Q_SLOTS: void serviceStateChanged(const QString &state); void configurationChange(QConnmanServiceInterface * service); void reEvaluateCellular(); - void inotifyActivated(); private: QConnmanManagerInterface *connmanManager; @@ -134,12 +133,8 @@ private: QNetworkConfiguration::BearerType ofonoTechToBearerType(const QString &type); bool isRoamingAllowed(const QString &context); - bool isAlwaysAskRoaming(); QMap connmanServiceInterfaces; - int inotifyWatcher; - int inotifyFileDescriptor; - protected: bool requiresPolling() const; }; -- cgit v1.2.3 From 3e68148a4dda31d35d12878407cf1d04451e4d3d Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Fri, 1 Aug 2014 12:15:18 +0200 Subject: Network: Fix NTLM (SSPI) with HTTP and HTTPS proxies This commit should fix proxy authentication when NTLM is used. NTLM differs from normal HTTP(S) authentication by having 2 roundtrips instead of 1, some parts of our code however were not prepared for that. I've tested this patch with Microsoft Forefront, both with normal NTLM and with NTLM SSPI (in Windows domain). I removed an optimization added in 3c3ea9a8, I could not see that behavior anymore. That commit was the wrong fix in my opinion. [ChangeLog][QtNetwork] Fix NTLM (SSPI) Proxy Authentication (HTTP/HTTPS) Task-number: QTBUG-30829 Task-number: QTBUG-35101 Change-Id: Idcc9c0dbf388b011d49f2806e9a6dd55ebc35cec Reviewed-by: Richard J. Moore Reviewed-by: Thiago Macieira Reviewed-by: Peter Hartmann --- src/network/kernel/qauthenticator.cpp | 4 +--- src/network/socket/qhttpsocketengine.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index f7b956651f..c582e95b1c 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -430,9 +430,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QListoptions[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm")); diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index 0a25815752..9f3c29e207 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -594,16 +594,18 @@ void QHttpSocketEngine::slotSocketReadNotification() priv = QAuthenticatorPrivate::getPrivate(d->authenticator); priv->hasFailed = false; } else if (statusCode == 407) { - if (d->credentialsSent) { + if (d->authenticator.isNull()) + d->authenticator.detach(); + priv = QAuthenticatorPrivate::getPrivate(d->authenticator); + + if (d->credentialsSent && priv->phase != QAuthenticatorPrivate::Phase2) { + // Remember that (e.g.) NTLM is two-phase, so only reset when the authentication is not currently in progress. //407 response again means the provided username/password were invalid. d->authenticator = QAuthenticator(); //this is needed otherwise parseHttpResponse won't set the state, and then signal isn't emitted. d->authenticator.detach(); priv = QAuthenticatorPrivate::getPrivate(d->authenticator); priv->hasFailed = true; } - else if (d->authenticator.isNull()) - d->authenticator.detach(); - priv = QAuthenticatorPrivate::getPrivate(d->authenticator); priv->parseHttpResponse(d->reply->header(), true); -- cgit v1.2.3 From 7f1051ed62ad3bc39c064af001e89ebdccc26a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 27 Jun 2014 16:29:23 +0200 Subject: Cocoa: Work around faulty screen list on startup The NSScreen API has been observed to a return a screen list with one mirrored, non-primary screen when Qt is running as a startup item. Always use the screen if there's only one screen in the list. Change-Id: I721e25bb7595599287b97f6528e04060ce5da6c1 Task-id: QTBUG-37878 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/cocoa/qcocoaintegration.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index fca7fa042c..9fd05a65ee 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -370,11 +370,15 @@ void QCocoaIntegration::updateScreens() return; QSet remainingScreens = QSet::fromList(mScreens); QList siblings; - for (uint i = 0; i < [screens count]; i++) { + uint screenCount = [screens count]; + for (uint i = 0; i < screenCount; i++) { NSScreen* scr = [screens objectAtIndex:i]; CGDirectDisplayID dpy = [[[scr deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue]; // If this screen is a mirror and is not the primary one of the mirror set, ignore it. - if (CGDisplayIsInMirrorSet(dpy)) { + // Exception: The NSScreen API has been observed to a return a screen list with one + // mirrored, non-primary screen when Qt is running as a startup item. Always use the + // screen if there's only one screen in the list. + if (screenCount > 1 && CGDisplayIsInMirrorSet(dpy)) { CGDirectDisplayID primary = CGDisplayMirrorsDisplay(dpy); if (primary != kCGNullDirectDisplay && primary != dpy) continue; -- cgit v1.2.3 From 9286fdf4a06f25fc6fa743346c6beef7438170cb Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 21 Aug 2014 12:05:49 +0200 Subject: Doc: corrected autolink errors Qjsonvalue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-40362 Change-Id: I2ae782ea606e8ee55ee0fcfbbb29db3216b0574b Reviewed-by: Martin Smith Reviewed-by: Topi Reiniö --- src/corelib/json/qjsonvalue.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp index 4c4838d314..4838a78217 100644 --- a/src/corelib/json/qjsonvalue.cpp +++ b/src/corelib/json/qjsonvalue.cpp @@ -420,17 +420,17 @@ QJsonValue QJsonValue::fromVariant(const QVariant &variant) } /*! - Converts the value to a QVariant. + Converts the value to a \l {QVariant::}{QVariant()}. The QJsonValue types will be converted as follows: - \value Null QVariant() + \value Null {QVariant::}{QVariant()} \value Bool QMetaType::Bool \value Double QMetaType::Double \value String QString \value Array QVariantList \value Object QVariantMap - \value Undefined QVariant() + \value Undefined {QVariant::}{QVariant()} \sa fromVariant() */ @@ -553,7 +553,7 @@ QJsonArray QJsonValue::toArray(const QJsonArray &defaultValue) const Converts the value to an array and returns it. - If type() is not Array, a QJsonArray() will be returned. + If type() is not Array, a \l{QJsonArray::}{QJsonArray()} will be returned. */ QJsonArray QJsonValue::toArray() const { @@ -578,8 +578,8 @@ QJsonObject QJsonValue::toObject(const QJsonObject &defaultValue) const Converts the value to an object and returns it. - If type() is not Object, the QJsonObject() will be returned. - */ + If type() is not Object, the \l {QJsonObject::}{QJsonObject()} will be returned. +*/ QJsonObject QJsonValue::toObject() const { return toObject(QJsonObject()); -- cgit v1.2.3 From 1498c99e9d5fac758bd9372e199366059af81a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Sun, 24 Aug 2014 17:09:55 +0100 Subject: BlackBerry PlayBook build fixes Change-Id: I32b232883bb29ca7305bca1da1df263f106ddd93 Reviewed-by: Rafael Roquetto --- src/corelib/kernel/kernel.pri | 2 +- src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 819c10e99f..55625f3571 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -169,7 +169,7 @@ blackberry { kernel/qeventdispatcher_blackberry_p.h } -qqnx_pps { +qqnx_pps:!blackberry-playbook { LIBS_PRIVATE += -lpps SOURCES += \ kernel/qppsattribute.cpp \ diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp index 08de94a082..232bd80fd0 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp @@ -46,7 +46,7 @@ #include #include #include -#if defined(Q_OS_BLACKBERRY) +#if defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET) #include #endif @@ -126,17 +126,21 @@ virtualkeyboard_layout_t QQnxVirtualKeyboardBps::keyboardLayout() const return VIRTUALKEYBOARD_LAYOUT_WEB; case NumPunc: return VIRTUALKEYBOARD_LAYOUT_NUM_PUNC; +#ifndef Q_OS_BLACKBERRY_TABLET case Number: return VIRTUALKEYBOARD_LAYOUT_NUMBER; +#endif case Symbol: return VIRTUALKEYBOARD_LAYOUT_SYMBOL; case Phone: return VIRTUALKEYBOARD_LAYOUT_PHONE; case Pin: return VIRTUALKEYBOARD_LAYOUT_PIN; +#ifndef Q_OS_BLACKBERRY_TABLET case Password: return VIRTUALKEYBOARD_LAYOUT_PASSWORD; -#if defined(Q_OS_BLACKBERRY) +#endif +#if defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET) #if BBNDK_VERSION_AT_LEAST(10, 2, 1) case Alphanumeric: return VIRTUALKEYBOARD_LAYOUT_ALPHANUMERIC; -- cgit v1.2.3 From 2529a8aaa2f5781f0d665f377a848626439c2de4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Wed, 6 Aug 2014 17:24:52 +0200 Subject: Android: Avoid caching the same class twice. The class name scheme can be separated by '/' or '.', if both formats where used we would end-up caching those classes twice. Change-Id: I3ae69694d6a8616bbaadfb3c2d0717fbf9ccb9fc Reviewed-by: Yoann Lopes --- src/corelib/kernel/qjni.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/corelib/kernel/qjni.cpp b/src/corelib/kernel/qjni.cpp index 4581b70ca7..b240185d7e 100644 --- a/src/corelib/kernel/qjni.cpp +++ b/src/corelib/kernel/qjni.cpp @@ -86,15 +86,14 @@ Q_GLOBAL_STATIC(JClassHash, cachedClasses) static jclass getCachedClass(JNIEnv *env, const char *className) { jclass clazz = 0; - QString key = QLatin1String(className); - QHash::iterator it = cachedClasses->find(key); + QString classDotEnc = QString::fromLatin1(className).replace(QLatin1Char('/'), QLatin1Char('.')); + QHash::iterator it = cachedClasses->find(classDotEnc); if (it == cachedClasses->end()) { QJNIObjectPrivate classLoader = QtAndroidPrivate::classLoader(); if (!classLoader.isValid()) return 0; - QJNIObjectPrivate stringName = QJNIObjectPrivate::fromString(QString::fromLatin1(className).replace(QLatin1Char('/'), - QLatin1Char('.'))); + QJNIObjectPrivate stringName = QJNIObjectPrivate::fromString(classDotEnc); QJNIObjectPrivate classObject = classLoader.callObjectMethod("loadClass", "(Ljava/lang/String;)Ljava/lang/Class;", stringName.object()); @@ -102,7 +101,7 @@ static jclass getCachedClass(JNIEnv *env, const char *className) if (!exceptionCheckAndClear(env) && classObject.isValid()) clazz = static_cast(env->NewGlobalRef(classObject.object())); - cachedClasses->insert(key, clazz); + cachedClasses->insert(classDotEnc, clazz); } else { clazz = it.value(); } -- cgit v1.2.3 From 2112a3eb77819165f8fd441a71ccf4a2dc2095bf Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 15 Aug 2014 09:47:14 +0200 Subject: Add empty changes-5.3.2 file Change-Id: I2e207e94b12302cddf84a2eb5450214a873d8e2f Reviewed-by: Jani Heikkinen --- dist/changes-5.3.2 | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 dist/changes-5.3.2 diff --git a/dist/changes-5.3.2 b/dist/changes-5.3.2 new file mode 100644 index 0000000000..58f53024e2 --- /dev/null +++ b/dist/changes-5.3.2 @@ -0,0 +1,51 @@ +Qt 5.3.2 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.3.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + + http://qt-project.org/doc/qt-5.3 + +The Qt version 5.3 series is binary compatible with the 5.2.x series. +Applications compiled for 5.2 will continue to run with 5.3. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + http://bugreports.qt-project.org/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Library * +**************************************************************************** + +QtCore +------ + +QtGui +----- + +QtSql +----- + +QtWidgets +--------- + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + +Android +------- + +**************************************************************************** +* Tools * +**************************************************************************** + +configure & build system +------------------------ + +qmake +----- -- cgit v1.2.3 From f8da177c0f7231850086fe15e88272df78fe14d0 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 22 Aug 2014 19:09:27 +0200 Subject: QMacStyle: Fix default button look on Yosemite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default button has different text color on OS X 10.10, and doesn't pulsate anymore. We first make sure we don't start any animation for default buttons. Then, we set the right text color in the attached palette, which implies making a copy of the style option object. This increases the size of this patch but keeps things sane. (It's also more concise than the QGtkStyle approach that consists on duplicating QCommonstyle's code for rendering CE_PushButtonLabel). Task-number: QTBUG-40833 Change-Id: Ifac118bb607eec17400c6ae42342a223a40843b4 Reviewed-by: Morten Johan Sørvig --- src/widgets/styles/qmacstyle_mac.mm | 111 +++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 40 deletions(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index b3c0463bca..debd19bbe0 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -3532,11 +3532,18 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter break; } + // No default button pulsating animation on Yosemite, + // so we have to do few things differently. + const bool yosemiteOrLater = QSysInfo::QSysInfo::MacintoshVersion > QSysInfo::MV_10_9; + // a focused auto-default button within an active window // takes precedence over a normal default button if (btn->features & QStyleOptionButton::AutoDefaultButton && opt->state & State_Active && opt->state & State_HasFocus) { - d->setAutoDefaultButton(opt->styleObject); + if (yosemiteOrLater) + d->autoDefaultButton = opt->styleObject; + else + d->setAutoDefaultButton(opt->styleObject); } else if (d->autoDefaultButton == opt->styleObject) { d->setAutoDefaultButton(0); } @@ -3544,7 +3551,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (!d->autoDefaultButton) { if (btn->features & QStyleOptionButton::DefaultButton && opt->state & State_Active) { d->defaultButton = opt->styleObject; - if (!d->animation(opt->styleObject)) + if (!yosemiteOrLater && !d->animation(opt->styleObject)) d->startAnimation(new QStyleAnimation(opt->styleObject)); } else if (d->defaultButton == opt->styleObject) { if (QStyleAnimation *animation = d->animation(opt->styleObject)) { @@ -3562,29 +3569,41 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter else if (d->pressedButton == opt->styleObject) d->pressedButton = 0; - // the default button animation is paused meanwhile any button - // is pressed or an auto-default button is animated instead - if (QStyleAnimation *defaultAnimation = d->animation(d->defaultButton)) { - if (d->pressedButton || d->autoDefaultButton) { - if (defaultAnimation->state() == QStyleAnimation::Running) { - defaultAnimation->pause(); - defaultAnimation->updateTarget(); - } - } else if (defaultAnimation->state() == QStyleAnimation::Paused) { - defaultAnimation->resume(); - } - } - HIThemeButtonDrawInfo bdi; d->initHIThemePushButton(btn, w, tds, &bdi); - if (!d->pressedButton) { - QStyleAnimation* animation = d->animation(opt->styleObject); - if (animation && animation->state() == QStyleAnimation::Running) { + + if (yosemiteOrLater) { + // We can't rely on an animation existing to test for the default look. That means a bit + // more logic (notice that the logic is slightly different for the bevel and the label). + if (tds == kThemeStateActive + && (btn->features & QStyleOptionButton::DefaultButton + || (btn->features & QStyleOptionButton::AutoDefaultButton + && d->autoDefaultButton == btn->styleObject))) bdi.adornment |= kThemeAdornmentDefault; - bdi.animation.time.start = d->defaultButtonStart; - bdi.animation.time.current = CFAbsoluteTimeGetCurrent(); + } else { + // the default button animation is paused meanwhile any button + // is pressed or an auto-default button is animated instead + if (QStyleAnimation *defaultAnimation = d->animation(d->defaultButton)) { + if (d->pressedButton || d->autoDefaultButton) { + if (defaultAnimation->state() == QStyleAnimation::Running) { + defaultAnimation->pause(); + defaultAnimation->updateTarget(); + } + } else if (defaultAnimation->state() == QStyleAnimation::Paused) { + defaultAnimation->resume(); + } + } + + if (!d->pressedButton) { + QStyleAnimation* animation = d->animation(opt->styleObject); + if (animation && animation->state() == QStyleAnimation::Running) { + bdi.adornment |= kThemeAdornmentDefault; + bdi.animation.time.start = d->defaultButtonStart; + bdi.animation.time.current = CFAbsoluteTimeGetCurrent(); + } } } + // Unlike Carbon, we want the button to always be drawn inside its bounds. // Therefore, make the button a bit smaller, so that even if it got focus, // the focus 'shadow' will be inside. @@ -3650,14 +3669,24 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } break; case CE_PushButtonLabel: - if (const QStyleOptionButton *btn = qstyleoption_cast(opt)) { + if (const QStyleOptionButton *b = qstyleoption_cast(opt)) { + QStyleOptionButton btn(*b); // We really don't want the label to be drawn the same as on // windows style if it has an icon and text, then it should be more like a // tab. So, cheat a little here. However, if it *is* only an icon // the windows style works great, so just use that implementation. - bool hasMenu = btn->features & QStyleOptionButton::HasMenu; - bool hasIcon = !btn->icon.isNull(); - bool hasText = !btn->text.isEmpty(); + bool hasMenu = btn.features & QStyleOptionButton::HasMenu; + bool hasIcon = !btn.icon.isNull(); + bool hasText = !btn.text.isEmpty(); + + if (QSysInfo::QSysInfo::MacintoshVersion > QSysInfo::MV_10_9) { + if (tds == kThemeStatePressed + || (tds == kThemeStateActive + && ((btn.features & QStyleOptionButton::DefaultButton && !d->autoDefaultButton) + || d->autoDefaultButton == btn.styleObject))) + btn.palette.setColor(QPalette::ButtonText, Qt::white); + } + if (!hasIcon && !hasMenu) { // ### this is really overly difficult, simplify. // It basically tries to get the right font for "small" and "mini" icons. @@ -3676,8 +3705,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter break; } } + if (themeId == kThemePushButtonFont) { - QCommonStyle::drawControl(ce, btn, p, w); + QCommonStyle::drawControl(ce, &btn, p, w); } else { p->save(); CGContextSetShouldAntialias(cg, true); @@ -3685,7 +3715,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter HIThemeTextInfo tti; tti.version = qt_mac_hitheme_version; tti.state = tds; - QColor textColor = btn->palette.buttonText().color(); + QColor textColor; + textColor = btn.palette.buttonText().color(); CGFloat colorComp[] = { static_cast(textColor.redF()), static_cast(textColor.greenF()), static_cast(textColor.blueF()), static_cast(textColor.alphaF()) }; CGContextSetFillColorSpace(cg, qt_mac_genericColorSpace()); @@ -3695,9 +3726,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter tti.verticalFlushness = kHIThemeTextVerticalFlushCenter; tti.options = kHIThemeTextBoxOptionNone; tti.truncationPosition = kHIThemeTextTruncationNone; - tti.truncationMaxLines = 1 + btn->text.count(QLatin1Char('\n')); - QCFString buttonText = qt_mac_removeMnemonics(btn->text); - QRect r = btn->rect; + tti.truncationMaxLines = 1 + btn.text.count(QLatin1Char('\n')); + QCFString buttonText = qt_mac_removeMnemonics(btn.text); + QRect r = btn.rect; HIRect bounds = qt_hirectForQRect(r); HIThemeDrawTextBox(buttonText, &bounds, &tti, cg, kHIThemeOrientationNormal); @@ -3705,11 +3736,11 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } } else { if (hasIcon && !hasText) { - QCommonStyle::drawControl(ce, btn, p, w); + QCommonStyle::drawControl(ce, &btn, p, w); } else { - QRect freeContentRect = btn->rect; + QRect freeContentRect = btn.rect; QRect textRect = itemTextRect( - btn->fontMetrics, freeContentRect, Qt::AlignCenter, btn->state & State_Enabled, btn->text); + btn.fontMetrics, freeContentRect, Qt::AlignCenter, btn.state & State_Enabled, btn.text); if (hasMenu) { if (QSysInfo::macVersion() > QSysInfo::MV_10_6) textRect.moveTo(w ? 15 : 11, textRect.top()); // Supports Qt Quick Controls @@ -3721,21 +3752,21 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter int contentW = textRect.width(); if (hasMenu) contentW += proxy()->pixelMetric(PM_MenuButtonIndicator) + 4; - QIcon::Mode mode = btn->state & State_Enabled ? QIcon::Normal : QIcon::Disabled; - if (mode == QIcon::Normal && btn->state & State_HasFocus) + QIcon::Mode mode = btn.state & State_Enabled ? QIcon::Normal : QIcon::Disabled; + if (mode == QIcon::Normal && btn.state & State_HasFocus) mode = QIcon::Active; // Decide if the icon is should be on or off: QIcon::State state = QIcon::Off; - if (btn->state & State_On) + if (btn.state & State_On) state = QIcon::On; - QPixmap pixmap = btn->icon.pixmap(btn->iconSize, mode, state); + QPixmap pixmap = btn.icon.pixmap(btn.iconSize, mode, state); int pixmapWidth = pixmap.width() / pixmap.devicePixelRatio(); int pixmapHeight = pixmap.height() / pixmap.devicePixelRatio(); contentW += pixmapWidth + QMacStylePrivate::PushButtonContentPadding; int iconLeftOffset = freeContentRect.x() + (freeContentRect.width() - contentW) / 2; int iconTopOffset = freeContentRect.y() + (freeContentRect.height() - pixmapHeight) / 2; QRect iconDestRect(iconLeftOffset, iconTopOffset, pixmapWidth, pixmapHeight); - QRect visualIconDestRect = visualRect(btn->direction, freeContentRect, iconDestRect); + QRect visualIconDestRect = visualRect(btn.direction, freeContentRect, iconDestRect); proxy()->drawItemPixmap(p, visualIconDestRect, Qt::AlignLeft | Qt::AlignVCenter, pixmap); int newOffset = iconDestRect.x() + iconDestRect.width() + QMacStylePrivate::PushButtonContentPadding - textRect.x(); @@ -3743,9 +3774,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } // Draw the text: if (hasText) { - textRect = visualRect(btn->direction, freeContentRect, textRect); - proxy()->drawItemText(p, textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, btn->palette, - (btn->state & State_Enabled), btn->text, QPalette::ButtonText); + textRect = visualRect(btn.direction, freeContentRect, textRect); + proxy()->drawItemText(p, textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, btn.palette, + (btn.state & State_Enabled), btn.text, QPalette::ButtonText); } } } -- cgit v1.2.3 From e9e66079b16754f1fef89c2ad93593d7d55c8654 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 25 Aug 2014 15:52:30 +0200 Subject: QMacStyle: Fix QTabBar appearance on Yosemite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The selected tab text color should be white except when the window is not active. Also, no text shadow should be rendered in any case. Finally, there's no need to move the tab shape up anymore. Task-number: QTBUG-40833 Change-Id: Ibb35f0bb7a12fb005202fd8c082eb9bb19645b2b Reviewed-by: Morten Johan Sørvig --- src/widgets/styles/qmacstyle_mac.mm | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index debd19bbe0..277ad47090 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -3811,6 +3811,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter return; } } + + bool usingYosemiteOrLater = QSysInfo::MacintoshVersion > QSysInfo::MV_10_9; + HIThemeTabDrawInfo tdi; tdi.version = 1; tdi.style = kThemeTabNonFront; @@ -3851,10 +3854,13 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter else tdi.adornment = kHIThemeTabAdornmentNone; tdi.kind = kHIThemeTabKindNormal; - if (!verticalTabs) - tabRect.setY(tabRect.y() - 1); - else - tabRect.setX(tabRect.x() - 1); + + if (!usingYosemiteOrLater) { + if (!verticalTabs) + tabRect.setY(tabRect.y() - 1); + else + tabRect.setX(tabRect.x() - 1); + } QStyleOptionTab::TabPosition tp = tabOpt->position; QStyleOptionTab::SelectedPosition sp = tabOpt->selectedPosition; if (tabOpt->direction == Qt::RightToLeft && !verticalTabs) { @@ -3919,18 +3925,21 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter ThemeTabDirection ttd = getTabDirection(myTab.shape); bool verticalTabs = ttd == kThemeTabWest || ttd == kThemeTabEast; bool selected = (myTab.state & QStyle::State_Selected); - bool usingModernOSX = QSysInfo::MacintoshVersion > QSysInfo::MV_10_6; + bool usingLionOrLater = QSysInfo::MacintoshVersion > QSysInfo::MV_10_6; + bool usingYosemiteOrLater = QSysInfo::MacintoshVersion > QSysInfo::MV_10_9; - if (usingModernOSX && selected && !myTab.documentMode) - myTab.palette.setColor(QPalette::WindowText, QColor(Qt::white)); + if (usingLionOrLater && selected && !myTab.documentMode + && (!usingYosemiteOrLater || myTab.state & State_Active)) + myTab.palette.setColor(QPalette::WindowText, Qt::white); // Check to see if we use have the same as the system font // (QComboMenuItem is internal and should never be seen by the // outside world, unless they read the source, in which case, it's // their own fault). bool nonDefaultFont = p->font() != qt_app_fonts_hash()->value("QComboMenuItem"); - if ((usingModernOSX && selected) || verticalTabs || nonDefaultFont || !tab->icon.isNull() - || !myTab.leftButtonSize.isNull() || !myTab.rightButtonSize.isNull()) { + bool isSelectedAndNeedsShadow = selected && usingLionOrLater && !usingYosemiteOrLater; + if (isSelectedAndNeedsShadow || verticalTabs || nonDefaultFont || !tab->icon.isNull() + || !myTab.leftButtonSize.isEmpty() || !myTab.rightButtonSize.isEmpty()) { int heightOffset = 0; if (verticalTabs) { heightOffset = -1; @@ -3940,7 +3949,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } myTab.rect.setHeight(myTab.rect.height() + heightOffset); - if (myTab.documentMode || (usingModernOSX && selected)) { + if (myTab.documentMode || isSelectedAndNeedsShadow) { p->save(); rotateTabPainter(p, myTab.shape, myTab.rect); -- cgit v1.2.3 From f1bce3bc17ebb99b1512b07499988538465c78a2 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 21 Aug 2014 15:33:09 +0200 Subject: Avoid crash if querying device that has gone away A device removed very fast after being inserted might disappear while we are still seting it up. We must therefore check if we indeed still get a matching device Task-number: QTBUG-40820 Change-Id: I4372fb1932264e5799f37cea0d016795e28ebed6 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 4986e85728..b38f9d42a9 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -331,10 +331,12 @@ XInput2DeviceData *QXcbConnection::deviceForId(int id) { XInput2DeviceData *dev = m_touchDevices[id]; if (!dev) { - int unused = 0; + int nrDevices = 0; QTouchDevice::Capabilities caps = 0; dev = new XInput2DeviceData; - dev->xiDeviceInfo = XIQueryDevice(static_cast(m_xlib_display), id, &unused); + dev->xiDeviceInfo = XIQueryDevice(static_cast(m_xlib_display), id, &nrDevices); + if (nrDevices <= 0) + return 0; int type = -1; int maxTouchPoints = 1; bool hasRelativeCoords = false; -- cgit v1.2.3 From 8e96e73ebce9e0e7bd9c9f55eb545c442fe93a70 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 14 Aug 2014 16:08:27 +0200 Subject: Doc: corrected autolink errors corelib io Task-number: QTBUG-40362 Change-Id: If11700d57db75ad7605bd8d53681002639c2e785 Reviewed-by: Jerome Pasion --- src/corelib/io/qfile.cpp | 6 +++--- src/corelib/io/qfiledevice.cpp | 2 +- src/corelib/io/qiodevice.cpp | 18 +++++++++--------- src/corelib/io/qprocess.cpp | 10 +++++----- src/corelib/io/qtemporaryfile.cpp | 10 ++++++---- src/corelib/io/qtextstream.cpp | 2 +- src/corelib/io/qurl.cpp | 29 ++++++++++++++--------------- 7 files changed, 39 insertions(+), 38 deletions(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 82aee331c5..feecbd0281 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -167,7 +167,7 @@ QAbstractFileEngine *QFilePrivate::engine() const disk into a 16-bit Unicode QString. By default, it assumes that the user system's local 8-bit encoding is used (e.g., UTF-8 on most unix based operating systems; see QTextCodec::codecForLocale() for - details). This can be changed using setCodec(). + details). This can be changed using \l QTextStream::setCodec(). To write text, we can use operator<<(), which is overloaded to take a QTextStream on the left and various data types (including @@ -987,8 +987,8 @@ bool QFile::open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags) those cases, size() returns \c 0. See QIODevice::isSequential() for more information. - \warning For Windows CE you may not be able to call seek(), setSize(), - fileTime(). size() returns \c 0. + \warning For Windows CE you may not be able to call seek(), and size() + returns \c 0. \warning Since this function opens the file without specifying the file name, you cannot use this QFile with a QFileInfo. diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp index f7e58a7bed..f9a79cdca0 100644 --- a/src/corelib/io/qfiledevice.cpp +++ b/src/corelib/io/qfiledevice.cpp @@ -269,7 +269,7 @@ int QFileDevice::handle() const /*! Returns the name of the file. - The default implementation in QFileDevice returns QString(). + The default implementation in QFileDevice returns a null string. */ QString QFileDevice::fileName() const { diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 53019e1ff4..7b0557a497 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -217,7 +217,7 @@ QIODevicePrivate::~QIODevicePrivate() \li waitFor....() - Subclasses of QIODevice implement blocking functions for device-specific operations. For example, QProcess - has a function called waitForStarted() which suspends operation in + has a function called \l {QProcess::}{waitForStarted()} which suspends operation in the calling thread until the process has started. \endlist @@ -730,8 +730,7 @@ qint64 QIODevice::bytesAvailable() const return d->buffer.size(); } -/*! - For buffered devices, this function returns the number of bytes +/*! For buffered devices, this function returns the number of bytes waiting to be written. For devices with no buffer, this function returns 0. @@ -943,9 +942,10 @@ qint64 QIODevice::read(char *data, qint64 maxSize) data read as a QByteArray. This function has no way of reporting errors; returning an empty - QByteArray() can mean either that no data was currently available + QByteArray can mean either that no data was currently available for reading, or that an error occurred. */ + QByteArray QIODevice::read(qint64 maxSize) { Q_D(QIODevice); @@ -994,10 +994,10 @@ QByteArray QIODevice::read(qint64 maxSize) \overload Reads all available data from the device, and returns it as a - QByteArray. + byte array. This function has no way of reporting errors; returning an empty - QByteArray() can mean either that no data was currently available + QByteArray can mean either that no data was currently available for reading, or that an error occurred. */ QByteArray QIODevice::readAll() @@ -1173,10 +1173,10 @@ qint64 QIODevice::readLine(char *data, qint64 maxSize) \overload Reads a line from the device, but no more than \a maxSize characters, - and returns the result as a QByteArray. + and returns the result as a byte array. This function has no way of reporting errors; returning an empty - QByteArray() can mean either that no data was currently available + QByteArray can mean either that no data was currently available for reading, or that an error occurred. */ QByteArray QIODevice::readLine(qint64 maxSize) @@ -1527,7 +1527,7 @@ qint64 QIODevice::peek(char *data, qint64 maxSize) \snippet code/src_corelib_io_qiodevice.cpp 5 This function has no way of reporting errors; returning an empty - QByteArray() can mean either that no data was currently available + QByteArray can mean either that no data was currently available for peeking, or that an error occurred. \sa read() diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index b03e96d0f6..66036fca90 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1689,8 +1689,8 @@ void QProcess::setEnvironment(const QStringList &environment) \deprecated Returns the environment that QProcess will use when starting a process, or an empty QStringList if no environment has been set - using setEnvironment() or setEnvironmentHash(). If no environment - has been set, the environment of the calling process will be used. + using setEnvironment(). If no environment has been set, the + environment of the calling process will be used. \note The environment settings are ignored on Windows CE, as there is no concept of an environment. @@ -2016,7 +2016,7 @@ QByteArray QProcess::readAllStandardError() \note No further splitting of the arguments is performed. \b{Windows:} The arguments are quoted and joined into a command line - that is compatible with the CommandLineToArgvW() Windows function. + that is compatible with the \c CommandLineToArgvW() Windows function. For programs that have different command line quoting requirements, you need to use setNativeArguments(). @@ -2320,8 +2320,8 @@ int QProcess::exitCode() const Returns the exit status of the last process that finished. - On Windows, if the process was terminated with TerminateProcess() - from another application this function will still return NormalExit + On Windows, if the process was terminated with TerminateProcess() from + another application, this function will still return NormalExit unless the exit code is less than 0. */ QProcess::ExitStatus QProcess::exitStatus() const diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 3cade0ed25..d88ffb7c84 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -700,18 +700,20 @@ void QTemporaryFile::setFileTemplate(const QString &name) /*! - If \a file is not already a native file then a QTemporaryFile is created - in the tempPath() and \a file is copied into the temporary file, then a - pointer to the temporary file is returned. If \a file is already a native - file, a QTemporaryFile is not created, no copy is made and 0 is returned. + If \a file is not already a native file, then a QTemporaryFile is created + in QDir::tempPath(), the contents of \a file is copied into it, and a pointer + to the temporary file is returned. Does nothing and returns \c 0 if \a file + is already a native file. For example: + \code QFile f(":/resources/file.txt"); QTemporaryFile::createNativeFile(f); // Returns a pointer to a temporary file QFile f("/users/qt/file.txt"); QTemporaryFile::createNativeFile(f); // Returns 0 + \endcode \sa QFileInfo::isNativePath() */ diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index 288a939ab2..b67df6a4a6 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -2822,7 +2822,7 @@ QTextStream &reset(QTextStream &stream) /*! \relates QTextStream - Calls skipWhiteSpace() on \a stream and returns \a stream. + Calls \l {QTextStream::}{skipWhiteSpace()} on \a stream and returns \a stream. \sa {QTextStream manipulators} */ diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 7018b333f2..c109fc4d3a 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -2315,7 +2315,7 @@ void QUrl::setHost(const QString &host, ParsingMode mode) as DNS requests or in HTTP request headers). If that flag is not present, this function returns the International Domain Name (IDN) in Unicode form, according to the list of permissible top-level domains (see - idnWhiteList()). + idnWhitelist()). All other flags are ignored. Host names cannot contain control or percent characters, so the returned value can be considered fully decoded. @@ -2656,8 +2656,8 @@ void QUrl::setQuery(const QUrlQuery &query) Sets the query string of the URL to an encoded version of \a query. The contents of \a query are converted to a string internally, each pair delimited by the character returned by - pairDelimiter(), and the key and value are delimited by - valueDelimiter(). + queryPairDelimiter(), and the key and value are delimited by + queryValueDelimiter(). \note This method does not encode spaces (ASCII 0x20) as plus (+) signs, like HTML forms do. If you need that kind of encoding, you must encode @@ -2676,8 +2676,8 @@ void QUrl::setQuery(const QUrlQuery &query) Sets the query string of the URL to the encoded version of \a query. The contents of \a query are converted to a string internally, each pair delimited by the character returned by - pairDelimiter(), and the key and value are delimited by - valueDelimiter(). + queryPairDelimiter(), and the key and value are delimited by + queryValueDelimiter(). \obsolete Use QUrlQuery and setQuery(). @@ -2691,11 +2691,11 @@ void QUrl::setQuery(const QUrlQuery &query) Inserts the pair \a key = \a value into the query string of the URL. - The key/value pair is encoded before it is added to the query. The + The key-value pair is encoded before it is added to the query. The pair is converted into separate strings internally. The \a key and \a value is first encoded into UTF-8 and then delimited by the - character returned by valueDelimiter(). Each key/value pair is - delimited by the character returned by pairDelimiter(). + character returned by queryValueDelimiter(). Each key-value pair is + delimited by the character returned by queryPairDelimiter(). \note This method does not encode spaces (ASCII 0x20) as plus (+) signs, like HTML forms do. If you need that kind of encoding, you must encode @@ -2929,9 +2929,8 @@ QString QUrl::query(ComponentFormattingOptions options) const The fragment is sometimes also referred to as the URL "reference". Passing an argument of QString() (a null QString) will unset the fragment. - Passing an argument of QString("") (an empty but not null QString) - will set the fragment to an empty string (as if the original URL - had a lone "#"). + Passing an argument of QString("") (an empty but not null QString) will set the + fragment to an empty string (as if the original URL had a lone "#"). The \a fragment data is interpreted according to \a mode: in StrictMode, any '%' characters must be followed by exactly two hexadecimal characters @@ -3006,10 +3005,10 @@ QString QUrl::fragment(ComponentFormattingOptions options) const The fragment is sometimes also referred to as the URL "reference". - Passing an argument of QByteArray() (a null QByteArray) will unset - the fragment. Passing an argument of QByteArray("") (an empty but - not null QByteArray) will set the fragment to an empty string (as - if the original URL had a lone "#"). + Passing an argument of QByteArray() (a null QByteArray) will unset the fragment. + Passing an argument of QByteArray("") (an empty but not null QByteArray) + will set the fragment to an empty string (as if the original URL + had a lone "#"). \obsolete Use setFragment(), which has the same behavior of null / empty. -- cgit v1.2.3 From 63f48d00aaa51bc892d6381b43d57a6bc55afced Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 25 Aug 2014 16:53:05 +0200 Subject: Initialize textureId in platform backing store Setting it initially to 0 is very important, otherwise we will do a glDeleteTextures with the undefined value. The result sometimes goes unnoticed and sometimes causes bizarre issues: For example in the 'textures' example one face of one cube out of the six did go blank from time to time since the corresponding texture was deleted by the backingstore. Change-Id: Iebf68e20b2af426c979980d8bc4449db2b98f2f0 Reviewed-by: Paul Olav Tvete --- src/gui/painting/qplatformbackingstore.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 5b6c4bb83d..0fe883cf2b 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -62,6 +62,7 @@ public: QPlatformBackingStorePrivate(QWindow *w) : window(w) #ifndef QT_NO_OPENGL + , textureId(0) , blitter(0) #endif { -- cgit v1.2.3 From e94642a9b0806f2e5dfd9a2f8c76ce5b420c3424 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 25 Aug 2014 19:07:11 +0200 Subject: QMacStyle: Fix push buttons focus ring on Yosemite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HITheme renders the focus ring in a way that diminishes contrast on the focused button edges. The same issue seems to affect combo boxes, check boxes, and radio buttons. We refactor the code that was used to draw CE_FocusFrame into qt_drawFocusRingOnPath(). We use it to render our own path for the push button contour. This should also allow us to implement the focus ring animation in the future. As a side note, notice how the square button part (kThemeBevelButton) is a complete joke. Not only we impose the wrong button kind and let HITheme do what it can with it, but we also prevent ourselves from using it by never adding padding for the focus ring. Hopefully, we can fix this whole button sizing and padding mess in 5.5 or 6.0, whatever breaks less apps around. Task-number: QTBUG-40833 Change-Id: Ib9e7829d99b38dc926c55b31c3d6d5d32b691867 Reviewed-by: Morten Johan Sørvig --- src/widgets/styles/qmacstyle_mac.mm | 58 +++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 277ad47090..0845a5eb02 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1098,6 +1098,19 @@ static QAquaWidgetSize qt_aqua_guess_size(const QWidget *widg, QSize large, QSiz } #endif +static void qt_drawFocusRingOnPath(CGContextRef cg, NSBezierPath *focusRingPath) +{ + CGContextSaveGState(cg); + [NSGraphicsContext setCurrentContext:[NSGraphicsContext + graphicsContextWithGraphicsPort:(CGContextRef)cg flipped:NO]]; + [NSGraphicsContext saveGraphicsState]; + NSSetFocusRingStyle(NSFocusRingOnly); + [focusRingPath setClip]; // Clear clip path to avoid artifacts when rendering the cursor at zero pos + [focusRingPath fill]; + [NSGraphicsContext restoreGraphicsState]; + CGContextRestoreGState(cg); +} + QAquaWidgetSize QMacStylePrivate::aquaSizeConstrain(const QStyleOption *option, const QWidget *widg, QStyle::ContentsType ct, QSize szHint, QSize *insz) const { @@ -3573,6 +3586,10 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter d->initHIThemePushButton(btn, w, tds, &bdi); if (yosemiteOrLater) { + // HITheme is not drawing a nice focus frame around buttons. + // We'll do it ourselves further down. + bdi.adornment &= ~kThemeAdornmentFocus; + // We can't rely on an animation existing to test for the default look. That means a bit // more logic (notice that the logic is slightly different for the bevel and the label). if (tds == kThemeStateActive @@ -3625,6 +3642,37 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter else HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0); + if (yosemiteOrLater && btn->state & State_HasFocus) { + CGRect focusRect = newRect; + if (bdi.kind == kThemePushButton) + focusRect.size.height += 1; // Another thing HITheme and Cocoa seem to disagree about. + else if (bdi.kind == kThemePushButtonMini) + focusRect.size.height = 15; // Our QPushButton sizes are really weird + + if (bdi.adornment & kThemeAdornmentDefault || bdi.state == kThemeStatePressed) { + if (bdi.kind == kThemePushButtonSmall) { + focusRect = CGRectInset(focusRect, -1, 0); + } else if (bdi.kind == kThemePushButtonMini) { + focusRect = CGRectInset(focusRect, 1, 0); + } + } else { + if (bdi.kind == kThemePushButton) { + focusRect = CGRectInset(focusRect, 1, 1); + } else if (bdi.kind == kThemePushButtonSmall) { + focusRect = CGRectInset(focusRect, 0, 2); + } else if (bdi.kind == kThemePushButtonMini) { + focusRect = CGRectInset(focusRect, 2, 1); + } + } + + NSBezierPath *pushButtonFocusRingPath; + if (bdi.kind == kThemeBevelButton) + pushButtonFocusRingPath = [NSBezierPath bezierPathWithRect:focusRect]; + else + pushButtonFocusRingPath = [NSBezierPath bezierPathWithRoundedRect:focusRect xRadius:4 yRadius:4]; + qt_drawFocusRingOnPath(cg, pushButtonFocusRingPath); + } + if (hasMenu) { int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w); QRect ir = btn->rect; @@ -4089,16 +4137,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter int yOff = proxy()->pixelMetric(PM_FocusFrameVMargin, opt, w); NSRect rect = NSMakeRect(xOff+opt->rect.x(), yOff+opt->rect.y(), opt->rect.width() - 2 * xOff, opt->rect.height() - 2 * yOff); - CGContextSaveGState(cg); - [NSGraphicsContext setCurrentContext:[NSGraphicsContext - graphicsContextWithGraphicsPort:(CGContextRef)cg flipped:NO]]; - [NSGraphicsContext saveGraphicsState]; - NSSetFocusRingStyle(NSFocusRingOnly); NSBezierPath *focusFramePath = [NSBezierPath bezierPathWithRect:rect]; - [focusFramePath setClip]; // Clear clip path to avoid artifacts when rendering the cursor at zero pos - [focusFramePath fill]; - [NSGraphicsContext restoreGraphicsState]; - CGContextRestoreGState(cg); + qt_drawFocusRingOnPath(cg, focusFramePath); break; } case CE_MenuItem: case CE_MenuEmptyArea: -- cgit v1.2.3 From f2e4ff4fd484d49e7338c9a2c5882782fe8f081b Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 27 Aug 2014 12:12:50 +0200 Subject: Also print the class name in the QObject::killTimer error msg. When no objectName is set, this will give at least some information, other than the memory address of the current instance. Change-Id: Iae452c0e9fe38f0aab35094ddf0edc0fd6b28c20 Reviewed-by: Olivier Goffart --- src/corelib/kernel/qobject.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index e714168e16..e588808ee8 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1636,9 +1636,10 @@ void QObject::killTimer(int id) int at = d->extraData ? d->extraData->runningTimers.indexOf(id) : -1; if (at == -1) { // timer isn't owned by this object - qWarning("QObject::killTimer(): Error: timer id %d is not valid for object %p (%s), timer has not been killed", + qWarning("QObject::killTimer(): Error: timer id %d is not valid for object %p (%s, %s), timer has not been killed", id, this, + metaObject()->className(), qPrintable(objectName())); return; } -- cgit v1.2.3 From 4c6ebe5f9e4ddc0d799a0f2bf4aef9f7e48e0dfb Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 27 Aug 2014 10:56:53 +0200 Subject: Android quickfix: Avoid crash at shutdown Qt Quick does a processEvents() at shutdown. On some versions of Android, this can trigger a getTextAfterCursor() after QGuiApplication shutdown. This patch still has a theoretical race condition, but should reduce the crash probablity to practically zero. [ChangeLog][Android] Fixed bug on some devices where the application would crash at shutdown if the virtual keyboard was open. Task-number: QTBUG-40957 Change-Id: Iefcc10a77e3d506c32ea151c27a3e87a7be40e68 Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/qandroidinputcontext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index 5d47d2fda4..acd7a42ba2 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -995,8 +995,10 @@ Q_INVOKABLE QVariant QAndroidInputContext::queryFocusObjectUnsafe(Qt::InputMetho QVariant QAndroidInputContext::queryFocusObjectThreadSafe(Qt::InputMethodQuery query, QVariant argument) { - bool inMainThread = qGuiApp->thread() == QThread::currentThread(); QVariant retval; + if (!qGuiApp) + return retval; + bool inMainThread = qGuiApp->thread() == QThread::currentThread(); QMetaObject::invokeMethod(this, "queryFocusObjectUnsafe", inMainThread ? Qt::DirectConnection : Qt::BlockingQueuedConnection, -- cgit v1.2.3 From 4dc751360a605f010fd5031e95302bed3317d5e6 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 26 Aug 2014 17:25:26 +0200 Subject: Android: added more devices to the FBO readback workaround check. Task-number: QTBUG-40483 Change-Id: I7f3d375934a57fe3ac58ae35cb00d394349cb33f Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/android/qandroidplatformopenglcontext.cpp | 11 ++++++++--- src/plugins/platforms/android/qandroidplatformopenglcontext.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp index f27bea8863..a352d3ebb8 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp @@ -64,7 +64,7 @@ void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface) static_cast(surface)->checkNativeSurface(eglConfig()); } -bool QAndroidPlatformOpenGLContext::needsFBOReadBackWorkaroud() +bool QAndroidPlatformOpenGLContext::needsFBOReadBackWorkaround() { static bool set = false; static bool needsWorkaround = false; @@ -74,7 +74,12 @@ bool QAndroidPlatformOpenGLContext::needsFBOReadBackWorkaroud() needsWorkaround = qstrncmp(rendererString, "Mali-4xx", 6) == 0 // Mali-400, Mali-450 || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205 - || qstrcmp(rendererString, "GC1000 core") == 0; + || qstrncmp(rendererString, "Adreno 2xx", 8) == 0 // Same as above but without the '(TM)' + || qstrncmp(rendererString, "Adreno (TM) 30x", 14) == 0 // Adreno 302, 305 + || qstrncmp(rendererString, "Adreno 30x", 9) == 0 // Same as above but without the '(TM)' + || qstrcmp(rendererString, "GC800 core") == 0 + || qstrcmp(rendererString, "GC1000 core") == 0 + || qstrcmp(rendererString, "Immersion.16") == 0; set = true; } @@ -90,7 +95,7 @@ bool QAndroidPlatformOpenGLContext::makeCurrent(QPlatformSurface *surface) if (rendererString != 0 && qstrncmp(rendererString, "Android Emulator", 16) == 0) ctx_d->workaround_missingPrecisionQualifiers = true; - if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaroud()) + if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaround()) ctx_d->workaround_brokenFBOReadBack = true; return ret; diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.h b/src/plugins/platforms/android/qandroidplatformopenglcontext.h index 10a89d541b..b734cb4db9 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.h +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.h @@ -57,7 +57,7 @@ public: private: virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface); - static bool needsFBOReadBackWorkaroud(); + static bool needsFBOReadBackWorkaround(); }; QT_END_NAMESPACE -- cgit v1.2.3 From 1d7408cc8b1a62966ab311e2fb2e6007b1a357fc Mon Sep 17 00:00:00 2001 From: Dyami Caliri Date: Fri, 22 Aug 2014 08:35:29 -0700 Subject: CoreWLan: terminate scan thread in QCoreWlanEngine destructor The scan thread can take an indeterminate amount of time, often longer than the 5 seconds we had previously waited. Since this destructor is only called when the application quits, it's ok that some resources may be lost. Task-number: QTBUG-36000 Change-Id: Ib184156b5a23c39ea4f7937a26ecb099554bd4de Reviewed-by: Peter Hartmann --- src/plugins/bearer/corewlan/qcorewlanengine.mm | 3 ++- src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 554ad26e51..65e70876f2 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -419,7 +419,8 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent) QCoreWlanEngine::~QCoreWlanEngine() { - scanThread->wait(5000); + scanThread->terminate(); + scanThread->wait(); while (!foundConfigurations.isEmpty()) delete foundConfigurations.takeFirst(); diff --git a/src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm b/src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm index ba1cf33258..6cf614cb30 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm @@ -404,7 +404,8 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent) QCoreWlanEngine::~QCoreWlanEngine() { - scanThread->wait(5000); + scanThread->terminate(); + scanThread->wait(); while (!foundConfigurations.isEmpty()) delete foundConfigurations.takeFirst(); -- cgit v1.2.3 From 75cf14e413427f6687b895731f5b1294389c4dc7 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 27 Aug 2014 15:39:26 +0200 Subject: Revert "Make unicode ranges in font take precedence over codepage" This reverts commit 3a84d92f5736da3dc3f6a385bf3723984a5640ed because it caused a regression with certain fonts on Windows that have divided information about writing system support in unicode ranges and codepage ranges. The original commit fixed a problem on Android where one of the fonts had an entry for Arabic in its codepage range but no glyphs for this script. This issue has been fixed in a different way now, by 0b87f4f6c912a508f170cd25ff5317bb77665fa9 which makes fallback fonts work properly, so the commit is no longer needed to fix said bug. [ChangeLog][Fonts] Fixed regression in font families returned by QFontDatabase::families() for certain writing systems. Task-number: QTBUG-39846 Change-Id: I3077b1e618b21680549abc1734cb6df6e264387e Reviewed-by: Konstantin Ritt --- src/gui/text/qplatformfontdatabase.cpp | 104 ++++++++++++++++----------------- 1 file changed, 51 insertions(+), 53 deletions(-) diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 2c3a1d7f70..da44a275f8 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -550,60 +550,58 @@ QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(q } } } - if (!hasScript) { - if (codePageRange[0] & ((1 << Latin1CsbBit) | (1 << CentralEuropeCsbBit) | (1 << TurkishCsbBit) | (1 << BalticCsbBit))) { - writingSystems.setSupported(QFontDatabase::Latin); - hasScript = true; - //qDebug("font %s supports Latin", familyName.latin1()); - } - if (codePageRange[0] & (1 << CyrillicCsbBit)) { - writingSystems.setSupported(QFontDatabase::Cyrillic); - hasScript = true; - //qDebug("font %s supports Cyrillic", familyName.latin1()); - } - if (codePageRange[0] & (1 << GreekCsbBit)) { - writingSystems.setSupported(QFontDatabase::Greek); - hasScript = true; - //qDebug("font %s supports Greek", familyName.latin1()); - } - if (codePageRange[0] & (1 << HebrewCsbBit)) { - writingSystems.setSupported(QFontDatabase::Hebrew); - hasScript = true; - //qDebug("font %s supports Hebrew", familyName.latin1()); - } - if (codePageRange[0] & (1 << ArabicCsbBit)) { - writingSystems.setSupported(QFontDatabase::Arabic); - hasScript = true; - //qDebug("font %s supports Arabic", familyName.latin1()); - } - if (codePageRange[0] & (1 << VietnameseCsbBit)) { - writingSystems.setSupported(QFontDatabase::Vietnamese); - hasScript = true; - //qDebug("font %s supports Vietnamese", familyName.latin1()); - } - if (codePageRange[0] & (1 << SimplifiedChineseCsbBit)) { - writingSystems.setSupported(QFontDatabase::SimplifiedChinese); - hasScript = true; - //qDebug("font %s supports Simplified Chinese", familyName.latin1()); - } - if (codePageRange[0] & (1 << TraditionalChineseCsbBit)) { - writingSystems.setSupported(QFontDatabase::TraditionalChinese); - hasScript = true; - //qDebug("font %s supports Traditional Chinese", familyName.latin1()); - } - if (codePageRange[0] & (1 << JapaneseCsbBit)) { - writingSystems.setSupported(QFontDatabase::Japanese); - hasScript = true; - //qDebug("font %s supports Japanese", familyName.latin1()); - } - if (codePageRange[0] & ((1 << KoreanCsbBit) | (1 << KoreanJohabCsbBit))) { - writingSystems.setSupported(QFontDatabase::Korean); - hasScript = true; - //qDebug("font %s supports Korean", familyName.latin1()); - } - if (!hasScript) - writingSystems.setSupported(QFontDatabase::Symbol); + if (codePageRange[0] & ((1 << Latin1CsbBit) | (1 << CentralEuropeCsbBit) | (1 << TurkishCsbBit) | (1 << BalticCsbBit))) { + writingSystems.setSupported(QFontDatabase::Latin); + hasScript = true; + //qDebug("font %s supports Latin", familyName.latin1()); + } + if (codePageRange[0] & (1 << CyrillicCsbBit)) { + writingSystems.setSupported(QFontDatabase::Cyrillic); + hasScript = true; + //qDebug("font %s supports Cyrillic", familyName.latin1()); + } + if (codePageRange[0] & (1 << GreekCsbBit)) { + writingSystems.setSupported(QFontDatabase::Greek); + hasScript = true; + //qDebug("font %s supports Greek", familyName.latin1()); + } + if (codePageRange[0] & (1 << HebrewCsbBit)) { + writingSystems.setSupported(QFontDatabase::Hebrew); + hasScript = true; + //qDebug("font %s supports Hebrew", familyName.latin1()); + } + if (codePageRange[0] & (1 << ArabicCsbBit)) { + writingSystems.setSupported(QFontDatabase::Arabic); + hasScript = true; + //qDebug("font %s supports Arabic", familyName.latin1()); + } + if (codePageRange[0] & (1 << VietnameseCsbBit)) { + writingSystems.setSupported(QFontDatabase::Vietnamese); + hasScript = true; + //qDebug("font %s supports Vietnamese", familyName.latin1()); + } + if (codePageRange[0] & (1 << SimplifiedChineseCsbBit)) { + writingSystems.setSupported(QFontDatabase::SimplifiedChinese); + hasScript = true; + //qDebug("font %s supports Simplified Chinese", familyName.latin1()); + } + if (codePageRange[0] & (1 << TraditionalChineseCsbBit)) { + writingSystems.setSupported(QFontDatabase::TraditionalChinese); + hasScript = true; + //qDebug("font %s supports Traditional Chinese", familyName.latin1()); + } + if (codePageRange[0] & (1 << JapaneseCsbBit)) { + writingSystems.setSupported(QFontDatabase::Japanese); + hasScript = true; + //qDebug("font %s supports Japanese", familyName.latin1()); + } + if (codePageRange[0] & ((1 << KoreanCsbBit) | (1 << KoreanJohabCsbBit))) { + writingSystems.setSupported(QFontDatabase::Korean); + hasScript = true; + //qDebug("font %s supports Korean", familyName.latin1()); } + if (!hasScript) + writingSystems.setSupported(QFontDatabase::Symbol); return writingSystems; } -- cgit v1.2.3 From 41826cfbae4569255c78ea5ade2a4b7ed9a2dfe1 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 28 Aug 2014 11:53:06 +0200 Subject: QGLXContext survives screen removal The screen pointer is usually only used to get the Display, which normally doesn't change anyway. Task-number: QTBUG-39996 Change-Id: Ie35f02fc9330647897a9f081afb8c9ce550eed2a Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qglxintegration.cpp | 61 ++++++++++++++++----------- src/plugins/platforms/xcb/qglxintegration.h | 2 +- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 9a56455940..67235e0ef1 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -162,7 +162,7 @@ static void updateFormatFromContext(QSurfaceFormat &format) QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share) : QPlatformOpenGLContext() - , m_screen(screen) + , m_display(DISPLAY_FROM_XCB(screen)) , m_context(0) , m_shareContext(0) , m_format(format) @@ -186,7 +186,7 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat glXCreateContextAttribsARBProc glXCreateContextAttribsARB = 0; glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc) glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB"); - QList glxExt = QByteArray(glXQueryExtensionsString(DISPLAY_FROM_XCB(m_screen), m_screen->screenNumber())).split(' '); + QList glxExt = QByteArray(glXQueryExtensionsString(m_display, screen->screenNumber())).split(' '); bool supportsProfiles = glxExt.contains("GLX_ARB_create_context_profile"); // Use glXCreateContextAttribsARB if available @@ -255,10 +255,10 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat contextAttributes << None; - m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, m_shareContext, true, contextAttributes.data()); + m_context = glXCreateContextAttribsARB(m_display, config, m_shareContext, true, contextAttributes.data()); if (!m_context && m_shareContext) { // re-try without a shared glx context - m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, 0, true, contextAttributes.data()); + m_context = glXCreateContextAttribsARB(m_display, config, 0, true, contextAttributes.data()); if (m_context) m_shareContext = 0; } @@ -271,10 +271,10 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat if (m_format.renderableType() == QSurfaceFormat::OpenGLES) return; - m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, m_shareContext, true); + m_context = glXCreateNewContext(m_display, config, GLX_RGBA_TYPE, m_shareContext, true); if (!m_context && m_shareContext) { // re-try without a shared glx context - m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, 0, true); + m_context = glXCreateNewContext(m_display, config, GLX_RGBA_TYPE, 0, true); if (m_context) m_shareContext = 0; } @@ -292,14 +292,14 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat return; // Note that m_format gets updated with the used surface format - visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(screen), screen->screenNumber(), &m_format); + visualInfo = qglx_findVisualInfo(m_display, screen->screenNumber(), &m_format); if (!visualInfo) qFatal("Could not initialize GLX"); - m_context = glXCreateContext(DISPLAY_FROM_XCB(screen), visualInfo, m_shareContext, true); + m_context = glXCreateContext(m_display, visualInfo, m_shareContext, true); if (!m_context && m_shareContext) { // re-try without a shared glx context m_shareContext = 0; - m_context = glXCreateContext(DISPLAY_FROM_XCB(screen), visualInfo, 0, true); + m_context = glXCreateContext(m_display, visualInfo, Q_NULLPTR, true); } // Create a temporary window so that we can make the new context current @@ -309,20 +309,31 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat // Query the OpenGL version and profile if (m_context && window) { - glXMakeCurrent(DISPLAY_FROM_XCB(screen), window, m_context); + glXMakeCurrent(m_display, window, m_context); updateFormatFromContext(m_format); // Make our context non-current - glXMakeCurrent(DISPLAY_FROM_XCB(screen), 0, 0); + glXMakeCurrent(m_display, 0, 0); } // Destroy our temporary window - XDestroyWindow(DISPLAY_FROM_XCB(screen), window); + XDestroyWindow(m_display, window); } QGLXContext::~QGLXContext() { - glXDestroyContext(DISPLAY_FROM_XCB(m_screen), m_context); + glXDestroyContext(m_display, m_context); +} + +static QXcbScreen *screenForPlatformSurface(QPlatformSurface *surface) +{ + QSurface::SurfaceClass surfaceClass = surface->surface()->surfaceClass(); + if (surfaceClass == QSurface::Window) { + return static_cast(static_cast(surface)->screen()); + } else if (surfaceClass == QSurface::Offscreen) { + return static_cast(static_cast(surface)->screen()); + } + return Q_NULLPTR; } bool QGLXContext::makeCurrent(QPlatformSurface *surface) @@ -330,24 +341,24 @@ bool QGLXContext::makeCurrent(QPlatformSurface *surface) bool success = false; Q_ASSERT(surface->surface()->supportsOpenGL()); - Display *dpy = DISPLAY_FROM_XCB(m_screen); GLXDrawable glxDrawable = 0; QSurface::SurfaceClass surfaceClass = surface->surface()->surfaceClass(); if (surfaceClass == QSurface::Window) { m_isPBufferCurrent = false; QXcbWindow *window = static_cast(surface); glxDrawable = window->xcb_window(); - success = glXMakeCurrent(dpy, glxDrawable, m_context); + success = glXMakeCurrent(m_display, glxDrawable, m_context); } else if (surfaceClass == QSurface::Offscreen) { m_isPBufferCurrent = true; QGLXPbuffer *pbuffer = static_cast(surface); glxDrawable = pbuffer->pbuffer(); - success = glXMakeContextCurrent(dpy, glxDrawable, glxDrawable, m_context); + success = glXMakeContextCurrent(m_display, glxDrawable, glxDrawable, m_context); } if (success) { int interval = surface->format().swapInterval(); - if (interval >= 0 && m_swapInterval != interval) { + QXcbScreen *screen = screenForPlatformSurface(surface); + if (interval >= 0 && m_swapInterval != interval && screen) { m_swapInterval = interval; typedef void (*qt_glXSwapIntervalEXT)(Display *, GLXDrawable, int); typedef void (*qt_glXSwapIntervalMESA)(unsigned int); @@ -356,15 +367,15 @@ bool QGLXContext::makeCurrent(QPlatformSurface *surface) static bool resolved = false; if (!resolved) { resolved = true; - QList glxExt = QByteArray(glXQueryExtensionsString(dpy, - m_screen->screenNumber())).split(' '); + QList glxExt = QByteArray(glXQueryExtensionsString(m_display, + screen->screenNumber())).split(' '); if (glxExt.contains("GLX_EXT_swap_control")) glXSwapIntervalEXT = (qt_glXSwapIntervalEXT) getProcAddress("glXSwapIntervalEXT"); if (glxExt.contains("GLX_MESA_swap_control")) glXSwapIntervalMESA = (qt_glXSwapIntervalMESA) getProcAddress("glXSwapIntervalMESA"); } if (glXSwapIntervalEXT) - glXSwapIntervalEXT(dpy, glxDrawable, interval); + glXSwapIntervalEXT(m_display, glxDrawable, interval); else if (glXSwapIntervalMESA) glXSwapIntervalMESA(interval); } @@ -376,9 +387,9 @@ bool QGLXContext::makeCurrent(QPlatformSurface *surface) void QGLXContext::doneCurrent() { if (m_isPBufferCurrent) - glXMakeContextCurrent(DISPLAY_FROM_XCB(m_screen), 0, 0, 0); + glXMakeContextCurrent(m_display, 0, 0, 0); else - glXMakeCurrent(DISPLAY_FROM_XCB(m_screen), 0, 0); + glXMakeCurrent(m_display, 0, 0); m_isPBufferCurrent = false; } @@ -389,7 +400,7 @@ void QGLXContext::swapBuffers(QPlatformSurface *surface) glxDrawable = static_cast(surface)->pbuffer(); else glxDrawable = static_cast(surface)->xcb_window(); - glXSwapBuffers(DISPLAY_FROM_XCB(m_screen), glxDrawable); + glXSwapBuffers(m_display, glxDrawable); if (surface->surface()->surfaceClass() == QSurface::Window) { QXcbWindow *platformWindow = static_cast(surface); @@ -397,7 +408,7 @@ void QGLXContext::swapBuffers(QPlatformSurface *surface) // use QueuedConnection to sync the window from the platformWindow's thread // as QXcbWindow is no QObject, a wrapper slot in QXcbConnection is used. if (platformWindow->needsSync()) - QMetaObject::invokeMethod(m_screen->connection(), "syncWindow", Qt::QueuedConnection, Q_ARG(QXcbWindow*, platformWindow)); + QMetaObject::invokeMethod(screenForPlatformSurface(surface)->connection(), "syncWindow", Qt::QueuedConnection, Q_ARG(QXcbWindow*, platformWindow)); } } @@ -410,7 +421,7 @@ void (*QGLXContext::getProcAddress(const QByteArray &procName)) () if (resolved && !glXGetProcAddressARB) return 0; if (!glXGetProcAddressARB) { - QList glxExt = QByteArray(glXGetClientString(DISPLAY_FROM_XCB(m_screen), GLX_EXTENSIONS)).split(' '); + QList glxExt = QByteArray(glXGetClientString(m_display, GLX_EXTENSIONS)).split(' '); if (glxExt.contains("GLX_ARB_get_proc_address")) { #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) void *handle = dlopen(NULL, RTLD_LAZY); diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h index 00bba94ab3..560dd6ab67 100644 --- a/src/plugins/platforms/xcb/qglxintegration.h +++ b/src/plugins/platforms/xcb/qglxintegration.h @@ -76,7 +76,7 @@ public: static void queryDummyContext(); private: - QXcbScreen *m_screen; + Display *m_display; GLXContext m_context; GLXContext m_shareContext; QSurfaceFormat m_format; -- cgit v1.2.3 From 5a278dd42a9fa6a27dca3a6ec1f8ada3c433a780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Wed, 27 Aug 2014 23:06:48 +0100 Subject: Android: Fix crash at shutdown when keyboard is visible This is a follow-up to 4c6ebe5f9e4ddc0d799a0f2bf4aef9f7e48e0dfb. Crash was still 100% reproducible for me with the previous fix. Task-number: QTBUG-40957 Change-Id: Ie59cfe4f1fc746251fe06ba96369738098b2a35f Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/android/androidjniinput.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index defc59abf0..cd0659227d 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -47,6 +47,7 @@ #include #include +#include #include QT_BEGIN_NAMESPACE @@ -716,7 +717,7 @@ namespace QtAndroidInput static void keyboardVisibilityChanged(JNIEnv */*env*/, jobject /*thiz*/, jboolean /*visibility*/) { QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext(); - if (inputContext) + if (inputContext && qGuiApp) inputContext->emitInputPanelVisibleChanged(); #ifdef QT_DEBUG_ANDROID_IM_PROTOCOL qDebug() << "@@@ KEYBOARDVISIBILITYCHANGED" << inputContext; -- cgit v1.2.3 From 3da75b05841e503c146a326c15b9065eebfe35b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 8 Aug 2014 16:14:56 +0200 Subject: QCoreTextFontDatabase: Remove number type asserts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On iOS 8, the value 0 is returned as a kCFNumberIntType. The code still works - CFNumberGetValue converts it to a 0.0 double. Change-Id: Ic50900b22e4fa19ad1481e8e0e293559bbfd8cd2 Reviewed-by: Tor Arne Vestbø --- src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index cff90f420b..ca7afb7d1b 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -264,7 +264,6 @@ static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd) if (styles) { if (CFNumberRef weightValue = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontWeightTrait)) { - Q_ASSERT(CFNumberIsFloatType(weightValue)); double normalizedWeight; if (CFNumberGetValue(weightValue, kCFNumberDoubleType, &normalizedWeight)) { if (normalizedWeight >= 0.62) @@ -280,7 +279,6 @@ static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd) } } if (CFNumberRef italic = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontSlantTrait)) { - Q_ASSERT(CFNumberIsFloatType(italic)); double d; if (CFNumberGetValue(italic, kCFNumberDoubleType, &d)) { if (d > 0.0) -- cgit v1.2.3 From 9c3a58a913a7e59359146264ee59d40d703d4db2 Mon Sep 17 00:00:00 2001 From: Dyami Caliri Date: Wed, 27 Aug 2014 09:27:50 -0700 Subject: Recreate child windows when changing screens When setting a new screen, the code calls QWindow::destroy(), which recursively destroys all child windows. It then calls create() on the top-level window, leaving child windows destroyed. This causes crashes if you have embedded native widgets. Task-number: QTBUG-40817 Change-Id: Iaace2589f48bbfd5faaf5ff95357ff43b310504a Reviewed-by: Shawn Rutledge Reviewed-by: Laszlo Agocs --- src/gui/kernel/qwindow.cpp | 34 ++++++++++++-------- src/gui/kernel/qwindow_p.h | 1 + .../kernel/qwidget_window/qwidget_window.pro | 2 +- .../kernel/qwidget_window/tst_qwidget_window.cpp | 37 ++++++++++++++++++++++ 4 files changed, 60 insertions(+), 14 deletions(-) mode change 100644 => 100755 tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro mode change 100644 => 100755 tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index d6f9fad070..6724d68c95 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -367,12 +367,31 @@ void QWindowPrivate::setScreen(QScreen *newScreen, bool recreate) if (newScreen) { q->connect(screen, SIGNAL(destroyed(QObject*)), q, SLOT(screenDestroyed(QObject*))); if (shouldRecreate) - q->create(); + create(true); } emit q->screenChanged(newScreen); } } +void QWindowPrivate::create(bool recursive) +{ + Q_Q(QWindow); + if (!platformWindow) { + platformWindow = QGuiApplicationPrivate::platformIntegration()->createPlatformWindow(q); + QObjectList childObjects = q->children(); + for (int i = 0; i < childObjects.size(); i ++) { + QObject *object = childObjects.at(i); + if (object->isWindowType()) { + QWindow *window = static_cast(object); + if (recursive) + window->d_func()->create(true); + if (window->d_func()->platformWindow) + window->d_func()->platformWindow->setParent(platformWindow); + } + } + } +} + void QWindowPrivate::clearFocusObject() { } @@ -490,18 +509,7 @@ bool QWindow::isVisible() const void QWindow::create() { Q_D(QWindow); - if (!d->platformWindow) { - d->platformWindow = QGuiApplicationPrivate::platformIntegration()->createPlatformWindow(this); - QObjectList childObjects = children(); - for (int i = 0; i < childObjects.size(); i ++) { - QObject *object = childObjects.at(i); - if(object->isWindowType()) { - QWindow *window = static_cast(object); - if (window->d_func()->platformWindow) - window->d_func()->platformWindow->setParent(d->platformWindow); - } - } - } + d->create(false); } /*! diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index 4305edea51..51d78bb9cd 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -132,6 +132,7 @@ public: void _q_clearAlert(); void setScreen(QScreen *newScreen, bool recreate); + void create(bool recursive); virtual void clearFocusObject(); diff --git a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro old mode 100644 new mode 100755 index baa2823f9a..d61681d5cb --- a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro +++ b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro @@ -1,7 +1,7 @@ CONFIG += testcase CONFIG += parallel_test TARGET = tst_qwidget_window -QT += widgets testlib +QT += widgets testlib core-private gui-private SOURCES += tst_qwidget_window.cpp x11 { diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp old mode 100644 new mode 100755 index d6b7fc20ed..87e1c7a4f3 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -52,6 +52,9 @@ #include #include #include +#include +#include +#include static inline void setFrameless(QWidget *w) { @@ -96,6 +99,8 @@ private slots: #endif void tst_qtbug35600(); + void tst_recreateWindow_QTBUG40817(); + }; void tst_QWidget_window::initTestCase() @@ -598,5 +603,37 @@ void tst_QWidget_window::tst_qtbug35600() // QTBUG-35600: program may crash here or on exit } +void tst_QWidget_window::tst_recreateWindow_QTBUG40817() +{ + QTabWidget tab; + + QWidget *w = new QWidget; + tab.addTab(w, "Tab1"); + QVBoxLayout *vl = new QVBoxLayout(w); + QLabel *lbl = new QLabel("HELLO1"); + lbl->setObjectName("label1"); + vl->addWidget(lbl); + w = new QWidget; + tab.addTab(w, "Tab2"); + vl = new QVBoxLayout(w); + lbl = new QLabel("HELLO2"); + lbl->setAttribute(Qt::WA_NativeWindow); + lbl->setObjectName("label2"); + vl->addWidget(lbl); + + tab.show(); + + QVERIFY(QTest::qWaitForWindowExposed(&tab)); + + QWindow *win = tab.windowHandle(); + win->destroy(); + QWindowPrivate *p = qt_window_private(win); + p->create(true); + win->show(); + + tab.setCurrentIndex(1); +} + + QTEST_MAIN(tst_QWidget_window) #include "tst_qwidget_window.moc" -- cgit v1.2.3 From e5a332ae54b4aaf598b6b97a3e7e5f876abf28f4 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 29 Aug 2014 11:33:21 +0200 Subject: Bump version Change-Id: I3aa94110b11e181dea1b8551982ce16dab57f893 --- src/corelib/global/qglobal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 255eb6c00b..c159ea172d 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -45,11 +45,11 @@ #include -#define QT_VERSION_STR "5.3.2" +#define QT_VERSION_STR "5.3.3" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x050302 +#define QT_VERSION 0x050303 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ -- cgit v1.2.3 From 032ab648c44796b3b5bdc3d93a507efc60ac4391 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Mon, 30 Jun 2014 16:42:13 +0200 Subject: QNX: Fix widgets scrolling Qt expects scroll operations to be executed immediately. They cannot be postponed since Qt may paint on the scrolled area afterwards. The new code will only use an accelerated scroll operation (screen_blit) once before the window is posted, because the blit is from the previous buffer to the current one. Hence an additional scroll operation could copy outdated pixel data. Additional scroll operations will be handled by Qt. Performance issues were not perceived with this approach so far. Task-number: QTBUG-39958 Change-Id: I6d7c3274c5db6a831a169615518fcdb4d926db70 Reviewed-by: Fabian Bumberger --- .../platforms/qnx/qqnxrasterbackingstore.cpp | 66 ++++++---------------- src/plugins/platforms/qnx/qqnxrasterbackingstore.h | 12 +--- 2 files changed, 20 insertions(+), 58 deletions(-) diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp index 7ae042cb50..c986a960f3 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp @@ -58,7 +58,8 @@ QT_BEGIN_NAMESPACE QQnxRasterBackingStore::QQnxRasterBackingStore(QWindow *window) : QPlatformBackingStore(window), - m_hasUnflushedPaintOperations(false) + m_needsPosting(false), + m_scrolled(false) { qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window; @@ -85,10 +86,10 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << this->window(); // Sometimes this method is called even though there is nothing to be - // flushed, for instance, after an expose event directly follows a - // geometry change event. - if (!m_hasUnflushedPaintOperations) - return; + // flushed (posted in "screen" parlance), for instance, after an expose + // event directly follows a geometry change event. + if (!m_needsPosting) + return; QQnxWindow *targetWindow = 0; if (window) @@ -99,25 +100,11 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const // child windows, are performed; conceptually ,child windows have no buffers // (actually they do have a 1x1 placeholder buffer due to libscreen limitations), // since Qt will only draw to the backing store of the top-level window. - if (!targetWindow || targetWindow == platformWindow()) { + if (!targetWindow || targetWindow == platformWindow()) + platformWindow()->post(region); // update the display with newly rendered content - // visit all pending scroll operations - for (int i = m_scrollOpList.size() - 1; i >= 0; i--) { - - // do the scroll operation - ScrollOp &op = m_scrollOpList[i]; - QRegion srcArea = op.totalArea.intersected( op.totalArea.translated(-op.dx, -op.dy) ); - platformWindow()->scroll(srcArea, op.dx, op.dy); - } - - // clear all pending scroll operations - m_scrollOpList.clear(); - - // update the display with newly rendered content - platformWindow()->post(region); - } - - m_hasUnflushedPaintOperations = false; + m_needsPosting = false; + m_scrolled = false; } void QQnxRasterBackingStore::resize(const QSize &size, const QRegion &staticContents) @@ -134,31 +121,14 @@ bool QQnxRasterBackingStore::scroll(const QRegion &area, int dx, int dy) { qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window(); - // calculate entire region affected by scroll operation (src + dst) - QRegion totalArea = area.translated(dx, dy); - totalArea += area; - m_hasUnflushedPaintOperations = true; - - // visit all pending scroll operations - for (int i = m_scrollOpList.size() - 1; i >= 0; i--) { - - ScrollOp &op = m_scrollOpList[i]; - if (op.totalArea == totalArea) { - // same area is being scrolled again - update delta - op.dx += dx; - op.dy += dy; - return true; - } else if (op.totalArea.intersects(totalArea)) { - // current scroll overlaps previous scroll but is - // not equal in area - just paint everything - qWarning("QQNX: pending scroll operations overlap but not equal"); - return false; - } - } + m_needsPosting = true; - // create new scroll operation - m_scrollOpList.append( ScrollOp(totalArea, dx, dy) ); - return true; + if (!m_scrolled) { + platformWindow()->scroll(area, dx, dy, true); + m_scrolled = true; + return true; + } + return false; } void QQnxRasterBackingStore::beginPaint(const QRegion ®ion) @@ -166,7 +136,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion ®ion) Q_UNUSED(region); qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window(); - m_hasUnflushedPaintOperations = true; + m_needsPosting = true; platformWindow()->adjustBufferSize(); diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h index 35efd68571..d71e274a1d 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h @@ -64,19 +64,11 @@ public: void endPaint(); private: - class ScrollOp { - public: - ScrollOp(const QRegion &a, int x, int y) : totalArea(a), dx(x), dy(y) {} - QRegion totalArea; - int dx; - int dy; - }; - QQnxRasterWindow *platformWindow() const; QWindow *m_window; - QList m_scrollOpList; - bool m_hasUnflushedPaintOperations; + bool m_needsPosting; + bool m_scrolled; }; QT_END_NAMESPACE -- cgit v1.2.3 From 2113bdee5dc78d6b615768afabc3ecd7d14f4b83 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 1 Sep 2014 10:32:25 +0200 Subject: QFileDialog: save and restore all settings even if widgets not used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some applications may use native file dialogs and some may use the widget implementation, but QFileDialog always saves all settings to the same place each time it destroyed. So it is important to remember all settings read in restoreState and put them back in saveState. This bug was introduced by 37ca2224eca671200a2710f57f970d2993e62aa5 Task-number: QTBUG-36888 Change-Id: Ied1db83817480312e963a042784d7bdd16f0a2b1 Reviewed-by: Jan Arve Sæther --- src/widgets/dialogs/qfiledialog.cpp | 21 +++++++++------------ src/widgets/dialogs/qfiledialog_p.h | 5 +++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 9219757dbf..e53cdeac29 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -454,15 +454,15 @@ QByteArray QFileDialog::saveState() const stream << d->qFileDialogUi->splitter->saveState(); stream << d->qFileDialogUi->sidebar->urls(); } else { - stream << QByteArray(); - stream << QList(); + stream << d->splitterState; + stream << d->sidebarUrls; } stream << history(); stream << *lastVisitedDir(); if (d->usingWidgets()) stream << d->qFileDialogUi->treeView->header()->saveState(); else - stream << QByteArray(); + stream << d->headerData; stream << qint32(viewMode()); return data; } @@ -484,9 +484,6 @@ bool QFileDialog::restoreState(const QByteArray &state) QDataStream stream(&sd, QIODevice::ReadOnly); if (stream.atEnd()) return false; - QByteArray splitterState; - QByteArray headerData; - QList bookmarks; QStringList history; QString currentDirectory; qint32 marker; @@ -497,11 +494,11 @@ bool QFileDialog::restoreState(const QByteArray &state) if (marker != QFileDialogMagic || v != version) return false; - stream >> splitterState - >> bookmarks + stream >> d->splitterState + >> d->sidebarUrls >> history >> currentDirectory - >> headerData + >> d->headerData >> viewMode; setDirectory(lastVisitedDir()->isEmpty() ? currentDirectory : *lastVisitedDir()); @@ -510,7 +507,7 @@ bool QFileDialog::restoreState(const QByteArray &state) if (!d->usingWidgets()) return true; - if (!d->qFileDialogUi->splitter->restoreState(splitterState)) + if (!d->qFileDialogUi->splitter->restoreState(d->splitterState)) return false; QList list = d->qFileDialogUi->splitter->sizes(); if (list.count() >= 2 && list.at(0) == 0 && list.at(1) == 0) { @@ -519,12 +516,12 @@ bool QFileDialog::restoreState(const QByteArray &state) d->qFileDialogUi->splitter->setSizes(list); } - d->qFileDialogUi->sidebar->setUrls(bookmarks); + d->qFileDialogUi->sidebar->setUrls(d->sidebarUrls); while (history.count() > 5) history.pop_front(); setHistory(history); QHeaderView *headerView = d->qFileDialogUi->treeView->header(); - if (!headerView->restoreState(headerData)) + if (!headerView->restoreState(d->headerData)) return false; QList actions = headerView->actions(); diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index 632bbca5a4..89c6414b71 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -273,6 +273,11 @@ public: QSharedPointer options; + // Memory of what was read from QSettings in restoreState() in case widgets are not used + QByteArray splitterState; + QByteArray headerData; + QList sidebarUrls; + ~QFileDialogPrivate(); private: -- cgit v1.2.3 From 0c9ae660820e8da220d607091ad7b9c1b4bf199e Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 27 Aug 2014 19:23:23 +0200 Subject: QMacStyle: Fix inactive combo box appearance in 10.10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As usual, HITheme is not helping, and renders inactive controls as disabled. Also, given the design changes in Yosemite, we can't just desaturate the active pixmap and render it. In this case, we render the inactive control and enhance it, making very close to the expected result. The pixel-exact version would be to render a plain push button, and then add the combo box arrows. However, these arrows would need to be created (and updated) since there seems to be no more API to render them. Task-number: QTBUG-40833 Change-Id: If1bc366c0bc83123972fabebbc8beeb9f071e7a1 Reviewed-by: Morten Johan Sørvig --- src/widgets/styles/qmacstyle_mac.mm | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 0845a5eb02..1f6940f063 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1335,7 +1335,7 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem bdi->adornment = kThemeAdornmentFocus; if (combo->activeSubControls & QStyle::SC_ComboBoxArrow) bdi->state = kThemeStatePressed; - else if (tds == kThemeStateInactive) + else if (tds == kThemeStateInactive && QSysInfo::MacintoshVersion <= QSysInfo::MV_10_9) bdi->state = kThemeStateActive; else bdi->state = tds; @@ -1744,6 +1744,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD const bool combo = opt->type == QStyleOption::SO_ComboBox; const bool button = opt->type == QStyleOption::SO_Button; const bool pressed = bdi->state == kThemeStatePressed; + const bool usingYosemiteOrLater = QSysInfo::MacintoshVersion > QSysInfo::MV_10_9; if (button && pressed) { if (bdi->kind == kThemePushButton) { @@ -1788,7 +1789,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD if (!combo && !button && bdi->value == kThemeButtonOff) { pm = activePixmap; - } else if (combo || button) { + } else if ((combo && !usingYosemiteOrLater) || button) { QImage image = activePixmap.toImage(); for (int y = 0; y < height; ++y) { @@ -1815,6 +1816,30 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD } } pm = QPixmap::fromImage(image); + } else if (combo && usingYosemiteOrLater) { + QImage image = activePixmap.toImage(); + + for (int y = 0; y < height; ++y) { + QRgb *scanLine = reinterpret_cast(image.scanLine(y)); + + for (int x = 0; x < width; ++x) { + QRgb &pixel = scanLine[x]; + int gray = qRed(pixel); // We know the image is grayscale + int alpha = qAlpha(pixel); + + if (gray == 128 && alpha == 128) { + pixel = qRgba(255, 255, 255, 255); + } else if (alpha == 0) { + pixel = 0; + } else { + bool belowThreshold = (alpha * gray) / 255 + 255 - alpha < 128; + gray = belowThreshold ? 0 : 2 * gray - 255; + alpha = belowThreshold ? 0 : 2 * alpha - 255; + pixel = qRgba(gray, gray, gray, alpha); + } + } + } + pm = QPixmap::fromImage(image); } else { QImage activeImage = activePixmap.toImage(); QImage colorlessImage; -- cgit v1.2.3 From f6c36917f15fda0066bf996c1d36ef6dace9f404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 28 Jul 2014 14:46:18 +0200 Subject: iOS: Update QIOSScreen::nativeOrientation() for iOS8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For iOS8 and up [UIScreen bounds] changes based on the interface orientation, so we need to use [UIScreen nativeBounds] instead. Change-Id: I3fc12cfa417df26ca94c803e970bc2dc18a94378 Reviewed-by: Morten Johan Sørvig Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.mm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 5331d05ae9..bb51d79e2a 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -294,8 +294,15 @@ qreal QIOSScreen::devicePixelRatio() const Qt::ScreenOrientation QIOSScreen::nativeOrientation() const { - // A UIScreen stays in the native orientation, regardless of rotation - return m_uiScreen.bounds.size.width >= m_uiScreen.bounds.size.height ? + CGRect nativeBounds = +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0) + QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0 ? m_uiScreen.nativeBounds : +#endif + m_uiScreen.bounds; + + // All known iOS devices have a native orientation of portrait, but to + // be on the safe side we compare the width and height of the bounds. + return nativeBounds.size.width >= nativeBounds.size.height ? Qt::LandscapeOrientation : Qt::PortraitOrientation; } -- cgit v1.2.3 From b9a7cedb6ebd85f249f54c8688943346c7a98260 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 1 Sep 2014 13:27:23 +0200 Subject: Android: Avoid deadlock in Qt.inputMethod.visible A blocking isSoftwareKeyboardVisible() is a deadlock waiting to happen: when the android input method performs blocking metacalls from the android thread to the GUI thread all the time, we cannot block the GUI thread waiting for the android thread. Task-number: QTBUG-40750 Change-Id: I2490897b0f65e0d92214907e239b10b372d949dd Reviewed-by: Christian Stromme --- .../org/qtproject/qt5/android/QtActivityDelegate.java | 5 ----- .../jar/src/org/qtproject/qt5/android/QtNative.java | 19 ------------------- src/plugins/platforms/android/androidjniinput.cpp | 16 ++++------------ 3 files changed, 4 insertions(+), 36 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 8e8b50f737..9e067f14c5 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -361,11 +361,6 @@ public class QtActivityDelegate }); } - public boolean isSoftwareKeyboardVisible() - { - return m_keyboardIsVisible; - } - String getAppIconSize(Activity a) { int size = a.getResources().getDimensionPixelSize(android.R.dimen.app_icon_size); diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index 0107cff23a..0e2af9a192 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -397,25 +397,6 @@ public class QtNative }); } - private static boolean isSoftwareKeyboardVisible() - { - final Semaphore semaphore = new Semaphore(0); - final Boolean[] ret = {false}; - runAction(new Runnable() { - @Override - public void run() { - ret[0] = m_activityDelegate.isSoftwareKeyboardVisible(); - semaphore.release(); - } - }); - try { - semaphore.acquire(); - } catch (Exception e) { - e.printStackTrace(); - } - return ret[0]; - } - private static void setFullScreen(final boolean fullScreen) { runAction(new Runnable() { diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index cd0659227d..2c4b664487 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -59,10 +59,10 @@ namespace QtAndroidInput static jmethodID m_showSoftwareKeyboardMethodID = 0; static jmethodID m_resetSoftwareKeyboardMethodID = 0; static jmethodID m_hideSoftwareKeyboardMethodID = 0; - static jmethodID m_isSoftwareKeyboardVisibleMethodID = 0; static jmethodID m_updateSelectionMethodID = 0; static bool m_ignoreMouseEvents = false; + static bool m_softwareKeyboardVisible = false; static QList m_touchPoints; @@ -125,15 +125,7 @@ namespace QtAndroidInput bool isSoftwareKeyboardVisible() { - AttachedJNIEnv env; - if (!env.jniEnv) - return false; - - bool visibility = env.jniEnv->CallStaticBooleanMethod(applicationClass(), m_isSoftwareKeyboardVisibleMethodID); -#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL - qDebug() << "@@@ ISSOFTWAREKEYBOARDVISIBLE" << visibility; -#endif - return visibility; + return m_softwareKeyboardVisible; } @@ -714,8 +706,9 @@ namespace QtAndroidInput false); } - static void keyboardVisibilityChanged(JNIEnv */*env*/, jobject /*thiz*/, jboolean /*visibility*/) + static void keyboardVisibilityChanged(JNIEnv */*env*/, jobject /*thiz*/, jboolean visibility) { + m_softwareKeyboardVisible = visibility; QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext(); if (inputContext && qGuiApp) inputContext->emitInputPanelVisibleChanged(); @@ -756,7 +749,6 @@ namespace QtAndroidInput GET_AND_CHECK_STATIC_METHOD(m_showSoftwareKeyboardMethodID, appClass, "showSoftwareKeyboard", "(IIIII)V"); GET_AND_CHECK_STATIC_METHOD(m_resetSoftwareKeyboardMethodID, appClass, "resetSoftwareKeyboard", "()V"); GET_AND_CHECK_STATIC_METHOD(m_hideSoftwareKeyboardMethodID, appClass, "hideSoftwareKeyboard", "()V"); - GET_AND_CHECK_STATIC_METHOD(m_isSoftwareKeyboardVisibleMethodID, appClass, "isSoftwareKeyboardVisible", "()Z"); GET_AND_CHECK_STATIC_METHOD(m_updateSelectionMethodID, appClass, "updateSelection", "(IIII)V"); return true; } -- cgit v1.2.3 From eb447679456336d387bb69a56c164b06fbe83166 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 28 Aug 2014 15:46:03 +0200 Subject: Fix crash in QTextLayout::cursorToX When 'cursorPos' is out of bounds ([0, lineEnd]), this method crashed. Change-Id: Ia0540ab3afbffb5c598f7b8515263cce3b3928e4 Task-number: QTBUG-40753 Reviewed-by: Dominik Haumann Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Konstantin Ritt --- src/gui/text/qtextlayout.cpp | 2 +- .../auto/gui/text/qtextlayout/tst_qtextlayout.cpp | 23 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 4879ae51d7..8e605e4ae1 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2583,7 +2583,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const } int lineEnd = line.from + line.length + line.trailingSpaces; - int pos = *cursorPos; + int pos = qBound(0, *cursorPos, lineEnd); int itm; const QCharAttributes *attributes = eng->attributes(); if (!attributes) { diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index ec698e5db4..e49d8c3b07 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -86,6 +86,7 @@ private slots: void cursorToXForSetColumns(); void cursorToXForTrailingSpaces_data(); void cursorToXForTrailingSpaces(); + void cursorToXInvalidInput(); void horizontalAlignment_data(); void horizontalAlignment(); void horizontalAlignmentMultiline_data(); @@ -674,6 +675,28 @@ void tst_QTextLayout::cursorToXForTrailingSpaces() QCOMPARE(line.cursorToX(6), cursorAt6); } +void tst_QTextLayout::cursorToXInvalidInput() +{ + QTextLayout layout("aaa", testFont); + + layout.beginLayout(); + QTextLine line = layout.createLine(); + line.setLineWidth(5); + layout.endLayout(); + + int cursorPos; + + cursorPos = 0; + layout.lineAt(0).cursorToX(&cursorPos); + QCOMPARE(cursorPos, 0); + cursorPos = -300; + layout.lineAt(0).cursorToX(&cursorPos); + QCOMPARE(cursorPos, 0); + cursorPos = 300; + layout.lineAt(0).cursorToX(&cursorPos); + QCOMPARE(cursorPos, 3); +} + void tst_QTextLayout::horizontalAlignment_data() { qreal width = TESTFONT_SIZE * 4; -- cgit v1.2.3 From 05670f586ffe05425b7542a27fcca31bddf231aa Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 2 Sep 2014 15:50:55 +0200 Subject: Android: use FBO readback workaround by default. Maintaining a black list of devices can't be reasonably done. The workaround is now enabled by default. It can be disabled with the QT_ANDROID_DISABLE_GLYPH_CACHE_WORKAROUND environment variable, in which case the current list of blacklisted drivers will still be taken into account. Task-number: QTBUG-40483 Change-Id: I9b90ab45e86569e8e4679333ddb9b835189892c7 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../android/qandroidplatformopenglcontext.cpp | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp index a352d3ebb8..dfc43f0fa5 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp @@ -70,16 +70,22 @@ bool QAndroidPlatformOpenGLContext::needsFBOReadBackWorkaround() static bool needsWorkaround = false; if (!set) { - const char *rendererString = reinterpret_cast(glGetString(GL_RENDERER)); - needsWorkaround = - qstrncmp(rendererString, "Mali-4xx", 6) == 0 // Mali-400, Mali-450 - || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205 - || qstrncmp(rendererString, "Adreno 2xx", 8) == 0 // Same as above but without the '(TM)' - || qstrncmp(rendererString, "Adreno (TM) 30x", 14) == 0 // Adreno 302, 305 - || qstrncmp(rendererString, "Adreno 30x", 9) == 0 // Same as above but without the '(TM)' - || qstrcmp(rendererString, "GC800 core") == 0 - || qstrcmp(rendererString, "GC1000 core") == 0 - || qstrcmp(rendererString, "Immersion.16") == 0; + QByteArray env = qgetenv("QT_ANDROID_DISABLE_GLYPH_CACHE_WORKAROUND"); + needsWorkaround = env.isEmpty() || env == "0" || env == "false"; + + if (!needsWorkaround) { + const char *rendererString = reinterpret_cast(glGetString(GL_RENDERER)); + needsWorkaround = + qstrncmp(rendererString, "Mali-4xx", 6) == 0 // Mali-400, Mali-450 + || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205 + || qstrncmp(rendererString, "Adreno 2xx", 8) == 0 // Same as above but without the '(TM)' + || qstrncmp(rendererString, "Adreno (TM) 30x", 14) == 0 // Adreno 302, 305 + || qstrncmp(rendererString, "Adreno 30x", 9) == 0 // Same as above but without the '(TM)' + || qstrcmp(rendererString, "GC800 core") == 0 + || qstrcmp(rendererString, "GC1000 core") == 0 + || qstrcmp(rendererString, "Immersion.16") == 0; + } + set = true; } -- cgit v1.2.3 From 20cf2debfb980d5d5741396bafa9984d52ded5a7 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Thu, 4 Sep 2014 02:54:17 +0200 Subject: Revert "iOS: Update QIOSScreen::nativeOrientation() for iOS8" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit f6c36917f15fda0066bf996c1d36ef6dace9f404. Depends on 203ce7c5ce36f300750607b74b2d2429be2d4959 which can't go into 5.3 because it introduces new enum values. Change-Id: I13040a7268fae4baeace244a3e75dc982d3a50b8 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosscreen.mm | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index bb51d79e2a..5331d05ae9 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -294,15 +294,8 @@ qreal QIOSScreen::devicePixelRatio() const Qt::ScreenOrientation QIOSScreen::nativeOrientation() const { - CGRect nativeBounds = -#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0) - QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0 ? m_uiScreen.nativeBounds : -#endif - m_uiScreen.bounds; - - // All known iOS devices have a native orientation of portrait, but to - // be on the safe side we compare the width and height of the bounds. - return nativeBounds.size.width >= nativeBounds.size.height ? + // A UIScreen stays in the native orientation, regardless of rotation + return m_uiScreen.bounds.size.width >= m_uiScreen.bounds.size.height ? Qt::LandscapeOrientation : Qt::PortraitOrientation; } -- cgit v1.2.3 From a544ef59060a6c430cbb92fceb0d1b0e22492f3f Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 4 Sep 2014 13:29:15 +0200 Subject: QCoreTextFontDatabase: reduce memory consumption MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ATSFontNotify() allocates over 30MB for no apparent reason for applications that don't register fonts. Change-Id: I7bbc97f53b76be1e638de8ca0d1be3a08586cf00 Reviewed-by: Tor Arne Vestbø Reviewed-by: Gabriel de Dietrich --- src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index ca7afb7d1b..063d20dbd4 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -768,6 +768,9 @@ QList QCoreTextFontDatabase::standardSizes() const void QCoreTextFontDatabase::removeApplicationFonts() { + if (m_applicationFonts.isEmpty()) + return; + foreach (const QVariant &font, m_applicationFonts) { #if HAVE_CORETEXT if (&CTFontManagerUnregisterGraphicsFont && &CTFontManagerUnregisterFontsForURL) { -- cgit v1.2.3 From 8206a263ab9bca7fef191d299c05294a00ec1c8f Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sat, 30 Aug 2014 00:40:33 +0200 Subject: Add missing private headers warning Change-Id: I7a4dd22ea3bcebf4c3ec3ad731628fd8f3c247e0 Reviewed-by: Thiago Macieira --- src/corelib/io/qdir_p.h | 11 +++++++++++ src/corelib/io/qtemporaryfile_p.h | 11 +++++++++++ src/corelib/kernel/qeventloop_p.h | 11 +++++++++++ src/corelib/kernel/qmetaobject_moc_p.h | 11 +++++++++++ src/corelib/mimetypes/qmimedatabase_p.h | 11 +++++++++++ src/corelib/mimetypes/qmimeglobpattern_p.h | 11 +++++++++++ src/corelib/mimetypes/qmimemagicrule_p.h | 11 +++++++++++ src/corelib/mimetypes/qmimemagicrulematcher_p.h | 11 +++++++++++ src/corelib/mimetypes/qmimeprovider_p.h | 11 +++++++++++ src/corelib/mimetypes/qmimetype_p.h | 11 +++++++++++ src/corelib/mimetypes/qmimetypeparser_p.h | 11 +++++++++++ src/corelib/plugin/qsystemlibrary_p.h | 11 +++++++++++ src/corelib/tools/qcollator_p.h | 11 +++++++++++ src/corelib/tools/qsimd_p.h | 11 +++++++++++ src/corelib/tools/qstringiterator_p.h | 11 +++++++++++ src/gui/image/qgifhandler_p.h | 11 +++++++++++ src/gui/image/qjpeghandler_p.h | 11 +++++++++++ src/gui/image/qpixmap_blitter_p.h | 11 +++++++++++ src/gui/kernel/qplatformtheme_p.h | 8 +++++--- src/gui/kernel/qshapedpixmapdndwindow_p.h | 11 +++++++++++ src/gui/kernel/qsimpledrag_p.h | 15 +++++++++++++-- src/gui/opengl/qopengl_p.h | 11 +++++++++++ src/gui/opengl/qopenglqueryhelper_p.h | 11 +++++++++++ src/gui/opengl/qopengltexture_p.h | 11 +++++++++++ src/gui/opengl/qopengltextureblitter_p.h | 11 +++++++++++ src/gui/opengl/qopengltexturehelper_p.h | 11 +++++++++++ src/gui/opengl/qopenglversionfunctionsfactory_p.h | 11 +++++++++++ src/gui/opengl/qtriangulatingstroker_p.h | 11 +++++++++++ src/gui/painting/qblittable_p.h | 11 +++++++++++ src/gui/painting/qcosmeticstroker_p.h | 11 +++++++++++ src/gui/painting/qpaintengine_blitter_p.h | 11 +++++++++++ src/gui/util/qabstractlayoutstyleinfo_p.h | 11 +++++++++++ src/gui/util/qlayoutpolicy_p.h | 11 +++++++++++ src/network/kernel/qurlinfo_p.h | 11 +++++++++++ src/network/ssl/qsslcertificateextension_p.h | 11 +++++++++++ src/network/ssl/qsslcontext_p.h | 11 +++++++++++ .../cfsocketnotifier/qcfsocketnotifier_p.h | 11 +++++++++++ src/platformsupport/cglconvenience/cglconvenience_p.h | 11 +++++++++++ src/platformsupport/clipboard/qmacmime_p.h | 11 +++++++++++ src/platformsupport/devicediscovery/qdevicediscovery_p.h | 11 +++++++++++ src/platformsupport/eglconvenience/qeglcompositor_p.h | 11 +++++++++++ src/platformsupport/eglconvenience/qeglconvenience_p.h | 11 +++++++++++ src/platformsupport/eglconvenience/qeglpbuffer_p.h | 11 +++++++++++ .../eglconvenience/qeglplatformbackingstore_p.h | 11 +++++++++++ .../eglconvenience/qeglplatformcontext_p.h | 11 +++++++++++ src/platformsupport/eglconvenience/qeglplatformcursor_p.h | 11 +++++++++++ .../eglconvenience/qeglplatformintegration_p.h | 11 +++++++++++ src/platformsupport/eglconvenience/qeglplatformscreen_p.h | 11 +++++++++++ src/platformsupport/eglconvenience/qeglplatformwindow_p.h | 11 +++++++++++ .../eglconvenience/qxlibeglintegration_p.h | 11 +++++++++++ .../eventdispatchers/qeventdispatcher_cf_p.h | 11 +++++++++++ src/platformsupport/fbconvenience/qfbbackingstore_p.h | 11 +++++++++++ src/platformsupport/fbconvenience/qfbcursor_p.h | 11 +++++++++++ src/platformsupport/fbconvenience/qfbscreen_p.h | 11 +++++++++++ src/platformsupport/fbconvenience/qfbvthandler_p.h | 11 +++++++++++ src/platformsupport/fbconvenience/qfbwindow_p.h | 11 +++++++++++ .../fontdatabases/basic/qbasicfontdatabase_p.h | 11 +++++++++++ .../fontdatabases/fontconfig/qfontconfigdatabase_p.h | 11 +++++++++++ .../fontconfig/qfontenginemultifontconfig_p.h | 11 +++++++++++ .../genericunix/qgenericunixfontdatabase_p.h | 11 +++++++++++ .../fontdatabases/mac/qcoretextfontdatabase_p.h | 11 +++++++++++ .../fontdatabases/mac/qfontengine_coretext_p.h | 11 +++++++++++ src/platformsupport/glxconvenience/qglxconvenience_p.h | 11 +++++++++++ .../input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h | 11 +++++++++++ .../input/evdevkeyboard/qevdevkeyboardhandler_p.h | 11 +++++++++++ .../input/evdevkeyboard/qevdevkeyboardmanager_p.h | 11 +++++++++++ .../input/evdevmouse/qevdevmousehandler_p.h | 11 +++++++++++ .../input/evdevmouse/qevdevmousemanager_p.h | 11 +++++++++++ src/platformsupport/input/evdevtablet/qevdevtablet_p.h | 11 +++++++++++ src/platformsupport/input/evdevtouch/qevdevtouch_p.h | 11 +++++++++++ src/platformsupport/linuxaccessibility/application_p.h | 11 +++++++++++ src/platformsupport/linuxaccessibility/atspiadaptor_p.h | 11 +++++++++++ src/platformsupport/linuxaccessibility/bridge_p.h | 11 +++++++++++ src/platformsupport/linuxaccessibility/cache_p.h | 11 +++++++++++ .../linuxaccessibility/constant_mappings_p.h | 10 ++++++++++ src/platformsupport/linuxaccessibility/dbusconnection_p.h | 11 +++++++++++ .../linuxaccessibility/struct_marshallers_p.h | 11 +++++++++++ .../services/genericunix/qgenericunixservices_p.h | 11 +++++++++++ .../themes/genericunix/qgenericunixthemes_p.h | 11 +++++++++++ src/plugins/printsupport/cups/qcupsprintersupport_p.h | 11 +++++++++++ src/tools/qdoc/qmlparser/qqmljsglobal_p.h | 11 +++++++++++ src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h | 11 +++++++++++ src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h | 11 +++++++++++ src/widgets/itemviews/qfileiconprovider_p.h | 11 +++++++++++ src/widgets/kernel/qwidgetwindow_qpa_p.h | 11 +++++++++++ src/widgets/kernel/qwindowcontainer_p.h | 11 +++++++++++ src/widgets/styles/qfusionstyle_p.h | 11 +++++++++++ src/widgets/styles/qgtkstyle_p.h | 11 +++++++++++ src/widgets/styles/qmacstyle_mac_p.h | 11 +++++++++++ src/widgets/styles/qwindowscestyle_p.h | 11 +++++++++++ src/widgets/styles/qwindowsmobilestyle_p.h | 11 +++++++++++ src/widgets/styles/qwindowsstyle_p.h | 11 +++++++++++ src/widgets/styles/qwindowsvistastyle_p.h | 11 +++++++++++ src/widgets/styles/qwindowsxpstyle_p.h | 11 +++++++++++ src/widgets/widgets/qkeysequenceedit_p.h | 11 +++++++++++ 95 files changed, 1040 insertions(+), 5 deletions(-) diff --git a/src/corelib/io/qdir_p.h b/src/corelib/io/qdir_p.h index bf7726db2f..4d2f25f9ba 100644 --- a/src/corelib/io/qdir_p.h +++ b/src/corelib/io/qdir_p.h @@ -42,6 +42,17 @@ #ifndef QDIR_P_H #define QDIR_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qfilesystementry_p.h" #include "qfilesystemmetadata_p.h" diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h index fe637c8dfd..46e9d169f4 100644 --- a/src/corelib/io/qtemporaryfile_p.h +++ b/src/corelib/io/qtemporaryfile_p.h @@ -42,6 +42,17 @@ #ifndef QTEMPORARYFILE_P_H #define QTEMPORARYFILE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #ifndef QT_NO_TEMPORARYFILE diff --git a/src/corelib/kernel/qeventloop_p.h b/src/corelib/kernel/qeventloop_p.h index 30c61ca759..1a1743260b 100644 --- a/src/corelib/kernel/qeventloop_p.h +++ b/src/corelib/kernel/qeventloop_p.h @@ -42,6 +42,17 @@ #ifndef QEVENTLOOP_P_H #define QEVENTLOOP_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qobject_p.h" QT_BEGIN_NAMESPACE diff --git a/src/corelib/kernel/qmetaobject_moc_p.h b/src/corelib/kernel/qmetaobject_moc_p.h index d26cd54e5d..1a7ca63ae1 100644 --- a/src/corelib/kernel/qmetaobject_moc_p.h +++ b/src/corelib/kernel/qmetaobject_moc_p.h @@ -43,6 +43,17 @@ # error "Include qmetaobject_p.h (or moc's utils.h) before including this file." #endif +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + QT_BEGIN_NAMESPACE // This function is shared with moc.cpp. This file should be included where needed. diff --git a/src/corelib/mimetypes/qmimedatabase_p.h b/src/corelib/mimetypes/qmimedatabase_p.h index 78bb6c2780..d0546cf5ce 100644 --- a/src/corelib/mimetypes/qmimedatabase_p.h +++ b/src/corelib/mimetypes/qmimedatabase_p.h @@ -42,6 +42,17 @@ #ifndef QMIMEDATABASE_P_H #define QMIMEDATABASE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/corelib/mimetypes/qmimeglobpattern_p.h b/src/corelib/mimetypes/qmimeglobpattern_p.h index ca22aa9588..05d701e787 100644 --- a/src/corelib/mimetypes/qmimeglobpattern_p.h +++ b/src/corelib/mimetypes/qmimeglobpattern_p.h @@ -42,6 +42,17 @@ #ifndef QMIMEGLOBPATTERN_P_H #define QMIMEGLOBPATTERN_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/corelib/mimetypes/qmimemagicrule_p.h b/src/corelib/mimetypes/qmimemagicrule_p.h index c252440d6c..aeed1908a7 100644 --- a/src/corelib/mimetypes/qmimemagicrule_p.h +++ b/src/corelib/mimetypes/qmimemagicrule_p.h @@ -42,6 +42,17 @@ #ifndef QMIMEMAGICRULE_P_H #define QMIMEMAGICRULE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/corelib/mimetypes/qmimemagicrulematcher_p.h b/src/corelib/mimetypes/qmimemagicrulematcher_p.h index 159342482f..49de59f55a 100644 --- a/src/corelib/mimetypes/qmimemagicrulematcher_p.h +++ b/src/corelib/mimetypes/qmimemagicrulematcher_p.h @@ -42,6 +42,17 @@ #ifndef QMIMEMAGICRULEMATCHER_P_H #define QMIMEMAGICRULEMATCHER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/corelib/mimetypes/qmimeprovider_p.h b/src/corelib/mimetypes/qmimeprovider_p.h index 4a263093bd..f79373bb0a 100644 --- a/src/corelib/mimetypes/qmimeprovider_p.h +++ b/src/corelib/mimetypes/qmimeprovider_p.h @@ -42,6 +42,17 @@ #ifndef QMIMEPROVIDER_P_H #define QMIMEPROVIDER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include "qmimedatabase_p.h" #include diff --git a/src/corelib/mimetypes/qmimetype_p.h b/src/corelib/mimetypes/qmimetype_p.h index c500520fe1..637c85d8ca 100644 --- a/src/corelib/mimetypes/qmimetype_p.h +++ b/src/corelib/mimetypes/qmimetype_p.h @@ -42,6 +42,17 @@ #ifndef QMIMETYPE_P_H #define QMIMETYPE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qmimetype.h" #include diff --git a/src/corelib/mimetypes/qmimetypeparser_p.h b/src/corelib/mimetypes/qmimetypeparser_p.h index c92bb81be4..ef7a12cdd5 100644 --- a/src/corelib/mimetypes/qmimetypeparser_p.h +++ b/src/corelib/mimetypes/qmimetypeparser_p.h @@ -43,6 +43,17 @@ #ifndef QMIMETYPEPARSER_P_H #define QMIMETYPEPARSER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qmimedatabase_p.h" #include "qmimeprovider_p.h" diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h index 4a2c86990f..8b0fd57faf 100644 --- a/src/corelib/plugin/qsystemlibrary_p.h +++ b/src/corelib/plugin/qsystemlibrary_p.h @@ -42,6 +42,17 @@ #ifndef QSYSTEMLIBRARY_P_H #define QSYSTEMLIBRARY_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #ifdef Q_OS_WIN # include diff --git a/src/corelib/tools/qcollator_p.h b/src/corelib/tools/qcollator_p.h index 50e1a01f82..526521ebf4 100644 --- a/src/corelib/tools/qcollator_p.h +++ b/src/corelib/tools/qcollator_p.h @@ -43,6 +43,17 @@ #ifndef QCOLLATOR_P_H #define QCOLLATOR_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qcollator.h" #include #ifdef QT_USE_ICU diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index e1c22bac71..b8dd3b101e 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -42,6 +42,17 @@ #ifndef QSIMD_P_H #define QSIMD_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/corelib/tools/qstringiterator_p.h b/src/corelib/tools/qstringiterator_p.h index c3986f0477..4ae705b085 100644 --- a/src/corelib/tools/qstringiterator_p.h +++ b/src/corelib/tools/qstringiterator_p.h @@ -43,6 +43,17 @@ #ifndef QSTRINGITERATOR_H #define QSTRINGITERATOR_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/gui/image/qgifhandler_p.h b/src/gui/image/qgifhandler_p.h index bf4ba30e20..80c9e145c5 100644 --- a/src/gui/image/qgifhandler_p.h +++ b/src/gui/image/qgifhandler_p.h @@ -47,6 +47,17 @@ #ifndef QGIFHANDLER_P_H #define QGIFHANDLER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/gui/image/qjpeghandler_p.h b/src/gui/image/qjpeghandler_p.h index f5676d9b14..4342782f03 100644 --- a/src/gui/image/qjpeghandler_p.h +++ b/src/gui/image/qjpeghandler_p.h @@ -42,6 +42,17 @@ #ifndef QJPEGHANDLER_P_H #define QJPEGHANDLER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 1f723178d8..481fb0bc24 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -42,6 +42,17 @@ #ifndef QPIXMAP_BLITTER_P_H #define QPIXMAP_BLITTER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/gui/kernel/qplatformtheme_p.h b/src/gui/kernel/qplatformtheme_p.h index 217c284a9e..f493037ddd 100644 --- a/src/gui/kernel/qplatformtheme_p.h +++ b/src/gui/kernel/qplatformtheme_p.h @@ -46,9 +46,11 @@ // 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. +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. // #include diff --git a/src/gui/kernel/qshapedpixmapdndwindow_p.h b/src/gui/kernel/qshapedpixmapdndwindow_p.h index 20674b6b19..1b56f47bd5 100644 --- a/src/gui/kernel/qshapedpixmapdndwindow_p.h +++ b/src/gui/kernel/qshapedpixmapdndwindow_p.h @@ -42,6 +42,17 @@ #ifndef QSHAPEDPIXMAPDNDWINDOW_H #define QSHAPEDPIXMAPDNDWINDOW_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h index 36ea4c1ec5..d17440f7a2 100644 --- a/src/gui/kernel/qsimpledrag_p.h +++ b/src/gui/kernel/qsimpledrag_p.h @@ -39,8 +39,19 @@ ** ****************************************************************************/ -#ifndef QSIMPLEDRAG_H -#define QSIMPLEDRAG_H +#ifndef QSIMPLEDRAG_P_H +#define QSIMPLEDRAG_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// #include diff --git a/src/gui/opengl/qopengl_p.h b/src/gui/opengl/qopengl_p.h index 3cf636751a..5926fc8fba 100644 --- a/src/gui/opengl/qopengl_p.h +++ b/src/gui/opengl/qopengl_p.h @@ -42,6 +42,17 @@ #ifndef QOPENGL_P_H #define QOPENGL_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/gui/opengl/qopenglqueryhelper_p.h b/src/gui/opengl/qopenglqueryhelper_p.h index a7136c1cb7..bfafb30518 100644 --- a/src/gui/opengl/qopenglqueryhelper_p.h +++ b/src/gui/opengl/qopenglqueryhelper_p.h @@ -42,6 +42,17 @@ #ifndef QOPENGLQUERYHELPER_P_H #define QOPENGLQUERYHELPER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #if !defined(QT_OPENGL_ES_2) diff --git a/src/gui/opengl/qopengltexture_p.h b/src/gui/opengl/qopengltexture_p.h index a732805f55..c50139ee59 100644 --- a/src/gui/opengl/qopengltexture_p.h +++ b/src/gui/opengl/qopengltexture_p.h @@ -42,6 +42,17 @@ #ifndef QABSTRACTOPENGLTEXTURE_P_H #define QABSTRACTOPENGLTEXTURE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #ifndef QT_NO_OPENGL #include "private/qobject_p.h" diff --git a/src/gui/opengl/qopengltextureblitter_p.h b/src/gui/opengl/qopengltextureblitter_p.h index c1dcaf5700..44b442f50e 100644 --- a/src/gui/opengl/qopengltextureblitter_p.h +++ b/src/gui/opengl/qopengltextureblitter_p.h @@ -42,6 +42,17 @@ #ifndef QOPENGLTEXTUREBLITTER_P_H #define QOPENGLTEXTUREBLITTER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/gui/opengl/qopengltexturehelper_p.h b/src/gui/opengl/qopengltexturehelper_p.h index 782486b90d..a920a08c71 100644 --- a/src/gui/opengl/qopengltexturehelper_p.h +++ b/src/gui/opengl/qopengltexturehelper_p.h @@ -42,6 +42,17 @@ #ifndef QOPENGLTEXTUREHELPER_P_H #define QOPENGLTEXTUREHELPER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #ifndef QT_NO_OPENGL diff --git a/src/gui/opengl/qopenglversionfunctionsfactory_p.h b/src/gui/opengl/qopenglversionfunctionsfactory_p.h index 2312e900f9..c644bc9082 100644 --- a/src/gui/opengl/qopenglversionfunctionsfactory_p.h +++ b/src/gui/opengl/qopenglversionfunctionsfactory_p.h @@ -51,6 +51,17 @@ #ifndef QOPENGLVERSIONFUNCTIONFACTORY_P_H #define QOPENGLVERSIONFUNCTIONFACTORY_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #ifndef QT_NO_OPENGL #include diff --git a/src/gui/opengl/qtriangulatingstroker_p.h b/src/gui/opengl/qtriangulatingstroker_p.h index 2328f75af8..dc3a13e698 100644 --- a/src/gui/opengl/qtriangulatingstroker_p.h +++ b/src/gui/opengl/qtriangulatingstroker_p.h @@ -42,6 +42,17 @@ #ifndef QTRIANGULATINGSTROKER_P_H #define QTRIANGULATINGSTROKER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h index f65549d63c..5c625f664e 100644 --- a/src/gui/painting/qblittable_p.h +++ b/src/gui/painting/qblittable_p.h @@ -42,6 +42,17 @@ #ifndef QBLITTABLE_P_H #define QBLITTABLE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h index 5fc3559da4..84e22b2653 100644 --- a/src/gui/painting/qcosmeticstroker_p.h +++ b/src/gui/painting/qcosmeticstroker_p.h @@ -42,6 +42,17 @@ #ifndef QCOSMETICSTROKER_P_H #define QCOSMETICSTROKER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index b70ee5fc5c..d917a30f1f 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -42,6 +42,17 @@ #ifndef QPAINTENGINE_BLITTER_P_H #define QPAINTENGINE_BLITTER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "private/qpaintengine_raster_p.h" #ifndef QT_NO_BLITTABLE diff --git a/src/gui/util/qabstractlayoutstyleinfo_p.h b/src/gui/util/qabstractlayoutstyleinfo_p.h index 52f151c5d2..b0f901d0ac 100644 --- a/src/gui/util/qabstractlayoutstyleinfo_p.h +++ b/src/gui/util/qabstractlayoutstyleinfo_p.h @@ -42,6 +42,17 @@ #ifndef QABSTRACTLAYOUTSTYLEINFO_P_H #define QABSTRACTLAYOUTSTYLEINFO_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include "qlayoutpolicy_p.h" diff --git a/src/gui/util/qlayoutpolicy_p.h b/src/gui/util/qlayoutpolicy_p.h index 664afef1a4..2d98bcd84c 100644 --- a/src/gui/util/qlayoutpolicy_p.h +++ b/src/gui/util/qlayoutpolicy_p.h @@ -42,6 +42,17 @@ #ifndef QLAYOUTPOLICY_H #define QLAYOUTPOLICY_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/network/kernel/qurlinfo_p.h b/src/network/kernel/qurlinfo_p.h index 1aa59f25ad..31eb0730d3 100644 --- a/src/network/kernel/qurlinfo_p.h +++ b/src/network/kernel/qurlinfo_p.h @@ -42,6 +42,17 @@ #ifndef QURLINFO_H #define QURLINFO_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/network/ssl/qsslcertificateextension_p.h b/src/network/ssl/qsslcertificateextension_p.h index cc04e76634..6891733174 100644 --- a/src/network/ssl/qsslcertificateextension_p.h +++ b/src/network/ssl/qsslcertificateextension_p.h @@ -42,6 +42,17 @@ #ifndef QSSLCERTIFICATEEXTENSION_P_H #define QSSLCERTIFICATEEXTENSION_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qsslcertificateextension.h" QT_BEGIN_NAMESPACE diff --git a/src/network/ssl/qsslcontext_p.h b/src/network/ssl/qsslcontext_p.h index 20b27c1ce7..408376b954 100644 --- a/src/network/ssl/qsslcontext_p.h +++ b/src/network/ssl/qsslcontext_p.h @@ -44,6 +44,17 @@ #ifndef QSSLCONTEXT_H #define QSSLCONTEXT_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h b/src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h index cd1eb8e4ca..dcd1b12ad7 100644 --- a/src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h +++ b/src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h @@ -42,6 +42,17 @@ #ifndef QCFSOCKETNOTIFIER_P_H #define QCFSOCKETNOTIFIER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/cglconvenience/cglconvenience_p.h b/src/platformsupport/cglconvenience/cglconvenience_p.h index 82842a78f0..674753d878 100644 --- a/src/platformsupport/cglconvenience/cglconvenience_p.h +++ b/src/platformsupport/cglconvenience/cglconvenience_p.h @@ -42,6 +42,17 @@ #ifndef QMACGLCONVENIENCE_H #define QMACGLCONVENIENCE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/clipboard/qmacmime_p.h b/src/platformsupport/clipboard/qmacmime_p.h index 0802987fab..6bdb90232c 100644 --- a/src/platformsupport/clipboard/qmacmime_p.h +++ b/src/platformsupport/clipboard/qmacmime_p.h @@ -42,6 +42,17 @@ #ifndef QMACMIME_H #define QMACMIME_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_p.h b/src/platformsupport/devicediscovery/qdevicediscovery_p.h index 0e21118324..fd44cdd8da 100644 --- a/src/platformsupport/devicediscovery/qdevicediscovery_p.h +++ b/src/platformsupport/devicediscovery/qdevicediscovery_p.h @@ -42,6 +42,17 @@ #ifndef QDEVICEDISCOVERY_H #define QDEVICEDISCOVERY_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/eglconvenience/qeglcompositor_p.h b/src/platformsupport/eglconvenience/qeglcompositor_p.h index 370345ada6..2e0a3adaf3 100644 --- a/src/platformsupport/eglconvenience/qeglcompositor_p.h +++ b/src/platformsupport/eglconvenience/qeglcompositor_p.h @@ -42,6 +42,17 @@ #ifndef QEGLCOMPOSITOR_H #define QEGLCOMPOSITOR_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/eglconvenience/qeglconvenience_p.h b/src/platformsupport/eglconvenience/qeglconvenience_p.h index 8616275e53..41d392e43a 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience_p.h +++ b/src/platformsupport/eglconvenience/qeglconvenience_p.h @@ -42,6 +42,17 @@ #ifndef QEGLCONVENIENCE_H #define QEGLCONVENIENCE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/eglconvenience/qeglpbuffer_p.h b/src/platformsupport/eglconvenience/qeglpbuffer_p.h index 1b4ac6f991..92d89198a4 100644 --- a/src/platformsupport/eglconvenience/qeglpbuffer_p.h +++ b/src/platformsupport/eglconvenience/qeglpbuffer_p.h @@ -42,6 +42,17 @@ #ifndef QEGLPBUFFER_H #define QEGLPBUFFER_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/eglconvenience/qeglplatformbackingstore_p.h b/src/platformsupport/eglconvenience/qeglplatformbackingstore_p.h index cb1e5999b0..57c632a4c5 100644 --- a/src/platformsupport/eglconvenience/qeglplatformbackingstore_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformbackingstore_p.h @@ -42,6 +42,17 @@ #ifndef QEGLPLATFORMBACKINGSTORE_H #define QEGLPLATFORMBACKINGSTORE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h index 714633c3bc..8fbd573e33 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h @@ -42,6 +42,17 @@ #ifndef QEGLPLATFORMCONTEXT_H #define QEGLPLATFORMCONTEXT_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/eglconvenience/qeglplatformcursor_p.h b/src/platformsupport/eglconvenience/qeglplatformcursor_p.h index 6f4216874a..be2ec56787 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcursor_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformcursor_p.h @@ -42,6 +42,17 @@ #ifndef QEGLPLATFORMCURSOR_H #define QEGLPLATFORMCURSOR_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h index f665455383..cc10f3ed77 100644 --- a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h @@ -42,6 +42,17 @@ #ifndef QEGLPLATFORMINTEGRATION_H #define QEGLPLATFORMINTEGRATION_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/eglconvenience/qeglplatformscreen_p.h b/src/platformsupport/eglconvenience/qeglplatformscreen_p.h index d0d8a52a87..955d9db5de 100644 --- a/src/platformsupport/eglconvenience/qeglplatformscreen_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformscreen_p.h @@ -42,6 +42,17 @@ #ifndef QEGLPLATFORMSCREEN_H #define QEGLPLATFORMSCREEN_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/eglconvenience/qeglplatformwindow_p.h b/src/platformsupport/eglconvenience/qeglplatformwindow_p.h index 17a1d07a79..86d6eee57a 100644 --- a/src/platformsupport/eglconvenience/qeglplatformwindow_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformwindow_p.h @@ -42,6 +42,17 @@ #ifndef QEGLPLATFORMWINDOW_H #define QEGLPLATFORMWINDOW_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/eglconvenience/qxlibeglintegration_p.h b/src/platformsupport/eglconvenience/qxlibeglintegration_p.h index a1360fe74e..2ee63d4fbc 100644 --- a/src/platformsupport/eglconvenience/qxlibeglintegration_p.h +++ b/src/platformsupport/eglconvenience/qxlibeglintegration_p.h @@ -42,6 +42,17 @@ #ifndef QTESTLITEEGLINTEGRATION_H #define QTESTLITEEGLINTEGRATION_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qeglconvenience_p.h" #include #include diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_cf_p.h b/src/platformsupport/eventdispatchers/qeventdispatcher_cf_p.h index 1742a9b939..fe911be510 100644 --- a/src/platformsupport/eventdispatchers/qeventdispatcher_cf_p.h +++ b/src/platformsupport/eventdispatchers/qeventdispatcher_cf_p.h @@ -76,6 +76,17 @@ #ifndef QEVENTDISPATCHER_CF_P_H #define QEVENTDISPATCHER_CF_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #define DEBUG_EVENT_DISPATCHER 0 #include diff --git a/src/platformsupport/fbconvenience/qfbbackingstore_p.h b/src/platformsupport/fbconvenience/qfbbackingstore_p.h index 8e560ee46a..2a8597e5d9 100644 --- a/src/platformsupport/fbconvenience/qfbbackingstore_p.h +++ b/src/platformsupport/fbconvenience/qfbbackingstore_p.h @@ -42,6 +42,17 @@ #ifndef QFBBACKINGSTORE_P_H #define QFBBACKINGSTORE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/fbconvenience/qfbcursor_p.h b/src/platformsupport/fbconvenience/qfbcursor_p.h index 40377e2075..4196cad96f 100644 --- a/src/platformsupport/fbconvenience/qfbcursor_p.h +++ b/src/platformsupport/fbconvenience/qfbcursor_p.h @@ -42,6 +42,17 @@ #ifndef QFBCURSOR_P_H #define QFBCURSOR_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/fbconvenience/qfbscreen_p.h b/src/platformsupport/fbconvenience/qfbscreen_p.h index dd940c4a1d..db93304fc7 100644 --- a/src/platformsupport/fbconvenience/qfbscreen_p.h +++ b/src/platformsupport/fbconvenience/qfbscreen_p.h @@ -42,6 +42,17 @@ #ifndef QFBSCREEN_P_H #define QFBSCREEN_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/fbconvenience/qfbvthandler_p.h b/src/platformsupport/fbconvenience/qfbvthandler_p.h index d98cd5a9d1..ddaedca3e0 100644 --- a/src/platformsupport/fbconvenience/qfbvthandler_p.h +++ b/src/platformsupport/fbconvenience/qfbvthandler_p.h @@ -42,6 +42,17 @@ #ifndef QFBVTHANDLER_H #define QFBVTHANDLER_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/fbconvenience/qfbwindow_p.h b/src/platformsupport/fbconvenience/qfbwindow_p.h index a2e0785c96..8e526404e0 100644 --- a/src/platformsupport/fbconvenience/qfbwindow_p.h +++ b/src/platformsupport/fbconvenience/qfbwindow_p.h @@ -42,6 +42,17 @@ #ifndef QFBWINDOW_P_H #define QFBWINDOW_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h index 247a2855e2..a512644966 100644 --- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase_p.h @@ -42,6 +42,17 @@ #ifndef QBASICFONTDATABASE_H #define QBASICFONTDATABASE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h index ba706dc59e..fc929e464d 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h @@ -42,6 +42,17 @@ #ifndef QFONTCONFIGDATABASE_H #define QFONTCONFIGDATABASE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h b/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h index 2d93d236e5..3c2be10be6 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h +++ b/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h @@ -42,6 +42,17 @@ #ifndef QFONTENGINEMULTIFONTCONFIG_H #define QFONTENGINEMULTIFONTCONFIG_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/fontdatabases/genericunix/qgenericunixfontdatabase_p.h b/src/platformsupport/fontdatabases/genericunix/qgenericunixfontdatabase_p.h index a8a0b8fe9c..42fd677cf7 100644 --- a/src/platformsupport/fontdatabases/genericunix/qgenericunixfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/genericunix/qgenericunixfontdatabase_p.h @@ -42,6 +42,17 @@ #ifndef QGENERICUNIXFONTDATABASE_H #define QGENERICUNIXFONTDATABASE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #ifdef Q_FONTCONFIGDATABASE diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index a3da27b28d..10f54310a8 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -42,6 +42,17 @@ #ifndef QCORETEXTFONTDATABASE_H #define QCORETEXTFONTDATABASE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #define HAVE_CORETEXT QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_4_1) #define HAVE_ATS QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_5, __IPHONE_NA) diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h index b9593b983e..8157742219 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h @@ -42,6 +42,17 @@ #ifndef QFONTENGINE_CORETEXT_P_H #define QFONTENGINE_CORETEXT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/glxconvenience/qglxconvenience_p.h b/src/platformsupport/glxconvenience/qglxconvenience_p.h index 66548a3479..0477589d6c 100644 --- a/src/platformsupport/glxconvenience/qglxconvenience_p.h +++ b/src/platformsupport/glxconvenience/qglxconvenience_p.h @@ -42,6 +42,17 @@ #ifndef QGLXCONVENIENCE_H #define QGLXCONVENIENCE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h index 5e919ebeb7..ff34ad346b 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h @@ -42,6 +42,17 @@ #ifndef QEVDEVKEYBOARDHANDLER_DEFAULTMAP_P_H #define QEVDEVKEYBOARDHANDLER_DEFAULTMAP_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qnamespace.h" #include "linux/input.h" diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h index 1065b05d51..81bc2f6154 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h @@ -42,6 +42,17 @@ #ifndef QEVDEVKEYBOARDHANDLER_P_H #define QEVDEVKEYBOARDHANDLER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h index 37c60c035c..0b1ccc23ab 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h @@ -42,6 +42,17 @@ #ifndef QEVDEVKEYBOARDMANAGER_P_H #define QEVDEVKEYBOARDMANAGER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qevdevkeyboardhandler_p.h" #include diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h index d419a1913e..5d8a536ee1 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h @@ -42,6 +42,17 @@ #ifndef QEVDEVMOUSEHANDLER_P_H #define QEVDEVMOUSEHANDLER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h index d52a16ea75..662b216b11 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h +++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h @@ -42,6 +42,17 @@ #ifndef QEVDEVMOUSEMANAGER_P_H #define QEVDEVMOUSEMANAGER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qevdevmousehandler_p.h" #include diff --git a/src/platformsupport/input/evdevtablet/qevdevtablet_p.h b/src/platformsupport/input/evdevtablet/qevdevtablet_p.h index 9222db9907..f168d8200b 100644 --- a/src/platformsupport/input/evdevtablet/qevdevtablet_p.h +++ b/src/platformsupport/input/evdevtablet/qevdevtablet_p.h @@ -42,6 +42,17 @@ #ifndef QEVDEVTABLET_P_H #define QEVDEVTABLET_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch_p.h b/src/platformsupport/input/evdevtouch/qevdevtouch_p.h index d0ea839f51..a5d9e73200 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouch_p.h +++ b/src/platformsupport/input/evdevtouch/qevdevtouch_p.h @@ -42,6 +42,17 @@ #ifndef QEVDEVTOUCH_P_H #define QEVDEVTOUCH_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/linuxaccessibility/application_p.h b/src/platformsupport/linuxaccessibility/application_p.h index e8684ab2b5..9a33c21ab6 100644 --- a/src/platformsupport/linuxaccessibility/application_p.h +++ b/src/platformsupport/linuxaccessibility/application_p.h @@ -42,6 +42,17 @@ #ifndef Q_SPI_APPLICATION_H #define Q_SPI_APPLICATION_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor_p.h b/src/platformsupport/linuxaccessibility/atspiadaptor_p.h index 8e905e4cca..8e7f55fdbc 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor_p.h +++ b/src/platformsupport/linuxaccessibility/atspiadaptor_p.h @@ -43,6 +43,17 @@ #ifndef ATSPIADAPTOR_H #define ATSPIADAPTOR_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/linuxaccessibility/bridge_p.h b/src/platformsupport/linuxaccessibility/bridge_p.h index 0e1624c522..f4b1680b15 100644 --- a/src/platformsupport/linuxaccessibility/bridge_p.h +++ b/src/platformsupport/linuxaccessibility/bridge_p.h @@ -43,6 +43,17 @@ #ifndef QSPIACCESSIBLEBRIDGE_H #define QSPIACCESSIBLEBRIDGE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/linuxaccessibility/cache_p.h b/src/platformsupport/linuxaccessibility/cache_p.h index a8128d9320..8f262cba55 100644 --- a/src/platformsupport/linuxaccessibility/cache_p.h +++ b/src/platformsupport/linuxaccessibility/cache_p.h @@ -43,6 +43,17 @@ #ifndef Q_SPI_CACHE_H #define Q_SPI_CACHE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include "struct_marshallers_p.h" diff --git a/src/platformsupport/linuxaccessibility/constant_mappings_p.h b/src/platformsupport/linuxaccessibility/constant_mappings_p.h index a0287a910b..9e653feb66 100644 --- a/src/platformsupport/linuxaccessibility/constant_mappings_p.h +++ b/src/platformsupport/linuxaccessibility/constant_mappings_p.h @@ -39,6 +39,16 @@ ** ****************************************************************************/ +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// /* * This file contains AT-SPI constants and mappings between QAccessible diff --git a/src/platformsupport/linuxaccessibility/dbusconnection_p.h b/src/platformsupport/linuxaccessibility/dbusconnection_p.h index 70f6fb80ac..1e75a10de8 100644 --- a/src/platformsupport/linuxaccessibility/dbusconnection_p.h +++ b/src/platformsupport/linuxaccessibility/dbusconnection_p.h @@ -43,6 +43,17 @@ #ifndef DBUSCONNECTION_H #define DBUSCONNECTION_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/linuxaccessibility/struct_marshallers_p.h b/src/platformsupport/linuxaccessibility/struct_marshallers_p.h index 0b775d5521..8f7da0df9a 100644 --- a/src/platformsupport/linuxaccessibility/struct_marshallers_p.h +++ b/src/platformsupport/linuxaccessibility/struct_marshallers_p.h @@ -43,6 +43,17 @@ #ifndef Q_SPI_STRUCT_MARSHALLERS_H #define Q_SPI_STRUCT_MARSHALLERS_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/platformsupport/services/genericunix/qgenericunixservices_p.h b/src/platformsupport/services/genericunix/qgenericunixservices_p.h index 92166caf7b..d758c71b79 100644 --- a/src/platformsupport/services/genericunix/qgenericunixservices_p.h +++ b/src/platformsupport/services/genericunix/qgenericunixservices_p.h @@ -42,6 +42,17 @@ #ifndef QGENERICUNIXDESKTOPSERVICES_H #define QGENERICUNIXDESKTOPSERVICES_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h index 36fcdd8dce..b8f6737ea0 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h @@ -42,6 +42,17 @@ #ifndef QGENERICUNIXTHEMES_H #define QGENERICUNIXTHEMES_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/plugins/printsupport/cups/qcupsprintersupport_p.h b/src/plugins/printsupport/cups/qcupsprintersupport_p.h index 1cba4e997b..9fe5f28850 100644 --- a/src/plugins/printsupport/cups/qcupsprintersupport_p.h +++ b/src/plugins/printsupport/cups/qcupsprintersupport_p.h @@ -43,6 +43,17 @@ #ifndef QCUPSPRINTERSUPPORT_H #define QCUPSPRINTERSUPPORT_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #ifndef QT_NO_PRINTER diff --git a/src/tools/qdoc/qmlparser/qqmljsglobal_p.h b/src/tools/qdoc/qmlparser/qqmljsglobal_p.h index c53e12ea56..f9e5aa9643 100644 --- a/src/tools/qdoc/qmlparser/qqmljsglobal_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsglobal_p.h @@ -41,6 +41,17 @@ #ifndef QQMLJSGLOBAL_P_H #define QQMLJSGLOBAL_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #ifdef QT_CREATOR diff --git a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h index 1338114d96..1c12f15744 100644 --- a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h +++ b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h @@ -42,6 +42,17 @@ #ifndef QGRAPHICSGRIDLAYOUTENGINE_P_H #define QGRAPHICSGRIDLAYOUTENGINE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #ifndef QT_NO_GRAPHICSVIEW diff --git a/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h b/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h index 275ebab6a1..8770e96136 100644 --- a/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h +++ b/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h @@ -41,6 +41,17 @@ #ifndef QGRAPHICSLAYOUTSTYLEINFO_P_H #define QGRAPHICSLAYOUTSTYLEINFO_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/widgets/itemviews/qfileiconprovider_p.h b/src/widgets/itemviews/qfileiconprovider_p.h index 9b2d536258..1c50a7e772 100644 --- a/src/widgets/itemviews/qfileiconprovider_p.h +++ b/src/widgets/itemviews/qfileiconprovider_p.h @@ -42,6 +42,17 @@ #ifndef QFILEICONPROVIDER_P_H #define QFILEICONPROVIDER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qfileiconprovider.h" #include diff --git a/src/widgets/kernel/qwidgetwindow_qpa_p.h b/src/widgets/kernel/qwidgetwindow_qpa_p.h index 06ba8ea646..76ba618afe 100644 --- a/src/widgets/kernel/qwidgetwindow_qpa_p.h +++ b/src/widgets/kernel/qwidgetwindow_qpa_p.h @@ -42,6 +42,17 @@ #ifndef QWIDGETWINDOW_QPA_P_H #define QWIDGETWINDOW_QPA_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include diff --git a/src/widgets/kernel/qwindowcontainer_p.h b/src/widgets/kernel/qwindowcontainer_p.h index 014b163f97..45b3cc021f 100644 --- a/src/widgets/kernel/qwindowcontainer_p.h +++ b/src/widgets/kernel/qwindowcontainer_p.h @@ -42,6 +42,17 @@ #ifndef QWINDOWCONTAINER_H #define QWINDOWCONTAINER_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qfusionstyle_p.h b/src/widgets/styles/qfusionstyle_p.h index 9e5a55918d..ceee6f8b03 100644 --- a/src/widgets/styles/qfusionstyle_p.h +++ b/src/widgets/styles/qfusionstyle_p.h @@ -42,6 +42,17 @@ #ifndef QFUSIONSTYLE_P_H #define QFUSIONSTYLE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qgtkstyle_p.h b/src/widgets/styles/qgtkstyle_p.h index 525d7f840a..93bb0d309b 100644 --- a/src/widgets/styles/qgtkstyle_p.h +++ b/src/widgets/styles/qgtkstyle_p.h @@ -42,6 +42,17 @@ #ifndef QGTKSTYLE_P_H #define QGTKSTYLE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h index 305bcf871c..b0fb9e06be 100644 --- a/src/widgets/styles/qmacstyle_mac_p.h +++ b/src/widgets/styles/qmacstyle_mac_p.h @@ -42,6 +42,17 @@ #ifndef QMACSTYLE_MAC_P_H #define QMACSTYLE_MAC_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qwindowscestyle_p.h b/src/widgets/styles/qwindowscestyle_p.h index 73fb2b7ab7..d5e2ee84ed 100644 --- a/src/widgets/styles/qwindowscestyle_p.h +++ b/src/widgets/styles/qwindowscestyle_p.h @@ -42,6 +42,17 @@ #ifndef QWINDOWSCESTYLE_P_H #define QWINDOWSCESTYLE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qwindowsmobilestyle_p.h b/src/widgets/styles/qwindowsmobilestyle_p.h index 4262bf5c73..75a4e45ea9 100644 --- a/src/widgets/styles/qwindowsmobilestyle_p.h +++ b/src/widgets/styles/qwindowsmobilestyle_p.h @@ -42,6 +42,17 @@ #ifndef QWINDOWSMOBILESTYLE_P_H #define QWINDOWSMOBILESTYLE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h index 1107e70061..39b85ec148 100644 --- a/src/widgets/styles/qwindowsstyle_p.h +++ b/src/widgets/styles/qwindowsstyle_p.h @@ -42,6 +42,17 @@ #ifndef QWINDOWSSTYLE_P_H #define QWINDOWSSTYLE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qwindowsvistastyle_p.h b/src/widgets/styles/qwindowsvistastyle_p.h index f7914f1645..1b3201c026 100644 --- a/src/widgets/styles/qwindowsvistastyle_p.h +++ b/src/widgets/styles/qwindowsvistastyle_p.h @@ -42,6 +42,17 @@ #ifndef QWINDOWSVISTASTYLE_P_H #define QWINDOWSVISTASTYLE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qwindowsxpstyle_p.h b/src/widgets/styles/qwindowsxpstyle_p.h index d61132295c..4bb7c73660 100644 --- a/src/widgets/styles/qwindowsxpstyle_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p.h @@ -42,6 +42,17 @@ #ifndef QWINDOWSXPSTYLE_P_H #define QWINDOWSXPSTYLE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qkeysequenceedit_p.h b/src/widgets/widgets/qkeysequenceedit_p.h index f74433bb71..adb3dc7a55 100644 --- a/src/widgets/widgets/qkeysequenceedit_p.h +++ b/src/widgets/widgets/qkeysequenceedit_p.h @@ -43,6 +43,17 @@ #ifndef QKEYSEQUENCEEDIT_P_H #define QKEYSEQUENCEEDIT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qkeysequenceedit.h" #include -- cgit v1.2.3 From 983dde1f2f3db76ab26e949d8c2f4f8b968b36be Mon Sep 17 00:00:00 2001 From: Thomas Fischer Date: Sun, 24 Aug 2014 14:01:26 +0200 Subject: Avoid adding widget to its own layout Widgets and layouts added or inserted to a layout are checked for: - Not being NULL - Not being the parent widget of a layout or the layout itself, respectively Without this commit, adding a widget to its own layout would result in a CPU-hogging infinite loop. Now, a warning is written to stderr and the add or insert function call is ignored. The checks are implemented as public functions of QLayoutPrivate and thus accessible in QLayout's descendants to be used in various "addWidget", "insertWidget", etc functions. Unlike 'classical' layouts like QGridLayout, QFormLayout does indeed accept widgets that are NULL. To not break this behavior, any call for the check functions first tests if the widget or layout, respectively, to test is NULL or not and calls the check only in the latter case. Automated tests for QBoxLayout, QGridLayout, and QFormLayout were added. For an unpatched Qt 5.3, each of those automated tests will freeze as explained in QTBUG-40609. For a fixed version, warning messages about invalid parameters to addWidget/addLayout/... calls will be read by QTest::ignoreMessage, resulting in a passed test. Change-Id: I1522d5727e643da3f7c025755975aca9f482676d Task-number: QTBUG-40609 Reviewed-by: Marc Mutz --- src/widgets/kernel/qboxlayout.cpp | 18 ++-------- src/widgets/kernel/qformlayout.cpp | 22 +++++++----- src/widgets/kernel/qgridlayout.cpp | 23 ++++-------- src/widgets/kernel/qlayout.cpp | 41 ++++++++++++++++++++++ src/widgets/kernel/qlayout_p.h | 2 ++ .../widgets/kernel/qboxlayout/tst_qboxlayout.cpp | 32 +++++++++++++++++ .../widgets/kernel/qformlayout/tst_qformlayout.cpp | 24 +++++++++++++ .../widgets/kernel/qgridlayout/tst_qgridlayout.cpp | 32 +++++++++++++++++ tests/manual/qlayout/gridwidget.cpp | 8 +++++ tests/manual/qlayout/hbwidget.cpp | 8 +++++ tests/manual/qlayout/vbwidget.cpp | 8 +++++ 11 files changed, 179 insertions(+), 39 deletions(-) diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp index 157fa55d2e..a186326551 100644 --- a/src/widgets/kernel/qboxlayout.cpp +++ b/src/widgets/kernel/qboxlayout.cpp @@ -51,20 +51,6 @@ QT_BEGIN_NAMESPACE -/* - Returns \c true if the \a widget can be added to the \a layout; - otherwise returns \c false. -*/ -static bool checkWidget(QLayout *layout, QWidget *widget) -{ - if (!widget) { - qWarning("QLayout: Cannot add null widget to %s/%s", layout->metaObject()->className(), - layout->objectName().toLocal8Bit().data()); - return false; - } - return true; -} - struct QBoxLayoutItem { QBoxLayoutItem(QLayoutItem *it, int stretch_ = 0) @@ -958,6 +944,8 @@ void QBoxLayout::insertSpacerItem(int index, QSpacerItem *spacerItem) void QBoxLayout::insertLayout(int index, QLayout *layout, int stretch) { Q_D(QBoxLayout); + if (!d->checkLayout(layout)) + return; if (!adoptLayout(layout)) return; if (index < 0) // append @@ -991,7 +979,7 @@ void QBoxLayout::insertWidget(int index, QWidget *widget, int stretch, Qt::Alignment alignment) { Q_D(QBoxLayout); - if (!checkWidget(this, widget)) + if (!d->checkWidget(widget)) return; addChildWidget(widget); if (index < 0) // append diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index 239e1ce1e2..9f545b858a 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -1280,6 +1280,8 @@ void QFormLayout::addRow(QLayout *layout) void QFormLayout::insertRow(int row, QWidget *label, QWidget *field) { Q_D(QFormLayout); + if ((label && !d->checkWidget(label)) || (field && !d->checkWidget(field))) + return; row = d->insertRow(row); if (label) @@ -1295,6 +1297,8 @@ void QFormLayout::insertRow(int row, QWidget *label, QWidget *field) void QFormLayout::insertRow(int row, QWidget *label, QLayout *field) { Q_D(QFormLayout); + if ((label && !d->checkWidget(label)) || (field && !d->checkLayout(field))) + return; row = d->insertRow(row); if (label) @@ -1313,6 +1317,10 @@ void QFormLayout::insertRow(int row, QWidget *label, QLayout *field) */ void QFormLayout::insertRow(int row, const QString &labelText, QWidget *field) { + Q_D(QFormLayout); + if (field && !d->checkWidget(field)) + return; + QLabel *label = 0; if (!labelText.isEmpty()) { label = new QLabel(labelText); @@ -1331,6 +1339,10 @@ void QFormLayout::insertRow(int row, const QString &labelText, QWidget *field) */ void QFormLayout::insertRow(int row, const QString &labelText, QLayout *field) { + Q_D(QFormLayout); + if (field && !d->checkLayout(field)) + return; + insertRow(row, labelText.isEmpty() ? 0 : new QLabel(labelText), field); } @@ -1344,11 +1356,8 @@ void QFormLayout::insertRow(int row, const QString &labelText, QLayout *field) void QFormLayout::insertRow(int row, QWidget *widget) { Q_D(QFormLayout); - - if (!widget) { - qWarning("QFormLayout: Cannot add null field to %s", qPrintable(objectName())); + if (!d->checkWidget(widget)) return; - } row = d->insertRow(row); d->setWidget(row, SpanningRole, widget); @@ -1365,11 +1374,8 @@ void QFormLayout::insertRow(int row, QWidget *widget) void QFormLayout::insertRow(int row, QLayout *layout) { Q_D(QFormLayout); - - if (!layout) { - qWarning("QFormLayout: Cannot add null field to %s", qPrintable(objectName())); + if (!d->checkLayout(layout)) return; - } row = d->insertRow(row); d->setLayout(row, SpanningRole, layout); diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp index 5434c40f97..6782e4a9f8 100644 --- a/src/widgets/kernel/qgridlayout.cpp +++ b/src/widgets/kernel/qgridlayout.cpp @@ -1430,20 +1430,6 @@ void QGridLayout::addItem(QLayoutItem *item, int row, int column, int rowSpan, i invalidate(); } -/* - Returns \c true if the widget \a w can be added to the layout \a l; - otherwise returns \c false. -*/ -static bool checkWidget(QLayout *l, QWidget *w) -{ - if (!w) { - qWarning("QLayout: Cannot add null widget to %s/%s", l->metaObject()->className(), - l->objectName().toLocal8Bit().data()); - return false; - } - return true; -} - /*! Adds the given \a widget to the cell grid at \a row, \a column. The top-left position is (0, 0) by default. @@ -1454,7 +1440,8 @@ static bool checkWidget(QLayout *l, QWidget *w) */ void QGridLayout::addWidget(QWidget *widget, int row, int column, Qt::Alignment alignment) { - if (!checkWidget(this, widget)) + Q_D(QGridLayout); + if (!d->checkWidget(widget)) return; if (row < 0 || column < 0) { qWarning("QGridLayout: Cannot add %s/%s to %s/%s at row %d column %d", @@ -1483,7 +1470,7 @@ void QGridLayout::addWidget(QWidget *widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment) { Q_D(QGridLayout); - if (!checkWidget(this, widget)) + if (!d->checkWidget(widget)) return; int toRow = (rowSpan < 0) ? -1 : fromRow + rowSpan - 1; int toColumn = (columnSpan < 0) ? -1 : fromColumn + columnSpan - 1; @@ -1518,6 +1505,8 @@ void QGridLayout::addWidget(QWidget *widget, int fromRow, int fromColumn, void QGridLayout::addLayout(QLayout *layout, int row, int column, Qt::Alignment alignment) { Q_D(QGridLayout); + if (!d->checkLayout(layout)) + return; if (!adoptLayout(layout)) return; QGridBox *b = new QGridBox(layout); @@ -1538,6 +1527,8 @@ void QGridLayout::addLayout(QLayout *layout, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment) { Q_D(QGridLayout); + if (!d->checkLayout(layout)) + return; if (!adoptLayout(layout)) return; QGridBox *b = new QGridBox(layout); diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index eb21a580b1..778514f47a 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -857,6 +857,47 @@ void QLayoutPrivate::reparentChildWidgets(QWidget *mw) } } +/*! + Returns \c true if the \a widget can be added to the \a layout; + otherwise returns \c false. +*/ +bool QLayoutPrivate::checkWidget(QWidget *widget) const +{ + Q_Q(const QLayout); + if (!widget) { + qWarning("QLayout: Cannot add a null widget to %s/%s", q->metaObject()->className(), + qPrintable(q->objectName())); + return false; + } + if (widget == q->parentWidget()) { + qWarning("QLayout: Cannot add parent widget %s/%s to its child layout %s/%s", + widget->metaObject()->className(), qPrintable(widget->objectName()), + q->metaObject()->className(), qPrintable(q->objectName())); + return false; + } + return true; +} + +/*! + Returns \c true if the \a otherLayout can be added to the \a layout; + otherwise returns \c false. +*/ +bool QLayoutPrivate::checkLayout(QLayout *otherLayout) const +{ + Q_Q(const QLayout); + if (!otherLayout) { + qWarning("QLayout: Cannot add a null layout to %s/%s", q->metaObject()->className(), + qPrintable(q->objectName())); + return false; + } + if (otherLayout == q) { + qWarning("QLayout: Cannot add layout %s/%s to itself", q->metaObject()->className(), + qPrintable(q->objectName())); + return false; + } + return true; +} + /*! This function is called from \c addWidget() functions in subclasses to add \a w as a managed widget of a layout. diff --git a/src/widgets/kernel/qlayout_p.h b/src/widgets/kernel/qlayout_p.h index 2100d86aba..71e0f9bcd3 100644 --- a/src/widgets/kernel/qlayout_p.h +++ b/src/widgets/kernel/qlayout_p.h @@ -76,6 +76,8 @@ public: void getMargin(int *result, int userMargin, QStyle::PixelMetric pm) const; void doResize(const QSize &); void reparentChildWidgets(QWidget *mw); + bool checkWidget(QWidget *widget) const; + bool checkLayout(QLayout *otherLayout) const; static QWidgetItem *createWidgetItem(const QLayout *layout, QWidget *widget); static QSpacerItem *createSpacerItem(const QLayout *layout, int w, int h, QSizePolicy::Policy hPolicy = QSizePolicy::Minimum, QSizePolicy::Policy vPolicy = QSizePolicy::Minimum); diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp index 850bedd9cc..4167d633b0 100644 --- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp +++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp @@ -79,6 +79,8 @@ private slots: void taskQTBUG_7103_minMaxWidthNotRespected(); void taskQTBUG_27420_takeAtShouldUnparentLayout(); + void taskQTBUG_40609_addingWidgetToItsOwnLayout(); + void taskQTBUG_40609_addingLayoutToItself(); void replaceWidget(); }; @@ -329,6 +331,36 @@ void tst_QBoxLayout::taskQTBUG_27420_takeAtShouldUnparentLayout() QVERIFY(!inner.isNull()); } +void tst_QBoxLayout::taskQTBUG_40609_addingWidgetToItsOwnLayout(){ + QWidget widget; + widget.setObjectName("347b469225a24a0ef05150a"); + QVBoxLayout layout(&widget); + layout.setObjectName("ef9e2b42298e0e6420105bb"); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null widget to QVBoxLayout/ef9e2b42298e0e6420105bb"); + layout.addWidget(Q_NULLPTR); + QCOMPARE(layout.count(), 0); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add parent widget QWidget/347b469225a24a0ef05150a to its child layout QVBoxLayout/ef9e2b42298e0e6420105bb"); + layout.addWidget(&widget); + QCOMPARE(layout.count(), 0); +} + +void tst_QBoxLayout::taskQTBUG_40609_addingLayoutToItself(){ + QWidget widget; + widget.setObjectName("fe44e5cb6c08006597126a"); + QVBoxLayout layout(&widget); + layout.setObjectName("cc751dd0f50f62b05a62da"); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null layout to QVBoxLayout/cc751dd0f50f62b05a62da"); + layout.addLayout(Q_NULLPTR); + QCOMPARE(layout.count(), 0); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add layout QVBoxLayout/cc751dd0f50f62b05a62da to itself"); + layout.addLayout(&layout); + QCOMPARE(layout.count(), 0); +} + struct Descr { Descr(int min, int sh, int max = -1, bool exp= false, int _stretch = 0, bool _empty = false) diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index 9df7e1662d..962e472606 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -135,6 +135,8 @@ private slots: */ void taskQTBUG_27420_takeAtShouldUnparentLayout(); + void taskQTBUG_40609_addingWidgetToItsOwnLayout(); + void taskQTBUG_40609_addingLayoutToItself(); }; @@ -949,6 +951,28 @@ void tst_QFormLayout::taskQTBUG_27420_takeAtShouldUnparentLayout() QVERIFY(!inner.isNull()); } +void tst_QFormLayout::taskQTBUG_40609_addingWidgetToItsOwnLayout(){ + QWidget widget; + widget.setObjectName("6435cbada60548b4522cbb6"); + QFormLayout layout(&widget); + layout.setObjectName("c03c0e22c0b6d019a93a248"); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add parent widget QWidget/6435cbada60548b4522cbb6 to its child layout QFormLayout/c03c0e22c0b6d019a93a248"); + layout.addRow(QLatin1String("48c81f39b7320082f8"), &widget); + QCOMPARE(layout.count(), 0); +} + +void tst_QFormLayout::taskQTBUG_40609_addingLayoutToItself(){ + QWidget widget; + widget.setObjectName("2bc425637d084c07ce65956"); + QFormLayout layout(&widget); + layout.setObjectName("60e31de0c8800eaba713a4f2"); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add layout QFormLayout/60e31de0c8800eaba713a4f2 to itself"); + layout.addRow(QLatin1String("9a2cd4f40c06b489f889"), &layout); + QCOMPARE(layout.count(), 0); +} + void tst_QFormLayout::replaceWidget() { QWidget w; diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp index 3b7c2ac14d..0dcae2fbcc 100644 --- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp @@ -101,6 +101,8 @@ private slots: void distributeMultiCell(); void taskQTBUG_27420_takeAtShouldUnparentLayout(); + void taskQTBUG_40609_addingWidgetToItsOwnLayout(); + void taskQTBUG_40609_addingLayoutToItself(); void replaceWidget(); private: @@ -1660,6 +1662,36 @@ void tst_QGridLayout::taskQTBUG_27420_takeAtShouldUnparentLayout() QVERIFY(!inner.isNull()); } +void tst_QGridLayout::taskQTBUG_40609_addingWidgetToItsOwnLayout(){ + QWidget widget; + widget.setObjectName("9bb37ca762aeb7269b8"); + QGridLayout layout(&widget); + layout.setObjectName("d631e91a35f2b66a6dff35"); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null widget to QGridLayout/d631e91a35f2b66a6dff35"); + layout.addWidget(Q_NULLPTR, 0, 0); + QCOMPARE(layout.count(), 0); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add parent widget QWidget/9bb37ca762aeb7269b8 to its child layout QGridLayout/d631e91a35f2b66a6dff35"); + layout.addWidget(&widget, 0, 0); + QCOMPARE(layout.count(), 0); +} + +void tst_QGridLayout::taskQTBUG_40609_addingLayoutToItself(){ + QWidget widget; + widget.setObjectName("0373d417fffe2c59c6fe543"); + QGridLayout layout(&widget); + layout.setObjectName("5d79e1b0aed83f100e3c2"); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null layout to QGridLayout/5d79e1b0aed83f100e3c2"); + layout.addLayout(Q_NULLPTR, 0, 0); + QCOMPARE(layout.count(), 0); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add layout QGridLayout/5d79e1b0aed83f100e3c2 to itself"); + layout.addLayout(&layout, 0, 0); + QCOMPARE(layout.count(), 0); +} + void tst_QGridLayout::replaceWidget() { QWidget wdg; diff --git a/tests/manual/qlayout/gridwidget.cpp b/tests/manual/qlayout/gridwidget.cpp index 31f0094182..6d7de3c763 100644 --- a/tests/manual/qlayout/gridwidget.cpp +++ b/tests/manual/qlayout/gridwidget.cpp @@ -53,6 +53,7 @@ GridWidget::GridWidget(QWidget *parent) : QWidget(parent) { QGridLayout *hb = new QGridLayout(this); + hb->setObjectName("GridWidget"); QComboBox *combo = new QComboBox(); combo->addItem("123"); QComboBox *combo2 = new QComboBox(); @@ -71,4 +72,11 @@ GridWidget::GridWidget(QWidget *parent) : hb->addWidget(new QPushButton("123"), 1, 4); hb->addWidget(new QSpinBox(), 0, 5); hb->addWidget(new QSpinBox(), 1, 5); + + qDebug("There should be four warnings, but no crash or freeze:"); + hb->addWidget(this, 6, 6); ///< This command should print a warning, but should not add "this" + hb->addWidget(Q_NULLPTR, 6, 7); ///< This command should print a warning, but should not add "NULL" + hb->addLayout(hb, 7, 6); ///< This command should print a warning, but should not add "hb" + hb->addLayout(Q_NULLPTR, 7, 7); ///< This command should print a warning, but should not add "NULL" + qDebug("Neither crashed nor frozen"); } diff --git a/tests/manual/qlayout/hbwidget.cpp b/tests/manual/qlayout/hbwidget.cpp index e8bb07f4a4..743b420b0d 100644 --- a/tests/manual/qlayout/hbwidget.cpp +++ b/tests/manual/qlayout/hbwidget.cpp @@ -53,6 +53,7 @@ HbWidget::HbWidget(QWidget *parent) : QWidget(parent) { QHBoxLayout *hb = new QHBoxLayout(this); + hb->setObjectName("HbWidget"); QComboBox *combo = new QComboBox(this); combo->addItem("123"); QComboBox *combo2 = new QComboBox(); @@ -67,4 +68,11 @@ HbWidget::HbWidget(QWidget *parent) : hb->addWidget(new QDateTimeEdit()); hb->addWidget(new QPushButton("123")); hb->addWidget(new QSpinBox()); + + qDebug("There should be four warnings, but no crash or freeze:"); + hb->addWidget(this); ///< This command should print a warning, but should not add "this" + hb->addWidget(Q_NULLPTR); ///< This command should print a warning, but should not add "NULL" + hb->addLayout(hb); ///< This command should print a warning, but should not add "hb" + hb->addLayout(Q_NULLPTR); ///< This command should print a warning, but should not add "NULL" + qDebug("Neither crashed nor frozen"); } diff --git a/tests/manual/qlayout/vbwidget.cpp b/tests/manual/qlayout/vbwidget.cpp index 063176625d..ffd918b955 100644 --- a/tests/manual/qlayout/vbwidget.cpp +++ b/tests/manual/qlayout/vbwidget.cpp @@ -53,6 +53,7 @@ VbWidget::VbWidget(QWidget *parent) : QWidget(parent) { QVBoxLayout *hb = new QVBoxLayout(this); + hb->setObjectName("VbWidget"); QComboBox *combo = new QComboBox(this); combo->addItem("123"); QComboBox *combo2 = new QComboBox(); @@ -67,4 +68,11 @@ VbWidget::VbWidget(QWidget *parent) : hb->addWidget(new QDateTimeEdit()); hb->addWidget(new QPushButton("123")); hb->addWidget(new QSpinBox()); + + qDebug("There should be four warnings, but no crash or freeze:"); + hb->addWidget(this); ///< This command should print a warning, but should not add "this" + hb->addWidget(Q_NULLPTR); ///< This command should print a warning, but should not add "NULL" + hb->addLayout(hb); ///< This command should print a warning, but should not add "hb" + hb->addLayout(Q_NULLPTR); ///< This command should print a warning, but should not add "NULL" + qDebug("Neither crashed nor frozen"); } -- cgit v1.2.3 From 61b47cd16693096072c1270bc5c7ee62873c0425 Mon Sep 17 00:00:00 2001 From: John Brooks Date: Fri, 29 Aug 2014 01:03:49 -0600 Subject: Correct QString::toStdString documentation on encoding This statement was left from when toAscii was used, instead of toUtf8. There is no loss of information when converting to UTF-8. Change-Id: Iad92977af319b324cbf06f1a24712b31a7836622 Reviewed-by: Louai Al-Khanji Reviewed-by: Robin Burchell Reviewed-by: Thiago Macieira --- src/corelib/tools/qstring.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 6c8db11212..3b18d31547 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -1306,9 +1306,6 @@ const QString::Null QString::null = { }; Returns a copy of the \a str string. The given string is converted to Unicode using the fromUtf8() function. - This constructor is only available if Qt is configured with STL - compatibility enabled. - \sa fromLatin1(), fromLocal8Bit(), fromUtf8() */ @@ -1341,7 +1338,7 @@ const QString::Null QString::null = { }; wchar_t is 2 bytes wide (e.g. windows) and in ucs4 on platforms where wchar_t is 4 bytes wide (most Unix systems). - This operator is mostly useful to pass a QString to a function + This method is mostly useful to pass a QString to a function that accepts a std::wstring object. \sa utf16(), toLatin1(), toUtf8(), toLocal8Bit() @@ -7720,12 +7717,9 @@ bool QString::isRightToLeft() const QString. The Unicode data is converted into 8-bit characters using the toUtf8() function. - This operator is mostly useful to pass a QString to a function + This method is mostly useful to pass a QString to a function that accepts a std::string object. - If the QString contains non-Latin1 Unicode characters, using this - can lead to loss of information. - \sa toLatin1(), toUtf8(), toLocal8Bit() */ -- cgit v1.2.3 From e6857b7ebccc6d7fbd5c77acbd3b0f33132bc068 Mon Sep 17 00:00:00 2001 From: Marcel Krems Date: Tue, 17 Jun 2014 12:40:31 +0200 Subject: Updated QSql{Query,Result}::bindValue doc to reflect the current state. Since 5.0 it is possible to use one call to bindValue to bind values to multiple placeholders with the same name. Task-number: QTBUG-23360 Change-Id: Ic838150d25dd07bca7bc9e5d91ab3362a73833d6 Reviewed-by: Matt Newell Reviewed-by: Mark Brand --- src/sql/kernel/qsqlquery.cpp | 6 ------ src/sql/kernel/qsqlresult.cpp | 6 ------ 2 files changed, 12 deletions(-) diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index 6b13eb02ed..b98e2baf1e 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -1063,12 +1063,6 @@ bool QSqlQuery::execBatch(BatchExecutionMode mode) To bind a NULL value, use a null QVariant; for example, use \c {QVariant(QVariant::String)} if you are binding a string. - Values cannot be bound to multiple locations in the query, eg: - \code - INSERT INTO testtable (id, name, samename) VALUES (:id, :name, :name) - \endcode - Binding to name will bind to the first :name, but not the second. - \sa addBindValue(), prepare(), exec(), boundValue(), boundValues() */ void QSqlQuery::bindValue(const QString& placeholder, const QVariant& val, diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp index 09b8f8d889..f933e6eeb1 100644 --- a/src/sql/kernel/qsqlresult.cpp +++ b/src/sql/kernel/qsqlresult.cpp @@ -704,12 +704,6 @@ void QSqlResult::bindValue(int index, const QVariant& val, QSql::ParamType param Binds the value \a val of parameter type \a paramType to the \a placeholder name in the current record (row). - Values cannot be bound to multiple locations in the query, eg: - \code - INSERT INTO testtable (id, name, samename) VALUES (:id, :name, :name) - \endcode - Binding to name will bind to the first :name, but not the second. - \note Binding an undefined placeholder will result in undefined behavior. \sa QSqlQuery::bindValue() -- cgit v1.2.3 From 529a31c967a202458abd126d378a2f690c2ec256 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 19 Feb 2014 14:12:36 +0100 Subject: configure: fix expanding system commands in qmake parser with GNU awk < 4 qmake variables using $$system() were incorrectly parsed by the custom qmake parser in the configure script, when using GNU awk 3.1.8 or earlier. They are parsed correctly with GNU awk 4 or mawk. This was occurring with such an assignement (from an extra mkspecs file): QMAKE_CC = $$system($$CMD QMAKE_CC 2>/dev/null) The custom qmake parser in the configure script first attempts to expand $$UPPERCASE variables, before running $$system(), using this: match(value, /\$\$(\{[_A-Z0-9.]+\}|[_A-Z0-9.]+)/) But when using non-ASCII locales with GNU awk 3.1.8 or earlier, $$system was expanded (to an empty string) because these earlier awk versions match lowercase letters for the [A-Z] regexp, which is traditionally used to match uppercase letters. This behavior has been changed in GNU awk 4.0.0, which only matches uppercase letters for [A-Z] by default. A workaround for earlier GNU awk versions is to run awk with the C locale. See GNU awk NEWS "Changes from 3.1.8 to 4.0.0": 25. Gawk now treats ranges of the form [d-h] as if they were in the C locale, no matter what kind of regexp is being used, and even if --posix. The latest POSIX standard allows this, and the documentation has been updated. Maybe this will stop all the questions about [a-z] matching uppercase letters. THIS CHANGES BEHAVIOR!!!! See also gawk.info "A.7 Regexp Ranges and Locales: A Long Sad Story" Change-Id: Ibb3eb28738c3e77d496c634e1f5c9f630957e730 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index cb8d78fd3c..b3b7528382 100755 --- a/configure +++ b/configure @@ -195,7 +195,7 @@ expandQMakeConf() extractQMakeVariables() { - $AWK ' + LC_ALL=C $AWK ' BEGIN { values["LITERAL_WHITESPACE"] = " " values["LITERAL_DOLLAR"] = "$" -- cgit v1.2.3 From 3e804976687ce3dbe424ae5dfa47bba0a6280ce1 Mon Sep 17 00:00:00 2001 From: Eric Lemanissier Date: Mon, 1 Sep 2014 19:57:51 +0200 Subject: Preventing caching of null authenticator In some cases, e.g. when bad credentials are provided in an ftp URI, QNetworkAccessAuthenticationManager::cacheCredentials is called with a null authenticator. This authenticator should not be cached, because it is useless, and leads to inconsistencies in the use of the cache Task-number: QTBUG-40622 Change-Id: If2a0a422b915f268648f5eef1d68601446123371 Reviewed-by: Peter Hartmann --- .../access/qnetworkaccessauthenticationmanager.cpp | 2 ++ .../access/qnetworkreply/tst_qnetworkreply.cpp | 23 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/network/access/qnetworkaccessauthenticationmanager.cpp b/src/network/access/qnetworkaccessauthenticationmanager.cpp index ea7bdc198a..b92f9c1b9b 100644 --- a/src/network/access/qnetworkaccessauthenticationmanager.cpp +++ b/src/network/access/qnetworkaccessauthenticationmanager.cpp @@ -231,6 +231,8 @@ void QNetworkAccessAuthenticationManager::cacheCredentials(const QUrl &url, const QAuthenticator *authenticator) { Q_ASSERT(authenticator); + if (authenticator->isNull()) + return; QString domain = QString::fromLatin1("/"); // FIXME: make QAuthenticator return the domain QString realm = authenticator->realm(); diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 9988db74c7..70c118b681 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -219,6 +219,7 @@ private Q_SLOTS: void putToFile(); void putToFtp_data(); void putToFtp(); + void putToFtpWithInvalidCredentials(); // QTBUG-40622 void putToHttp_data(); void putToHttp(); void putToHttpSynchronous_data(); @@ -2075,6 +2076,28 @@ void tst_QNetworkReply::putToFtp() QObject::disconnect(r, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); } +void tst_QNetworkReply::putToFtpWithInvalidCredentials() +{ + QUrl url("ftp://" + QtNetworkSettings::serverName()); + url.setPath(QString("/qtest/upload/qnetworkaccess-putToFtp-%1-%2") + .arg(QTest::currentDataTag()) + .arg(uniqueExtension)); + url.setUserName("invalidUser"); + url.setPassword("InvalidPassword"); + QNetworkRequest req(url); + QNetworkReplyPtr r; + + for (int i = 0; i < 2; i++) + { + runSimpleRequest(QNetworkAccessManager::PutOperation, req, r, QByteArray()); + + QVERIFY(r->isFinished()); + QCOMPARE(r->url(), url); + QCOMPARE(r->error(), QNetworkReply::AuthenticationRequiredError); + r->close(); + } +} + void tst_QNetworkReply::putToHttp_data() { putToFile_data(); -- cgit v1.2.3 From 507fff201bcafc1c28397e7008d8fbfe4c6ffb38 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 25 Aug 2014 13:53:44 +0200 Subject: qsql ibase: fix memory corruption due to LONG being 4 bytes in firebird. As fb_types.h says, Firebird requires (S)LONG to be 32 bit, and it defines SLONG to int. This leads to sqllen being 4, so qsql_ibase.cpp allocates 4 bytes... and was writing 8 bytes into it. Fixed by checking sqllen, the same way QIBaseResult::gotoNext does. Change-Id: Ie8680d32f98c354dfc8430b8efbfe95450556956 Reviewed-by: Mark Brand --- src/sql/drivers/ibase/qsql_ibase.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index cc26bfe7e8..c751fea825 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -1030,11 +1030,15 @@ bool QIBaseResult::exec() *((qint64*)d->inda->sqlvar[para].sqldata) = val.toLongLong(); break; case SQL_LONG: - if (d->inda->sqlvar[para].sqlscale < 0) - *((long*)d->inda->sqlvar[para].sqldata) = - (long)floor(0.5 + val.toDouble() * pow(10.0, d->inda->sqlvar[para].sqlscale * -1)); - else - *((long*)d->inda->sqlvar[para].sqldata) = (long)val.toLongLong(); + if (d->inda->sqlvar[para].sqllen == 4) { + if (d->inda->sqlvar[para].sqlscale < 0) + *((qint32*)d->inda->sqlvar[para].sqldata) = + (qint32)floor(0.5 + val.toDouble() * pow(10.0, d->inda->sqlvar[para].sqlscale * -1)); + else + *((qint32*)d->inda->sqlvar[para].sqldata) = (qint32)val.toInt(); + } else { + *((qint64*)d->inda->sqlvar[para].sqldata) = val.toLongLong(); + } break; case SQL_SHORT: if (d->inda->sqlvar[para].sqlscale < 0) -- cgit v1.2.3 From 209a75f2d071e0977b6c0a8a2ce5d6eb0ff95b8c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 9 Sep 2014 07:29:46 -0700 Subject: Qt 5.3.2 changelog Change-Id: I96c014c364c93d412b11acee00dc339d5eceb306 Reviewed-by: Akseli Salovaara Reviewed-by: Jani Heikkinen --- dist/changes-5.3.2 | 69 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/dist/changes-5.3.2 b/dist/changes-5.3.2 index 58f53024e2..dd0aeff80e 100644 --- a/dist/changes-5.3.2 +++ b/dist/changes-5.3.2 @@ -1,5 +1,5 @@ Qt 5.3.2 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.3.0. +compatibility (source and binary) with Qt 5.3.0 and Qt 5.3.1. For more details, refer to the online documentation included in this distribution. The documentation is also available online: @@ -24,15 +24,41 @@ information about a particular change. QtCore ------ + - QObject: + * [QTBUG-40638] Fixed disconnecting from pointer to member signal that + belongs in the base class but whose type is explicitly given as a + pointer to a member in the derived class + QtGui ----- -QtSql ------ + - Fonts: + * [QTBUG-39846] Fixed regression in font families returned by + QFontDatabase::families() for certain writing systems. + + - QImage: + * QImage::fill(uint) now fills the given pixel value unconverted when + used on RGBA8888 image, making it consistent with the documentation + and treatment of all other image formats. + + - Text: + * [QTBUG-39832] Fixed lines breaking on non-breaking spaces. + * [QTBUG-39930][QTBUG-39860] Fixed several regressions in font selection + when combining different writing systems in the same text. -QtWidgets +QtNetwork --------- + - [QTBUG-30829][QTBUG-35101] Fixed NTLM (SSPI) Proxy Authentication + (HTTP/HTTPS) + + - QNetworkAccessManager: + * Fixed high CPU load when handling POST/upload QIODevice that generates + data on readyRead(). + * [QTBUG-40797] QNetworkAccessManager now properly handles FTP transfer + failures by removing failed cached ftp connections. + + **************************************************************************** * Platform Specific Changes * **************************************************************************** @@ -40,12 +66,33 @@ QtWidgets Android ------- -**************************************************************************** -* Tools * -**************************************************************************** + - [QTBUG-39978] Fixed regression where QScreen::physicalSize() would + return 0x0. + - Added support for building libraries with spaces in name. + - [QTBUG-39377] Fixed common characters like digits and punctuation + showing as boxes when positioned next to non-latin scripts. + - [QTBUG-39377] Fixed common characters like digits and punctuation + showing as boxes when positioned next to non-latin scripts. + - Fixed font selection to prefer "Droid Serif" when Serif style hint is + set on QFont. + - [QTBUG-40957] Fixed bug on some devices where the application would + crash at shutdown if the virtual keyboard was open. + +EGLFS +----- -configure & build system ------------------------- + - Double click events are now sent correctly on eglfs. -qmake ------ +Windows +------- + + - [QTBUG-39172] Fixed using QRawFont with fallback fonts, e.g. in the case + of text rendering in Qt Quick. + +X11 / XCB +--------- + + - [QTBUG-39666][QTBUG-39573][QTBUG-39570] QTabletEvents and proximity + events correctly identify the tool in use; the meaning of certain + valuators depends on the tool; and the valuators' current values are + not lost between events -- cgit v1.2.3 From 4b6d87372561c960a3e42989db8c0bdb02f1df4a Mon Sep 17 00:00:00 2001 From: Boris Savelev Date: Thu, 4 Sep 2014 14:50:40 +0400 Subject: Add QMAKE_CFLAGS_XCB to xcb Add QMAKE_CFLAGS_XCB to xcb-static, needed for successfully building with -qt-xcb. Add QMAKE_CFLAGS because some code gets built with the C compiler. Also, this fixes a compile error when xcb include is not in system include path. Task-number: QTBUG-41129 Change-Id: I842ebe391a7a857e234becc451c33601fce9b07a Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/xcb-plugin.pro | 1 + src/plugins/platforms/xcb/xcb-static/xcb-static.pro | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index 4d76e4d449..874d42c36c 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -105,6 +105,7 @@ contains(QT_CONFIG, opengl) { DEFINES += $$QMAKE_DEFINES_XCB LIBS += $$QMAKE_LIBS_XCB QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB +QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB CONFIG += qpa/genericunixfontdatabase diff --git a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro index dfdcb2e83a..d0fe282b14 100644 --- a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro +++ b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro @@ -10,6 +10,9 @@ XCB_DIR = ../../../../3rdparty/xcb INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB +QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB + # ignore compiler warnings in 3rdparty code QMAKE_CFLAGS_STATIC_LIB+=-w -- cgit v1.2.3 From c1b46b98edc2f12fb7c596660777debed9191f52 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 11 Sep 2014 10:01:44 +0200 Subject: Fix possible divide by zero in QPlainTextEdit If the font engine for some reason fails to get font metrics for the font, the application should still not crash. [ChangeLog][Widgets][QPlainTextEdit] Fixed a possible divide by zero crash when font metrics were missing for the font. Task-number: QTBUG-40347 Change-Id: I571bc3eace07cdbee6f9ce9aa649df95412aed71 Reviewed-by: Simon Hausmann --- src/widgets/widgets/qplaintextedit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 23c1e99231..bd7f844eca 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -998,7 +998,8 @@ void QPlainTextEditPrivate::_q_adjustScrollbars() } else { vmax = qMax(0, doc->lineCount() - 1); - vSliderLength = viewport->height() / q->fontMetrics().lineSpacing(); + int lineSpacing = q->fontMetrics().lineSpacing(); + vSliderLength = lineSpacing != 0 ? viewport->height() / lineSpacing : 0; } -- cgit v1.2.3 From 982b9b7ec2441103b100c09cfcca4755d67fe839 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 4 Sep 2014 19:11:23 +0200 Subject: QMacStyle: Use NSView rendering for some inactive widgets on 10.10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now, we use them for inactive non-editable combo box, check box, and radio button only on Yosemite. We keep as much as possible the previous behavior on older versions. In addition, we add a way for QQuickStyleItem to specify the window the item is on. This is currently without effect, since we don't seem to take the inactive window state into account. Task-number: QTBUG-40833 Change-Id: I2fb2a99e6adf1972f881195b79b07ce85a960273 Reviewed-by: Morten Johan Sørvig --- src/widgets/styles/qmacstyle_mac.mm | 125 ++++++++++++++++++++++++++++++++- src/widgets/styles/qmacstyle_mac_p_p.h | 8 +++ src/widgets/styles/qstylehelper.cpp | 10 +++ src/widgets/styles/qstylehelper_p.h | 2 + 4 files changed, 142 insertions(+), 3 deletions(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 1f6940f063..d74e032412 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1702,7 +1702,7 @@ void QMacStylePrivate::setAutoDefaultButton(QObject *button) const } QMacStylePrivate::QMacStylePrivate() - : mouseDown(false) + : mouseDown(false), backingStoreNSView(nil) { defaultButtonStart = CFAbsoluteTimeGetCurrent(); memset(&buttonState, 0, sizeof(ButtonState)); @@ -1715,6 +1715,12 @@ QMacStylePrivate::QMacStylePrivate() } +QMacStylePrivate::~QMacStylePrivate() +{ + Q_FOREACH (NSView *b, buttons) + [b release]; +} + ThemeDrawState QMacStylePrivate::getDrawState(QStyle::State flags) { ThemeDrawState tds = kThemeStateActive; @@ -1732,6 +1738,97 @@ ThemeDrawState QMacStylePrivate::getDrawState(QStyle::State flags) return tds; } +NSView *QMacStylePrivate::buttonOfKind(ThemeButtonKind kind) const +{ + NSView *bv = buttons[kind]; + if (!bv) { + if (kind == kThemePopupButton) + bv = [[NSPopUpButton alloc] init]; + else if (kind == kThemeComboBox) + bv = [[NSComboBox alloc] init]; + else + bv = [[NSButton alloc] init]; + + switch (kind) { + case kThemeArrowButton: { + NSButton *bc = (NSButton *)bv; + bc.buttonType = NSOnOffButton; + bc.bezelStyle = NSDisclosureBezelStyle; + break; + } + case kThemeCheckBox: + case kThemeCheckBoxSmall: + case kThemeCheckBoxMini: { + NSButton *bc = (NSButton *)bv; + bc.buttonType = NSSwitchButton; + break; + } + case kThemeRadioButton: + case kThemeRadioButtonSmall: + case kThemeRadioButtonMini: { + NSButton *bc = (NSButton *)bv; + bc.buttonType = NSRadioButton; + break; + } + case kThemePushButton: + case kThemePushButtonSmall: + case kThemePushButtonMini: { + NSButton *bc = (NSButton *)bv; + bc.buttonType = NSMomentaryPushButton; + bc.bezelStyle = NSRoundedBezelStyle; + break; + } + default: + break; + } + +// if (kind == kThemePushButtonSmall +// || kind == kThemePopupButtonSmall +// || kind == kThemeCheckBoxSmall +// || kind == kThemeRadioButtonSmall) +// bc.controlSize = NSSmallControlSize; +// else if (kind == kThemePushButtonMini +// || kind == kThemePopupButtonMini +// || kind == kThemeCheckBoxMini +// || kind == kThemeRadioButtonMini) +// bc.controlSize = NSMiniControlSize; + + if ([bv isKindOfClass:[NSButton class]]) { + NSButton *bc = (NSButton *)bv; + bc.title = nil; + } + + const_cast(this)->buttons.insert(kind, bv); + } + + return bv; +} + +void QMacStylePrivate::drawNSViewInRect(NSView *view, const QRect &qtRect, QPainter *p) const +{ + QMacCGContext ctx(p); + CGContextSaveGState(ctx); + + [NSGraphicsContext saveGraphicsState]; + [NSGraphicsContext setCurrentContext:[NSGraphicsContext + graphicsContextWithGraphicsPort:ctx flipped:YES]]; + + CGRect rect = CGRectMake(qtRect.x() + 1, qtRect.y(), qtRect.width(), qtRect.height()); + + [backingStoreNSView addSubview:view]; + view.frame = rect; + [view drawRect:rect]; + [view removeFromSuperviewWithoutNeedingDisplay]; + + [NSGraphicsContext restoreGraphicsState]; + CGContextRestoreGState(ctx); +} + +void QMacStylePrivate::resolveCurrentNSView(QWindow *window) +{ + backingStoreNSView = window ? (NSView *)window->winId() : nil; +} + void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonDrawInfo *bdi, QPainter *p, const QStyleOption *opt) const { @@ -1742,6 +1839,9 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD finalyoff = 0; const bool combo = opt->type == QStyleOption::SO_ComboBox; + const bool editableCombo = bdi->kind == kThemeComboBox + || bdi->kind == kThemeComboBoxSmall + || bdi->kind == kThemeComboBoxMini; const bool button = opt->type == QStyleOption::SO_Button; const bool pressed = bdi->state == kThemeStatePressed; const bool usingYosemiteOrLater = QSysInfo::MacintoshVersion > QSysInfo::MV_10_9; @@ -1789,7 +1889,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD if (!combo && !button && bdi->value == kThemeButtonOff) { pm = activePixmap; - } else if ((combo && !usingYosemiteOrLater) || button) { + } else if (!usingYosemiteOrLater && (combo || button)) { QImage image = activePixmap.toImage(); for (int y = 0; y < height; ++y) { @@ -1816,7 +1916,17 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD } } pm = QPixmap::fromImage(image); - } else if (combo && usingYosemiteOrLater) { + } else if ((usingYosemiteOrLater && combo && !editableCombo) || button) { + NSButton *bc = (NSButton *)buttonOfKind(bdi->kind); + [bc highlight:pressed]; + bc.enabled = bdi->state != kThemeStateUnavailable && bdi->state != kThemeStateUnavailableInactive; + bc.state = bdi->value == kThemeButtonOn ? NSOnState : + bdi->value == kThemeButtonMixed ? NSMixedState : NSOffState; + p->translate(0, 1); + drawNSViewInRect(bc, opt->rect, p); + p->translate(0, -1); + return; + } else if (usingYosemiteOrLater && editableCombo) { QImage image = activePixmap.toImage(); for (int y = 0; y < height; ++y) { @@ -2944,6 +3054,9 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai Q_D(const QMacStyle); ThemeDrawState tds = d->getDrawState(opt->state); QMacCGContext cg(p); + QWindow *window = w && w->window() ? w->window()->windowHandle() : + QStyleHelper::styleObjectWindow(opt->styleObject); + const_cast(d)->resolveCurrentNSView(window); switch (pe) { case PE_IndicatorArrowUp: case PE_IndicatorArrowDown: @@ -3358,6 +3471,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter Q_D(const QMacStyle); ThemeDrawState tds = d->getDrawState(opt->state); QMacCGContext cg(p); + QWindow *window = w && w->window() ? w->window()->windowHandle() : + QStyleHelper::styleObjectWindow(opt->styleObject); + const_cast(d)->resolveCurrentNSView(window); switch (ce) { case CE_HeaderSection: if (const QStyleOptionHeader *header = qstyleoption_cast(opt)) { @@ -5075,6 +5191,9 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex Q_D(const QMacStyle); ThemeDrawState tds = d->getDrawState(opt->state); QMacCGContext cg(p); + QWindow *window = widget && widget->window() ? widget->window()->windowHandle() : + QStyleHelper::styleObjectWindow(opt->styleObject); + const_cast(d)->resolveCurrentNSView(window); switch (cc) { case CC_Slider: case CC_ScrollBar: diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index 6f42f0ea79..3bbff61340 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -145,6 +145,7 @@ class QMacStylePrivate : public QCommonStylePrivate Q_DECLARE_PUBLIC(QMacStyle) public: QMacStylePrivate(); + ~QMacStylePrivate(); // Ideally these wouldn't exist, but since they already exist we need some accessors. static const int PushButtonLeftOffset; @@ -194,6 +195,11 @@ public: void setAutoDefaultButton(QObject *button) const; + NSView *buttonOfKind(ThemeButtonKind kind) const; + + void drawNSViewInRect(NSView *view, const QRect &rect, QPainter *p) const; + void resolveCurrentNSView(QWindow *window); + public: mutable QPointer pressedButton; mutable QPointer defaultButton; @@ -212,6 +218,8 @@ public: void *nsscroller; #endif void *indicatorBranchButtonCell; + NSView *backingStoreNSView; + QHash buttons; }; QT_END_NAMESPACE diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp index 6be07a3f45..49e406a8b7 100644 --- a/src/widgets/styles/qstylehelper.cpp +++ b/src/widgets/styles/qstylehelper.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include "qstylehelper_p.h" #include @@ -397,5 +398,14 @@ QColor backgroundColor(const QPalette &pal, const QWidget* widget) return widget->parentWidget()->parentWidget()->palette().color(QPalette::Base); return pal.color(QPalette::Base); } + +QWindow *styleObjectWindow(QObject *so) +{ + if (so) + return so->property("_q_styleObjectWindow").value(); + + return 0; +} + } QT_END_NAMESPACE diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h index 73e5c94dcd..1229af7497 100644 --- a/src/widgets/styles/qstylehelper_p.h +++ b/src/widgets/styles/qstylehelper_p.h @@ -68,6 +68,7 @@ class QPainter; class QPixmap; class QStyleOptionSlider; class QStyleOption; +class QWindow; namespace QStyleHelper { @@ -87,6 +88,7 @@ namespace QStyleHelper bool hasAncestor(QObject *obj, QAccessible::Role role); #endif QColor backgroundColor(const QPalette &pal, const QWidget* widget = 0); + QWindow *styleObjectWindow(QObject *so); } -- cgit v1.2.3 From c8d2514347cedbd05f9e11822a9268f32e779dc3 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 19 Aug 2014 11:51:09 +0200 Subject: QGuiApplication: clear font database on cleanup Change-Id: If196c5e93b7ed68c6a0f6be7414f9efc8195f168 Task-number: QTBUG-40865 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/kernel/qguiapplication.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 7648233608..4727e754cd 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -588,6 +588,7 @@ QGuiApplication::~QGuiApplication() #endif //QT_NO_SESSIONMANAGER clearPalette(); + QFontDatabase::removeAllApplicationFonts(); #ifndef QT_NO_CURSOR d->cursor_list.clear(); -- cgit v1.2.3 From 1126701f8c459b92aee8a08befaf8e4ec216fd46 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Mon, 1 Sep 2014 14:53:14 +0200 Subject: cocoa: don't override NSApplication-sendEvent if configured as AA_MacPluginApplication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I48cebbcb814ee8e97583c3165e7cb668077cfbad Task-number: QTBUG-40409 Reviewed-by: Morten Johan Sørvig --- src/corelib/global/qnamespace.qdoc | 2 +- src/corelib/kernel/qcoreapplication.cpp | 8 ++++++++ src/plugins/platforms/cocoa/qcocoaapplication.mm | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index a47f2e2945..50697e82a7 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -125,7 +125,7 @@ to author a plugin. This includes avoiding loading our nib for the main menu and not taking possession of the native menu bar. When setting this attribute to true will also set the AA_DontUseNativeMenuBar attribute - to true. + to true. It also disables native event filters. \value AA_DontUseNativeMenuBar All menubars created while this attribute is set to true won't be used as a native menubar (e.g, the menubar at diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 6868eb6a1e..82c157ee7f 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2528,6 +2528,9 @@ void QCoreApplication::removeLibraryPath(const QString &path) \note The filter function set here receives native messages, i.e. MSG or XCB event structs. + \note Native event filters will be disabled when the application the + Qt::AA_MacPluginApplication attribute is set. + For maximum portability, you should always try to use QEvents and QObject::installEventFilter() whenever possible. @@ -2537,6 +2540,11 @@ void QCoreApplication::removeLibraryPath(const QString &path) */ void QCoreApplication::installNativeEventFilter(QAbstractNativeEventFilter *filterObj) { + if (QCoreApplication::testAttribute(Qt::AA_MacPluginApplication)) { + qWarning("Native event filters are not applied when the Qt::AA_MacPluginApplication attribute is set"); + return; + } + QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance(QCoreApplicationPrivate::theMainThread); if (!filterObj || !eventDispatcher) return; diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm index 551a59823c..bac76357da 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplication.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm @@ -189,6 +189,12 @@ QT_BEGIN_NAMESPACE void qt_redirectNSApplicationSendEvent() { + if (QCoreApplication::testAttribute(Qt::AA_MacPluginApplication)) + // In a plugin we cannot chain sendEvent hooks: a second plugin could + // store the implementation of the first, which during the program flow + // can be unloaded. + return; + if ([NSApp isMemberOfClass:[QNSApplication class]]) { // No need to change implementation since Qt // already controls a subclass of NSApplication @@ -209,6 +215,10 @@ void qt_redirectNSApplicationSendEvent() void qt_resetNSApplicationSendEvent() { + if (QCoreApplication::testAttribute(Qt::AA_MacPluginApplication)) + return; + + qt_cocoa_change_back_implementation([NSApplication class], @selector(sendEvent:), @selector(QT_MANGLE_NAMESPACE(qt_sendEvent_original):)); -- cgit v1.2.3 From 739f98aa09e2f13fcc23c78eb41980f2f472ce20 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 28 Aug 2014 12:49:19 +0200 Subject: cocoa: fix namespace manging for QNSView MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I83035b45cabd938a9fdfa3a5d12de2c1793b30b3 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.h | 6 +++++- src/plugins/platforms/cocoa/qnsview.mm | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 5387f2a825..cbeecb987f 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -48,6 +48,8 @@ #include #include +#include "private/qcore_mac_p.h" + QT_BEGIN_NAMESPACE class QCocoaWindow; class QCocoaBackingStore; @@ -56,7 +58,7 @@ QT_END_NAMESPACE Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper); -@interface QNSView : NSView { +@interface QT_MANGLE_NAMESPACE(QNSView) : NSView { QCocoaBackingStore* m_backingStore; QPoint m_backingStoreOffset; CGImageRef m_maskImage; @@ -134,4 +136,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper); @end +QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSView); + #endif //QNSVIEW_H diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index a18ee7ff71..7ece5dcdf8 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -122,7 +122,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; @end -@implementation QNSView +@implementation QT_MANGLE_NAMESPACE(QNSView) + (void)initialize { -- cgit v1.2.3 From 1da57ecd06507e5cbf7f93c3343c730753fbc22c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 10 Sep 2014 16:34:45 +0200 Subject: fix bogus library paths in ANGLE prl files Task-number: QTBUG-41204 Change-Id: I3ddcba23467e7df3a4449c4960972f37810ed323 Reviewed-by: Joerg Bornemann --- src/angle/src/common/common.pri | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri index 0943b3f299..afb8a8675d 100644 --- a/src/angle/src/common/common.pri +++ b/src/angle/src/common/common.pri @@ -7,6 +7,11 @@ INCLUDEPATH += \ LIBS_PRIVATE = $$QMAKE_LIBS_CORE $$QMAKE_LIBS_GUI +lib_replace.match = $$[QT_INSTALL_LIBS/get] +lib_replace.replace = $$[QT_INSTALL_LIBS/raw] +lib_replace.CONFIG = path +QMAKE_PRL_INSTALL_REPLACE += lib_replace + # DirectX is included in the Windows 8 Kit, but everything else requires the DX SDK. win32-msvc2012|win32-msvc2013|winrt { FXC = fxc.exe -- cgit v1.2.3 From a3b88a00254b43696d1761b6c7ad80c2ed94d32e Mon Sep 17 00:00:00 2001 From: Aki Koskinen Date: Tue, 19 Aug 2014 23:28:41 +0300 Subject: Improved documentation for QStyledItemDelegate::eventFilter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added the notion that enter and return keys are not handled if editor is of type QTextEdit or QPlainTextEdit. Change-Id: I9d5cb529bf154c687fab1949fccf37e9da096c85 Reviewed-by: Topi Reiniö Reviewed-by: Jerome Pasion --- src/widgets/itemviews/qstyleditemdelegate.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp index da5aeb3290..b5fc8d7d63 100644 --- a/src/widgets/itemviews/qstyleditemdelegate.cpp +++ b/src/widgets/itemviews/qstyleditemdelegate.cpp @@ -627,6 +627,9 @@ void QStyledItemDelegate::setItemEditorFactory(QItemEditorFactory *factory) \li \uicontrol Esc \endlist + If the \a editor's type is QTextEdit or QPlainTextEdit then \uicontrol Enter and + \uicontrol Return keys are \e not handled. + In the case of \uicontrol Tab, \uicontrol Backtab, \uicontrol Enter and \uicontrol Return key press events, the \a editor's data is comitted to the model and the editor is closed. If the \a event is a \uicontrol Tab key press -- cgit v1.2.3 From d4d752e241684a9639129e4fb5863883610f5137 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Mon, 28 Jul 2014 10:01:31 +0200 Subject: QWindowsWindow: Fixed warning text Change-Id: I80019f705edcf3b5f974af72ef86b45546582210 Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/windows/qwindowswindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 7d04c99d16..0382144cbe 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1952,7 +1952,7 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const mmi->ptMaxPosition.x = screen->availableGeometry().x(); mmi->ptMaxPosition.y = screen->availableGeometry().y(); } else if (!screen){ - qWarning() << "effectiveScreen() returned a null screen"; + qWarning() << "window()->screen() returned a null screen"; } } -- cgit v1.2.3 From 0fa0608f707306cb34a9ca91952cebbac25065a5 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 28 Aug 2014 15:22:35 +0200 Subject: Logging: Remove use of _declspec(thread) thread-local variables are known to be broken on Windows XP if the library is loaded dynamically. This has been fixed since Windows Vista, but to avoid any elaborate runtime checking of the OS version we're just removing the logic alltogether for MSVC / Windows. Task-number: QTBUG-41008 Change-Id: I64ee95270d142294c975a5890d6e1b62a833b6ef Reviewed-by: Thiago Macieira --- src/corelib/global/qlogging.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index ca0fb1bb23..51169eb963 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1282,12 +1282,9 @@ static void qDefaultMsgHandler(QtMsgType type, const char *buf) qDefaultMessageHandler(type, emptyContext, QString::fromLocal8Bit(buf)); } -#if defined(Q_COMPILER_THREAD_LOCAL) || (defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)) -#if defined(Q_CC_MSVC) -static __declspec(thread) bool msgHandlerGrabbed = false; -#else +#if defined(Q_COMPILER_THREAD_LOCAL) + static thread_local bool msgHandlerGrabbed = false; -#endif static bool grabMessageHandler() { @@ -1306,7 +1303,7 @@ static void ungrabMessageHandler() #else static bool grabMessageHandler() { return true; } static void ungrabMessageHandler() { } -#endif // (Q_COMPILER_THREAD_LOCAL) || ((Q_CC_MSVC) && !(Q_OS_WINCE)) +#endif // (Q_COMPILER_THREAD_LOCAL) static void qt_message_print(QtMsgType msgType, const QMessageLogContext &context, const QString &message) { -- cgit v1.2.3 From b2b9fdfda0f7838059d7e826d81740977ef35a6e Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 15 Sep 2014 16:23:02 +0200 Subject: QSizeGrip: use a QPointer to the tracked TLW And not a normal pointer. The problem is that in certain scenarios, if the TLW containing a QSizeGrip changes and the old TLW gets immediately destroyed, then the mechanism which updates the tracked TLW is run too late, and ends up accessing a dangling pointer. Therefore, we need to protect that pointer via a smart pointer. Task-number: QTBUG-22867 Change-Id: Icfb051132bacde604f660ac7a98bc0a9d1022c68 Reviewed-by: Marc Mutz --- src/widgets/widgets/qsizegrip.cpp | 2 +- .../widgets/widgets/qsizegrip/tst_qsizegrip.cpp | 25 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp index e46de3958f..5994071bfc 100644 --- a/src/widgets/widgets/qsizegrip.cpp +++ b/src/widgets/widgets/qsizegrip.cpp @@ -83,7 +83,7 @@ public: int dyMax; Qt::Corner m_corner; bool gotMousePress; - QWidget *tlw; + QPointer tlw; #ifdef Q_WS_MAC void updateMacSizer(bool hide) const; #endif diff --git a/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp b/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp index f88cd634de..2600348998 100644 --- a/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp +++ b/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp @@ -46,6 +46,10 @@ #include #include #include +#include +#include +#include +#include static inline Qt::Corner sizeGripCorner(QWidget *parent, QSizeGrip *sizeGrip) { @@ -75,6 +79,7 @@ private slots: void hideAndShowOnWindowStateChange_data(); void hideAndShowOnWindowStateChange(); void orientation(); + void dontCrashOnTLWChange(); private: QLineEdit *dummyWidget; @@ -191,6 +196,26 @@ void tst_QSizeGrip::orientation() QCOMPARE(sizeGripCorner(&widget, sizeGrip), Qt::TopRightCorner); } +void tst_QSizeGrip::dontCrashOnTLWChange() +{ + // QTBUG-22867 + QMdiArea mdiArea; + mdiArea.show(); + + QMainWindow *mw = new QMainWindow(); + QMdiSubWindow *mdi = mdiArea.addSubWindow(mw); + mw->statusBar()->setSizeGripEnabled(true); + mdiArea.removeSubWindow(mw); + delete mdi; + mw->show(); + + // the above setup causes a change of TLW for the size grip, + // and it must not crash. + + QVERIFY(QTest::qWaitForWindowExposed(&mdiArea)); + QVERIFY(QTest::qWaitForWindowExposed(mw)); +} + QTEST_MAIN(tst_QSizeGrip) #include "tst_qsizegrip.moc" -- cgit v1.2.3 From 055622ed48888d5a38ee8f2314c252c96dc34e84 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 16 Sep 2014 11:07:24 +0200 Subject: OS X: Fix positioning of popup menus in case of native NSWindows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code transformed the coordinates from the view to the window's content view, and since that content view is flipped in the pure Qt world (content view == QNSView), it manually flipped the coordinates to transform from that to window coordinates. Instead just directly transform the view coordinates to window coordinates using standard Cocoa methods, which then works with any kind of content view and NSWindow configuration. Task-number: QTBUG-40958 Change-Id: Idddd327fe9cff3309606379d0e04ee8b4bd5eece Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoamenu.mm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index a89979a8ea..3d0201e1a0 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -463,9 +463,8 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf // Else, we need to transform 'pos' to window or screen coordinates. NSPoint nsPos = NSMakePoint(pos.x() - 1, pos.y()); if (view) { - // Flip y-coordinate first, the convert to content view space. - nsPos.y = view.frame.size.height - nsPos.y; - nsPos = [view convertPoint:nsPos toView:view.window.contentView]; + // convert coordinates from view to the view's window + nsPos = [view convertPoint:nsPos toView:nil]; } else if (!QGuiApplication::screens().isEmpty()) { QScreen *screen = QGuiApplication::screens().at(0); nsPos.y = screen->availableVirtualSize().height() - nsPos.y; -- cgit v1.2.3 From bb3d2ca9f18071537888622310ca0cb7f587e61d Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 16 Sep 2014 16:33:57 +0200 Subject: QToolButton: properly reset the size hint when a menu is set on it QToolButton::sizeHint() takes into account the presence of a menu. However, setMenu() doesn't retrigger a size hint recalculation. Hence, (un)setting a menu on an already sized tool button won't properly reset the size hint. Since the calculated size hint is cached, delete the cached value and call updateGeometry to cause a recalculation. Task-number: QTBUG-38949 Change-Id: I6e79e5e70e31afdfd129282b3668875eca86f51d Reviewed-by: Marc Mutz --- src/widgets/widgets/qtoolbutton.cpp | 4 ++++ .../widgets/qtoolbutton/tst_qtoolbutton.cpp | 28 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 497bc52109..cb441d6c6e 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -652,6 +652,10 @@ void QToolButton::setMenu(QMenu* menu) } else { d->menuAction = 0; } + + // changing the menu set may change the size hint, so reset it + d->sizeHint = QSize(); + updateGeometry(); update(); } diff --git a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp index 168a17773e..650f189309 100644 --- a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp +++ b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp @@ -66,6 +66,7 @@ private slots: void task230994_iconSize(); void task176137_autoRepeatOfAction(); void qtbug_26956_popupTimerDone(); + void qtbug_34759_sizeHintResetWhenSettingMenu(); protected slots: void sendMouseClick(); @@ -265,5 +266,32 @@ void tst_QToolButton::qtbug_26956_popupTimerDone() tb->showMenu(); } +void tst_QToolButton::qtbug_34759_sizeHintResetWhenSettingMenu() +{ + // There is no reliable way of checking what's ultimately a style-dependent + // sizing. So the idea is checking if the size is the "correct" size w.r.t. + // another toolbutton which has had a menu set before it was shown for the first time + + QToolButton button1; + QToolButton button2; + + button1.setToolButtonStyle(Qt::ToolButtonIconOnly); + button1.setPopupMode(QToolButton::MenuButtonPopup); + + button2.setToolButtonStyle(Qt::ToolButtonIconOnly); + button2.setPopupMode(QToolButton::MenuButtonPopup); + + button2.setMenu(new QMenu(&button2)); + + button1.show(); + button2.show(); + + QVERIFY(QTest::qWaitForWindowExposed(&button1)); + QVERIFY(QTest::qWaitForWindowExposed(&button2)); + + button1.setMenu(new QMenu(&button1)); + QTRY_COMPARE(button1.sizeHint(), button2.sizeHint()); +} + QTEST_MAIN(tst_QToolButton) #include "tst_qtoolbutton.moc" -- cgit v1.2.3 From e409eafe23c8f90a01ed198090c2d7df0d07e708 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 16 Sep 2014 16:37:32 +0200 Subject: OSX: emit aboutToShow signal for top-level dock menu. Qt sets a QCocoaMenuDelegate on every menu it creates in order to emit the (OSX specific) aboutToShow signal. However, there are a few cases where OSX will copy a menu without copying the delegate. One of those cases is the dock: the result of -[NSApplication applicationDockMenu:] is used to create a new menu, to which a few more items are copied. This copy is then send back to the dock. This patch invokes the delegate's -menuWillOpen: method when -[NSApplication applicationDockMenu:] is called. Note that sub-menus won't receive the call-back, because the dock doesn't tell the application what happens after returning from applicationDockMenu:. Task-number: QTBUG-39604 Change-Id: I0e06df371a3d77342ae4b7148041214e5c4579d7 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index 92358ecc74..24ad75ceec 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -163,6 +163,9 @@ static void cleanupCocoaApplicationDelegate() - (NSMenu *)applicationDockMenu:(NSApplication *)sender { Q_UNUSED(sender); + // Manually invoke the delegate's -menuWillOpen: method. + // See QTBUG-39604 (and its fix) for details. + [[dockMenu delegate] menuWillOpen:dockMenu]; return [[dockMenu retain] autorelease]; } -- cgit v1.2.3 From 1fa3627423a73fe19333e2e016feb35cdf8cd1ea Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Wed, 17 Sep 2014 14:08:38 -0500 Subject: Remove reference to removed qatomic_sparc.h qatomic_sparc.h was removed previously as part of general cleanup of old atomic code for Qt 5.3. Unfortunately SPARC include reference was not removed resulting in build failure on that platform. Task-number: QTBUG-41384 Change-Id: Ic6e31b32324b0e5dd3700a6a21515a8eea5668bd Reviewed-by: Thiago Macieira --- src/corelib/thread/qbasicatomic.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index cf69d34589..0fe4d20bc5 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -62,8 +62,6 @@ # include "QtCore/qatomic_ia64.h" #elif defined(Q_PROCESSOR_MIPS) # include "QtCore/qatomic_mips.h" -#elif defined(Q_PROCESSOR_SPARC) -# include "QtCore/qatomic_sparc.h" #elif defined(Q_PROCESSOR_X86) # include -- cgit v1.2.3 From a5df2e7120412dfdedb9f4951cdb061c0f218bf7 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 22 Aug 2014 14:19:04 +0200 Subject: Cocoa: Handle insertNewLine selector for when it is sent while composing text Some IMEs will perform an insertNewLine when Return/Enter is pressed while composing text as well as causing the edit to finish. By handling this it will ensure that the extra enter/return event is sent when the IME requests it. Task-id: QTBUG-39125 Change-Id: Ice6eded68e6b1dc51703a38316f76f78099923da Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/cocoa/qnsview.h | 1 + src/plugins/platforms/cocoa/qnsview.mm | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index cbeecb987f..44a1556fc4 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -78,6 +78,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper); bool m_shouldSetGLContextinDrawRect; NSString *m_inputSource; QNSViewMouseMoveHelper *m_mouseMoveHelper; + bool m_resendKeyEvent; } - (id)init; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 7ece5dcdf8..86691456b8 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -149,6 +149,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; m_sendUpAsRightButton = false; m_inputSource = 0; m_mouseMoveHelper = [[QNSViewMouseMoveHelper alloc] initWithView:self]; + m_resendKeyEvent = false; if (!touchDevice) { touchDevice = new QTouchDevice; @@ -1402,6 +1403,8 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) } } } + if (m_resendKeyEvent) + m_sendKeyEvent = true; } if (m_sendKeyEvent && m_composingText.isEmpty()) @@ -1409,6 +1412,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat]); m_sendKeyEvent = false; + m_resendKeyEvent = false; } - (void)keyDown:(NSEvent *)nsevent @@ -1479,6 +1483,12 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) } } +- (void) insertNewline:(id)sender +{ + Q_UNUSED(sender); + m_resendKeyEvent = true; +} + - (void) doCommandBySelector:(SEL)aSelector { [self tryToPerform:aSelector with:self]; -- cgit v1.2.3