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) 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/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/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. 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. */ 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. + 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: 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. + 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 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)); 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. diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 369405c7cd..b41a883e80 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -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; otherwise returns an empty list. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QStringList QVariant::toStringList() const { @@ -2394,14 +2394,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. - \sa canConvert(), convert() + Calling QVariant::toString() on an unsupported variant returns an empty + string. + + \sa canConvert(int targetTypeId), convert() */ QString QVariant::toString() const { @@ -2412,7 +2417,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 { @@ -2423,7 +2428,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 { @@ -2440,7 +2445,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 { @@ -2457,7 +2462,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 { @@ -2474,7 +2479,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 { @@ -2488,7 +2493,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 @@ -2504,7 +2509,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 { @@ -2519,7 +2524,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 { @@ -2532,7 +2537,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 { @@ -2545,7 +2550,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 { @@ -2558,7 +2563,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 { @@ -2572,7 +2577,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 { @@ -2585,7 +2590,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 { @@ -2598,7 +2603,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 { @@ -2612,7 +2617,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 { @@ -2628,7 +2633,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 { @@ -2642,7 +2647,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 { @@ -2656,7 +2661,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 @@ -2673,7 +2678,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 { @@ -2688,7 +2693,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 { @@ -2701,7 +2706,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 { @@ -2717,7 +2722,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 { @@ -2730,7 +2735,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 { @@ -2743,7 +2748,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 { @@ -2756,7 +2761,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 { @@ -2769,7 +2774,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 { @@ -2784,7 +2789,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 { @@ -2795,7 +2800,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 { @@ -2838,7 +2843,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 { @@ -2860,7 +2865,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 { @@ -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 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 { @@ -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 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 { @@ -2911,7 +2916,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 { @@ -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 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 { @@ -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 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 { @@ -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 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 { @@ -2984,7 +2989,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 { @@ -3366,7 +3371,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) diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp index 9a5505bd1e..f418ac1205 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); + } } /*! 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); 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; diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 70d1757af4..659d1c53cb 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -70,11 +70,13 @@ QT_BEGIN_NAMESPACE -class QXcbShmImage : public QXcbObject +class QXcbBackingStore; + +class QXcbBackingStoreImage : public QXcbObject { public: - QXcbShmImage(QXcbScreen *connection, const QSize &size, uint depth, QImage::Format format); - ~QXcbShmImage() { destroy(true); } + 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,16 +137,15 @@ 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 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) { } @@ -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,28 +176,25 @@ 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) - : 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) +QXcbBackingStoreImage::QXcbBackingStoreImage(QXcbBackingStore *backingStore, const QSize &size) + : QXcbObject(backingStore->connection()) + , m_backingStore(backingStore) { - const xcb_format_t *fmt = connection()->formatForDepth(depth); + 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 QXcbShmImage::resize(const QSize &size) +void QXcbBackingStoreImage::resize(const QSize &size) { xcb_format_t fmt; fmt.depth = m_xcb_image->depth; @@ -207,7 +205,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,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_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()); + 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); } -void QXcbShmImage::destroy(bool destroyShm) +void QXcbBackingStoreImage::destroy(bool destroyShm) { if (m_xcb_image->data) { if (m_shm_info.shmaddr) { @@ -268,7 +267,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 +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(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 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); -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 +476,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 +556,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 +577,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 +646,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 +662,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 +703,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 @@ -719,7 +718,6 @@ void QXcbShmImage::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 QXcbShmImage(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 2e8fbfb7fa..747626c213 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 = nullptr; QStack m_paintRegions; QImage m_rgbImage; }; 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) 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; 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 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$ ** ****************************************************************************/ diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index 314cce0270..a612f0749b 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');