Merge remote-tracking branch 'origin/5.11' into dev

Change-Id: I0120f804522c0c652e9537b6e9fe08189f071ed2
This commit is contained in:
Qt Forward Merge Bot 2018-04-10 01:00:25 +02:00
commit e027c7241f
20 changed files with 250 additions and 190 deletions

View File

@ -694,10 +694,14 @@ defineReplace(printHostPaths) {
defineTest(qtConfOutput_preparePaths) { defineTest(qtConfOutput_preparePaths) {
isEmpty(config.input.prefix) { 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 config.input.prefix = $$QT_BUILD_TREE # In Development, we use sandboxed builds by default
else: \ } else {
config.input.prefix = /usr/local/Qt-$$[QT_VERSION] win32: \
config.input.prefix = C:/Qt/Qt-$$[QT_VERSION]
else: \
config.input.prefix = /usr/local/Qt-$$[QT_VERSION]
}
have_prefix = false have_prefix = false
} else { } else {
config.input.prefix = $$absolute_path($$config.input.prefix, $$OUT_PWD) config.input.prefix = $$absolute_path($$config.input.prefix, $$OUT_PWD)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -80,7 +80,7 @@
/*! /*!
\example tutorials/addressbook/part1 \example tutorials/addressbook/part1
\title Part 1 - Designing the User Interface \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 This first part covers the design of the basic graphical user
interface (GUI) for our address book application. interface (GUI) for our address book application.
@ -232,6 +232,7 @@
/*! /*!
\example tutorials/addressbook/part2 \example tutorials/addressbook/part2
\title Part 2 - Adding Addresses \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 The next step in creating the address book is to implement some
user interactions. user interactions.
@ -381,9 +382,10 @@
/*! /*!
\example tutorials/addressbook/part3 \example tutorials/addressbook/part3
\title Part 3 - Navigating between Entries \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 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 decide what sort of a data structure we need for containing these
contacts. contacts.
@ -496,6 +498,7 @@
/*! /*!
\example tutorials/addressbook/part4 \example tutorials/addressbook/part4
\title Part 4 - Editing and Removing Addresses \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 Now we look at ways to modify the contents of contacts stored in
the address book. the address book.
@ -628,6 +631,7 @@
/*! /*!
\example tutorials/addressbook/part5 \example tutorials/addressbook/part5
\title Part 5 - Adding a Find Function \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 Here we look at ways to locate contacts and addresses in the
address book. address book.
@ -770,6 +774,7 @@
/*! /*!
\example tutorials/addressbook/part6 \example tutorials/addressbook/part6
\title Part 6 - Loading and Saving \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 This part covers the Qt file handling features we use to write
loading and saving routines for the address book. loading and saving routines for the address book.
@ -890,6 +895,7 @@
/*! /*!
\example tutorials/addressbook/part7 \example tutorials/addressbook/part7
\title Part 7 - Additional Features \title Part 7 - Additional Features
\brief Describes how to export data in VCard format.
This part covers some additional features that make the address This part covers some additional features that make the address
book more convenient for the frequent user. book more convenient for the frequent user.

View File

@ -29,17 +29,29 @@
\example statemachine/eventtransitions \example statemachine/eventtransitions
\title Event Transitions Example \title Event Transitions Example
\brief The Event Transitions example shows how to use event transitions, a \brief The Event Transitions example shows how to use event transitions,
feature of \l{The State Machine Framework}. 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 \snippet statemachine/eventtransitions/main.cpp 0
The \c Window class's constructors begins by creating a button. 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 \snippet statemachine/eventtransitions/main.cpp 1
Two states, \c s1 and \c s2, are created; upon entry they will assign State \c s1 is the state "Outside" and state \c s2 is state "Inside".
"Outside" and "Inside" to the button's text, respectively.
\snippet statemachine/eventtransitions/main.cpp 2 \snippet statemachine/eventtransitions/main.cpp 2
@ -54,11 +66,11 @@
\snippet statemachine/eventtransitions/main.cpp 4 \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 receives an event of type QEvent::MouseButtonPress and the state machine
is in state \c s2. When the button receives an event of type 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 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 \snippet statemachine/eventtransitions/main.cpp 5
@ -67,6 +79,7 @@
\snippet statemachine/eventtransitions/main.cpp 6 \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.
*/ */

View File

@ -30,43 +30,74 @@
\title Find Files Example \title Find Files Example
\ingroup examples-dialogs \ingroup examples-dialogs
\brief The Find Files example shows how to use QProgressDialog to provide \brief A dialog for finding files in a specified folder
feedback on the progress of a slow operation. The example also
shows how to use QFileDialog to facilitate browsing, how to use The Find Files application allows the user to search for files in a
QTextStream's streaming operators to read a file, and how to use specified directory, matching a given file name or wildcard,
QTableWidget to provide standard table display facilities for and containing a specified string (if filled in). The search
applications. In addition, files can be opened using the result is displayed in a table containing the names of the files
QDesktopServices class. 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 \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 \section1 Window Class Definition
The \c Window class inherits QWidget, and is the main application 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. results.
\snippet dialogs/findfiles/window.h 0 \snippet dialogs/findfiles/window.h 0
We need two private slots: The \c browse() slot is called whenever The application has two private slots:
the user wants to browse for a directory to search in, and the \c \table
find() slot is called whenever the user requests a search to be \row
performed by pressing the \uicontrol Find button. \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: We use the \c In addition we declare several private functions:
findFiles() function to search for files matching the user's
specifications, we call the \c showFiles() function to display the \table
results, and we use \c createButton(), \c createComboBox() and \c \row
createFilesTable() when we are constructing the widget. \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 \section1 Window Class Implementation
@ -103,11 +134,11 @@
Here we use the static QFileDialog::getExistingDirectory() Here we use the static QFileDialog::getExistingDirectory()
function which returns an existing directory selected by the function which returns an existing directory selected by the
user. Then we display the directory in the directory combobox 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. index.
QComboBox::addItem() adds an item to the combobox with the given 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 the specified userData. The item is appended to the list of
existing items. existing items.
@ -118,13 +149,13 @@
First we eliminate any previous search results by setting the First we eliminate any previous search results by setting the
table widgets row count to zero. Then we retrieve 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. comboboxes.
\snippet dialogs/findfiles/window.cpp 4 \snippet dialogs/findfiles/window.cpp 4
We use the directory's path to create a QDir; the QDir class 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 We use QDirIterator to iterate over the files that match the
specified file name and build a QStringList of paths. 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 In the private \c findFiles() function we search through a list of
files, looking for the ones that contain a specified text. This files, looking for the ones that contain a specified text. This
can be a very slow operation depending on the number of files as 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 well as their sizes. QProgressDialog displays a progress dialog
there exists some large files on the list, we provide a if the application has to search through a large number of files,
QProgressDialog. 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
The QProgressDialog class provides feedback on the progress of a time.
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.
\snippet dialogs/findfiles/window.cpp 6 \snippet dialogs/findfiles/window.cpp 6

View File

@ -70,7 +70,10 @@ LanguageChooser::LanguageChooser(const QString& defaultLang, QWidget *parent)
for (int i = 0; i < qmFiles.size(); ++i) { for (int i = 0; i < qmFiles.size(); ++i) {
QCheckBox *checkBox = new QCheckBox(languageName(qmFiles[i])); QCheckBox *checkBox = new QCheckBox(languageName(qmFiles[i]));
qmFileForCheckBoxMap.insert(checkBox, qmFiles[i]); qmFileForCheckBoxMap.insert(checkBox, qmFiles[i]);
connect(checkBox, SIGNAL(toggled(bool)), this, SLOT(checkBoxToggled())); connect(checkBox,
QOverload<bool>::of(&QCheckBox::toggled),
this,
&LanguageChooser::checkBoxToggled);
if (languageMatch(defaultLang, qmFiles[i])) if (languageMatch(defaultLang, qmFiles[i]))
checkBox->setCheckState(Qt::Checked); checkBox->setCheckState(Qt::Checked);
groupBoxLayout->addWidget(checkBox, i / 2, i % 2); groupBoxLayout->addWidget(checkBox, i / 2, i % 2);
@ -84,8 +87,8 @@ LanguageChooser::LanguageChooser(const QString& defaultLang, QWidget *parent)
hideAllButton = buttonBox->addButton("Hide All", hideAllButton = buttonBox->addButton("Hide All",
QDialogButtonBox::ActionRole); QDialogButtonBox::ActionRole);
connect(showAllButton, SIGNAL(clicked()), this, SLOT(showAll())); connect(showAllButton, &QAbstractButton::clicked, this, &LanguageChooser::showAll);
connect(hideAllButton, SIGNAL(clicked()), this, SLOT(hideAll())); connect(hideAllButton, &QAbstractButton::clicked, this, &LanguageChooser::hideAll);
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(groupBox); mainLayout->addWidget(groupBox);

View File

@ -76,7 +76,7 @@ MainWindow::MainWindow()
centralWidget->setLayout(mainLayout); centralWidget->setLayout(mainLayout);
exitAction = new QAction(tr("E&xit"), this); 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 = menuBar()->addMenu(tr("&File"));
fileMenu->setPalette(QPalette(Qt::red)); fileMenu->setPalette(QPalette(Qt::red));

View File

@ -11,13 +11,16 @@ QMAKE_APPLE_DEVICE_ARCHS = x86_64
# configure \ # configure \
# -pkg-config \ # -pkg-config \
# -fontconfig -system-freetype \ # -fontconfig -system-freetype \
# -system-xcb -xkb -no-opengl \ # -system-xcb -no-opengl
# -qt-xkbcommon -qt-xkbcommon-x11
# #
# Ensure that pkg-config is properly configured, or that # Ensure that pkg-config is properly configured, or that
# PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/opt/X11/share/pkgconfig # PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/opt/X11/share/pkgconfig
# is set in your build environment. # 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 # Due to irreconcilable differences between Cocoa
# and X11, OpenGL is currently not supported. # and X11, OpenGL is currently not supported.

View File

@ -2386,7 +2386,7 @@ inline T qVariantToHelper(const QVariant::Private &d, const HandlersManager &han
\l QMetaType::QVariantList of a type that can be converted to QString; \l QMetaType::QVariantList of a type that can be converted to QString;
otherwise returns an empty list. otherwise returns an empty list.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QStringList QVariant::toStringList() const QStringList QVariant::toStringList() const
{ {
@ -2394,14 +2394,19 @@ QStringList QVariant::toStringList() const
} }
/*! /*!
Returns the variant as a QString if the variant has userType() \l Returns the variant as a QString if the variant has a userType()
QMetaType::QString, \l QMetaType::Bool, \l QMetaType::QByteArray, 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::QChar, \l QMetaType::QDate, \l QMetaType::QDateTime,
\l QMetaType::Double, \l QMetaType::Int, \l QMetaType::LongLong, \l QMetaType::Double, \l QMetaType::Int, \l QMetaType::LongLong,
\l QMetaType::QStringList, \l QMetaType::QTime, \l QMetaType::UInt, or \l QMetaType::QStringList, \l QMetaType::QTime, \l QMetaType::UInt, or
\l QMetaType::ULongLong; otherwise returns an empty string. \l QMetaType::ULongLong.
\sa canConvert(), convert() Calling QVariant::toString() on an unsupported variant returns an empty
string.
\sa canConvert(int targetTypeId), convert()
*/ */
QString QVariant::toString() const QString QVariant::toString() const
{ {
@ -2412,7 +2417,7 @@ QString QVariant::toString() const
Returns the variant as a QMap<QString, QVariant> if the variant Returns the variant as a QMap<QString, QVariant> if the variant
has type() \l QMetaType::QVariantMap; otherwise returns an empty map. has type() \l QMetaType::QVariantMap; otherwise returns an empty map.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QVariantMap QVariant::toMap() const QVariantMap QVariant::toMap() const
{ {
@ -2423,7 +2428,7 @@ QVariantMap QVariant::toMap() const
Returns the variant as a QHash<QString, QVariant> if the variant Returns the variant as a QHash<QString, QVariant> if the variant
has type() \l QMetaType::QVariantHash; otherwise returns an empty map. has type() \l QMetaType::QVariantHash; otherwise returns an empty map.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QVariantHash QVariant::toHash() const QVariantHash QVariant::toHash() const
{ {
@ -2440,7 +2445,7 @@ QVariantHash QVariant::toHash() const
If the type() is \l QMetaType::QString, an invalid date will be returned if 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. the string cannot be parsed as a Qt::ISODate format date.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QDate QVariant::toDate() const QDate QVariant::toDate() const
{ {
@ -2457,7 +2462,7 @@ QDate QVariant::toDate() const
If the type() is \l QMetaType::QString, an invalid time will be returned if 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. the string cannot be parsed as a Qt::ISODate format time.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QTime QVariant::toTime() const QTime QVariant::toTime() const
{ {
@ -2474,7 +2479,7 @@ QTime QVariant::toTime() const
If the type() is \l QMetaType::QString, an invalid date/time will be 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. 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 QDateTime QVariant::toDateTime() const
{ {
@ -2488,7 +2493,7 @@ QDateTime QVariant::toDateTime() const
Returns the variant as a QEasingCurve if the variant has userType() Returns the variant as a QEasingCurve if the variant has userType()
\l QMetaType::QEasingCurve; otherwise returns a default easing curve. \l QMetaType::QEasingCurve; otherwise returns a default easing curve.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
#ifndef QT_BOOTSTRAPPED #ifndef QT_BOOTSTRAPPED
QEasingCurve QVariant::toEasingCurve() const QEasingCurve QVariant::toEasingCurve() const
@ -2504,7 +2509,7 @@ QEasingCurve QVariant::toEasingCurve() const
\l QMetaType::QByteArray or \l QMetaType::QString (converted using \l QMetaType::QByteArray or \l QMetaType::QString (converted using
QString::fromUtf8()); otherwise returns an empty byte array. QString::fromUtf8()); otherwise returns an empty byte array.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QByteArray QVariant::toByteArray() const QByteArray QVariant::toByteArray() const
{ {
@ -2519,7 +2524,7 @@ QByteArray QVariant::toByteArray() const
\l QMetaType::QPoint or \l QMetaType::QPointF; otherwise returns a null \l QMetaType::QPoint or \l QMetaType::QPointF; otherwise returns a null
QPoint. QPoint.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QPoint QVariant::toPoint() const QPoint QVariant::toPoint() const
{ {
@ -2532,7 +2537,7 @@ QPoint QVariant::toPoint() const
Returns the variant as a QRect if the variant has userType() Returns the variant as a QRect if the variant has userType()
\l QMetaType::QRect; otherwise returns an invalid QRect. \l QMetaType::QRect; otherwise returns an invalid QRect.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QRect QVariant::toRect() const QRect QVariant::toRect() const
{ {
@ -2545,7 +2550,7 @@ QRect QVariant::toRect() const
Returns the variant as a QSize if the variant has userType() Returns the variant as a QSize if the variant has userType()
\l QMetaType::QSize; otherwise returns an invalid QSize. \l QMetaType::QSize; otherwise returns an invalid QSize.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QSize QVariant::toSize() const QSize QVariant::toSize() const
{ {
@ -2558,7 +2563,7 @@ QSize QVariant::toSize() const
Returns the variant as a QSizeF if the variant has userType() \l Returns the variant as a QSizeF if the variant has userType() \l
QMetaType::QSizeF; otherwise returns an invalid QSizeF. QMetaType::QSizeF; otherwise returns an invalid QSizeF.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QSizeF QVariant::toSizeF() const QSizeF QVariant::toSizeF() const
{ {
@ -2572,7 +2577,7 @@ QSizeF QVariant::toSizeF() const
\l QMetaType::QRect or \l QMetaType::QRectF; otherwise returns an invalid \l QMetaType::QRect or \l QMetaType::QRectF; otherwise returns an invalid
QRectF. QRectF.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QRectF QVariant::toRectF() const QRectF QVariant::toRectF() const
{ {
@ -2585,7 +2590,7 @@ QRectF QVariant::toRectF() const
Returns the variant as a QLineF if the variant has userType() Returns the variant as a QLineF if the variant has userType()
\l QMetaType::QLineF; otherwise returns an invalid QLineF. \l QMetaType::QLineF; otherwise returns an invalid QLineF.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QLineF QVariant::toLineF() const QLineF QVariant::toLineF() const
{ {
@ -2598,7 +2603,7 @@ QLineF QVariant::toLineF() const
Returns the variant as a QLine if the variant has userType() Returns the variant as a QLine if the variant has userType()
\l QMetaType::QLine; otherwise returns an invalid QLine. \l QMetaType::QLine; otherwise returns an invalid QLine.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QLine QVariant::toLine() const QLine QVariant::toLine() const
{ {
@ -2612,7 +2617,7 @@ QLine QVariant::toLine() const
QMetaType::QPoint or \l QMetaType::QPointF; otherwise returns a null QMetaType::QPoint or \l QMetaType::QPointF; otherwise returns a null
QPointF. QPointF.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QPointF QVariant::toPointF() const QPointF QVariant::toPointF() const
{ {
@ -2628,7 +2633,7 @@ QPointF QVariant::toPointF() const
Returns the variant as a QUrl if the variant has userType() Returns the variant as a QUrl if the variant has userType()
\l QMetaType::QUrl; otherwise returns an invalid QUrl. \l QMetaType::QUrl; otherwise returns an invalid QUrl.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QUrl QVariant::toUrl() const QUrl QVariant::toUrl() const
{ {
@ -2642,7 +2647,7 @@ QUrl QVariant::toUrl() const
Returns the variant as a QLocale if the variant has userType() Returns the variant as a QLocale if the variant has userType()
\l QMetaType::QLocale; otherwise returns an invalid QLocale. \l QMetaType::QLocale; otherwise returns an invalid QLocale.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QLocale QVariant::toLocale() const QLocale QVariant::toLocale() const
{ {
@ -2656,7 +2661,7 @@ QLocale QVariant::toLocale() const
Returns the variant as a QRegExp if the variant has userType() Returns the variant as a QRegExp if the variant has userType()
\l QMetaType::QRegExp; otherwise returns an empty QRegExp. \l QMetaType::QRegExp; otherwise returns an empty QRegExp.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
#ifndef QT_NO_REGEXP #ifndef QT_NO_REGEXP
QRegExp QVariant::toRegExp() const QRegExp QVariant::toRegExp() const
@ -2673,7 +2678,7 @@ QRegExp QVariant::toRegExp() const
Returns the variant as a QRegularExpression if the variant has userType() \l Returns the variant as a QRegularExpression if the variant has userType() \l
QRegularExpression; otherwise returns an empty QRegularExpression. QRegularExpression; otherwise returns an empty QRegularExpression.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QRegularExpression QVariant::toRegularExpression() const QRegularExpression QVariant::toRegularExpression() const
{ {
@ -2688,7 +2693,7 @@ QRegularExpression QVariant::toRegularExpression() const
Returns the variant as a QModelIndex if the variant has userType() \l Returns the variant as a QModelIndex if the variant has userType() \l
QModelIndex; otherwise returns a default constructed QModelIndex. QModelIndex; otherwise returns a default constructed QModelIndex.
\sa canConvert(), convert(), toPersistentModelIndex() \sa canConvert(int targetTypeId), convert(), toPersistentModelIndex()
*/ */
QModelIndex QVariant::toModelIndex() const QModelIndex QVariant::toModelIndex() const
{ {
@ -2701,7 +2706,7 @@ QModelIndex QVariant::toModelIndex() const
Returns the variant as a QPersistentModelIndex if the variant has userType() \l Returns the variant as a QPersistentModelIndex if the variant has userType() \l
QPersistentModelIndex; otherwise returns a default constructed QPersistentModelIndex. QPersistentModelIndex; otherwise returns a default constructed QPersistentModelIndex.
\sa canConvert(), convert(), toModelIndex() \sa canConvert(int targetTypeId), convert(), toModelIndex()
*/ */
QPersistentModelIndex QVariant::toPersistentModelIndex() const QPersistentModelIndex QVariant::toPersistentModelIndex() const
{ {
@ -2717,7 +2722,7 @@ QPersistentModelIndex QVariant::toPersistentModelIndex() const
\l QMetaType::QUuid, \l QMetaType::QByteArray or \l QMetaType::QString; \l QMetaType::QUuid, \l QMetaType::QByteArray or \l QMetaType::QString;
otherwise returns a default-constructed QUuid. otherwise returns a default-constructed QUuid.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QUuid QVariant::toUuid() const QUuid QVariant::toUuid() const
{ {
@ -2730,7 +2735,7 @@ QUuid QVariant::toUuid() const
Returns the variant as a QJsonValue if the variant has userType() \l Returns the variant as a QJsonValue if the variant has userType() \l
QJsonValue; otherwise returns a default constructed QJsonValue. QJsonValue; otherwise returns a default constructed QJsonValue.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QJsonValue QVariant::toJsonValue() const QJsonValue QVariant::toJsonValue() const
{ {
@ -2743,7 +2748,7 @@ QJsonValue QVariant::toJsonValue() const
Returns the variant as a QJsonObject if the variant has userType() \l Returns the variant as a QJsonObject if the variant has userType() \l
QJsonObject; otherwise returns a default constructed QJsonObject. QJsonObject; otherwise returns a default constructed QJsonObject.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QJsonObject QVariant::toJsonObject() const QJsonObject QVariant::toJsonObject() const
{ {
@ -2756,7 +2761,7 @@ QJsonObject QVariant::toJsonObject() const
Returns the variant as a QJsonArray if the variant has userType() \l Returns the variant as a QJsonArray if the variant has userType() \l
QJsonArray; otherwise returns a default constructed QJsonArray. QJsonArray; otherwise returns a default constructed QJsonArray.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QJsonArray QVariant::toJsonArray() const QJsonArray QVariant::toJsonArray() const
{ {
@ -2769,7 +2774,7 @@ QJsonArray QVariant::toJsonArray() const
Returns the variant as a QJsonDocument if the variant has userType() \l Returns the variant as a QJsonDocument if the variant has userType() \l
QJsonDocument; otherwise returns a default constructed QJsonDocument. QJsonDocument; otherwise returns a default constructed QJsonDocument.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QJsonDocument QVariant::toJsonDocument() const QJsonDocument QVariant::toJsonDocument() const
{ {
@ -2784,7 +2789,7 @@ QJsonDocument QVariant::toJsonDocument() const
\l QMetaType::QChar, \l QMetaType::Int, or \l QMetaType::UInt; otherwise \l QMetaType::QChar, \l QMetaType::Int, or \l QMetaType::UInt; otherwise
returns an invalid QChar. returns an invalid QChar.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QChar QVariant::toChar() const QChar QVariant::toChar() const
{ {
@ -2795,7 +2800,7 @@ QChar QVariant::toChar() const
Returns the variant as a QBitArray if the variant has userType() Returns the variant as a QBitArray if the variant has userType()
\l QMetaType::QBitArray; otherwise returns an empty bit array. \l QMetaType::QBitArray; otherwise returns an empty bit array.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QBitArray QVariant::toBitArray() const QBitArray QVariant::toBitArray() const
{ {
@ -2838,7 +2843,7 @@ inline T qNumVariantToHelper(const QVariant::Private &d,
will not be reflected in \a ok. A simple workaround is to use will not be reflected in \a ok. A simple workaround is to use
QString::toInt(). QString::toInt().
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
int QVariant::toInt(bool *ok) const int QVariant::toInt(bool *ok) const
{ {
@ -2860,7 +2865,7 @@ int QVariant::toInt(bool *ok) const
overflow will not be reflected in \a ok. A simple workaround is to use overflow will not be reflected in \a ok. A simple workaround is to use
QString::toUInt(). QString::toUInt().
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
uint QVariant::toUInt(bool *ok) const uint QVariant::toUInt(bool *ok) const
{ {
@ -2877,7 +2882,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 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. 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 qlonglong QVariant::toLongLong(bool *ok) const
{ {
@ -2894,7 +2899,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 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. 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 qulonglong QVariant::toULongLong(bool *ok) const
{ {
@ -2911,7 +2916,7 @@ qulonglong QVariant::toULongLong(bool *ok) const
\l QMetaType::QByteArray and its lower-case content is not one of the \l QMetaType::QByteArray and its lower-case content is not one of the
following: empty, "0" or "false"; otherwise returns \c false. following: empty, "0" or "false"; otherwise returns \c false.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
bool QVariant::toBool() const bool QVariant::toBool() const
{ {
@ -2934,7 +2939,7 @@ bool QVariant::toBool() const
If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be 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. 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 double QVariant::toDouble(bool *ok) const
{ {
@ -2953,7 +2958,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 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. 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 float QVariant::toFloat(bool *ok) const
{ {
@ -2972,7 +2977,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 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. 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 qreal QVariant::toReal(bool *ok) const
{ {
@ -2984,7 +2989,7 @@ qreal QVariant::toReal(bool *ok) const
\l QMetaType::QVariantList or \l QMetaType::QStringList; otherwise returns \l QMetaType::QVariantList or \l QMetaType::QStringList; otherwise returns
an empty list. an empty list.
\sa canConvert(), convert() \sa canConvert(int targetTypeId), convert()
*/ */
QVariantList QVariant::toList() const QVariantList QVariant::toList() const
{ {
@ -3366,7 +3371,7 @@ bool QVariant::canConvert(int targetTypeId) const
failed a previous conversion will always fail, changing the type, remaining null, failed a previous conversion will always fail, changing the type, remaining null,
and returning \c false. and returning \c false.
\sa canConvert(), clear() \sa canConvert(int targetTypeId), clear()
*/ */
bool QVariant::convert(int targetTypeId) bool QVariant::convert(int targetTypeId)

View File

@ -291,10 +291,14 @@ public:
QSemaphore::QSemaphore(int n) QSemaphore::QSemaphore(int n)
{ {
Q_ASSERT_X(n >= 0, "QSemaphore", "parameter 'n' must be non-negative"); Q_ASSERT_X(n >= 0, "QSemaphore", "parameter 'n' must be non-negative");
if (futexAvailable()) if (futexAvailable()) {
u.store(n); quintptr nn = unsigned(n);
else if (futexHasWaiterCount)
nn |= quint64(nn) << 32; // token count replicated in high word
u.store(nn);
} else {
d = new QSemaphorePrivate(n); d = new QSemaphorePrivate(n);
}
} }
/*! /*!

View File

@ -2889,7 +2889,7 @@ Q_GUI_EXPORT QStringList qt_sort_families_by_writing_system(QChar::Script script
uint order = i; uint order = i;
if (testFamily == nullptr if (testFamily == nullptr
|| (testFamily->writingSystems[writingSystem] & QtFontFamily::Supported) == 0) { || (testFamily->writingSystems[writingSystem] & QtFontFamily::Supported) == 0) {
order |= 1 << 31; order |= 1u << 31;
} }
supported.insert(order, family); supported.insert(order, family);

View File

@ -236,9 +236,9 @@ void QSslSocketBackendPrivate::startClientEncryption()
switch (q->protocol()) { switch (q->protocol()) {
case QSsl::AnyProtocol: case QSsl::AnyProtocol:
case QSsl::SslV3: case QSsl::SslV3:
case QSsl::TlsV1SslV3:
protectionLevel = SocketProtectionLevel_Ssl; // Only use this value if weak cipher support is required protectionLevel = SocketProtectionLevel_Ssl; // Only use this value if weak cipher support is required
break; break;
case QSsl::TlsV1SslV3:
case QSsl::TlsV1_0: case QSsl::TlsV1_0:
protectionLevel = SocketProtectionLevel_Tls10; protectionLevel = SocketProtectionLevel_Tls10;
break; break;

View File

@ -70,11 +70,13 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QXcbShmImage : public QXcbObject class QXcbBackingStore;
class QXcbBackingStoreImage : public QXcbObject
{ {
public: public:
QXcbShmImage(QXcbScreen *connection, const QSize &size, uint depth, QImage::Format format); QXcbBackingStoreImage(QXcbBackingStore *backingStore, const QSize &size);
~QXcbShmImage() { destroy(true); } ~QXcbBackingStoreImage() { destroy(true); }
void resize(const QSize &size); void resize(const QSize &size);
@ -105,25 +107,24 @@ private:
void flushPixmap(const QRegion &region, bool fullRegion = false); void flushPixmap(const QRegion &region, bool fullRegion = false);
void setClip(const QRegion &region); void setClip(const QRegion &region);
xcb_window_t m_screen_root;
xcb_shm_segment_info_t m_shm_info; 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; QImage m_qimage;
QPlatformGraphicsBuffer *m_graphics_buffer; QPlatformGraphicsBuffer *m_graphics_buffer = nullptr;
xcb_gcontext_t m_gc; xcb_gcontext_t m_gc = 0;
xcb_drawable_t m_gc_drawable; xcb_drawable_t m_gc_drawable = 0;
// When using shared memory these variables are used only for server-side scrolling. // 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 // 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 // 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 // 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 // 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; QRegion m_pendingFlush;
// This is the scrolled region which is stored in server-side pixmap // This is the scrolled region which is stored in server-side pixmap
@ -136,16 +137,15 @@ private:
// as a pixmap region to server // as a pixmap region to server
QByteArray m_flushBuffer; QByteArray m_flushBuffer;
bool m_hasAlpha; bool m_hasAlpha = false;
bool m_clientSideScroll; bool m_clientSideScroll = false;
}; };
class QXcbShmGraphicsBuffer : public QPlatformGraphicsBuffer class QXcbGraphicsBuffer : public QPlatformGraphicsBuffer
{ {
public: public:
QXcbShmGraphicsBuffer(QImage *image) QXcbGraphicsBuffer(QImage *image)
: QPlatformGraphicsBuffer(image->size(), QImage::toPixelFormat(image->format())) : QPlatformGraphicsBuffer(image->size(), QImage::toPixelFormat(image->format()))
, m_access_lock(QPlatformGraphicsBuffer::None)
, m_image(image) , m_image(image)
{ } { }
@ -165,9 +165,10 @@ public:
int bytesPerLine() const override { return m_image->bytesPerLine(); } int bytesPerLine() const override { return m_image->bytesPerLine(); }
Origin origin() const override { return QPlatformGraphicsBuffer::OriginTopLeft; } Origin origin() const override { return QPlatformGraphicsBuffer::OriginTopLeft; }
private: private:
AccessTypes m_access_lock; AccessTypes m_access_lock = QPlatformGraphicsBuffer::None;
QImage *m_image; QImage *m_image = nullptr;
}; };
static inline size_t imageDataSize(const xcb_image_t *image) static inline size_t imageDataSize(const xcb_image_t *image)
@ -175,28 +176,25 @@ static inline size_t imageDataSize(const xcb_image_t *image)
return static_cast<size_t>(image->stride) * image->height; return static_cast<size_t>(image->stride) * image->height;
} }
QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QImage::Format format) QXcbBackingStoreImage::QXcbBackingStoreImage(QXcbBackingStore *backingStore, const QSize &size)
: QXcbObject(screen->connection()) : QXcbObject(backingStore->connection())
, m_screen_root(screen->screen()->root) , m_backingStore(backingStore)
, 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); QXcbWindow *window = static_cast<QXcbWindow *>(backingStore->window()->handle());
const xcb_format_t *fmt = connection()->formatForDepth(window->depth());
Q_ASSERT(fmt); 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; m_hasAlpha = QImage::toPixelFormat(format).alphaUsage() == QPixelFormat::UsesAlpha;
if (!m_hasAlpha) if (!m_hasAlpha)
format = qt_maybeAlphaVersionWithSameDepth(format); create(size, fmt, qt_maybeAlphaVersionWithSameDepth(format));
else
memset(&m_shm_info, 0, sizeof m_shm_info); create(size, fmt, format);
create(size, fmt, format);
} }
void QXcbShmImage::resize(const QSize &size) void QXcbBackingStoreImage::resize(const QSize &size)
{ {
xcb_format_t fmt; xcb_format_t fmt;
fmt.depth = m_xcb_image->depth; fmt.depth = m_xcb_image->depth;
@ -207,7 +205,7 @@ void QXcbShmImage::resize(const QSize &size)
create(size, &fmt, m_qimage.format()); 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(), m_xcb_image = xcb_image_create(size.width(), size.height(),
XCB_IMAGE_FORMAT_Z_PIXMAP, XCB_IMAGE_FORMAT_Z_PIXMAP,
@ -232,17 +230,18 @@ 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_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_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()); m_xcb_pixmap = xcb_generate_id(xcb_connection());
auto xcbScreen = static_cast<QXcbScreen *>(m_backingStore->window()->screen()->handle());
xcb_create_pixmap(xcb_connection(), xcb_create_pixmap(xcb_connection(),
m_xcb_image->depth, m_xcb_image->depth,
m_xcb_pixmap, m_xcb_pixmap,
m_screen_root, xcbScreen->root(),
m_xcb_image->width, m_xcb_image->height); 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_xcb_image->data) {
if (m_shm_info.shmaddr) { if (m_shm_info.shmaddr) {
@ -268,7 +267,7 @@ void QXcbShmImage::destroy(bool destroyShm)
m_xcb_pixmap = 0; m_xcb_pixmap = 0;
} }
void QXcbShmImage::flushScrolledRegion(bool clientSideScroll) void QXcbBackingStoreImage::flushScrolledRegion(bool clientSideScroll)
{ {
if (m_clientSideScroll == clientSideScroll) if (m_clientSideScroll == clientSideScroll)
return; return;
@ -316,7 +315,7 @@ void QXcbShmImage::flushScrolledRegion(bool clientSideScroll)
} }
} }
void QXcbShmImage::createShmSegment(size_t segmentSize) void QXcbBackingStoreImage::createShmSegment(size_t segmentSize)
{ {
Q_ASSERT(connection()->hasShm()); Q_ASSERT(connection()->hasShm());
Q_ASSERT(m_segmentSize == 0); Q_ASSERT(m_segmentSize == 0);
@ -400,7 +399,7 @@ void QXcbShmImage::createShmSegment(size_t segmentSize)
} }
} }
void QXcbShmImage::destroyShmSegment(size_t segmentSize) void QXcbBackingStoreImage::destroyShmSegment(size_t segmentSize)
{ {
#ifndef XCB_USE_SHM_FD #ifndef XCB_USE_SHM_FD
Q_UNUSED(segmentSize) Q_UNUSED(segmentSize)
@ -433,7 +432,7 @@ void QXcbShmImage::destroyShmSegment(size_t segmentSize)
extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); 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 QRect bounds(QPoint(), size());
const QRegion scrollArea(area & bounds); const QRegion scrollArea(area & bounds);
@ -477,7 +476,7 @@ bool QXcbShmImage::scroll(const QRegion &area, int dx, int dy)
return true; return true;
} }
void QXcbShmImage::ensureGC(xcb_drawable_t dst) void QXcbBackingStoreImage::ensureGC(xcb_drawable_t dst)
{ {
if (m_gc_drawable != dst) { if (m_gc_drawable != dst) {
if (m_gc) if (m_gc)
@ -557,7 +556,7 @@ static inline quint32 round_up_scanline(quint32 base, quint32 pad)
return (base + pad - 1) & -pad; return (base + pad - 1) & -pad;
} }
void QXcbShmImage::shmPutImage(xcb_drawable_t drawable, const QRegion &region, const QPoint &offset) void QXcbBackingStoreImage::shmPutImage(xcb_drawable_t drawable, const QRegion &region, const QPoint &offset)
{ {
for (const QRect &rect : region) { for (const QRect &rect : region) {
const QPoint source = rect.translated(offset).topLeft(); const QPoint source = rect.translated(offset).topLeft();
@ -578,7 +577,7 @@ void QXcbShmImage::shmPutImage(xcb_drawable_t drawable, const QRegion &region, c
m_dirtyShm |= region.translated(offset); m_dirtyShm |= region.translated(offset);
} }
void QXcbShmImage::flushPixmap(const QRegion &region, bool fullRegion) void QXcbBackingStoreImage::flushPixmap(const QRegion &region, bool fullRegion)
{ {
if (!fullRegion) { if (!fullRegion) {
auto actualRegion = m_pendingFlush.intersected(region); auto actualRegion = m_pendingFlush.intersected(region);
@ -647,7 +646,7 @@ void QXcbShmImage::flushPixmap(const QRegion &region, bool fullRegion)
} }
} }
void QXcbShmImage::setClip(const QRegion &region) void QXcbBackingStoreImage::setClip(const QRegion &region)
{ {
if (region.isEmpty()) { if (region.isEmpty()) {
static const uint32_t mask = XCB_GC_CLIP_MASK; static const uint32_t mask = XCB_GC_CLIP_MASK;
@ -663,7 +662,7 @@ void QXcbShmImage::setClip(const QRegion &region)
} }
} }
void QXcbShmImage::put(xcb_drawable_t dst, const QRegion &region, const QPoint &offset) void QXcbBackingStoreImage::put(xcb_drawable_t dst, const QRegion &region, const QPoint &offset)
{ {
Q_ASSERT(!m_clientSideScroll); Q_ASSERT(!m_clientSideScroll);
@ -704,7 +703,7 @@ void QXcbShmImage::put(xcb_drawable_t dst, const QRegion &region, const QPoint &
setClip(QRegion()); setClip(QRegion());
} }
void QXcbShmImage::preparePaint(const QRegion &region) void QXcbBackingStoreImage::preparePaint(const QRegion &region)
{ {
if (hasShm()) { if (hasShm()) {
// to prevent X from reading from the image region while we're writing to it // to prevent X from reading from the image region while we're writing to it
@ -719,7 +718,6 @@ void QXcbShmImage::preparePaint(const QRegion &region)
QXcbBackingStore::QXcbBackingStore(QWindow *window) QXcbBackingStore::QXcbBackingStore(QWindow *window)
: QPlatformBackingStore(window) : QPlatformBackingStore(window)
, m_image(0)
{ {
QXcbScreen *screen = static_cast<QXcbScreen *>(window->screen()->handle()); QXcbScreen *screen = static_cast<QXcbScreen *>(window->screen()->handle());
setConnection(screen->connection()); setConnection(screen->connection());
@ -856,12 +854,10 @@ void QXcbBackingStore::resize(const QSize &size, const QRegion &)
} }
QXcbWindow* win = static_cast<QXcbWindow *>(pw); QXcbWindow* win = static_cast<QXcbWindow *>(pw);
if (m_image) { if (m_image)
m_image->resize(size); m_image->resize(size);
} else { else
QXcbScreen *screen = static_cast<QXcbScreen *>(window()->screen()->handle()); m_image = new QXcbBackingStoreImage(this, size);
m_image = new QXcbShmImage(screen, size, win->depth(), win->imageFormat());
}
// Slow path for bgr888 VNC: Create an additional image, paint into that and // 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. // swap R and B while copying to m_image after each paint.

View File

@ -49,7 +49,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QXcbShmImage; class QXcbBackingStoreImage;
class QXcbBackingStore : public QXcbObject, public QPlatformBackingStore class QXcbBackingStore : public QXcbObject, public QPlatformBackingStore
{ {
@ -75,7 +75,7 @@ public:
void endPaint() override; void endPaint() override;
private: private:
QXcbShmImage *m_image; QXcbBackingStoreImage *m_image = nullptr;
QStack<QRegion> m_paintRegions; QStack<QRegion> m_paintRegions;
QImage m_rgbImage; QImage m_rgbImage;
}; };

View File

@ -41,10 +41,8 @@ class tst_QClipboard : public QObject
{ {
Q_OBJECT Q_OBJECT
private slots: private slots:
#ifdef QT_NO_CLIPBOARD
void initTestCase(); void initTestCase();
void cleanupTestCase(); #if QT_CONFIG(clipboard)
#else
void init(); void init();
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_QNX) #if defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_QNX)
void copy_exit_paste(); void copy_exit_paste();
@ -58,19 +56,16 @@ private slots:
#endif #endif
}; };
#ifdef QT_NO_CLIPBOARD
void tst_QClipboard::initTestCase() void tst_QClipboard::initTestCase()
{ {
#if !QT_CONFIG(clipboard)
QSKIP("This test requires clipboard support"); 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() #if QT_CONFIG(clipboard)
{
QSKIP("This test requires clipboard support");
}
#else
void tst_QClipboard::init() void tst_QClipboard::init()
{ {
#if QT_CONFIG(process) #if QT_CONFIG(process)
@ -436,7 +431,7 @@ void tst_QClipboard::clearBeforeSetText()
QCOMPARE(QGuiApplication::clipboard()->text(), text); QCOMPARE(QGuiApplication::clipboard()->text(), text);
} }
#endif #endif // QT_CONFIG(clipboard)
QTEST_MAIN(tst_QClipboard) QTEST_MAIN(tst_QClipboard)

View File

@ -608,7 +608,7 @@ void tst_QTouchEvent::basicRawEventTranslation()
touchWidget.setAttribute(Qt::WA_AcceptTouchEvents); touchWidget.setAttribute(Qt::WA_AcceptTouchEvents);
touchWidget.setGeometry(100, 100, 400, 300); touchWidget.setGeometry(100, 100, 400, 300);
touchWidget.show(); touchWidget.show();
QVERIFY(QTest::qWaitForWindowActive(&touchWidget)); QVERIFY(QTest::qWaitForWindowExposed(&touchWidget));
QPointF pos = touchWidget.rect().center(); QPointF pos = touchWidget.rect().center();
QPointF screenPos = touchWidget.mapToGlobal(pos.toPoint()); QPointF screenPos = touchWidget.mapToGlobal(pos.toPoint());
@ -741,7 +741,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
rightWidget.setGeometry(300, 100, 100, 100); rightWidget.setGeometry(300, 100, 100, 100);
touchWidget.show(); touchWidget.show();
QVERIFY(QTest::qWaitForWindowActive(&touchWidget)); QVERIFY(QTest::qWaitForWindowExposed(&touchWidget));
QPointF leftPos = leftWidget.rect().center(); QPointF leftPos = leftWidget.rect().center();
QPointF rightPos = rightWidget.rect().center(); QPointF rightPos = rightWidget.rect().center();
@ -968,7 +968,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
rightWidget.setGeometry(300, 100, 100, 100); rightWidget.setGeometry(300, 100, 100, 100);
touchWidget.show(); touchWidget.show();
QVERIFY(QTest::qWaitForWindowActive(&touchWidget)); QVERIFY(QTest::qWaitForWindowExposed(&touchWidget));
QPointF leftPos = leftWidget.rect().center(); QPointF leftPos = leftWidget.rect().center();
QPointF rightPos = rightWidget.rect().center(); QPointF rightPos = rightWidget.rect().center();
@ -1184,7 +1184,7 @@ void tst_QTouchEvent::basicRawEventTranslationOfIds()
touchWidget.setAttribute(Qt::WA_AcceptTouchEvents); touchWidget.setAttribute(Qt::WA_AcceptTouchEvents);
touchWidget.setGeometry(100, 100, 400, 300); touchWidget.setGeometry(100, 100, 400, 300);
touchWidget.show(); touchWidget.show();
QVERIFY(QTest::qWaitForWindowActive(&touchWidget)); QVERIFY(QTest::qWaitForWindowExposed(&touchWidget));
QVarLengthArray<QPointF, 2> pos; QVarLengthArray<QPointF, 2> pos;
QVarLengthArray<QPointF, 2> screenPos; QVarLengthArray<QPointF, 2> screenPos;

View File

@ -1 +1,2 @@
linux redhatenterpriselinuxworkstation-6.6
rhel-7.4

View File

@ -3,27 +3,26 @@
** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/ ** 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 ** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in ** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the ** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in ** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms ** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further ** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us. ** information use the contact form at https://www.qt.io/contact-us.
** **
** GNU Lesser General Public License Usage ** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser ** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.1 as published by the Free Software ** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** packaging of this file. Please review the following information to ** included in the packaging of this file. Please review the following
** ensure the GNU Lesser General Public License version 2.1 requirements ** information to ensure the GNU General Public License requirements will
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
** **
** As a special exception, The Qt Company gives you certain additional ** $QT_END_LICENSE$
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** **
****************************************************************************/ ****************************************************************************/

View File

@ -592,10 +592,14 @@ void tst_QPrinter::printDialogCompleter()
{ {
QPrintDialog dialog; QPrintDialog dialog;
dialog.printer()->setOutputFileName(testPdfFileName(QLatin1String("file"))); 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.setEnabledOptions(QAbstractPrintDialog::PrintToFile);
dialog.show(); dialog.show();
QTest::qWait(100); QVERIFY(QTest::qWaitForWindowActive(&dialog));
QTest::keyClick(&dialog, Qt::Key_Tab); QTest::keyClick(&dialog, Qt::Key_Tab);
QTest::keyClick(&dialog, 'P'); QTest::keyClick(&dialog, 'P');