From 4dada8068a8a5c4cd52958cf25fd2a50b1af5ac0 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 3 May 2018 12:15:06 +0200 Subject: [PATCH 01/11] tst_qiodevice: Skip broken winrt tests Change-Id: I399cc1aed3ee4151cf6adfd8f8780d8975604d52 Reviewed-by: Maurice Kalinowski Reviewed-by: Andre de la Rocha --- tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index 4923baa0ca..fed05698fd 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -104,6 +104,9 @@ void tst_QIODevice::getSetCheck() //---------------------------------------------------------------------------------- void tst_QIODevice::constructing_QTcpSocket() { +#if defined(Q_OS_WINRT) + QSKIP("Synchronous socket calls are broken on winrt. See QTBUG-40922"); +#endif if (!QtNetworkSettings::verifyTestNetworkSettings()) QSKIP("No network test server available"); @@ -263,6 +266,9 @@ void tst_QIODevice::unget() buffer.ungetChar('Q'); QCOMPARE(buffer.readLine(buf, 3), qint64(1)); +#if defined(Q_OS_WINRT) + QSKIP("Synchronous socket calls are broken on winrt. See QTBUG-40922"); +#endif for (int i = 0; i < 2; ++i) { QTcpSocket socket; QIODevice *dev; From a27f888dec9c838d5e64496be0e5a5e6d980db32 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 3 May 2018 12:18:24 +0200 Subject: [PATCH 02/11] tst_qresourceengine: Fix test for configurations with builtin_testdata If builtin_testdata is present additional data ends in inside of resources so that tests can access this data when needed. The addiitonal data has to be taken into account in the resource engine's test. Change-Id: I10de6b9612ca49b314d77cfadd5b2360a5d90d53 Reviewed-by: Andre de la Rocha Reviewed-by: Oswald Buddenhagen --- .../corelib/io/qresourceengine/qresourceengine.pro | 2 ++ .../io/qresourceengine/tst_qresourceengine.cpp | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro index f937d23fe2..e8071297b1 100644 --- a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro +++ b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro @@ -21,3 +21,5 @@ GENERATED_TESTDATA = $${runtime_resource.target} android:!android-embedded { RESOURCES += android_testdata.qrc } + +builtin_testdata: DEFINES += BUILTIN_TESTDATA diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index ab1866fb2d..9de2aabd31 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -125,9 +125,19 @@ void tst_QResourceEngine::checkStructure_data() rootContents.insert(1, QLatin1String("android_testdata")); #endif +#if defined(BUILTIN_TESTDATA) + rootContents.insert(8, QLatin1String("testqrc")); +#endif + + QTest::newRow("root dir") << QString(":/") << QString() - << (QStringList() << "search_file.txt") + << (QStringList() +#if defined(BUILTIN_TESTDATA) + << "parentdir.txt" + << "runtime_resource.rcc" +#endif + << "search_file.txt") << rootContents << QLocale::c() << qlonglong(0); From da97dcec3eb8f52523c9950b9a00d893bd88c27b Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 3 May 2018 12:16:01 +0200 Subject: [PATCH 03/11] tst_qresourceengine: Fix test for static MSVC builds The test relies on the existence of qt-project.org in resources. It contains mimetype data and is automatically added. For static builds on MSVC it is only added if it is actually needed though. Change-Id: Icd1d74466607196f9b635205f7cb4d9b300ec4b8 Reviewed-by: Joerg Bornemann --- .../auto/corelib/io/qresourceengine/tst_qresourceengine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index 9de2aabd31..b7e85e8f05 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -29,6 +29,7 @@ #include #include +#include class tst_QResourceEngine: public QObject { @@ -344,6 +345,11 @@ void tst_QResourceEngine::checkStructure() QFETCH(QLocale, locale); QFETCH(qlonglong, contentsSize); + // We rely on the existence of the root "qt-project.org" in resources. For + // static builds on MSVC these resources are only added if they are used. + QMimeDatabase db; + Q_UNUSED(db); + bool directory = (containedDirs.size() + containedFiles.size() > 0); QLocale::setDefault(locale); From 64836ec256e60a40f408c7ca067e82037d435066 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 30 Apr 2018 13:49:44 +0200 Subject: [PATCH 04/11] TestLib: Fix license headers in qabstractitemmodeltester.* Change-Id: Ide05bcdd30cd5f672949aacd5564a4a73c38366d Reviewed-by: Lars Knoll --- src/testlib/qabstractitemmodeltester.cpp | 21 ++++++++++++++++----- src/testlib/qabstractitemmodeltester.h | 21 ++++++++++++++++----- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/testlib/qabstractitemmodeltester.cpp b/src/testlib/qabstractitemmodeltester.cpp index 18ae14be3a..e970be2c8d 100644 --- a/src/testlib/qabstractitemmodeltester.cpp +++ b/src/testlib/qabstractitemmodeltester.cpp @@ -4,9 +4,9 @@ ** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the test suite of the Qt Toolkit. +** This file is part of the QtTest module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -15,13 +15,24 @@ ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/testlib/qabstractitemmodeltester.h b/src/testlib/qabstractitemmodeltester.h index 706c0ac16f..07bc170a7a 100644 --- a/src/testlib/qabstractitemmodeltester.h +++ b/src/testlib/qabstractitemmodeltester.h @@ -3,9 +3,9 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the test suite of the Qt Toolkit. +** This file is part of the QtTest module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -14,13 +14,24 @@ ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** From f72777b969bd74a1472ce8f028da01a82200d656 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Sat, 5 May 2018 14:56:15 +0200 Subject: [PATCH 05/11] QShortcutMap: print ambiguous shortcuts when DEBUG_QSHORTCUTMAP is defined This is useful to see why shortcuts (in Qt Widgets and Qt Quick) are not behaving as expected. For example: The following shortcuts are about to be activated ambiguously: - QKeySequence("Esc") (belonging to QQuickShortcut(0x7fcd4c8e6a70, name = "exploreViewBackOrCloseShortcut")) - QKeySequence("Esc") (belonging to QQuickPopupItem(0x7fcd4c8e5110)) Change-Id: Id20a3017d69cfe417c2286dccf46b3d5ff0b31b2 Reviewed-by: Friedemann Kleint --- src/gui/kernel/qshortcutmap.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index 6c19eab287..fa1eb6f6bf 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -648,10 +648,16 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e) // Find next const QShortcutEntry *current = 0, *next = 0; int i = 0, enabledShortcuts = 0; +#if defined(DEBUG_QSHORTCUTMAP) + QVector ambiguousShortcuts; +#endif while(i < d->identicals.size()) { current = d->identicals.at(i); if (current->enabled || !next){ ++enabledShortcuts; +#if defined(DEBUG_QSHORTCUTMAP) + ambiguousShortcuts.append(current); +#endif if (enabledShortcuts > d->ambigCount + 1) break; next = current; @@ -665,6 +671,13 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e) return; // Dispatch next enabled #if defined(DEBUG_QSHORTCUTMAP) + if (ambiguousShortcuts.size() > 1) { + qDebug() << "The following shortcuts are about to be activated ambiguously:"; + for (const QShortcutEntry *entry : qAsConst(ambiguousShortcuts)) { + qDebug().nospace() << "- " << entry->keyseq << " (belonging to " << entry->owner << ")"; + } + } + qDebug().nospace() << "QShortcutMap::dispatchEvent(): Sending QShortcutEvent(\"" << next->keyseq.toString() << "\", " << next->id << ", " From 8f7dcba204d21444cb0bd00f13fc496bb9420484 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Mon, 7 May 2018 11:34:44 +0900 Subject: [PATCH 06/11] Fix build without features.timezone Change-Id: I3f8421103afa61baf415636b4dc8cf93fb477bcc Reviewed-by: Oswald Buddenhagen --- src/corelib/tools/qdatetimeparser.cpp | 2 ++ src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index 551e01e076..d03518e70d 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -44,7 +44,9 @@ #include "qset.h" #include "qlocale.h" #include "qdatetime.h" +#if QT_CONFIG(timezone) #include "qtimezone.h" +#endif #include "qregexp.h" #include "qdebug.h" diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp index 6375825720..a862e8d2a7 100644 --- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp @@ -55,7 +55,9 @@ #include #include #endif +#if QT_CONFIG(timezone) #include +#endif #include #if defined Q_OS_WIN @@ -438,8 +440,10 @@ static QString timespecToString(const QDateTime &dateTime) return QStringLiteral("Z"); case Qt::OffsetFromUTC: return secondsToOffset(dateTime.offsetFromUtc()); +#if QT_CONFIG(timezone) case Qt::TimeZone: return secondsToOffset(dateTime.timeZone().offsetFromUtc(dateTime)); +#endif default: return QString(); } From 3a912e92bb13463a1118c45f8127682a5d918a90 Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Thu, 3 May 2018 19:31:53 +0300 Subject: [PATCH 07/11] Fix building with -no-feature-shortcut Change-Id: I7576055a6d81d6a7a075ebff16ca6b0ced4e984e Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 4 ++++ src/plugins/platforms/windows/qwindowsmenu.cpp | 6 ++++++ src/widgets/dialogs/qwizard_win.cpp | 2 ++ 3 files changed, 12 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 35f81f0165..950d8ecd36 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -855,8 +855,12 @@ bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, con sendExtendedPressRelease(receiver, qtKey, Qt::KeyboardModifier(state), 0, 0, 0); // QTBUG-43343: Make sure to return false if Qt does not handle the key, otherwise, // the keys are not passed to the active media player. +# if QT_CONFIG(shortcut) const QKeySequence sequence(Qt::Modifier(state) + qtKey); return QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(sequence); +# else + return false; +# endif #else Q_UNREACHABLE(); return false; diff --git a/src/plugins/platforms/windows/qwindowsmenu.cpp b/src/plugins/platforms/windows/qwindowsmenu.cpp index b89e1b66a3..71802b9017 100644 --- a/src/plugins/platforms/windows/qwindowsmenu.cpp +++ b/src/plugins/platforms/windows/qwindowsmenu.cpp @@ -390,6 +390,7 @@ void QWindowsMenuItem::setChecked(bool isChecked) menuItemSetChangeState(parentMenuHandle(), m_id, FALSE, m_checked, MF_CHECKED, MF_UNCHECKED); } +#if QT_CONFIG(shortcut) void QWindowsMenuItem::setShortcut(const QKeySequence &shortcut) { qCDebug(lcQpaMenus) << __FUNCTION__ << '(' << shortcut << ')' << this; @@ -399,6 +400,7 @@ void QWindowsMenuItem::setShortcut(const QKeySequence &shortcut) if (m_parentMenu != nullptr) updateText(); } +#endif void QWindowsMenuItem::setEnabled(bool enabled) { @@ -441,10 +443,12 @@ UINT QWindowsMenuItem::state() const QString QWindowsMenuItem::nativeText() const { QString result = m_text; +#if QT_CONFIG(shortcut) if (!m_shortcut.isEmpty()) { result += QLatin1Char('\t'); result += m_shortcut.toString(QKeySequence::NativeText); } +#endif return result; } @@ -894,8 +898,10 @@ void QWindowsMenuItem::formatDebug(QDebug &d) const d << ", subMenu=" << static_cast(m_subMenu); d << ", tag=" << showbase << hex << tag() << noshowbase << dec << ", id=" << m_id; +#if QT_CONFIG(shortcut) if (!m_shortcut.isEmpty()) d << ", shortcut=" << m_shortcut; +#endif if (m_visible) d << " [visible]"; if (m_enabled) diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index 6f0e436ae0..5ef304c9f1 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -79,7 +79,9 @@ QVistaBackButton::QVistaBackButton(QWidget *widget) { setFocusPolicy(Qt::NoFocus); // Native dialogs use ALT-Left even in RTL mode, so do the same, even if it might be counter-intuitive. +#if QT_CONFIG(shortcut) setShortcut(QKeySequence(Qt::ALT | Qt::Key_Left)); +#endif } QSize QVistaBackButton::sizeHint() const From 807f819357e9e2419ee47e03d76df162ab6365b6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 5 Apr 2018 09:47:48 +0200 Subject: [PATCH 08/11] Manual dialogs test: Add about dialog showing style and scaling Change-Id: I8750956056466d3cfd99903fb5e432ac81223403 Reviewed-by: Andy Shaw --- tests/manual/dialogs/main.cpp | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/manual/dialogs/main.cpp b/tests/manual/dialogs/main.cpp index 3f7b33ee7a..83089e684c 100644 --- a/tests/manual/dialogs/main.cpp +++ b/tests/manual/dialogs/main.cpp @@ -33,10 +33,13 @@ #include "wizardpanel.h" #include "messageboxpanel.h" +#include +#include #include #include #include #include +#include #include #include #include @@ -44,10 +47,40 @@ // Test for dialogs, allowing to play with all dialog options for implementing native dialogs. // Compiles with Qt 4.8 and Qt 5. +class AboutDialog : public QDialog +{ +public: + explicit AboutDialog(QWidget *parent = 0); +}; + +AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent) +{ + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + QFormLayout *mainLayout = new QFormLayout(this); +#if QT_VERSION >= 0x050600 + mainLayout->addRow(new QLabel(QLibraryInfo::build())); +#else + mainLayout->addRow(new QLabel(QLatin1String("Qt ") + QLatin1String(QT_VERSION_STR ))); +#endif + mainLayout->addRow("Style:", new QLabel(qApp->style()->objectName())); +#if QT_VERSION >= 0x050600 + mainLayout->addRow("DPR:", new QLabel(QString::number(qApp->devicePixelRatio()))); +#endif + const QString resolution = QString::number(logicalDpiX()) + QLatin1Char(',') + + QString::number(logicalDpiY()) + QLatin1String("dpi"); + mainLayout->addRow("Resolution:", new QLabel(resolution)); + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + mainLayout->addRow(buttonBox); +} + class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); + +public slots: + void aboutDialog(); }; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) @@ -66,6 +99,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) action->setShortcut(QKeySequence(QKeySequence::Paste)); action = editMenu->addAction(tr("Select All")); action->setShortcut(QKeySequence(QKeySequence::SelectAll)); + QMenu *aboutMenu = menuBar()->addMenu(tr("&About")); + QAction *aboutAction = aboutMenu->addAction(tr("About..."), this, SLOT(aboutDialog())); + aboutAction->setShortcut(Qt::Key_F1); QTabWidget *tabWidget = new QTabWidget; tabWidget->addTab(new FileDialogPanel, tr("QFileDialog")); tabWidget->addTab(new ColorDialogPanel, tr("QColorDialog")); @@ -78,6 +114,13 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) setCentralWidget(tabWidget); } +void MainWindow::aboutDialog() +{ + AboutDialog dialog(this); + dialog.setWindowTitle(tr("About Dialogs")); + dialog.exec(); +} + int main(int argc, char *argv[]) { #if QT_VERSION >= 0x050700 From 09d4faa008d77bc919b46d77f07a4e15a8f6cd21 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 26 Apr 2018 10:32:03 +0200 Subject: [PATCH 09/11] QtGui: Enable synchronous delivery for QWSysIf:::WindowScreenChangedEvent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-67777 Change-Id: I6d52b650fb33283010ef06259da83cdb2fd3483f Reviewed-by: Oliver Wolff Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qwindowsysteminterface.cpp | 5 +++-- src/gui/kernel/qwindowsysteminterface.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 5243ae66a2..c310ab5213 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -258,11 +258,12 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowStateChanged, QWindow *window, Qt: QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } -void QWindowSystemInterface::handleWindowScreenChanged(QWindow *window, QScreen *screen) +QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowScreenChanged, QWindow *window, QScreen *screen) { + QWindowSystemInterfacePrivate::WindowScreenChangedEvent *e = new QWindowSystemInterfacePrivate::WindowScreenChangedEvent(window, screen); - QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } QT_DEFINE_QPA_EVENT_HANDLER(void, handleSafeAreaMarginsChanged, QWindow *window) diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index b22495f9d0..a7cc30be4b 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -205,6 +205,7 @@ public: template static void handleWindowStateChanged(QWindow *window, Qt::WindowStates newState, int oldState = -1); + template static void handleWindowScreenChanged(QWindow *window, QScreen *newScreen); template From c580644fe91148f0cb5fde44d262678ef47c5faa Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Thu, 29 Mar 2018 11:50:58 +0300 Subject: [PATCH 10/11] tests/auto/network: Avoid unconditional qWait()s MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace with QSignalSpy or QTRY_COMPARE when possible. Task-number: QTBUG-63992 Change-Id: I18dc8837301424855487a12ee62451a5aeb21bf0 Reviewed-by: Mårten Nordheim Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qftp/tst_qftp.cpp | 2 -- .../qnetworkreply/tst_qnetworkreply.cpp | 11 +++++----- .../socket/qlocalsocket/tst_qlocalsocket.cpp | 12 ++++++----- .../socket/qtcpsocket/tst_qtcpsocket.cpp | 6 +----- .../network/ssl/qsslsocket/tst_qsslsocket.cpp | 21 +++++-------------- 5 files changed, 19 insertions(+), 33 deletions(-) diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index 1620c2ade6..6e18e1a663 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -2078,8 +2078,6 @@ void tst_QFtp::doneSignal() if (QTestEventLoop::instance().timeout()) QFAIL("Network operation timed out"); - QTest::qWait(200); - QCOMPARE(spy.count(), 1); QCOMPARE(spy.first().first().toBool(), false); } diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 69bd78a4f0..0ef3dc0b61 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -7816,13 +7816,14 @@ void tst_QNetworkReply::closeDuringDownload() QFETCH(QUrl, url); QNetworkRequest request(url); QNetworkReply* reply = manager.get(request); - connect(reply, SIGNAL(readyRead()), &QTestEventLoop::instance(), SLOT(exitLoop())); - QTestEventLoop::instance().enterLoop(10); - QVERIFY(!QTestEventLoop::instance().timeout()); - connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QSignalSpy readyReadSpy(reply, &QNetworkReply::readyRead); + QVERIFY(readyReadSpy.wait(10000)); + QSignalSpy destroySpy(reply, &QObject::destroyed); reply->close(); reply->deleteLater(); - QTest::qWait(1000); //cancelling ftp takes some time, this avoids a warning caused by test's cleanup() destroying the connection cache before the abort is finished + // Wait for destruction to avoid a warning caused by test's cleanup() + // destroying the connection cache before the abort is finished + QVERIFY(destroySpy.wait()); } void tst_QNetworkReply::ftpAuthentication_data() diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 53d260f19e..779d55a77a 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -1225,12 +1225,13 @@ public: socket.write("testing\n"); exec(); } +signals: + void bytesWrittenReceived(); public slots: - void bytesWritten(qint64) { + void bytesWritten(qint64) { + emit bytesWrittenReceived(); exit(); - } - -private: + } }; /* @@ -1248,11 +1249,12 @@ void tst_QLocalSocket::bytesWrittenSignal() QLocalServer server; QVERIFY(server.listen("qlocalsocket_readyread")); WriteThread writeThread; + QSignalSpy receivedSpy(&writeThread, &WriteThread::bytesWrittenReceived); writeThread.start(); bool timedOut = false; QVERIFY(server.waitForNewConnection(3000, &timedOut)); QVERIFY(!timedOut); - QTest::qWait(2000); + QVERIFY(receivedSpy.wait(2000)); QVERIFY(writeThread.wait(2000)); } diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index fc92ed6cbc..263a475435 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -2048,11 +2048,7 @@ void tst_QTcpSocket::connectToLocalHostNoService() // port with no service listening. QTcpSocket *socket = newSocket(); socket->connectToHost("localhost", 31415); // no service running here, one suspects - - while(socket->state() == QTcpSocket::HostLookupState || socket->state() == QTcpSocket::ConnectingState) { - QTest::qWait(100); - } - QCOMPARE(socket->state(), QTcpSocket::UnconnectedState); + QTRY_COMPARE(socket->state(), QTcpSocket::UnconnectedState); delete socket; } #endif diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index bb01116240..de759ae051 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -2908,10 +2908,7 @@ void tst_QSslSocket::qtbug18498_peek2() QScopedPointer server(listener.socket); QVERIFY(server->write("HELLO\r\n", 7)); - QElapsedTimer stopwatch; - stopwatch.start(); - while (client->bytesAvailable() < 7 && stopwatch.elapsed() < 5000) - QTest::qWait(100); + QTRY_COMPARE(client->bytesAvailable(), 7); char c; QCOMPARE(client->peek(&c,1), 1); QCOMPARE(c, 'H'); @@ -2930,8 +2927,7 @@ void tst_QSslSocket::qtbug18498_peek2() bigblock.fill('#', QIODEVICE_BUFFERSIZE + 1024); QVERIFY(client->write(QByteArray("head"))); QVERIFY(client->write(bigblock)); - while (server->bytesAvailable() < bigblock.length() + 4 && stopwatch.elapsed() < 5000) - QTest::qWait(100); + QTRY_COMPARE(server->bytesAvailable(), bigblock.length() + 4); QCOMPARE(server->read(4), QByteArray("head")); QCOMPARE(server->peek(bigblock.length()), bigblock); b.reserve(bigblock.length()); @@ -2947,10 +2943,7 @@ void tst_QSslSocket::qtbug18498_peek2() QCOMPARE(server->readAll(), bigblock); QVERIFY(client->write("STARTTLS\r\n")); - stopwatch.start(); - // ### Qt5 use QTRY_VERIFY - while (server->bytesAvailable() < 10 && stopwatch.elapsed() < 5000) - QTest::qWait(100); + QTRY_COMPARE(server->bytesAvailable(), 10); QCOMPARE(server->peek(&c,1), 1); QCOMPARE(c, 'S'); b = server->peek(3); @@ -2983,9 +2976,7 @@ void tst_QSslSocket::qtbug18498_peek2() client->startClientEncryption(); QVERIFY(server->write("hello\r\n", 7)); - stopwatch.start(); - while (client->bytesAvailable() < 7 && stopwatch.elapsed() < 5000) - QTest::qWait(100); + QTRY_COMPARE(client->bytesAvailable(), 7); QVERIFY(server->mode() == QSslSocket::SslServerMode && client->mode() == QSslSocket::SslClientMode); QCOMPARE(client->peek(&c,1), 1); QCOMPARE(c, 'h'); @@ -2996,9 +2987,7 @@ void tst_QSslSocket::qtbug18498_peek2() QCOMPARE(client->readAll(), QByteArray("ello\r\n")); QVERIFY(client->write("goodbye\r\n")); - stopwatch.start(); - while (server->bytesAvailable() < 9 && stopwatch.elapsed() < 5000) - QTest::qWait(100); + QTRY_COMPARE(server->bytesAvailable(), 9); QCOMPARE(server->peek(&c,1), 1); QCOMPARE(c, 'g'); QCOMPARE(server->readAll(), QByteArray("goodbye\r\n")); From 1b7337d23dbc767ba482d9051180f10d77052913 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 8 May 2018 10:57:10 +0200 Subject: [PATCH 11/11] qlalr: Fix startup crash in static builds Replace the global variables qout, qerr by a functions to delay the initialization. Task-number: QTBUG-68166 Change-Id: Ib023da1bccc7eabc6e633ccb8945e5f209c5765e Reviewed-by: Kevin Funk Reviewed-by: Brett Stottlemyer Reviewed-by: Oswald Buddenhagen --- src/tools/qlalr/cppgenerator.cpp | 12 ++++---- src/tools/qlalr/lalr.cpp | 53 +++++++++++++++++++------------- src/tools/qlalr/lalr.g | 14 ++++----- src/tools/qlalr/lalr.h | 5 ++- src/tools/qlalr/main.cpp | 12 ++++---- src/tools/qlalr/recognizer.cpp | 14 ++++----- 6 files changed, 59 insertions(+), 51 deletions(-) diff --git a/src/tools/qlalr/cppgenerator.cpp b/src/tools/qlalr/cppgenerator.cpp index ed0f53d43e..b14c73a8fe 100644 --- a/src/tools/qlalr/cppgenerator.cpp +++ b/src/tools/qlalr/cppgenerator.cpp @@ -186,7 +186,7 @@ void CppGenerator::operator () () else if (u < 0) { if (verbose) - qout << "*** Warning. Found a reduce/reduce conflict in state " << q << " on token ``" << s << "'' between rule " + qout() << "*** Warning. Found a reduce/reduce conflict in state " << q << " on token ``" << s << "'' between rule " << r << " and " << -u << endl; ++reduce_reduce_conflict_count; @@ -194,7 +194,7 @@ void CppGenerator::operator () () u = qMax (u, -r); if (verbose) - qout << "\tresolved using rule " << -u << endl; + qout() << "\tresolved using rule " << -u << endl; } else if (u > 0) @@ -227,7 +227,7 @@ void CppGenerator::operator () () ++shift_reduce_conflict_count; if (verbose) - qout << "*** Warning. Found a shift/reduce conflict in state " << q << " on token ``" << s << "'' with rule " << r << endl; + qout() << "*** Warning. Found a shift/reduce conflict in state " << q << " on token ``" << s << "'' with rule " << r << endl; } } } @@ -238,10 +238,10 @@ void CppGenerator::operator () () { if (shift_reduce_conflict_count != grammar.expected_shift_reduce || reduce_reduce_conflict_count != grammar.expected_reduce_reduce) - qerr << "*** Conflicts: " << shift_reduce_conflict_count << " shift/reduce, " << reduce_reduce_conflict_count << " reduce/reduce" << endl; + qerr() << "*** Conflicts: " << shift_reduce_conflict_count << " shift/reduce, " << reduce_reduce_conflict_count << " reduce/reduce" << endl; if (verbose) - qout << endl << "*** Conflicts: " << shift_reduce_conflict_count << " shift/reduce, " << reduce_reduce_conflict_count << " reduce/reduce" << endl + qout() << endl << "*** Conflicts: " << shift_reduce_conflict_count << " shift/reduce, " << reduce_reduce_conflict_count << " reduce/reduce" << endl << endl; } @@ -266,7 +266,7 @@ void CppGenerator::operator () () RulePointer rule = grammar.rules.begin () + i; if (rule != grammar.goal) - qerr << "*** Warning: Rule ``" << *rule << "'' is useless!" << endl; + qerr() << "*** Warning: Rule ``" << *rule << "'' is useless!" << endl; } } diff --git a/src/tools/qlalr/lalr.cpp b/src/tools/qlalr/lalr.cpp index 0ccf4c1588..00597d1379 100644 --- a/src/tools/qlalr/lalr.cpp +++ b/src/tools/qlalr/lalr.cpp @@ -40,8 +40,17 @@ #define QLALR_NO_DEBUG_LOOKAHEADS QT_BEGIN_NAMESPACE -QTextStream qerr (stderr, QIODevice::WriteOnly); -QTextStream qout (stdout, QIODevice::WriteOnly); +QTextStream &qerr() +{ + static QTextStream result(stderr, QIODevice::WriteOnly); + return result; +} + +QTextStream &qout() +{ + static QTextStream result(stdout, QIODevice::WriteOnly); + return result; +} bool operator < (Name a, Name b) { @@ -303,7 +312,7 @@ void Automaton::buildNullables () } #ifndef QLALR_NO_DEBUG_NULLABLES - qerr << "nullables = {" << nullables << endl; + qerr() << "nullables = {" << nullables << endl; #endif } @@ -446,7 +455,7 @@ void Automaton::buildLookbackSets () lookbacks.insert (item, Lookback (p, A)); #ifndef QLALR_NO_DEBUG_LOOKBACKS - qerr << "*** (" << id (q) << ", " << *rule << ") lookback (" << id (p) << ", " << *A << ")" << endl; + qerr() << "*** (" << id (q) << ", " << *rule << ") lookback (" << id (p) << ", " << *A << ")" << endl; #endif } } @@ -477,7 +486,7 @@ void Automaton::buildDirectReads () #ifndef QLALR_NO_DEBUG_DIRECT_READS for (QMap::iterator dr = q->reads.begin (); dr != q->reads.end (); ++dr) - qerr << "*** DR(" << id (q) << ", " << dr.key () << ") = " << dr.value () << endl; + qerr() << "*** DR(" << id (q) << ", " << dr.key () << ") = " << dr.value () << endl; #endif } } @@ -506,11 +515,11 @@ void Automaton::buildReadsDigraph () source->insertEdge (target); #ifndef QLALR_NO_DEBUG_READS - qerr << "*** "; - dump (qerr, source); - qerr << " reads "; - dump (qerr, target); - qerr << endl; + qerr() << "*** "; + dump (qerr(), source); + qerr() << " reads "; + dump (qerr(), target); + qerr() << endl; #endif } } @@ -545,7 +554,7 @@ void Automaton::visitReadNode (ReadNode node) _M_reads_stack.push (node); #ifndef QLALR_NO_DEBUG_INCLUDES - // qerr << "*** Debug. visit node (" << id (node->data.state) << ", " << node->data.nt << ") N = " << N << endl; + // qerr() << "*** Debug. visit node (" << id (node->data.state) << ", " << node->data.nt << ") N = " << N << endl; #endif for (ReadsGraph::edge_iterator edge = node->begin (); edge != node->end (); ++edge) @@ -625,7 +634,7 @@ void Automaton::buildIncludesDigraph () source->insertEdge (target); #ifndef QLALR_NO_DEBUG_INCLUDES - qerr << "*** (" << id (p) << ", " << *A << ") includes (" << id (pp) << ", " << *name << ")" << endl; + qerr() << "*** (" << id (p) << ", " << *A << ") includes (" << id (pp) << ", " << *name << ")" << endl; #endif // QLALR_NO_DEBUG_INCLUDES continue; @@ -647,7 +656,7 @@ void Automaton::buildIncludesDigraph () source->insertEdge (target); #ifndef QLALR_NO_DEBUG_INCLUDES - qerr << "*** (" << id (p) << ", " << *A << ") includes (" << id (pp) << ", " << *name << ")" << endl; + qerr() << "*** (" << id (p) << ", " << *A << ") includes (" << id (pp) << ", " << *name << ")" << endl; #endif // QLALR_NO_DEBUG_INCLUDES } } @@ -664,7 +673,7 @@ void Automaton::visitIncludeNode (IncludeNode node) _M_includes_stack.push (node); #ifndef QLALR_NO_DEBUG_INCLUDES - // qerr << "*** Debug. visit node (" << id (node->data.state) << ", " << node->data.nt << ") N = " << N << endl; + // qerr() << "*** Debug. visit node (" << id (node->data.state) << ", " << node->data.nt << ") N = " << N << endl; #endif for (IncludesGraph::edge_iterator edge = node->begin (); edge != node->end (); ++edge) @@ -676,11 +685,11 @@ void Automaton::visitIncludeNode (IncludeNode node) node->dfn = qMin (N, r->dfn); #ifndef QLALR_NO_DEBUG_INCLUDES - qerr << "*** Merge. follows"; - dump (qerr, node); - qerr << " += follows"; - dump (qerr, r); - qerr << endl; + qerr() << "*** Merge. follows"; + dump (qerr(), node); + qerr() << " += follows"; + dump (qerr(), r); + qerr() << endl; #endif NameSet &dst = node->data.state->follows [node->data.nt]; @@ -714,9 +723,9 @@ void Automaton::buildLookaheads () StatePointer q = lookback.state; #ifndef QLALR_NO_DEBUG_LOOKAHEADS - qerr << "(" << id (p) << ", " << *item->rule << ") lookbacks "; - dump (qerr, lookback); - qerr << " with follows (" << id (q) << ", " << lookback.nt << ") = " << q->follows [lookback.nt] << endl; + qerr() << "(" << id (p) << ", " << *item->rule << ") lookbacks "; + dump (qerr(), lookback); + qerr() << " with follows (" << id (q) << ", " << lookback.nt << ") = " << q->follows [lookback.nt] << endl; #endif lookaheads [item].insert (q->follows [lookback.nt].begin (), q->follows [lookback.nt].end ()); diff --git a/src/tools/qlalr/lalr.g b/src/tools/qlalr/lalr.g index 5e335c5a3b..05d30c21fd 100644 --- a/src/tools/qlalr/lalr.g +++ b/src/tools/qlalr/lalr.g @@ -261,7 +261,7 @@ int Recognizer::nextToken() if (ch == QLatin1Char ('"')) inp (); else - qerr << _M_input_file << ":" << _M_line << ": Warning. Expected `\"'" << endl; + qerr() << _M_input_file << ":" << _M_line << ": Warning. Expected `\"'" << endl; _M_current_value = text; return (token = STRING_LITERAL); @@ -314,7 +314,7 @@ int Recognizer::nextToken() return (token = PREC); else { - qerr << _M_input_file << ":" << _M_line << ": Unknown keyword `" << text << "'" << endl; + qerr() << _M_input_file << ":" << _M_line << ": Unknown keyword `" << text << "'" << endl; exit (EXIT_FAILURE); return (token = ERROR); } @@ -439,7 +439,7 @@ bool Recognizer::parse (const QString &input_file) QFile file(_M_input_file); if (! file.open(QFile::ReadOnly)) { - qerr << "qlalr: no input file\n"; + qerr() << "qlalr: no input file\n"; return false; } @@ -659,7 +659,7 @@ case $rule_number: { if (_M_grammar->terminals.find (_M_current_rule->lhs) != _M_grammar->terminals.end ()) { - qerr << _M_input_file << ":" << _M_line << ": Invalid non terminal `" << *_M_current_rule->lhs << "'" << endl; + qerr() << _M_input_file << ":" << _M_line << ": Invalid non terminal `" << *_M_current_rule->lhs << "'" << endl; return false; } @@ -683,7 +683,7 @@ case $rule_number: { if (_M_grammar->terminals.find (_M_current_rule->lhs) != _M_grammar->terminals.end ()) { - qerr << _M_input_file << ":" << _M_line << ": Invalid non terminal `" << *_M_current_rule->lhs << "'" << endl; + qerr() << _M_input_file << ":" << _M_line << ": Invalid non terminal `" << *_M_current_rule->lhs << "'" << endl; return false; } @@ -712,7 +712,7 @@ case $rule_number: { Name tok = _M_grammar->intern (sym(2)); if (! _M_grammar->isTerminal (tok)) { - qerr << _M_input_file << ":" << _M_line << ": `" << *tok << " is not a terminal symbol" << endl; + qerr() << _M_input_file << ":" << _M_line << ": `" << *tok << " is not a terminal symbol" << endl; _M_current_rule->prec = _M_grammar->names.end (); } else @@ -758,7 +758,7 @@ case $rule_number: { } } - qerr << _M_input_file << ":" << _M_line << ": Syntax error" << endl; + qerr() << _M_input_file << ":" << _M_line << ": Syntax error" << endl; return false; } diff --git a/src/tools/qlalr/lalr.h b/src/tools/qlalr/lalr.h index b303b897d4..6a2baaa462 100644 --- a/src/tools/qlalr/lalr.h +++ b/src/tools/qlalr/lalr.h @@ -501,9 +501,8 @@ QTextStream &operator << (QTextStream &out, const Item &item); QTextStream &operator << (QTextStream &out, const NameSet &ns); QT_BEGIN_NAMESPACE -// ... hmm -extern QTextStream qerr; -extern QTextStream qout; +QTextStream &qerr(); +QTextStream &qout(); QT_END_NAMESPACE #endif // LALR_H diff --git a/src/tools/qlalr/main.cpp b/src/tools/qlalr/main.cpp index c16bdcdf17..5971eb201d 100644 --- a/src/tools/qlalr/main.cpp +++ b/src/tools/qlalr/main.cpp @@ -44,7 +44,7 @@ static void help_me () { - qerr << "Usage: qlalr [options] [input file name]" << endl + qerr() << "Usage: qlalr [options] [input file name]" << endl << endl << " --help, -h\t\tdisplay this help and exit" << endl << " --verbose, -v\t\tverbose output" << endl @@ -91,7 +91,7 @@ int main (int argc, char *argv[]) file_name = arg; else - qerr << "*** Warning. Ignore argument `" << arg << "'" << endl; + qerr() << "*** Warning. Ignore argument `" << arg << "'" << endl; } if (file_name.isEmpty ()) @@ -108,13 +108,13 @@ int main (int argc, char *argv[]) if (grammar.rules.isEmpty ()) { - qerr << "*** Fatal. No rules!" << endl; + qerr() << "*** Fatal. No rules!" << endl; exit (EXIT_FAILURE); } else if (grammar.start == grammar.names.end ()) { - qerr << "*** Fatal. No start symbol!" << endl; + qerr() << "*** Fatal. No start symbol!" << endl; exit (EXIT_FAILURE); } @@ -131,13 +131,13 @@ int main (int argc, char *argv[]) if (generate_dot) { - DotGraph genDotFile (qout); + DotGraph genDotFile (qout()); genDotFile (&aut); } else if (generate_report) { - ParseTable genParseTable (qout); + ParseTable genParseTable (qout()); genParseTable(&aut); } diff --git a/src/tools/qlalr/recognizer.cpp b/src/tools/qlalr/recognizer.cpp index 8c7665f1b9..ab797c85d0 100644 --- a/src/tools/qlalr/recognizer.cpp +++ b/src/tools/qlalr/recognizer.cpp @@ -97,7 +97,7 @@ int Recognizer::nextToken() if (ch == QLatin1Char ('"')) inp (); else - qerr << _M_input_file << ":" << _M_line << ": Warning. Expected `\"'" << endl; + qerr() << _M_input_file << ":" << _M_line << ": Warning. Expected `\"'" << endl; _M_current_value = text; return (token = STRING_LITERAL); @@ -150,7 +150,7 @@ int Recognizer::nextToken() return (token = PREC); else { - qerr << _M_input_file << ":" << _M_line << ": Unknown keyword `" << text << "'" << endl; + qerr() << _M_input_file << ":" << _M_line << ": Unknown keyword `" << text << "'" << endl; exit (EXIT_FAILURE); return (token = ERROR); } @@ -275,7 +275,7 @@ bool Recognizer::parse (const QString &input_file) QFile file(_M_input_file); if (! file.open(QFile::ReadOnly)) { - qerr << "qlalr: no input file\n"; + qerr() << "qlalr: no input file\n"; return false; } @@ -405,7 +405,7 @@ case 34: { if (_M_grammar->terminals.find (_M_current_rule->lhs) != _M_grammar->terminals.end ()) { - qerr << _M_input_file << ":" << _M_line << ": Invalid non terminal `" << *_M_current_rule->lhs << "'" << endl; + qerr() << _M_input_file << ":" << _M_line << ": Invalid non terminal `" << *_M_current_rule->lhs << "'" << endl; return false; } @@ -420,7 +420,7 @@ case 38: { if (_M_grammar->terminals.find (_M_current_rule->lhs) != _M_grammar->terminals.end ()) { - qerr << _M_input_file << ":" << _M_line << ": Invalid non terminal `" << *_M_current_rule->lhs << "'" << endl; + qerr() << _M_input_file << ":" << _M_line << ": Invalid non terminal `" << *_M_current_rule->lhs << "'" << endl; return false; } @@ -443,7 +443,7 @@ case 40: { Name tok = _M_grammar->intern (sym(2)); if (! _M_grammar->isTerminal (tok)) { - qerr << _M_input_file << ":" << _M_line << ": `" << *tok << " is not a terminal symbol" << endl; + qerr() << _M_input_file << ":" << _M_line << ": `" << *tok << " is not a terminal symbol" << endl; _M_current_rule->prec = _M_grammar->names.end (); } else @@ -474,7 +474,7 @@ case 43: { } } - qerr << _M_input_file << ":" << _M_line << ": Syntax error" << endl; + qerr() << _M_input_file << ":" << _M_line << ": Syntax error" << endl; return false; }