From a9d903d18f668a6827149f82816caf96ac6365a2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 5 Apr 2018 21:29:53 -0700 Subject: QSemaphore: Fix 64-bit Linux QSemaphores initialized to non-zero MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original design for the 64-bit futex had the token count replicated in the high part. But the constructor wasn't setting it. This is one of the issues I had noticed when investigating QTBUG-66875, but didn't need to address since the the fix I ended up applying in commit 081c001deb75fa38385d3ff8cbbdb4f788529133 made that unnecessary: the high part only had the number of waiters. Unfortunately, when commit f502270c0f06daba75c1da381bd1658d81aa7bba brought back the token count in the high part, I failed to correct that problem. As a consequence, every QSemaphore that was initialized in the constructor to a non-zero value would eventually deadlock. This commit fixes that oversight. Task-number: QTBUG-67481 Change-Id: I662b8f168c74440ab1a8fffd1522be6b85adb4d0 Reviewed-by: Lars Knoll Reviewed-by: Mårten Nordheim Reviewed-by: Svenn-Arne Dragly --- src/corelib/thread/qsemaphore.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp index c440d6db39..e91e859975 100644 --- a/src/corelib/thread/qsemaphore.cpp +++ b/src/corelib/thread/qsemaphore.cpp @@ -291,10 +291,14 @@ public: QSemaphore::QSemaphore(int n) { Q_ASSERT_X(n >= 0, "QSemaphore", "parameter 'n' must be non-negative"); - if (futexAvailable()) - u.store(n); - else + if (futexAvailable()) { + quintptr nn = unsigned(n); + if (futexHasWaiterCount) + nn |= quint64(nn) << 32; // token count replicated in high word + u.store(nn); + } else { d = new QSemaphorePrivate(n); + } } /*! -- cgit v1.2.3 From b49a2e671a6c01bec0f0140a81f5501074ec8856 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Tue, 3 Apr 2018 13:41:41 +0300 Subject: tst_QPrinter: Use qWaitForWindowActive() to wait for dialog Instead of an unconditional wait. The QSKIP is necessary because the PDF format is non-native and the Windows implementation of QPrintDialog doesn't work then. The macOS implementation has the same warning, so add the check for that OS as well. The test has previously passed, since it hasn't seen not actually opening the dialog as an issue. Change-Id: Ib53e378b232580358f13e0c5206404412f9e6ee2 Reviewed-by: Friedemann Kleint --- tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index 88bae686ab..f68cf5c59c 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -592,10 +592,14 @@ void tst_QPrinter::printDialogCompleter() { QPrintDialog dialog; dialog.printer()->setOutputFileName(testPdfFileName(QLatin1String("file"))); +#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN) + if (dialog.printer()->outputFormat() != QPrinter::NativeFormat) + QSKIP("Dialog cannot be used with non-native formats"); +#endif dialog.setEnabledOptions(QAbstractPrintDialog::PrintToFile); dialog.show(); - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowActive(&dialog)); QTest::keyClick(&dialog, Qt::Key_Tab); QTest::keyClick(&dialog, 'P'); -- cgit v1.2.3 From 335754d0a329bc2ad845b68b40833bbd8428084a Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 6 Apr 2018 14:53:38 +0200 Subject: Fix license header for tst_toolingsupport.cpp Change-Id: Id355afc8eb57a40a0f8d06fa2920f03d94ef9337 Reviewed-by: Joerg Bornemann Reviewed-by: hjk --- tests/auto/other/toolsupport/tst_toolsupport.cpp | 25 ++++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp index a78bdc34f1..f31a755f9e 100644 --- a/tests/auto/other/toolsupport/tst_toolsupport.cpp +++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp @@ -3,27 +3,26 @@ ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** -** This file is part of Qt Creator. +** This file is part of the test suite of the Qt Toolkit. ** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** $QT_END_LICENSE$ ** ****************************************************************************/ -- cgit v1.2.3 From 23b2d2ada5b1b66ad65eda10d70b5b48d32ef9c5 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 5 Mar 2018 16:19:40 +0100 Subject: Doc: Update Event Transitions Example - added screenshot - some modifications to the text Task-number QTBUG-60635 Change-Id: I57b269f93cdba696b424b5ba008d0f46ac612cda Reviewed-by: Martin Smith --- doc/src/images/transitions.png | Bin 0 -> 4314 bytes examples/widgets/doc/src/eventtransitions.qdoc | 27 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 doc/src/images/transitions.png diff --git a/doc/src/images/transitions.png b/doc/src/images/transitions.png new file mode 100644 index 0000000000..b29466f5ab Binary files /dev/null and b/doc/src/images/transitions.png differ diff --git a/examples/widgets/doc/src/eventtransitions.qdoc b/examples/widgets/doc/src/eventtransitions.qdoc index 2c59d0863d..4d332c0e00 100644 --- a/examples/widgets/doc/src/eventtransitions.qdoc +++ b/examples/widgets/doc/src/eventtransitions.qdoc @@ -29,17 +29,29 @@ \example statemachine/eventtransitions \title Event Transitions Example - \brief The Event Transitions example shows how to use event transitions, a - feature of \l{The State Machine Framework}. + \brief The Event Transitions example shows how to use event transitions, + a feature of \l{The State Machine Framework}. + + The Event Transitions Example illustrates how states change when a + user enters or leaves the area of a button. The states are handled by + a QStateMachine object. The screen consists of a QVBoxLayout with a + central button. + + When the mouse is outside the button, the text in the button displays + "Outside". When the mouse enters the button, it displays "Inside". + + \borderedimage transitions.png \snippet statemachine/eventtransitions/main.cpp 0 The \c Window class's constructors begins by creating a button. + This button is added to \c layout, which is a QVBoxLayout object. + Then two states are created: \s1 is the state + "Outside", and \c s2 is the state "Inside". \snippet statemachine/eventtransitions/main.cpp 1 - Two states, \c s1 and \c s2, are created; upon entry they will assign - "Outside" and "Inside" to the button's text, respectively. + State \c s1 is the state "Outside" and state \c s2 is state "Inside". \snippet statemachine/eventtransitions/main.cpp 2 @@ -54,11 +66,11 @@ \snippet statemachine/eventtransitions/main.cpp 4 - Next, the state \c s3 is created. \c s3 will be entered when the button + Next, state \c s3 is created. \c s3 will be entered when the button receives an event of type QEvent::MouseButtonPress and the state machine is in state \c s2. When the button receives an event of type QEvent::MouseButtonRelease and the state machine is in state \c s3, the - machine will transition back to state \c s2. + machine will revert to state \c s2. \snippet statemachine/eventtransitions/main.cpp 5 @@ -67,6 +79,7 @@ \snippet statemachine/eventtransitions/main.cpp 6 - The main() function constructs a Window object and shows it. + The main() function constructs a Window object that displays the QVBoxLayout + object \c layout with its \c button. */ -- cgit v1.2.3 From cb577004566e66c65bcdf53b5a84f0a41f039174 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 8 Mar 2018 14:29:06 +0100 Subject: Doc: Update Find Files example - review text - update screenshot Task-number: QTBUG-60635 Change-Id: I596ce0e08be9ed9aea7834eeda1c3c2c19c28d7a Reviewed-by: Paul Wicking Reviewed-by: Venugopal Shivashankar --- doc/src/images/findfiles-example.png | Bin 11219 -> 11174 bytes examples/widgets/doc/src/findfiles.qdoc | 105 ++++++++++++++++++++------------ 2 files changed, 66 insertions(+), 39 deletions(-) diff --git a/doc/src/images/findfiles-example.png b/doc/src/images/findfiles-example.png index acb5ea1abf..cf3885c015 100644 Binary files a/doc/src/images/findfiles-example.png and b/doc/src/images/findfiles-example.png differ diff --git a/examples/widgets/doc/src/findfiles.qdoc b/examples/widgets/doc/src/findfiles.qdoc index a2eb326519..ad39b003ae 100644 --- a/examples/widgets/doc/src/findfiles.qdoc +++ b/examples/widgets/doc/src/findfiles.qdoc @@ -30,43 +30,74 @@ \title Find Files Example \ingroup examples-dialogs - \brief The Find Files example shows how to use QProgressDialog to provide - feedback on the progress of a slow operation. The example also - shows how to use QFileDialog to facilitate browsing, how to use - QTextStream's streaming operators to read a file, and how to use - QTableWidget to provide standard table display facilities for - applications. In addition, files can be opened using the - QDesktopServices class. + \brief A dialog for finding files in a specified folder + + The Find Files application allows the user to search for files in a + specified directory, matching a given file name or wildcard, + and containing a specified string (if filled in). The search + result is displayed in a table containing the names of the files + and their sizes. The application also shows the number of files found. + + The Find Files example illustrates the use of several classes: + + \table + \row + \li QProgressDialog + \li Provide feedback on the progress of a search operation + \row + \li QFileDialog + \li Browse through a file list + \row + \li QTextStream + \li Use stream operators to read a file + \row + \li QTableWidget + \li Browse through the search results in a table + \row + \li QDesktopServices + \li Open files in the result list in a suitable application + \endtable \image findfiles-example.png Screenshot of the Find Files example - With the Find Files application the user can search for files in a - specified directory, matching a specified file name (using wild - cards if appropriate) and containing a specified text. - - The user is provided with a \uicontrol Browse option, and the result of - the search is displayed in a table with the names of the files - found and their sizes. In addition the application provides a - total count of the files found. \section1 Window Class Definition The \c Window class inherits QWidget, and is the main application - widget. It shows the search options, and displays the search + widget. It shows the search options and displays the search results. \snippet dialogs/findfiles/window.h 0 - We need two private slots: The \c browse() slot is called whenever - the user wants to browse for a directory to search in, and the \c - find() slot is called whenever the user requests a search to be - performed by pressing the \uicontrol Find button. - - In addition we declare several private functions: We use the \c - findFiles() function to search for files matching the user's - specifications, we call the \c showFiles() function to display the - results, and we use \c createButton(), \c createComboBox() and \c - createFilesTable() when we are constructing the widget. + The application has two private slots: + \table + \row + \li The \c browse() slot + \li Called whenever the user wants to browse for a directory to search in + \row + \li The \c find() slot + \li Called whenever the user launches a search with the \uicontrol Find button + \endtable + + In addition we declare several private functions: + + \table + \row + \li findFiles() + \li Search for files matching the search parameters + \row + \li showFiles() + \li Display the search result + \row + \li ceateButton() + \li Construct the widget + \row + \li createComboBox() + \li Construct the widget + \row + \li createFilesTable() + \li Construct the widget + \endtable \section1 Window Class Implementation @@ -103,11 +134,11 @@ Here we use the static QFileDialog::getExistingDirectory() function which returns an existing directory selected by the user. Then we display the directory in the directory combobox - using the QComboBox::addItem() function, and updates the current + using the QComboBox::addItem() function and update the current index. QComboBox::addItem() adds an item to the combobox with the given - text (if it is not already present in the list), and containing + text (if not already present in the list), and containing the specified userData. The item is appended to the list of existing items. @@ -118,13 +149,13 @@ First we eliminate any previous search results by setting the table widgets row count to zero. Then we retrieve the - specified file name, text and directory path from the respective + specified file name, text, and directory path from the respective comboboxes. \snippet dialogs/findfiles/window.cpp 4 We use the directory's path to create a QDir; the QDir class - provides access to directory structures and their contents. + provides access to the directory structure and its contents. We use QDirIterator to iterate over the files that match the specified file name and build a QStringList of paths. @@ -144,15 +175,11 @@ In the private \c findFiles() function we search through a list of files, looking for the ones that contain a specified text. This can be a very slow operation depending on the number of files as - well as their sizes. In case there are a large number of files, or - there exists some large files on the list, we provide a - QProgressDialog. - - The QProgressDialog class provides feedback on the progress of a - slow operation. It is used to give the user an indication of how - long an operation is going to take, and to demonstrate that the - application has not frozen. It can also give the user an - opportunity to abort the operation. + well as their sizes. QProgressDialog displays a progress dialog + if the application has to search through a large number of files, + or if some of the files have a large size. QProgressDialog can + also allow the user to abort the operation if it takes too much + time. \snippet dialogs/findfiles/window.cpp 6 -- cgit v1.2.3 From 5c240f380aa936a4f0a781c035fcd148cd4b3720 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 12 Mar 2018 16:51:01 +0100 Subject: Doc: Add brief statements to Address Book Example chapters Task-number: QTBUG-60635 Change-Id: Ice6d2b6a475ba4352a87bb46366826334aed2af2 Reviewed-by: Paul Wicking Reviewed-by: Venugopal Shivashankar --- examples/widgets/doc/src/addressbook-tutorial.qdoc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/widgets/doc/src/addressbook-tutorial.qdoc b/examples/widgets/doc/src/addressbook-tutorial.qdoc index 31d1d64dac..1f6966e8ae 100644 --- a/examples/widgets/doc/src/addressbook-tutorial.qdoc +++ b/examples/widgets/doc/src/addressbook-tutorial.qdoc @@ -80,7 +80,7 @@ /*! \example tutorials/addressbook/part1 \title Part 1 - Designing the User Interface - + \brief Describes how to code the user interface of the Address Book Example. This first part covers the design of the basic graphical user interface (GUI) for our address book application. @@ -232,6 +232,7 @@ /*! \example tutorials/addressbook/part2 \title Part 2 - Adding Addresses + \brief Describes the code for inserting records in the Address Book Example. The next step in creating the address book is to implement some user interactions. @@ -381,9 +382,10 @@ /*! \example tutorials/addressbook/part3 \title Part 3 - Navigating between Entries + \brief Explains the code that enables navigating the contacts. The address book is now about half complete. We should add the - capability to navigate among the contacts, but first we must + capability to navigate the contacts, but first we must decide what sort of a data structure we need for containing these contacts. @@ -496,6 +498,7 @@ /*! \example tutorials/addressbook/part4 \title Part 4 - Editing and Removing Addresses + \brief Explains how to add edit and remove functionality. Now we look at ways to modify the contents of contacts stored in the address book. @@ -628,6 +631,7 @@ /*! \example tutorials/addressbook/part5 \title Part 5 - Adding a Find Function + \brief Describes how to add a find function. Here we look at ways to locate contacts and addresses in the address book. @@ -770,6 +774,7 @@ /*! \example tutorials/addressbook/part6 \title Part 6 - Loading and Saving + \brief Describes how to add save and load functionality. This part covers the Qt file handling features we use to write loading and saving routines for the address book. @@ -890,6 +895,7 @@ /*! \example tutorials/addressbook/part7 \title Part 7 - Additional Features + \brief Describes how to export data in VCard format. This part covers some additional features that make the address book more convenient for the frequent user. -- cgit v1.2.3 From 5ffd47b76418eb4ef3369a78471cd6567c4659d0 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 20 Mar 2018 10:41:04 +0100 Subject: Doc: Update connect syntax in I18n Widgets Example Task-number: QTBUG-60635 Change-Id: Icfa0d09ac6c9ad4396fbe1138277bb1dd866a803 Reviewed-by: Paul Wicking Reviewed-by: Venugopal Shivashankar --- examples/widgets/tools/i18n/languagechooser.cpp | 9 ++++++--- examples/widgets/tools/i18n/mainwindow.cpp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/widgets/tools/i18n/languagechooser.cpp b/examples/widgets/tools/i18n/languagechooser.cpp index 83aafe6b8a..58cf9d4047 100644 --- a/examples/widgets/tools/i18n/languagechooser.cpp +++ b/examples/widgets/tools/i18n/languagechooser.cpp @@ -70,7 +70,10 @@ LanguageChooser::LanguageChooser(const QString& defaultLang, QWidget *parent) for (int i = 0; i < qmFiles.size(); ++i) { QCheckBox *checkBox = new QCheckBox(languageName(qmFiles[i])); qmFileForCheckBoxMap.insert(checkBox, qmFiles[i]); - connect(checkBox, SIGNAL(toggled(bool)), this, SLOT(checkBoxToggled())); + connect(checkBox, + QOverload::of(&QCheckBox::toggled), + this, + &LanguageChooser::checkBoxToggled); if (languageMatch(defaultLang, qmFiles[i])) checkBox->setCheckState(Qt::Checked); groupBoxLayout->addWidget(checkBox, i / 2, i % 2); @@ -84,8 +87,8 @@ LanguageChooser::LanguageChooser(const QString& defaultLang, QWidget *parent) hideAllButton = buttonBox->addButton("Hide All", QDialogButtonBox::ActionRole); - connect(showAllButton, SIGNAL(clicked()), this, SLOT(showAll())); - connect(hideAllButton, SIGNAL(clicked()), this, SLOT(hideAll())); + connect(showAllButton, &QAbstractButton::clicked, this, &LanguageChooser::showAll); + connect(hideAllButton, &QAbstractButton::clicked, this, &LanguageChooser::hideAll); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(groupBox); diff --git a/examples/widgets/tools/i18n/mainwindow.cpp b/examples/widgets/tools/i18n/mainwindow.cpp index d5de81cab7..6ebfddfa98 100644 --- a/examples/widgets/tools/i18n/mainwindow.cpp +++ b/examples/widgets/tools/i18n/mainwindow.cpp @@ -76,7 +76,7 @@ MainWindow::MainWindow() centralWidget->setLayout(mainLayout); exitAction = new QAction(tr("E&xit"), this); - connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); + connect(exitAction, &QAction::triggered, qApp, QApplication::quit); fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->setPalette(QPalette(Qt::red)); -- cgit v1.2.3 From b451c9dfdc1421e202b5ce9c2e06931fc0c4c215 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 6 Apr 2018 14:37:22 +0200 Subject: tst_QTouchEvent: Wait for window exposed instead of active MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes the tests pass on Wayland compositors that don't automatically give focus to newly created windows. Such as a headless Weston, which is very useful for testing. Task-number: QTBUG-66846 Change-Id: I502504b333499c89be193a3ebc19d41264a13580 Reviewed-by: Shawn Rutledge Reviewed-by: Jan Arve Sæther --- tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index d16d95500b..db5e83e2c7 100644 --- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -608,7 +608,7 @@ void tst_QTouchEvent::basicRawEventTranslation() touchWidget.setAttribute(Qt::WA_AcceptTouchEvents); touchWidget.setGeometry(100, 100, 400, 300); touchWidget.show(); - QVERIFY(QTest::qWaitForWindowActive(&touchWidget)); + QVERIFY(QTest::qWaitForWindowExposed(&touchWidget)); QPointF pos = touchWidget.rect().center(); QPointF screenPos = touchWidget.mapToGlobal(pos.toPoint()); @@ -741,7 +741,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen() rightWidget.setGeometry(300, 100, 100, 100); touchWidget.show(); - QVERIFY(QTest::qWaitForWindowActive(&touchWidget)); + QVERIFY(QTest::qWaitForWindowExposed(&touchWidget)); QPointF leftPos = leftWidget.rect().center(); QPointF rightPos = rightWidget.rect().center(); @@ -968,7 +968,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() rightWidget.setGeometry(300, 100, 100, 100); touchWidget.show(); - QVERIFY(QTest::qWaitForWindowActive(&touchWidget)); + QVERIFY(QTest::qWaitForWindowExposed(&touchWidget)); QPointF leftPos = leftWidget.rect().center(); QPointF rightPos = rightWidget.rect().center(); @@ -1184,7 +1184,7 @@ void tst_QTouchEvent::basicRawEventTranslationOfIds() touchWidget.setAttribute(Qt::WA_AcceptTouchEvents); touchWidget.setGeometry(100, 100, 400, 300); touchWidget.show(); - QVERIFY(QTest::qWaitForWindowActive(&touchWidget)); + QVERIFY(QTest::qWaitForWindowExposed(&touchWidget)); QVarLengthArray pos; QVarLengthArray screenPos; -- cgit v1.2.3 From 1b109dbd917e7e4627177f375f17e60257486520 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 6 Apr 2018 12:50:02 +0200 Subject: tst_QClipboard: Skip on Wayland, as it requires real input events On Wayland, manipulating the clipboard requires an input event serial, which is not possible to get unless the compositor sends us input events. Change-Id: If5231a5db85f8d6ad988ea93f240cee0c3466f9f Reviewed-by: Friedemann Kleint --- tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp index 87fd5c0dc6..993ebbaac6 100644 --- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp @@ -41,10 +41,8 @@ class tst_QClipboard : public QObject { Q_OBJECT private slots: -#ifdef QT_NO_CLIPBOARD void initTestCase(); - void cleanupTestCase(); -#else +#if QT_CONFIG(clipboard) void init(); #if defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_QNX) void copy_exit_paste(); @@ -58,19 +56,16 @@ private slots: #endif }; -#ifdef QT_NO_CLIPBOARD void tst_QClipboard::initTestCase() { +#if !QT_CONFIG(clipboard) QSKIP("This test requires clipboard support"); +#endif + if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) + QSKIP("Wayland: Manipulating the clipboard requires real input events. Can't auto test."); } -void tst_QClipboard::cleanupTestCase() -{ - QSKIP("This test requires clipboard support"); -} - -#else - +#if QT_CONFIG(clipboard) void tst_QClipboard::init() { #if QT_CONFIG(process) @@ -436,7 +431,7 @@ void tst_QClipboard::clearBeforeSetText() QCOMPARE(QGuiApplication::clipboard()->text(), text); } -#endif +#endif // QT_CONFIG(clipboard) QTEST_MAIN(tst_QClipboard) -- cgit v1.2.3 From 1c92bb87fe4d32265b3c6d33b6e548bd41635c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 20 Mar 2018 12:01:48 +0100 Subject: Fix TlsV1SslV3 case in the WinRT SSL backend It would previously only enable TLS v1.0, but it should also enable SSL v3. According to Microsoft's documentation[0] that is exactly what "SocketProtectionLevel_Ssl" does. [0]: https://docs.microsoft.com/en-us/uwp/api/windows.networking.sockets.socketprotectionlevel Change-Id: Id48f1ad310d994b8379116c9fa2102db858d7f69 Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslsocket_winrt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/ssl/qsslsocket_winrt.cpp b/src/network/ssl/qsslsocket_winrt.cpp index ff9dccc734..53a8a8b61b 100644 --- a/src/network/ssl/qsslsocket_winrt.cpp +++ b/src/network/ssl/qsslsocket_winrt.cpp @@ -236,9 +236,9 @@ void QSslSocketBackendPrivate::startClientEncryption() switch (q->protocol()) { case QSsl::AnyProtocol: case QSsl::SslV3: + case QSsl::TlsV1SslV3: protectionLevel = SocketProtectionLevel_Ssl; // Only use this value if weak cipher support is required break; - case QSsl::TlsV1SslV3: case QSsl::TlsV1_0: protectionLevel = SocketProtectionLevel_Tls10; break; -- cgit v1.2.3 From f5a624c9b94455bebd7eb8fabbb300c4793fe6df Mon Sep 17 00:00:00 2001 From: Mikhail Svetkin Date: Thu, 5 Apr 2018 15:08:15 +0200 Subject: Fix integer overflow (1 << 31) On platforms where integer by default is int32(max is 2147483647) and (1 << 31) will be 2147483648 Change-Id: I59ccb5344d5ad7d085f01bbc7cebdf6152ff7755 Reviewed-by: Jesus Fernandez Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/gui/text/qfontdatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 404a722e29..a4e5130937 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -2889,7 +2889,7 @@ Q_GUI_EXPORT QStringList qt_sort_families_by_writing_system(QChar::Script script uint order = i; if (testFamily == nullptr || (testFamily->writingSystems[writingSystem] & QtFontFamily::Supported) == 0) { - order |= 1 << 31; + order |= 1u << 31; } supported.insert(order, family); -- cgit v1.2.3 From 5c4e5032b5162341168c1cec09f0247c7f2283e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 26 Mar 2018 15:19:17 +0200 Subject: Unblacklist qsslkey for Linux Except RHEL-6.6 and 7.4 It was blacklisted in f3939d943ed132eaf3daead797d961c3ffbc31a5, along with a lot of other entries. No specifics are known about why it was blacklisted originally, but now it only fails on RHEL because they use OpenSSL 1.0.1. Change-Id: I6d1d1b7b7bf5386b2115b8780163550cf03bbad7 Reviewed-by: Gatis Paeglis Reviewed-by: Timur Pocheptsov --- tests/auto/network/ssl/qsslkey/BLACKLIST | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/network/ssl/qsslkey/BLACKLIST b/tests/auto/network/ssl/qsslkey/BLACKLIST index a08e1f35eb..c0dfe5eb86 100644 --- a/tests/auto/network/ssl/qsslkey/BLACKLIST +++ b/tests/auto/network/ssl/qsslkey/BLACKLIST @@ -1 +1,2 @@ -linux +redhatenterpriselinuxworkstation-6.6 +rhel-7.4 -- cgit v1.2.3 From 37161d038061584227fe29b9c808acfcc8e865ee Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Wed, 21 Mar 2018 15:10:33 +0100 Subject: Doc: Update QVariant::toString description, update see also links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the toString description to reflect that the listed types are not exclusive, and update see also link to link to the canConvert method that includes conversion table. Task-number: QTBUG-67174 Change-Id: I3ad2889c98a235995b94a2d0496a6fb8c024b7bb Reviewed-by: Topi Reiniö --- src/corelib/kernel/qvariant.cpp | 91 ++++++++++++++++++++++------------------- 1 file changed, 48 insertions(+), 43 deletions(-) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index b3a86576af..6192b66487 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2379,7 +2379,7 @@ inline T qVariantToHelper(const QVariant::Private &d, const HandlersManager &han \l QMetaType::QVariantList of a type that can be converted to QString; otherwise returns an empty list. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QStringList QVariant::toStringList() const { @@ -2387,14 +2387,19 @@ QStringList QVariant::toStringList() const } /*! - Returns the variant as a QString if the variant has userType() \l - QMetaType::QString, \l QMetaType::Bool, \l QMetaType::QByteArray, + Returns the variant as a QString if the variant has a userType() + including, but not limited to: + + \l QMetaType::QString, \l QMetaType::Bool, \l QMetaType::QByteArray, \l QMetaType::QChar, \l QMetaType::QDate, \l QMetaType::QDateTime, \l QMetaType::Double, \l QMetaType::Int, \l QMetaType::LongLong, \l QMetaType::QStringList, \l QMetaType::QTime, \l QMetaType::UInt, or - \l QMetaType::ULongLong; otherwise returns an empty string. + \l QMetaType::ULongLong. + + Calling QVariant::toString() on an unsupported variant returns an empty + string. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QString QVariant::toString() const { @@ -2405,7 +2410,7 @@ QString QVariant::toString() const Returns the variant as a QMap if the variant has type() \l QMetaType::QVariantMap; otherwise returns an empty map. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QVariantMap QVariant::toMap() const { @@ -2416,7 +2421,7 @@ QVariantMap QVariant::toMap() const Returns the variant as a QHash if the variant has type() \l QMetaType::QVariantHash; otherwise returns an empty map. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QVariantHash QVariant::toHash() const { @@ -2433,7 +2438,7 @@ QVariantHash QVariant::toHash() const If the type() is \l QMetaType::QString, an invalid date will be returned if the string cannot be parsed as a Qt::ISODate format date. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QDate QVariant::toDate() const { @@ -2450,7 +2455,7 @@ QDate QVariant::toDate() const If the type() is \l QMetaType::QString, an invalid time will be returned if the string cannot be parsed as a Qt::ISODate format time. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QTime QVariant::toTime() const { @@ -2467,7 +2472,7 @@ QTime QVariant::toTime() const If the type() is \l QMetaType::QString, an invalid date/time will be returned if the string cannot be parsed as a Qt::ISODate format date/time. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QDateTime QVariant::toDateTime() const { @@ -2481,7 +2486,7 @@ QDateTime QVariant::toDateTime() const Returns the variant as a QEasingCurve if the variant has userType() \l QMetaType::QEasingCurve; otherwise returns a default easing curve. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ #ifndef QT_BOOTSTRAPPED QEasingCurve QVariant::toEasingCurve() const @@ -2497,7 +2502,7 @@ QEasingCurve QVariant::toEasingCurve() const \l QMetaType::QByteArray or \l QMetaType::QString (converted using QString::fromUtf8()); otherwise returns an empty byte array. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QByteArray QVariant::toByteArray() const { @@ -2512,7 +2517,7 @@ QByteArray QVariant::toByteArray() const \l QMetaType::QPoint or \l QMetaType::QPointF; otherwise returns a null QPoint. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QPoint QVariant::toPoint() const { @@ -2525,7 +2530,7 @@ QPoint QVariant::toPoint() const Returns the variant as a QRect if the variant has userType() \l QMetaType::QRect; otherwise returns an invalid QRect. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QRect QVariant::toRect() const { @@ -2538,7 +2543,7 @@ QRect QVariant::toRect() const Returns the variant as a QSize if the variant has userType() \l QMetaType::QSize; otherwise returns an invalid QSize. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QSize QVariant::toSize() const { @@ -2551,7 +2556,7 @@ QSize QVariant::toSize() const Returns the variant as a QSizeF if the variant has userType() \l QMetaType::QSizeF; otherwise returns an invalid QSizeF. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QSizeF QVariant::toSizeF() const { @@ -2565,7 +2570,7 @@ QSizeF QVariant::toSizeF() const \l QMetaType::QRect or \l QMetaType::QRectF; otherwise returns an invalid QRectF. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QRectF QVariant::toRectF() const { @@ -2578,7 +2583,7 @@ QRectF QVariant::toRectF() const Returns the variant as a QLineF if the variant has userType() \l QMetaType::QLineF; otherwise returns an invalid QLineF. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QLineF QVariant::toLineF() const { @@ -2591,7 +2596,7 @@ QLineF QVariant::toLineF() const Returns the variant as a QLine if the variant has userType() \l QMetaType::QLine; otherwise returns an invalid QLine. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QLine QVariant::toLine() const { @@ -2605,7 +2610,7 @@ QLine QVariant::toLine() const QMetaType::QPoint or \l QMetaType::QPointF; otherwise returns a null QPointF. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QPointF QVariant::toPointF() const { @@ -2621,7 +2626,7 @@ QPointF QVariant::toPointF() const Returns the variant as a QUrl if the variant has userType() \l QMetaType::QUrl; otherwise returns an invalid QUrl. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QUrl QVariant::toUrl() const { @@ -2635,7 +2640,7 @@ QUrl QVariant::toUrl() const Returns the variant as a QLocale if the variant has userType() \l QMetaType::QLocale; otherwise returns an invalid QLocale. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QLocale QVariant::toLocale() const { @@ -2649,7 +2654,7 @@ QLocale QVariant::toLocale() const Returns the variant as a QRegExp if the variant has userType() \l QMetaType::QRegExp; otherwise returns an empty QRegExp. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ #ifndef QT_NO_REGEXP QRegExp QVariant::toRegExp() const @@ -2666,7 +2671,7 @@ QRegExp QVariant::toRegExp() const Returns the variant as a QRegularExpression if the variant has userType() \l QRegularExpression; otherwise returns an empty QRegularExpression. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QRegularExpression QVariant::toRegularExpression() const { @@ -2681,7 +2686,7 @@ QRegularExpression QVariant::toRegularExpression() const Returns the variant as a QModelIndex if the variant has userType() \l QModelIndex; otherwise returns a default constructed QModelIndex. - \sa canConvert(), convert(), toPersistentModelIndex() + \sa canConvert(int targetTypeId), convert(), toPersistentModelIndex() */ QModelIndex QVariant::toModelIndex() const { @@ -2694,7 +2699,7 @@ QModelIndex QVariant::toModelIndex() const Returns the variant as a QPersistentModelIndex if the variant has userType() \l QPersistentModelIndex; otherwise returns a default constructed QPersistentModelIndex. - \sa canConvert(), convert(), toModelIndex() + \sa canConvert(int targetTypeId), convert(), toModelIndex() */ QPersistentModelIndex QVariant::toPersistentModelIndex() const { @@ -2710,7 +2715,7 @@ QPersistentModelIndex QVariant::toPersistentModelIndex() const \l QMetaType::QUuid, \l QMetaType::QByteArray or \l QMetaType::QString; otherwise returns a default-constructed QUuid. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QUuid QVariant::toUuid() const { @@ -2723,7 +2728,7 @@ QUuid QVariant::toUuid() const Returns the variant as a QJsonValue if the variant has userType() \l QJsonValue; otherwise returns a default constructed QJsonValue. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QJsonValue QVariant::toJsonValue() const { @@ -2736,7 +2741,7 @@ QJsonValue QVariant::toJsonValue() const Returns the variant as a QJsonObject if the variant has userType() \l QJsonObject; otherwise returns a default constructed QJsonObject. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QJsonObject QVariant::toJsonObject() const { @@ -2749,7 +2754,7 @@ QJsonObject QVariant::toJsonObject() const Returns the variant as a QJsonArray if the variant has userType() \l QJsonArray; otherwise returns a default constructed QJsonArray. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QJsonArray QVariant::toJsonArray() const { @@ -2762,7 +2767,7 @@ QJsonArray QVariant::toJsonArray() const Returns the variant as a QJsonDocument if the variant has userType() \l QJsonDocument; otherwise returns a default constructed QJsonDocument. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QJsonDocument QVariant::toJsonDocument() const { @@ -2777,7 +2782,7 @@ QJsonDocument QVariant::toJsonDocument() const \l QMetaType::QChar, \l QMetaType::Int, or \l QMetaType::UInt; otherwise returns an invalid QChar. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QChar QVariant::toChar() const { @@ -2788,7 +2793,7 @@ QChar QVariant::toChar() const Returns the variant as a QBitArray if the variant has userType() \l QMetaType::QBitArray; otherwise returns an empty bit array. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QBitArray QVariant::toBitArray() const { @@ -2831,7 +2836,7 @@ inline T qNumVariantToHelper(const QVariant::Private &d, will not be reflected in \a ok. A simple workaround is to use QString::toInt(). - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ int QVariant::toInt(bool *ok) const { @@ -2853,7 +2858,7 @@ int QVariant::toInt(bool *ok) const overflow will not be reflected in \a ok. A simple workaround is to use QString::toUInt(). - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ uint QVariant::toUInt(bool *ok) const { @@ -2870,7 +2875,7 @@ uint QVariant::toUInt(bool *ok) const If \a ok is non-null: \c{*}\c{ok} is set to true if the value could be converted to an int; otherwise \c{*}\c{ok} is set to false. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ qlonglong QVariant::toLongLong(bool *ok) const { @@ -2887,7 +2892,7 @@ qlonglong QVariant::toLongLong(bool *ok) const If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be converted to an int; otherwise \c{*}\a{ok} is set to false. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ qulonglong QVariant::toULongLong(bool *ok) const { @@ -2904,7 +2909,7 @@ qulonglong QVariant::toULongLong(bool *ok) const \l QMetaType::QByteArray and its lower-case content is not one of the following: empty, "0" or "false"; otherwise returns \c false. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ bool QVariant::toBool() const { @@ -2927,7 +2932,7 @@ bool QVariant::toBool() const If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be converted to a double; otherwise \c{*}\a{ok} is set to false. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ double QVariant::toDouble(bool *ok) const { @@ -2946,7 +2951,7 @@ double QVariant::toDouble(bool *ok) const If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be converted to a double; otherwise \c{*}\a{ok} is set to false. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ float QVariant::toFloat(bool *ok) const { @@ -2965,7 +2970,7 @@ float QVariant::toFloat(bool *ok) const If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be converted to a double; otherwise \c{*}\a{ok} is set to false. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ qreal QVariant::toReal(bool *ok) const { @@ -2977,7 +2982,7 @@ qreal QVariant::toReal(bool *ok) const \l QMetaType::QVariantList or \l QMetaType::QStringList; otherwise returns an empty list. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QVariantList QVariant::toList() const { @@ -3359,7 +3364,7 @@ bool QVariant::canConvert(int targetTypeId) const failed a previous conversion will always fail, changing the type, remaining null, and returning \c false. - \sa canConvert(), clear() + \sa canConvert(int targetTypeId), clear() */ bool QVariant::convert(int targetTypeId) -- cgit v1.2.3 From fe19527a4347dfbf39bc9073ff26a9f5a28930c0 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 1 Nov 2017 14:21:21 +0200 Subject: Configure: Restore default prefix on Windows The configure unification accidentally changed it to /usr/local as used on unix. Use C:/Qt again. Task-number: QTBUG-61373 Change-Id: I758c639bdb07c97b55f990821e73a5135038f4a0 Reviewed-by: Oswald Buddenhagen --- configure.pri | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/configure.pri b/configure.pri index 7185647e44..0512ef0144 100644 --- a/configure.pri +++ b/configure.pri @@ -694,10 +694,14 @@ defineReplace(printHostPaths) { defineTest(qtConfOutput_preparePaths) { isEmpty(config.input.prefix) { - $$qtConfEvaluate("features.developer-build"): \ + $$qtConfEvaluate("features.developer-build") { config.input.prefix = $$QT_BUILD_TREE # In Development, we use sandboxed builds by default - else: \ - config.input.prefix = /usr/local/Qt-$$[QT_VERSION] + } else { + win32: \ + config.input.prefix = C:/Qt/Qt-$$[QT_VERSION] + else: \ + config.input.prefix = /usr/local/Qt-$$[QT_VERSION] + } have_prefix = false } else { config.input.prefix = $$absolute_path($$config.input.prefix, $$OUT_PWD) -- cgit v1.2.3 From 315327f3d6419d2689d3414d62012d65fe441f27 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 15 Mar 2018 16:33:20 +0100 Subject: xcb: rename two classes in qxcbbackingstore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QXcbShmImage to QXcbBackingStoreImage as it is an image that might or might not have SHM capability. The current name implies that it always uses SHM. QXcbShmGraphicsBuffer to QXcbGraphicsBuffer as it has nothing to do with SHM. Change-Id: I57ced75891e8b10515142769278a7f3f40da91ef Reviewed-by: Alexander Volkov Reviewed-by: Błażej Szczygieł Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 42 +++++++++++++------------- src/plugins/platforms/xcb/qxcbbackingstore.h | 4 +-- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 70d1757af4..6efdb2d834 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -70,11 +70,11 @@ QT_BEGIN_NAMESPACE -class QXcbShmImage : public QXcbObject +class QXcbBackingStoreImage : public QXcbObject { public: - QXcbShmImage(QXcbScreen *connection, const QSize &size, uint depth, QImage::Format format); - ~QXcbShmImage() { destroy(true); } + QXcbBackingStoreImage(QXcbScreen *connection, const QSize &size, uint depth, QImage::Format format); + ~QXcbBackingStoreImage() { destroy(true); } void resize(const QSize &size); @@ -140,10 +140,10 @@ private: bool m_clientSideScroll; }; -class QXcbShmGraphicsBuffer : public QPlatformGraphicsBuffer +class QXcbGraphicsBuffer : public QPlatformGraphicsBuffer { public: - QXcbShmGraphicsBuffer(QImage *image) + QXcbGraphicsBuffer(QImage *image) : QPlatformGraphicsBuffer(image->size(), QImage::toPixelFormat(image->format())) , m_access_lock(QPlatformGraphicsBuffer::None) , m_image(image) @@ -175,7 +175,7 @@ static inline size_t imageDataSize(const xcb_image_t *image) return static_cast(image->stride) * image->height; } -QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QImage::Format format) +QXcbBackingStoreImage::QXcbBackingStoreImage(QXcbScreen *screen, const QSize &size, uint depth, QImage::Format format) : QXcbObject(screen->connection()) , m_screen_root(screen->screen()->root) , m_segmentSize(0) @@ -196,7 +196,7 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QI create(size, fmt, format); } -void QXcbShmImage::resize(const QSize &size) +void QXcbBackingStoreImage::resize(const QSize &size) { xcb_format_t fmt; fmt.depth = m_xcb_image->depth; @@ -207,7 +207,7 @@ void QXcbShmImage::resize(const QSize &size) create(size, &fmt, m_qimage.format()); } -void QXcbShmImage::create(const QSize &size, const xcb_format_t *fmt, QImage::Format format) +void QXcbBackingStoreImage::create(const QSize &size, const xcb_format_t *fmt, QImage::Format format) { m_xcb_image = xcb_image_create(size.width(), size.height(), XCB_IMAGE_FORMAT_Z_PIXMAP, @@ -232,7 +232,7 @@ void QXcbShmImage::create(const QSize &size, const xcb_format_t *fmt, QImage::Fo m_xcb_image->data = m_shm_info.shmaddr ? m_shm_info.shmaddr : (uint8_t *)malloc(segmentSize); m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, format); - m_graphics_buffer = new QXcbShmGraphicsBuffer(&m_qimage); + m_graphics_buffer = new QXcbGraphicsBuffer(&m_qimage); m_xcb_pixmap = xcb_generate_id(xcb_connection()); xcb_create_pixmap(xcb_connection(), @@ -242,7 +242,7 @@ void QXcbShmImage::create(const QSize &size, const xcb_format_t *fmt, QImage::Fo m_xcb_image->width, m_xcb_image->height); } -void QXcbShmImage::destroy(bool destroyShm) +void QXcbBackingStoreImage::destroy(bool destroyShm) { if (m_xcb_image->data) { if (m_shm_info.shmaddr) { @@ -268,7 +268,7 @@ void QXcbShmImage::destroy(bool destroyShm) m_xcb_pixmap = 0; } -void QXcbShmImage::flushScrolledRegion(bool clientSideScroll) +void QXcbBackingStoreImage::flushScrolledRegion(bool clientSideScroll) { if (m_clientSideScroll == clientSideScroll) return; @@ -316,7 +316,7 @@ void QXcbShmImage::flushScrolledRegion(bool clientSideScroll) } } -void QXcbShmImage::createShmSegment(size_t segmentSize) +void QXcbBackingStoreImage::createShmSegment(size_t segmentSize) { Q_ASSERT(connection()->hasShm()); Q_ASSERT(m_segmentSize == 0); @@ -400,7 +400,7 @@ void QXcbShmImage::createShmSegment(size_t segmentSize) } } -void QXcbShmImage::destroyShmSegment(size_t segmentSize) +void QXcbBackingStoreImage::destroyShmSegment(size_t segmentSize) { #ifndef XCB_USE_SHM_FD Q_UNUSED(segmentSize) @@ -433,7 +433,7 @@ void QXcbShmImage::destroyShmSegment(size_t segmentSize) extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); -bool QXcbShmImage::scroll(const QRegion &area, int dx, int dy) +bool QXcbBackingStoreImage::scroll(const QRegion &area, int dx, int dy) { const QRect bounds(QPoint(), size()); const QRegion scrollArea(area & bounds); @@ -477,7 +477,7 @@ bool QXcbShmImage::scroll(const QRegion &area, int dx, int dy) return true; } -void QXcbShmImage::ensureGC(xcb_drawable_t dst) +void QXcbBackingStoreImage::ensureGC(xcb_drawable_t dst) { if (m_gc_drawable != dst) { if (m_gc) @@ -557,7 +557,7 @@ static inline quint32 round_up_scanline(quint32 base, quint32 pad) return (base + pad - 1) & -pad; } -void QXcbShmImage::shmPutImage(xcb_drawable_t drawable, const QRegion ®ion, const QPoint &offset) +void QXcbBackingStoreImage::shmPutImage(xcb_drawable_t drawable, const QRegion ®ion, const QPoint &offset) { for (const QRect &rect : region) { const QPoint source = rect.translated(offset).topLeft(); @@ -578,7 +578,7 @@ void QXcbShmImage::shmPutImage(xcb_drawable_t drawable, const QRegion ®ion, c m_dirtyShm |= region.translated(offset); } -void QXcbShmImage::flushPixmap(const QRegion ®ion, bool fullRegion) +void QXcbBackingStoreImage::flushPixmap(const QRegion ®ion, bool fullRegion) { if (!fullRegion) { auto actualRegion = m_pendingFlush.intersected(region); @@ -647,7 +647,7 @@ void QXcbShmImage::flushPixmap(const QRegion ®ion, bool fullRegion) } } -void QXcbShmImage::setClip(const QRegion ®ion) +void QXcbBackingStoreImage::setClip(const QRegion ®ion) { if (region.isEmpty()) { static const uint32_t mask = XCB_GC_CLIP_MASK; @@ -663,7 +663,7 @@ void QXcbShmImage::setClip(const QRegion ®ion) } } -void QXcbShmImage::put(xcb_drawable_t dst, const QRegion ®ion, const QPoint &offset) +void QXcbBackingStoreImage::put(xcb_drawable_t dst, const QRegion ®ion, const QPoint &offset) { Q_ASSERT(!m_clientSideScroll); @@ -704,7 +704,7 @@ void QXcbShmImage::put(xcb_drawable_t dst, const QRegion ®ion, const QPoint & setClip(QRegion()); } -void QXcbShmImage::preparePaint(const QRegion ®ion) +void QXcbBackingStoreImage::preparePaint(const QRegion ®ion) { if (hasShm()) { // to prevent X from reading from the image region while we're writing to it @@ -860,7 +860,7 @@ void QXcbBackingStore::resize(const QSize &size, const QRegion &) m_image->resize(size); } else { QXcbScreen *screen = static_cast(window()->screen()->handle()); - m_image = new QXcbShmImage(screen, size, win->depth(), win->imageFormat()); + m_image = new QXcbBackingStoreImage(screen, size, win->depth(), win->imageFormat()); } // Slow path for bgr888 VNC: Create an additional image, paint into that and diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h index 2e8fbfb7fa..f40030001b 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.h +++ b/src/plugins/platforms/xcb/qxcbbackingstore.h @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE -class QXcbShmImage; +class QXcbBackingStoreImage; class QXcbBackingStore : public QXcbObject, public QPlatformBackingStore { @@ -75,7 +75,7 @@ public: void endPaint() override; private: - QXcbShmImage *m_image; + QXcbBackingStoreImage *m_image; QStack m_paintRegions; QImage m_rgbImage; }; -- cgit v1.2.3 From 89ab15ac913de09ca46b123776dfb2cdbf84a13b Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 15 Mar 2018 17:45:02 +0100 Subject: xcb: various coding style cleanups in qxcbbackingstore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Pass QXcbBackingStoreImage a pointer to QXcbBackingStore. This allow for simpler QXcbBackingStoreImage ctor. - Use member initializers. Change-Id: Ia992390060bb30e1184813cd0d115a8bf0fbc237 Reviewed-by: Błażej Szczygieł Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 68 ++++++++++++-------------- src/plugins/platforms/xcb/qxcbbackingstore.h | 2 +- 2 files changed, 33 insertions(+), 37 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 6efdb2d834..659d1c53cb 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -70,10 +70,12 @@ QT_BEGIN_NAMESPACE +class QXcbBackingStore; + class QXcbBackingStoreImage : public QXcbObject { public: - QXcbBackingStoreImage(QXcbScreen *connection, const QSize &size, uint depth, QImage::Format format); + QXcbBackingStoreImage(QXcbBackingStore *backingStore, const QSize &size); ~QXcbBackingStoreImage() { destroy(true); } void resize(const QSize &size); @@ -105,25 +107,24 @@ private: void flushPixmap(const QRegion ®ion, bool fullRegion = false); void setClip(const QRegion ®ion); - xcb_window_t m_screen_root; - xcb_shm_segment_info_t m_shm_info; - size_t m_segmentSize; + QXcbBackingStore *m_backingStore = nullptr; + size_t m_segmentSize = 0; - xcb_image_t *m_xcb_image; + xcb_image_t *m_xcb_image = nullptr; QImage m_qimage; - QPlatformGraphicsBuffer *m_graphics_buffer; + QPlatformGraphicsBuffer *m_graphics_buffer = nullptr; - xcb_gcontext_t m_gc; - xcb_drawable_t m_gc_drawable; + xcb_gcontext_t m_gc = 0; + xcb_drawable_t m_gc_drawable = 0; // When using shared memory these variables are used only for server-side scrolling. // When not using shared memory, we maintain a server-side pixmap with the backing // store as well as repainted content not yet flushed to the pixmap. We only flush // the regions we need and only when these are marked dirty. This way we can just // do a server-side copy on expose instead of sending the pixels every time - xcb_pixmap_t m_xcb_pixmap; + xcb_pixmap_t m_xcb_pixmap = 0; QRegion m_pendingFlush; // This is the scrolled region which is stored in server-side pixmap @@ -136,8 +137,8 @@ private: // as a pixmap region to server QByteArray m_flushBuffer; - bool m_hasAlpha; - bool m_clientSideScroll; + bool m_hasAlpha = false; + bool m_clientSideScroll = false; }; class QXcbGraphicsBuffer : public QPlatformGraphicsBuffer @@ -145,7 +146,6 @@ class QXcbGraphicsBuffer : public QPlatformGraphicsBuffer public: QXcbGraphicsBuffer(QImage *image) : QPlatformGraphicsBuffer(image->size(), QImage::toPixelFormat(image->format())) - , m_access_lock(QPlatformGraphicsBuffer::None) , m_image(image) { } @@ -165,9 +165,10 @@ public: int bytesPerLine() const override { return m_image->bytesPerLine(); } Origin origin() const override { return QPlatformGraphicsBuffer::OriginTopLeft; } + private: - AccessTypes m_access_lock; - QImage *m_image; + AccessTypes m_access_lock = QPlatformGraphicsBuffer::None; + QImage *m_image = nullptr; }; static inline size_t imageDataSize(const xcb_image_t *image) @@ -175,25 +176,22 @@ static inline size_t imageDataSize(const xcb_image_t *image) return static_cast(image->stride) * image->height; } -QXcbBackingStoreImage::QXcbBackingStoreImage(QXcbScreen *screen, const QSize &size, uint depth, QImage::Format format) - : QXcbObject(screen->connection()) - , m_screen_root(screen->screen()->root) - , m_segmentSize(0) - , m_graphics_buffer(nullptr) - , m_gc(0) - , m_gc_drawable(0) - , m_xcb_pixmap(0) - , m_clientSideScroll(false) -{ - const xcb_format_t *fmt = connection()->formatForDepth(depth); +QXcbBackingStoreImage::QXcbBackingStoreImage(QXcbBackingStore *backingStore, const QSize &size) + : QXcbObject(backingStore->connection()) + , m_backingStore(backingStore) +{ + QXcbWindow *window = static_cast(backingStore->window()->handle()); + const xcb_format_t *fmt = connection()->formatForDepth(window->depth()); Q_ASSERT(fmt); + memset(&m_shm_info, 0, sizeof m_shm_info); + + QImage::Format format = window->imageFormat(); m_hasAlpha = QImage::toPixelFormat(format).alphaUsage() == QPixelFormat::UsesAlpha; if (!m_hasAlpha) - format = qt_maybeAlphaVersionWithSameDepth(format); - - memset(&m_shm_info, 0, sizeof m_shm_info); - create(size, fmt, format); + create(size, fmt, qt_maybeAlphaVersionWithSameDepth(format)); + else + create(size, fmt, format); } void QXcbBackingStoreImage::resize(const QSize &size) @@ -235,10 +233,11 @@ void QXcbBackingStoreImage::create(const QSize &size, const xcb_format_t *fmt, Q m_graphics_buffer = new QXcbGraphicsBuffer(&m_qimage); m_xcb_pixmap = xcb_generate_id(xcb_connection()); + auto xcbScreen = static_cast(m_backingStore->window()->screen()->handle()); xcb_create_pixmap(xcb_connection(), m_xcb_image->depth, m_xcb_pixmap, - m_screen_root, + xcbScreen->root(), m_xcb_image->width, m_xcb_image->height); } @@ -719,7 +718,6 @@ void QXcbBackingStoreImage::preparePaint(const QRegion ®ion) QXcbBackingStore::QXcbBackingStore(QWindow *window) : QPlatformBackingStore(window) - , m_image(0) { QXcbScreen *screen = static_cast(window->screen()->handle()); setConnection(screen->connection()); @@ -856,12 +854,10 @@ void QXcbBackingStore::resize(const QSize &size, const QRegion &) } QXcbWindow* win = static_cast(pw); - if (m_image) { + if (m_image) m_image->resize(size); - } else { - QXcbScreen *screen = static_cast(window()->screen()->handle()); - m_image = new QXcbBackingStoreImage(screen, size, win->depth(), win->imageFormat()); - } + else + m_image = new QXcbBackingStoreImage(this, size); // Slow path for bgr888 VNC: Create an additional image, paint into that and // swap R and B while copying to m_image after each paint. diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h index f40030001b..747626c213 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.h +++ b/src/plugins/platforms/xcb/qxcbbackingstore.h @@ -75,7 +75,7 @@ public: void endPaint() override; private: - QXcbBackingStoreImage *m_image; + QXcbBackingStoreImage *m_image = nullptr; QStack m_paintRegions; QImage m_rgbImage; }; -- cgit v1.2.3 From 3b85d53913741660473dbc242a48c2ee65d51421 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 29 Mar 2018 17:12:36 -0700 Subject: macx-clang: Update informal documentation for xcb build Remove references to XKB and explain what to do if pkg-config is missing or unwanted. Change-Id: I099bf01ff49e1b8f6e822a50f0fe4904965a7a9f Reviewed-by: Gatis Paeglis Reviewed-by: Oswald Buddenhagen --- mkspecs/macx-clang/qmake.conf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mkspecs/macx-clang/qmake.conf b/mkspecs/macx-clang/qmake.conf index 170464d08f..14c885fd78 100644 --- a/mkspecs/macx-clang/qmake.conf +++ b/mkspecs/macx-clang/qmake.conf @@ -11,13 +11,16 @@ QMAKE_APPLE_DEVICE_ARCHS = x86_64 # configure \ # -pkg-config \ # -fontconfig -system-freetype \ -# -system-xcb -xkb -no-opengl \ -# -qt-xkbcommon -qt-xkbcommon-x11 +# -system-xcb -no-opengl # # Ensure that pkg-config is properly configured, or that # PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/opt/X11/share/pkgconfig # is set in your build environment. # +# If you don't want to use pkg-config, you can add: +# -L/opt/X11/lib -I/opt/X11/include +# to the configure options. +# # Due to irreconcilable differences between Cocoa # and X11, OpenGL is currently not supported. -- cgit v1.2.3