diff options
Diffstat (limited to 'src')
111 files changed, 960 insertions, 373 deletions
diff --git a/src/corelib/doc/images/qrect-unite.png b/src/corelib/doc/images/qrect-unite.png Binary files differdeleted file mode 100644 index 3f6239f405b..00000000000 --- a/src/corelib/doc/images/qrect-unite.png +++ /dev/null diff --git a/src/corelib/doc/images/qrect-unite.webp b/src/corelib/doc/images/qrect-unite.webp Binary files differnew file mode 100644 index 00000000000..99fb562b34d --- /dev/null +++ b/src/corelib/doc/images/qrect-unite.webp diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 6c11d85f606..5f692c7c434 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -1176,17 +1176,17 @@ uchar *QDynamicFileResourceRoot::map_sys(QFile &file, qint64 offset, qsizetype s void *ptr = nullptr; if (size < 0) size = qMin(file.size() - offset, (std::numeric_limits<qsizetype>::max)()); - + int fd = file.handle(); + if (fd < 0) + return nullptr; // We don't use QFile::map() here because we want to dispose of the QFile object #if defined(QT_USE_MMAP) - int fd = file.handle(); int protection = PROT_READ; // read-only memory int flags = MAP_FILE | MAP_PRIVATE; // swap-backed map from file ptr = QT_MMAP(nullptr, size, protection, flags, fd, offset); if (ptr == MAP_FAILED) ptr = nullptr; #elif defined(Q_OS_WIN) - int fd = file.handle(); HANDLE fileHandle = reinterpret_cast<HANDLE>(_get_osfhandle(fd)); if (fileHandle != INVALID_HANDLE_VALUE) { HANDLE mapHandle = CreateFileMapping(fileHandle, 0, PAGE_WRITECOPY, 0, 0, 0); diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index a4fbf69da8b..2fde5598ed2 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -1944,7 +1944,8 @@ void QUrl::setUrl(const QString &url, ParsingMode parsingMode) The following example shows a URL where the scheme is "ftp": - \image qurl-authority2.png + \image qurl-authority2.png {Illustration highlighting 'ftp' as scheme + of an example URL starting with 'ftp://'.} To set the scheme, the following call is used: \snippet code/src_corelib_io_qurl.cpp 11 @@ -1999,7 +2000,8 @@ QString QUrl::scheme() const The following example shows a valid authority string: - \image qurl-authority.png + \image qurl-authority.png {Screenshot of a URL with parts labeled: scheme, + authority, user info (user and password), host, and port.} The \a authority data is interpreted according to \a mode: in StrictMode, any '%' characters must be followed by exactly two hexadecimal characters @@ -2066,7 +2068,7 @@ QString QUrl::authority(ComponentFormattingOptions options) const separated by a ':'. If the password is empty, the colon must be omitted. The following example shows a valid user info string: - \image qurl-authority3.png + \image qurl-authority3.png {Screenshot of a URL with user info highlighted} The \a userInfo data is interpreted according to \a mode: in StrictMode, any '%' characters must be followed by exactly two hexadecimal characters @@ -2368,12 +2370,13 @@ int QUrl::port(int defaultPort) const Sets the path of the URL to \a path. The path is the part of the URL that comes after the authority but before the query string. - \image qurl-ftppath.png + \image qurl-ftppath.png {Screenshot showing a URL with the path highlighted} For non-hierarchical schemes, the path will be everything following the scheme declaration, as in the following example: - \image qurl-mailtopath.png + \image qurl-mailtopath.png {Screenshot of a URL with the mail path + highlighted} The \a path data is interpreted according to \a mode: in StrictMode, any '%' characters must be followed by exactly two hexadecimal characters @@ -2589,7 +2592,7 @@ QString QUrl::query(ComponentFormattingOptions options) const characters. It is typically used in HTTP for referring to a certain link or point on a page: - \image qurl-fragment.png + \image qurl-fragment.png {Screenshot of a URL with the fragment highlighted} The fragment is sometimes also referred to as the URL "reference". diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp index 77eb7f9eebf..ede89584e7b 100644 --- a/src/corelib/io/qurlquery.cpp +++ b/src/corelib/io/qurlquery.cpp @@ -29,7 +29,8 @@ QT_BEGIN_NAMESPACE It is used to parse the query strings found in URLs like the following: - \image qurl-querystring.png + \image qurl-querystring.png {Illustration of a URL with part after question mark + highlighted as query string.} Query strings like the above are used to transmit options in the URL and are usually decoded into multiple key-value pairs. The one above would contain @@ -548,7 +549,8 @@ QString QUrlQuery::query(QUrl::ComponentFormattingOptions encoding) const and between key-value pairs in the URL's query string. The default value delimiter is '=' and the default pair delimiter is '&'. - \image qurl-querystring.png + \image qurl-querystring.png {Illustration of a URL with part after + question mark highlighted as query string.} \a valueDelimiter will be used for separating keys from values, and \a pairDelimiter will be used to separate key-value pairs. diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index f759f467cfc..c960e11f6bb 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -1390,7 +1390,8 @@ void QAbstractItemModel::resetInternalData() simple table of rows and columns. Each item has a unique index specified by a QModelIndex. - \image modelindex-no-parent.png + \image modelindex-no-parent.png {Screenshot showing a 3x3 grid with numbered + rows and columns that shows the cell at row 1, column 2 highlighted.} Every item of data that can be accessed via a model has an associated model index. You can obtain this model index using the index() function. Each diff --git a/src/corelib/itemmodels/qrangemodel_impl.h b/src/corelib/itemmodels/qrangemodel_impl.h index e0d5185ec47..f38dc88c0d9 100644 --- a/src/corelib/itemmodels/qrangemodel_impl.h +++ b/src/corelib/itemmodels/qrangemodel_impl.h @@ -1560,12 +1560,12 @@ public: return setRangeModelDataRole(); return ItemAccess::writeRole(target, data, role); } if constexpr (has_metaobject<value_type>) { - if (role == Qt::RangeModelDataRole) { - return setRangeModelDataRole(); - } else if (row_traits::fixed_size() <= 1) { + if (row_traits::fixed_size() <= 1) { // multi-role value + if (role == Qt::RangeModelDataRole) + return setRangeModelDataRole(); return writeRole(role, QRangeModelDetails::pointerTo(target), data); - } else if (column <= row_traits::fixed_size() - && (role == Qt::DisplayRole || role == Qt::EditRole)) { + } else if (column <= row_traits::fixed_size() // multi-column + && (role == Qt::DisplayRole || role == Qt::EditRole || role == Qt::RangeModelDataRole)) { return writeProperty(column, QRangeModelDetails::pointerTo(target), data); } } else if constexpr (multi_role::value) { diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 835f2d97f3e..8efb8370028 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -276,6 +276,10 @@ inline void QFactoryLoader::Private::updateSinglePath(const QString &path) #endif QDirListing::IteratorFlag::FilesOnly | QDirListing::IteratorFlag::ResolveSymlinks); + auto versionFromLib = [](const QLibraryPrivate *lib) { + return lib->metaData.value(QtPluginMetaDataKeys::QtVersion).toInteger(); + }; + for (const auto &dirEntry : plugins) { const QString &fileName = dirEntry.fileName(); #if defined(Q_PROCESSOR_X86) @@ -314,7 +318,7 @@ inline void QFactoryLoader::Private::updateSinglePath(const QString &path) continue; static constexpr qint64 QtVersionNoPatch = QT_VERSION_CHECK(QT_VERSION_MAJOR, QT_VERSION_MINOR, 0); - int thisVersion = library->metaData.value(QtPluginMetaDataKeys::QtVersion).toInteger(); + qint64 thisVersion = versionFromLib(library.get()); if (iid.startsWith(QStringLiteral("org.qt-project.Qt.QPA"))) { // QPA plugins must match Qt Major.Minor if (thisVersion != QtVersionNoPatch) { @@ -338,7 +342,7 @@ inline void QFactoryLoader::Private::updateSinglePath(const QString &path) // If the existing library was built with a future Qt version, // whereas the one we're considering has a Qt version that fits // better, we prioritize the better match. - int existingVersion = existingLibrary->metaData.value(QtPluginMetaDataKeys::QtVersion).toInteger(); + qint64 existingVersion = versionFromLib(existingLibrary); if (existingVersion == QtVersionNoPatch) continue; // Prefer exact Qt version match if (existingVersion < QtVersionNoPatch && thisVersion > QtVersionNoPatch) diff --git a/src/corelib/serialization/qtextstream.cpp b/src/corelib/serialization/qtextstream.cpp index 08764340d66..dd216ae3dff 100644 --- a/src/corelib/serialization/qtextstream.cpp +++ b/src/corelib/serialization/qtextstream.cpp @@ -319,12 +319,14 @@ void QTextStreamPrivate::setupDevice(QIODevice *device) disconnectFromDevice(); #ifndef QT_NO_QOBJECT - // Explicitly set a direct connection (though it would have been so - // anyway) so that QTextStream can be used from multiple threads when the - // application code is handling synchronization (see also QTBUG-12055). - aboutToCloseConnection = - QObject::connect(device, &QIODevice::aboutToClose, device, - [this] { flushWriteBuffer(); }, Qt::DirectConnection); + if (device) { + // Explicitly set a direct connection (though it would have been so + // anyway) so that QTextStream can be used from multiple threads when the + // application code is handling synchronization (see also QTBUG-12055). + aboutToCloseConnection = QObject::connect( + device, &QIODevice::aboutToClose, device, [this] { flushWriteBuffer(); }, + Qt::DirectConnection); + } #else Q_UNUSED(device); #endif diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index a1e47b033eb..de68a0042ac 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -66,172 +66,213 @@ The type of easing curve. - \value Linear \image qeasingcurve-linear.png + \value Linear \image qeasingcurve-linear.png {Graph of a + linear function.} \caption Easing curve for a linear (t) function: velocity is constant. - \value InQuad \image qeasingcurve-inquad.png + \value InQuad \image qeasingcurve-inquad.png {Graph of a + InQuadratic function.} \caption Easing curve for a quadratic (t^2) function: accelerating from zero velocity. - \value OutQuad \image qeasingcurve-outquad.png + \value OutQuad \image qeasingcurve-outquad.png {Graph of a + OutQuadratic function} \caption Easing curve for a quadratic (t^2) function: decelerating to zero velocity. - \value InOutQuad \image qeasingcurve-inoutquad.png + \value InOutQuad \image qeasingcurve-inoutquad.png {Graph of a + InOutquad quadratic function} \caption Easing curve for a quadratic (t^2) function: acceleration until halfway, then deceleration. - \value OutInQuad \image qeasingcurve-outinquad.png + \value OutInQuad \image qeasingcurve-outinquad.png {Graph of a + OutInquad quadratic function} \caption Easing curve for a quadratic (t^2) function: deceleration until halfway, then acceleration. - \value InCubic \image qeasingcurve-incubic.png + \value InCubic \image qeasingcurve-incubic.png {Graph of a + InCubic function} \caption Easing curve for a cubic (t^3) function: accelerating from zero velocity. - \value OutCubic \image qeasingcurve-outcubic.png + \value OutCubic \image qeasingcurve-outcubic.png {Graph of a + OutCubic function} \caption Easing curve for a cubic (t^3) function: decelerating to zero velocity. - \value InOutCubic \image qeasingcurve-inoutcubic.png + \value InOutCubic \image qeasingcurve-inoutcubic.png {Graph of a + InOutCubic function.} \caption Easing curve for a cubic (t^3) function: acceleration until halfway, then deceleration. - \value OutInCubic \image qeasingcurve-outincubic.png + \value OutInCubic \image qeasingcurve-outincubic.png {Graph of a + OutInCubic function.} \caption Easing curve for a cubic (t^3) function: deceleration until halfway, then acceleration. - \value InQuart \image qeasingcurve-inquart.png + \value InQuart \image qeasingcurve-inquart.png {Graph of a + InQuartic function.} \caption Easing curve for a quartic (t^4) function: accelerating from zero velocity. - \value OutQuart \image qeasingcurve-outquart.png + \value OutQuart \image qeasingcurve-outquart.png {Graph of a + OutQuartic function.} \caption Easing curve for a quartic (t^4) function: decelerating to zero velocity. - \value InOutQuart \image qeasingcurve-inoutquart.png + \value InOutQuart \image qeasingcurve-inoutquart.png {Graph of a + InOutQuartic function.} \caption Easing curve for a quartic (t^4) function: acceleration until halfway, then deceleration. - \value OutInQuart \image qeasingcurve-outinquart.png + \value OutInQuart \image qeasingcurve-outinquart.png {Graph of a + OutInQuartic function.} \caption Easing curve for a quartic (t^4) function: deceleration until halfway, then acceleration. - \value InQuint \image qeasingcurve-inquint.png + \value InQuint \image qeasingcurve-inquint.png {Graph of a + InQuintic function} \caption Easing curve for a quintic (t^5) easing in: accelerating from zero velocity. - \value OutQuint \image qeasingcurve-outquint.png + \value OutQuint \image qeasingcurve-outquint.png {Graph of a + OutQuintic function} \caption Easing curve for a quintic (t^5) function: decelerating to zero velocity. - \value InOutQuint \image qeasingcurve-inoutquint.png + \value InOutQuint \image qeasingcurve-inoutquint.png {Graph of a + InOutQuintic function} \caption Easing curve for a quintic (t^5) function: acceleration until halfway, then deceleration. - \value OutInQuint \image qeasingcurve-outinquint.png + \value OutInQuint \image qeasingcurve-outinquint.png {Graph of a + OutInQuintic function} \caption Easing curve for a quintic (t^5) function: deceleration until halfway, then acceleration. - \value InSine \image qeasingcurve-insine.png + \value InSine \image qeasingcurve-insine.png {Graph of a + InSinusoidal function} \caption Easing curve for a sinusoidal (sin(t)) function: accelerating from zero velocity. - \value OutSine \image qeasingcurve-outsine.png + \value OutSine \image qeasingcurve-outsine.png {Graph of a + OutSinusoidal function} \caption Easing curve for a sinusoidal (sin(t)) function: decelerating to zero velocity. - \value InOutSine \image qeasingcurve-inoutsine.png + \value InOutSine \image qeasingcurve-inoutsine.png {Graph of a + InOutSinusoidal function} \caption Easing curve for a sinusoidal (sin(t)) function: acceleration until halfway, then deceleration. - \value OutInSine \image qeasingcurve-outinsine.png + \value OutInSine \image qeasingcurve-outinsine.png {Graph of a + OutInSinusoidal function} \caption Easing curve for a sinusoidal (sin(t)) function: deceleration until halfway, then acceleration. - \value InExpo \image qeasingcurve-inexpo.png + \value InExpo \image qeasingcurve-inexpo.png {Graph of a + InExponential function} \caption Easing curve for an exponential (2^t) function: accelerating from zero velocity. - \value OutExpo \image qeasingcurve-outexpo.png + \value OutExpo \image qeasingcurve-outexpo.png {Graph of a + OutExponential function} \caption Easing curve for an exponential (2^t) function: decelerating to zero velocity. - \value InOutExpo \image qeasingcurve-inoutexpo.png + \value InOutExpo \image qeasingcurve-inoutexpo.png {Graph of a + InOutExponential function} \caption Easing curve for an exponential (2^t) function: acceleration until halfway, then deceleration. - \value OutInExpo \image qeasingcurve-outinexpo.png + \value OutInExpo \image qeasingcurve-outinexpo.png {Graph of a + OutInExponential function} \caption Easing curve for an exponential (2^t) function: deceleration until halfway, then acceleration. - \value InCirc \image qeasingcurve-incirc.png + \value InCirc \image qeasingcurve-incirc.png {Graph of a + InCircular function} \caption Easing curve for a circular (sqrt(1-t^2)) function: accelerating from zero velocity. - \value OutCirc \image qeasingcurve-outcirc.png + \value OutCirc \image qeasingcurve-outcirc.png {Graph of a + OutCircular function} \caption Easing curve for a circular (sqrt(1-t^2)) function: decelerating to zero velocity. - \value InOutCirc \image qeasingcurve-inoutcirc.png + \value InOutCirc \image qeasingcurve-inoutcirc.png {Graph of a + InOutCircular function} \caption Easing curve for a circular (sqrt(1-t^2)) function: acceleration until halfway, then deceleration. - \value OutInCirc \image qeasingcurve-outincirc.png + \value OutInCirc \image qeasingcurve-outincirc.png {Graph of a + OutInCircular function} \caption Easing curve for a circular (sqrt(1-t^2)) function: deceleration until halfway, then acceleration. - \value InElastic \image qeasingcurve-inelastic.png + \value InElastic \image qeasingcurve-inelastic.png {Graph of a + InElastic function} \caption Easing curve for an elastic (exponentially decaying sine wave) function: accelerating from zero velocity. The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter. - \value OutElastic \image qeasingcurve-outelastic.png + \value OutElastic \image qeasingcurve-outelastic.png {Graph of a + OutElastic function} \caption Easing curve for an elastic (exponentially decaying sine wave) function: decelerating to zero velocity. The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter. - \value InOutElastic \image qeasingcurve-inoutelastic.png + \value InOutElastic \image qeasingcurve-inoutelastic.png {Graph of a + InOutElastic function} \caption Easing curve for an elastic (exponentially decaying sine wave) function: acceleration until halfway, then deceleration. - \value OutInElastic \image qeasingcurve-outinelastic.png + \value OutInElastic \image qeasingcurve-outinelastic.png {Graph of a + OutInElastic function} \caption Easing curve for an elastic (exponentially decaying sine wave) function: deceleration until halfway, then acceleration. - \value InBack \image qeasingcurve-inback.png + \value InBack \image qeasingcurve-inback.png {Graph of a + InBack function} \caption Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity. - \value OutBack \image qeasingcurve-outback.png + \value OutBack \image qeasingcurve-outback.png {Graph of a + OutBack function} \caption Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing out: decelerating to zero velocity. - \value InOutBack \image qeasingcurve-inoutback.png + \value InOutBack \image qeasingcurve-inoutback.png Graph of a + InOutBack function} \caption Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration. - \value OutInBack \image qeasingcurve-outinback.png + \value OutInBack \image qeasingcurve-outinback.png {Graph of a + OutInBack function} \caption Easing curve for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration. - \value InBounce \image qeasingcurve-inbounce.png + \value InBounce \image qeasingcurve-inbounce.png {Graph of a + InBounce function} \caption Easing curve for a bounce (exponentially decaying parabolic bounce) function: accelerating from zero velocity. - \value OutBounce \image qeasingcurve-outbounce.png + \value OutBounce \image qeasingcurve-outbounce.png {Graph of a + OutBounce function} \caption Easing curve for a bounce (exponentially decaying parabolic bounce) function: decelerating from zero velocity. - \value InOutBounce \image qeasingcurve-inoutbounce.png + \value InOutBounce \image qeasingcurve-inoutbounce.png {Graph of a + InOutBounce function} \caption Easing curve for a bounce (exponentially decaying parabolic bounce) function easing in/out: acceleration until halfway, then deceleration. - \value OutInBounce \image qeasingcurve-outinbounce.png + \value OutInBounce \image qeasingcurve-outinbounce.png {Graph of a + OutInBounce function} \caption Easing curve for a bounce (exponentially decaying parabolic bounce) function easing out/in: diff --git a/src/corelib/tools/qiterator.qdoc b/src/corelib/tools/qiterator.qdoc index 99c1c22620b..3d8ea595167 100644 --- a/src/corelib/tools/qiterator.qdoc +++ b/src/corelib/tools/qiterator.qdoc @@ -1188,7 +1188,7 @@ \sa hasNext(), next(), peekPrevious() */ -/*! \fn template <class Key, class T> QMutableMapIterator<Key, T>::Item QMutableMapIterator<Key, T>::peekNext() const +/*! \fn template <class Key, class T> QMutableMultiMapIterator<Key, T>::Item QMutableMultiMapIterator<Key, T>::peekNext() const Returns a reference to the next item without moving the iterator. diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp index e313b06aa92..7da65599a72 100644 --- a/src/corelib/tools/qline.cpp +++ b/src/corelib/tools/qline.cpp @@ -508,7 +508,8 @@ QDataStream &operator>>(QDataStream &stream, QLine &line) Returns a line that is perpendicular to this line with the same starting point and length. - \image qlinef-normalvector.png + \image qlinef-normalvector.png {Diagram showing two vectors with the same + starting point: (v_x, v_y) and (vy, -vx).} \sa unitVector() */ diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp index 6ca3caa0f44..acd3f8cbd13 100644 --- a/src/corelib/tools/qrect.cpp +++ b/src/corelib/tools/qrect.cpp @@ -66,8 +66,15 @@ QT_BEGIN_NAMESPACE \table \row - \li \inlineimage qrect-intersect.png - \li \inlineimage qrect-unite.png + \li \inlineimage qrect-intersect.png {Diagram showing intersection + of two rectangles r and s with the overlapping area + highlighted. It's also showing how the width and + height of the highlighted area is determined with + r.intersect(s).width() and r.intersect(s).height().} + \li \inlineimage qrect-unite.webp {Diagram showing two overlapped + rectangles r and s and their united size which is + determined with r.united(s).width() and + r.united(s).height().} \row \li intersected() \li united() @@ -132,7 +139,10 @@ QT_BEGIN_NAMESPACE horizontally, leaving the rectangle's left edge at the given x coordinate and its size unchanged. - \image qrect-coordinates.png + \image qrect-coordinates.png {Diagram of a rectangle showing QRect + methods for positions: x(), y(), center(), corners (topLeft(), + topRight(), bottomLeft(), bottomRight()), and edges (top(), + bottom(), left(), right()).} Note that for historical reasons the values returned by the bottom() and right() functions deviate from the true bottom-right @@ -977,7 +987,9 @@ QRect QRect::operator|(const QRect &r) const noexcept Returns the bounding rectangle of this rectangle and the given \a rectangle. - \image qrect-unite.png + \image qrect-unite.webp {Diagram showing two overlapped rectangles r and s + and their united size which is determined with r.united(s).width and + r.united(s).height().} \sa intersected() */ @@ -1046,7 +1058,11 @@ QRect QRect::operator&(const QRect &r) const noexcept Returns the intersection of this rectangle and the given \a rectangle. Note that \c{r.intersected(s)} is equivalent to \c{r & s}. - \image qrect-intersect.png + \image qrect-intersect.png {Diagram showing intersection of two + rectangles r and s with the overlapping area highlighted. + It also shows how the width and height of the highlighted area + is determined with r.intersect(s).width and + r.intersect(s).height().} \sa intersects(), united(), operator&=() */ @@ -1332,8 +1348,15 @@ QDebug operator<<(QDebug dbg, const QRect &r) \table \row - \li \inlineimage qrect-intersect.png - \li \inlineimage qrect-unite.png + \li \inlineimage qrect-intersect.png {Diagram showing intersection + of two rectangles r and s with the overlapping area + highlighted. It's also showing how the width and + height of the highlighted area is determined with + r.intersect(s).width and r.intersect(s).height().} + \li \inlineimage qrect-unite.webp {Diagram showing two overlapped + rectangles r and s and their united size which is + determined with r.united(s).width and + r.united(s).height()} \row \li intersected() \li united() @@ -1398,7 +1421,10 @@ QDebug operator<<(QDebug dbg, const QRect &r) vertically, leaving the rectangle's bottom edge at the given y coordinate and its size unchanged. - \image qrectf-coordinates.png + \image qrectf-coordinates.png {Diagram of a rectangle showing QRect + methods for positions: x(), y(), center(), corners (topLeft(), + topRight(), bottomLeft(), bottomRight()), and edges (top(), + bottom(), left(), right()).} It is also possible to add offsets to this rectangle's coordinates using the adjust() function, as well as retrieve a new rectangle @@ -2171,7 +2197,9 @@ QRectF QRectF::operator|(const QRectF &r) const noexcept Returns the bounding rectangle of this rectangle and the given \a rectangle. - \image qrect-unite.png + \image qrect-unite.webp {Diagram showing two overlapped rectangles + r and s and their united size which is determined with + r.united(s).width and r.united(s).height()} \sa intersected() */ @@ -2246,7 +2274,11 @@ QRectF QRectF::operator&(const QRectF &r) const noexcept rectangle. Note that \c {r.intersected(s)} is equivalent to \c {r & s}. - \image qrect-intersect.png + \image qrect-intersect.png {Diagram showing intersection of two + rectangles r and s with the overlapping area highlighted. + It's also showing how the width and height of the + highlighted area is determined with r.intersect(s).width + and r.intersect(s).height().} \sa intersects(), united(), operator&=() */ diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 6d4c93b2553..6ba113ef8fb 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2528,41 +2528,52 @@ QRgb QImage::pixel(int x, int y) const } return d->colortable.at(index); } - + std::optional<QRgb> out; switch (d->format) { case Format_RGB32: - return 0xff000000 | reinterpret_cast<const QRgb *>(s)[x]; case Format_ARGB32: // Keep old behaviour. case Format_ARGB32_Premultiplied: - return reinterpret_cast<const QRgb *>(s)[x]; + out = reinterpret_cast<const QRgb *>(s)[x]; + break; case Format_RGBX8888: case Format_RGBA8888: // Match ARGB32 behavior. case Format_RGBA8888_Premultiplied: - return RGBA2ARGB(reinterpret_cast<const quint32 *>(s)[x]); + out = RGBA2ARGB(reinterpret_cast<const quint32 *>(s)[x]); + break; case Format_BGR30: case Format_A2BGR30_Premultiplied: - return qConvertA2rgb30ToArgb32<PixelOrderBGR>(reinterpret_cast<const quint32 *>(s)[x]); + out = qConvertA2rgb30ToArgb32<PixelOrderBGR>(reinterpret_cast<const quint32 *>(s)[x]); + break; case Format_RGB30: case Format_A2RGB30_Premultiplied: - return qConvertA2rgb30ToArgb32<PixelOrderRGB>(reinterpret_cast<const quint32 *>(s)[x]); + out = qConvertA2rgb30ToArgb32<PixelOrderRGB>(reinterpret_cast<const quint32 *>(s)[x]); + break; case Format_RGB16: return qConvertRgb16To32(reinterpret_cast<const quint16 *>(s)[x]); case Format_RGBX64: case Format_RGBA64: // Match ARGB32 behavior. case Format_RGBA64_Premultiplied: - return reinterpret_cast<const QRgba64 *>(s)[x].toArgb32(); + out = reinterpret_cast<const QRgba64 *>(s)[x].toArgb32(); + break; case Format_RGBX16FPx4: case Format_RGBA16FPx4: // Match ARGB32 behavior. case Format_RGBA16FPx4_Premultiplied: - return reinterpret_cast<const QRgbaFloat16 *>(s)[x].toArgb32(); + out = reinterpret_cast<const QRgbaFloat16 *>(s)[x].toArgb32(); + break; case Format_RGBX32FPx4: case Format_RGBA32FPx4: // Match ARGB32 behavior. case Format_RGBA32FPx4_Premultiplied: - return reinterpret_cast<const QRgbaFloat32 *>(s)[x].toArgb32(); + out = reinterpret_cast<const QRgbaFloat32 *>(s)[x].toArgb32(); default: break; } const QPixelLayout *layout = &qPixelLayouts[d->format]; + if (out) { + // Fix up alpha + if (!layout->hasAlphaChannel) + *out |= 0xff000000; + return *out; + } uint result; return *layout->fetchToARGB32PM(&result, s, x, 1, nullptr, nullptr); } @@ -2747,6 +2758,8 @@ QColor QImage::pixelColor(int x, int y) const QRgbaFloat16 p = reinterpret_cast<const QRgbaFloat16 *>(s)[x]; if (d->format == Format_RGBA16FPx4_Premultiplied) p = p.unpremultiplied(); + else if (d->format == Format_RGBX16FPx4) + p.setAlpha(1.0f); QColor color; color.setRgbF(p.red(), p.green(), p.blue(), p.alpha()); return color; @@ -2757,6 +2770,8 @@ QColor QImage::pixelColor(int x, int y) const QRgbaFloat32 p = reinterpret_cast<const QRgbaFloat32 *>(s)[x]; if (d->format == Format_RGBA32FPx4_Premultiplied) p = p.unpremultiplied(); + else if (d->format == Format_RGBX32FPx4) + p.setAlpha(1.0f); QColor color; color.setRgbF(p.red(), p.green(), p.blue(), p.alpha()); return color; @@ -2765,6 +2780,16 @@ QColor QImage::pixelColor(int x, int y) const c = QRgba64::fromArgb32(pixel(x, y)); break; } + // Alpha fix up + switch (d->format) { + case Format_BGR30: + case Format_RGB30: + case Format_RGBX64: + c.setAlpha(65535); + break; + default: + break; + } // QColor is always unpremultiplied if (hasAlphaChannel() && qPixelLayouts[d->format].premultiplied) c = c.unpremultiplied(); @@ -3001,7 +3026,8 @@ bool QImage::isGrayscale() const given \a size according to the given \a aspectRatioMode and \a transformMode. - \image qimage-scaling.png + \image qimage-scaling.png {Illustration showing three different + ways to scale images with Aspect Ratio Mode} \list \li If \a aspectRatioMode is Qt::IgnoreAspectRatio, the image diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index e52f8244550..ac0525d7abf 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -26,9 +26,16 @@ QT_BEGIN_NAMESPACE -void qt_format_text(const QFont &fnt, const QRectF &_r, - int tf, const QTextOption *opt, const QString& str, QRectF *brect, - int tabstops, int *, int tabarraylen, +void qt_format_text(const QFont &fnt, + const QRectF &_r, + int tf, + int alignment, + const QTextOption *opt, + const QString& str, + QRectF *brect, + int tabstops, + int *, + int tabarraylen, QPainter *painter); /*! @@ -616,21 +623,46 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) s >> justificationWidth; int flags = Qt::TextSingleLine | Qt::TextDontClip | Qt::TextForceLeftToRight; + int alignment = 0; QSizeF size(1, 1); if (justificationWidth > 0) { size.setWidth(justificationWidth); flags |= Qt::TextJustificationForced; - flags |= Qt::AlignJustify; + alignment |= Qt::AlignJustify; } - QFontMetrics fm(fnt); - QPointF pt(p.x(), p.y() - fm.ascent()); - qt_format_text(fnt, QRectF(pt, size), flags, /*opt*/nullptr, - str, /*brect=*/nullptr, /*tabstops=*/0, /*...*/nullptr, /*tabarraylen=*/0, painter); + QPointF pt(p.x(), p.y()); + if (d->formatMajor >= QDataStream::Qt_6_11) { + alignment |= Qt::AlignBaseline; + } else { + QFontMetrics fm(fnt); + pt.ry() -= fm.ascent(); + } + + qt_format_text(fnt, + QRectF(pt, size), + flags, + alignment, + /*opt*/nullptr, + str, + /*brect=*/nullptr, + /*tabstops=*/0, + /*...*/nullptr, + /*tabarraylen=*/0, + painter); } else { - qt_format_text(font, QRectF(p, QSizeF(1, 1)), Qt::TextSingleLine | Qt::TextDontClip, /*opt*/nullptr, - str, /*brect=*/nullptr, /*tabstops=*/0, /*...*/nullptr, /*tabarraylen=*/0, painter); + qt_format_text(font, + QRectF(p, QSizeF(1, 1)), + Qt::TextSingleLine | Qt::TextDontClip, + 0, + /*opt*/nullptr, + str, + /*brect=*/nullptr, + /*tabstops=*/0, + /*...*/nullptr, + /*tabarraylen=*/0, + painter); } break; diff --git a/src/gui/itemmodels/qfilesystemmodel_p.h b/src/gui/itemmodels/qfilesystemmodel_p.h index 0747b2a07d6..e8599beec2c 100644 --- a/src/gui/itemmodels/qfilesystemmodel_p.h +++ b/src/gui/itemmodels/qfilesystemmodel_p.h @@ -22,7 +22,6 @@ #include <private/qabstractitemmodel_p.h> #include <qabstractitemmodel.h> #include "qfileinfogatherer_p.h" -#include <qpair.h> #include <qdir.h> #include <qicon.h> #include <qfileinfo.h> diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm index 59193a3c716..dfdfa8f84e7 100644 --- a/src/gui/painting/qcoregraphics.mm +++ b/src/gui/painting/qcoregraphics.mm @@ -333,25 +333,24 @@ QT_END_NAMESPACE + (instancetype)imageFromQIcon:(const QIcon &)icon { - return [NSImage imageFromQIcon:icon withSize:0]; + return [NSImage imageFromQIcon:icon withSize:QSize()]; } -+ (instancetype)imageFromQIcon:(const QIcon &)icon withSize:(int)size ++ (instancetype)imageFromQIcon:(const QIcon &)icon withSize:(const QSize &)size { - return [NSImage imageFromQIcon:icon withSize:0 withMode:QIcon::Normal withState:QIcon::Off]; + return [NSImage imageFromQIcon:icon withSize:size withMode:QIcon::Normal withState:QIcon::Off]; } - -+ (instancetype)imageFromQIcon:(const QIcon &)icon withSize:(int)size withMode:(QIcon::Mode)mode - withState:(QIcon::State)state ++ (instancetype)imageFromQIcon:(const QIcon &)icon withSize:(const QSize &)size + withMode:(QIcon::Mode)mode withState:(QIcon::State)state { if (icon.isNull()) return nil; auto availableSizes = icon.availableSizes(); - if (availableSizes.isEmpty() && size > 0) - availableSizes << QSize(size, size); + if (availableSizes.isEmpty() && !size.isNull()) + availableSizes << size; auto nsImage = [[[NSImage alloc] initWithSize:NSZeroSize] autorelease]; @@ -377,8 +376,10 @@ QT_END_NAMESPACE [nsImage setTemplate:icon.isMask()]; - if (size) - nsImage.size = CGSizeMake(size, size); + if (!size.isNull()) { + auto imageSize = QSizeF::fromCGSize(nsImage.size); + nsImage.size = imageSize.scaled(size, Qt::KeepAspectRatio).toCGSize(); + } return nsImage; } diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h index 61eeb78a012..7bec19ffb98 100644 --- a/src/gui/painting/qcoregraphics_p.h +++ b/src/gui/painting/qcoregraphics_p.h @@ -17,6 +17,8 @@ #include <QtCore/private/qcore_mac_p.h> +#include <QtCore/qsize.h> + #include <QtGui/private/qtguiglobal_p.h> #include <QtGui/qicon.h> #include <QtGui/qpalette.h> @@ -58,11 +60,12 @@ QT_END_NAMESPACE @interface NSImage (QtExtras) + (instancetype)imageFromQImage:(const QT_PREPEND_NAMESPACE(QImage) &)image; + (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon; -+ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon withSize:(int)size; + (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon - withSize:(int)size - withMode:(QT_PREPEND_NAMESPACE(QIcon)::Mode)mode - withState:(QT_PREPEND_NAMESPACE(QIcon)::State)state; + withSize:(const QT_PREPEND_NAMESPACE(QSize) &)size; ++ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon + withSize:(const QT_PREPEND_NAMESPACE(QSize) &)size + withMode:(QT_PREPEND_NAMESPACE(QIcon)::Mode)mode + withState:(QT_PREPEND_NAMESPACE(QIcon)::State)state; @end QT_BEGIN_NAMESPACE #endif // __OBJC__ diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index b109e9a5a20..04433c7703a 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -802,7 +802,7 @@ static DestStoreProc64 destStoreProc64[] = destStore64, // Format_A2RGB30_Premultiplied destStore64, // Format_Alpha8 destStore64Gray8, // Format_Grayscale8 - nullptr, // Format_RGBX64 + destStore64, // Format_RGBX64 destStore64RGBA64, // Format_RGBA64 nullptr, // Format_RGBA64_Premultiplied destStore64Gray16, // Format_Grayscale16 @@ -3904,6 +3904,9 @@ static inline Operator getOperator(const QSpanData *data, const QT_FT_Span *span op.destStore64 = destStoreProc64[data->rasterBuffer->format]; op.funcSolid64 = functionForModeSolid64[op.mode]; op.func64 = functionForMode64[op.mode]; + // RGBx64 do not need conversion on writeback if all pixels are opaque + if (data->rasterBuffer->format == QImage::Format_RGBX64 && solidSource) + op.destStore64 = nullptr; #else op.destStore64 = nullptr; op.funcSolid64 = nullptr; @@ -4144,7 +4147,7 @@ static void blend_color_generic_fp(int count, const QT_FT_Span *spans, void *use }; QT_THREAD_PARALLEL_FILLS(function); #else - blend_color_generic(count, spans, userData); + blend_color_generic_rgb64(count, spans, userData); #endif } @@ -6162,6 +6165,14 @@ static void qt_rectfill_nonpremul_argb32(QRasterBuffer *rasterBuffer, color.unpremultiplied().toArgb32(), x, y, width, height, rasterBuffer->bytesPerLine()); } +static void qt_rectfill_rgbx(QRasterBuffer *rasterBuffer, + int x, int y, int width, int height, + const QRgba64 &color) +{ + qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()), + ARGB2RGBA(color.toArgb32() | 0xff000000), x, y, width, height, rasterBuffer->bytesPerLine()); +} + static void qt_rectfill_rgba(QRasterBuffer *rasterBuffer, int x, int y, int width, int height, const QRgba64 &color) @@ -6353,7 +6364,7 @@ DrawHelper qDrawHelper[] = qt_bitmapblit_rgba8888, qt_alphamapblit_generic, qt_alphargbblit_generic, - qt_rectfill_rgba + qt_rectfill_rgbx }, // Format_RGBA8888 { diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 40dfef5a1e5..3b64a8ecf73 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -7164,22 +7164,18 @@ void QPainter::setViewTransformEnabled(bool enable) d->updateMatrix(); } -void qt_format_text(const QFont &fnt, const QRectF &_r, - int tf, const QString& str, QRectF *brect, - int tabstops, int *ta, int tabarraylen, +void qt_format_text(const QFont &fnt, + const QRectF &_r, + int tf, + int alignment, + const QTextOption *option, + const QString& str, + QRectF *brect, + int tabstops, + int *ta, + int tabarraylen, QPainter *painter) { - qt_format_text(fnt, _r, - tf, nullptr, str, brect, - tabstops, ta, tabarraylen, - painter); -} -void qt_format_text(const QFont &fnt, const QRectF &_r, - int tf, const QTextOption *option, const QString& str, QRectF *brect, - int tabstops, int *ta, int tabarraylen, - QPainter *painter) -{ - Q_ASSERT( !((tf & ~Qt::TextDontPrint)!=0 && option!=nullptr) ); // we either have an option or flags if (_r.isEmpty() && !(tf & Qt::TextDontClip)) { @@ -7190,7 +7186,7 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, } if (option) { - tf |= option->alignment(); + alignment |= option->alignment(); if (option->wrapMode() != QTextOption::NoWrap) tf |= Qt::TextWordWrap; @@ -7222,12 +7218,12 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, else layout_direction = Qt::LeftToRight; - tf = QGuiApplicationPrivate::visualAlignment(layout_direction, QFlag(tf)); + alignment = QGuiApplicationPrivate::visualAlignment(layout_direction, QFlag(alignment)); bool isRightToLeft = layout_direction == Qt::RightToLeft; bool expandtabs = ((tf & Qt::TextExpandTabs) && - (((tf & Qt::AlignLeft) && !isRightToLeft) || - ((tf & Qt::AlignRight) && isRightToLeft))); + (((alignment & Qt::AlignLeft) && !isRightToLeft) || + ((alignment & Qt::AlignRight) && isRightToLeft))); if (!painter) tf |= Qt::TextDontPrint; @@ -7326,7 +7322,7 @@ start_lengthVariant: } engine.option.setTextDirection(layout_direction); - if (tf & Qt::AlignJustify) + if (alignment & Qt::AlignJustify) engine.option.setAlignment(Qt::AlignJustify); else engine.option.setAlignment(Qt::AlignLeft); // do not do alignment twice @@ -7365,6 +7361,10 @@ start_lengthVariant: // Make sure lines are positioned on whole pixels height = qCeil(height); + + if (alignment & Qt::AlignBaseline && l.lineNumber() == 0) + height -= l.ascent(); + l.setPosition(QPointF(0., height)); height += textLayout.engine()->lines[l.lineNumber()].height().toReal(); width = qMax(width, l.naturalTextWidth()); @@ -7376,14 +7376,14 @@ start_lengthVariant: qreal yoff = 0; qreal xoff = 0; - if (tf & Qt::AlignBottom) + if (alignment & Qt::AlignBottom) yoff = r.height() - height; - else if (tf & Qt::AlignVCenter) + else if (alignment & Qt::AlignVCenter) yoff = (r.height() - height)/2; - if (tf & Qt::AlignRight) + if (alignment & Qt::AlignRight) xoff = r.width() - width; - else if (tf & Qt::AlignHCenter) + else if (alignment & Qt::AlignHCenter) xoff = (r.width() - width)/2; QRectF bounds = QRectF(r.x() + xoff, r.y() + yoff, width, height); @@ -7410,12 +7410,12 @@ start_lengthVariant: qreal advance = line.horizontalAdvance(); xoff = 0; - if (tf & Qt::AlignRight) { + if (alignment & Qt::AlignRight) { xoff = r.width() - advance - eng->leadingSpaceWidth(eng->lines[line.lineNumber()]).toReal(); - } - else if (tf & Qt::AlignHCenter) + } else if (alignment & Qt::AlignHCenter) { xoff = (r.width() - advance) / 2; + } line.draw(painter, QPointF(r.x() + xoff, r.y() + yoff)); eng->drawDecorations(painter); @@ -7427,6 +7427,48 @@ start_lengthVariant: } } +void qt_format_text(const QFont &fnt, const QRectF &_r, + int tf, const QString& str, QRectF *brect, + int tabstops, int *ta, int tabarraylen, + QPainter *painter) +{ + qt_format_text(fnt, + _r, + tf, + tf & ~Qt::AlignBaseline, // Qt::AlignBaseline conflicts with Qt::TextSingleLine + nullptr, + str, + brect, + tabstops, + ta, + tabarraylen, + painter); +} + +void qt_format_text(const QFont &fnt, + const QRectF &_r, + int tf, + const QTextOption *option, + const QString& str, + QRectF *brect, + int tabstops, + int *ta, + int tabarraylen, + QPainter *painter) +{ + qt_format_text(fnt, + _r, + tf, + tf & ~Qt::AlignBaseline, // Qt::AlignBaseline conflicts with Qt::TextSingleLine + option, + str, + brect, + tabstops, + ta, + tabarraylen, + painter); +} + /*! Sets the layout direction used by the painter when drawing text, to the specified \a direction. diff --git a/src/gui/painting/qpixellayout.cpp b/src/gui/painting/qpixellayout.cpp index cfb58221070..e524f95a900 100644 --- a/src/gui/painting/qpixellayout.cpp +++ b/src/gui/painting/qpixellayout.cpp @@ -1758,7 +1758,7 @@ static void QT_FASTCALL storeRGB16FFromRGB32(uchar *dest, const uint *src, int i { QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index; for (int i = 0; i < count; ++i) - d[i] = QRgbaFloat16::fromArgb32(src[i]); + d[i] = QRgbaFloat16::fromArgb32(src[i] | 0xff000000); } static const uint *QT_FASTCALL fetchRGBA16FToARGB32PM(uint *buffer, const uchar *src, int index, int count, @@ -1814,7 +1814,7 @@ static void QT_FASTCALL storeRGB32FFromRGB32(uchar *dest, const uint *src, int i { QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index; for (int i = 0; i < count; ++i) - d[i] = QRgbaFloat32::fromArgb32(src[i]); + d[i] = QRgbaFloat32::fromArgb32(src[i] | 0xff000000); } static const uint *QT_FASTCALL fetchRGBA32FToARGB32PM(uint *buffer, const uchar *src, int index, int count, diff --git a/src/gui/platform/unix/qdesktopunixservices.cpp b/src/gui/platform/unix/qdesktopunixservices.cpp index bbc6b41a2bc..d0ee636d484 100644 --- a/src/gui/platform/unix/qdesktopunixservices.cpp +++ b/src/gui/platform/unix/qdesktopunixservices.cpp @@ -29,6 +29,7 @@ #include <QtCore/QUrlQuery> #include <QtDBus/QDBusConnection> +#include <QtDBus/QDBusServiceWatcher> #include <QtDBus/QDBusMessage> #include <QtDBus/QDBusPendingCall> #include <QtDBus/QDBusPendingCallWatcher> @@ -373,6 +374,34 @@ private Q_SLOTS: private: const QString m_parentWindowId; }; + +void registerWithHostPortal() +{ + static bool registered = false; + if (registered) { + return; + } + + auto message = QDBusMessage::createMethodCall( + "org.freedesktop.portal.Desktop"_L1, "/org/freedesktop/portal/desktop"_L1, + "org.freedesktop.host.portal.Registry"_L1, "Register"_L1); + message.setArguments({ QGuiApplication::desktopFileName(), QVariantMap() }); + auto watcher = + new QDBusPendingCallWatcher(QDBusConnection::sessionBus().asyncCall(message), qGuiApp); + QObject::connect(watcher, &QDBusPendingCallWatcher::finished, watcher, [watcher] { + watcher->deleteLater(); + if (watcher->isError()) { + // Expected error when running against an older portal + if (watcher->error().type() == QDBusError::UnknownInterface || watcher->error().type() == QDBusError::UnknownMethod) + qCInfo(lcQpaServices) << "Failed to register with host portal" << watcher->error(); + else + qCWarning(lcQpaServices) << "Failed to register with host portal" << watcher->error(); + } else { + qCDebug(lcQpaServices) << "Successfully registered with host portal as" << QGuiApplication::desktopFileName(); + registered = true; + } + }); +} } // namespace #endif // QT_CONFIG(dbus) @@ -395,7 +424,7 @@ QDesktopUnixServices::QDesktopUnixServices() QDBusPendingCall pendingCall = QDBusConnection::sessionBus().asyncCall(message); auto watcher = new QDBusPendingCallWatcher(pendingCall); m_watcher = watcher; - QObject::connect(watcher, &QDBusPendingCallWatcher::finished, watcher, + QObject::connect(watcher, &QDBusPendingCallWatcher::finished, watcher, [this](QDBusPendingCallWatcher *watcher) { watcher->deleteLater(); QDBusPendingReply<QVariant> reply = *watcher; @@ -403,6 +432,31 @@ QDesktopUnixServices::QDesktopUnixServices() m_hasScreenshotPortalWithColorPicking = true; }); + if (checkNeedPortalSupport()) { + return; + } + + // The program might only set the desktopfilename after creating the app + // try again when it's running + if (!QGuiApplication::desktopFileName().isEmpty()) { + registerWithHostPortal(); + } else { + QMetaObject::invokeMethod( + qGuiApp, + [] { + if (QGuiApplication::desktopFileName().isEmpty()) { + qCInfo(lcQpaServices) << "QGuiApplication::desktopFileName not set. Unable to register application with portal registry"; + return; + } + registerWithHostPortal(); + }, + Qt::QueuedConnection); + } + m_portalWatcher = std::make_unique<QDBusServiceWatcher>( + "org.freedesktop.portal.Desktop"_L1, QDBusConnection::sessionBus(), + QDBusServiceWatcher::WatchForRegistration); + QObject::connect(m_portalWatcher.get(), &QDBusServiceWatcher::serviceRegistered, + m_portalWatcher.get(), ®isterWithHostPortal); #endif } diff --git a/src/gui/platform/unix/qdesktopunixservices_p.h b/src/gui/platform/unix/qdesktopunixservices_p.h index bb29f5248df..2c43a237b02 100644 --- a/src/gui/platform/unix/qdesktopunixservices_p.h +++ b/src/gui/platform/unix/qdesktopunixservices_p.h @@ -26,6 +26,7 @@ QT_BEGIN_NAMESPACE class QDBusPendingCallWatcher; class QWindow; +class QDBusServiceWatcher; class Q_GUI_EXPORT QDesktopUnixServices : public QPlatformServices { @@ -51,6 +52,7 @@ private: QString m_documentLauncher; #if QT_CONFIG(dbus) QPointer<QDBusPendingCallWatcher> m_watcher = nullptr; + std::unique_ptr<QDBusServiceWatcher> m_portalWatcher; #endif bool m_hasScreenshotPortalWithColorPicking = false; }; diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp index f4dca6185bc..c77c0004be8 100644 --- a/src/gui/text/qdistancefield.cpp +++ b/src/gui/text/qdistancefield.cpp @@ -495,7 +495,8 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path const quint32 *indices = pathIndices.data(); QVarLengthArray<QPoint> normals; QVarLengthArray<QPoint> vertices; - QVarLengthArray<bool> isConvex; + + QVarLengthArray<int> crossProducts; QVarLengthArray<bool> needsClipping; drawPolygons(bits.data(), imgWidth, imgHeight, pathVertices.data(), @@ -536,10 +537,10 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path || (to.y() < offs << 8) || (to.y() >= (imgHeight - offs) << 8)); } - isConvex.resize(normals.size()); + crossProducts.resize(normals.size()); for (int next = 0, prev = normals.size() - 1; next < normals.size(); prev = next++) { - isConvex[prev] = normals.at(prev).x() * normals.at(next).y() - - normals.at(prev).y() * normals.at(next).x() < 0; + crossProducts[prev] = normals.at(prev).x() * normals.at(next).y() + - normals.at(prev).y() * normals.at(next).x(); } // Draw quads. @@ -571,7 +572,8 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path exteriorColor); } - if (isConvex.at(prev)) { + const int crossProduct = crossProducts.at(prev); + if (crossProduct < 0) { QPoint p = extPrev; if (needsClipping[prev]) { for (;;) { @@ -612,7 +614,7 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path extPrev = p; } } - } else { + } else if (crossProduct > 0) { QPoint p = intPrev; if (needsClipping[prev]) { for (;;) { diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h index 5b1b64d7ee9..deae6462b6f 100644 --- a/src/gui/text/qtextlayout.h +++ b/src/gui/text/qtextlayout.h @@ -179,7 +179,7 @@ private: friend class QPainter; friend class QGraphicsSimpleTextItemPrivate; friend class QGraphicsSimpleTextItem; - friend void qt_format_text(const QFont &font, const QRectF &_r, int tf, const QTextOption *, const QString& str, + friend void qt_format_text(const QFont &font, const QRectF &_r, int tf, int alignment, const QTextOption *, const QString& str, QRectF *brect, int tabstops, int* tabarray, int tabarraylen, QPainter *painter); QTextEngine *d; diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index dd6d4fea90b..07712c423e0 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -432,6 +432,7 @@ #include "qabstractsocket.h" #include "qabstractsocket_p.h" +#include "qnetworkinterface.h" #include "private/qhostinfo_p.h" @@ -1175,12 +1176,11 @@ bool QAbstractSocketPrivate::readFromSocket() // Read from the socket, store data in the read buffer. char *ptr = buffer.reserve(bytesToRead); qint64 readBytes = socketEngine->read(ptr, bytesToRead); + buffer.chop(bytesToRead - (readBytes < 0 ? qint64(0) : readBytes)); if (readBytes == -2) { // No bytes currently available for reading. - buffer.chop(bytesToRead); return true; } - buffer.chop(bytesToRead - (readBytes < 0 ? qint64(0) : readBytes)); #if defined(QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::readFromSocket() got %lld bytes, buffer size = %lld", readBytes, buffer.size()); @@ -1500,7 +1500,8 @@ bool QAbstractSocket::bind(const QHostAddress &address, quint16 port, BindMode m return d->bind(address, port, mode); } -bool QAbstractSocketPrivate::bind(const QHostAddress &address, quint16 port, QAbstractSocket::BindMode mode) +bool QAbstractSocketPrivate::bind(const QHostAddress &address, quint16 port, QAbstractSocket::BindMode mode, + const QNetworkInterface *iface) { Q_Q(QAbstractSocket); @@ -1535,6 +1536,10 @@ bool QAbstractSocketPrivate::bind(const QHostAddress &address, quint16 port, QAb socketEngine->setOption(QAbstractSocketEngine::BindExclusively, 0); #endif } +#if QT_CONFIG(networkinterface) + if (iface && iface->isValid()) + socketEngine->setOption(QAbstractSocketEngine::BindInterfaceIndex, iface->index()); +#endif bool result = socketEngine->bind(address, port); cachedSocketDescriptor = socketEngine->socketDescriptor(); diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h index 1ffe4f197a7..3100802d4ab 100644 --- a/src/network/socket/qabstractsocket_p.h +++ b/src/network/socket/qabstractsocket_p.h @@ -28,8 +28,10 @@ QT_BEGIN_NAMESPACE class QHostInfo; +class QNetworkInterface; -class QAbstractSocketPrivate : public QIODevicePrivate, public QAbstractSocketEngineReceiver +class Q_NETWORK_EXPORT QAbstractSocketPrivate : public QIODevicePrivate, + public QAbstractSocketEngineReceiver { Q_DECLARE_PUBLIC(QAbstractSocket) public: @@ -49,7 +51,8 @@ public: } #endif - virtual bool bind(const QHostAddress &address, quint16 port, QAbstractSocket::BindMode mode); + virtual bool bind(const QHostAddress &address, quint16 port, QAbstractSocket::BindMode mode, + const QNetworkInterface *iface = nullptr); virtual bool canReadNotification(); bool canWriteNotification(); diff --git a/src/network/socket/qabstractsocketengine_p.h b/src/network/socket/qabstractsocketengine_p.h index b9cdf38b5e0..48ebfed71a2 100644 --- a/src/network/socket/qabstractsocketengine_p.h +++ b/src/network/socket/qabstractsocketengine_p.h @@ -75,7 +75,8 @@ public: ReceivePacketInformation, ReceiveHopLimit, MaxStreamsSocketOption, - PathMtuInformation + PathMtuInformation, + BindInterfaceIndex, }; enum PacketHeaderOption { diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index f33e5a26bd9..4c83ef7e5df 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -910,12 +910,11 @@ qint64 QNativeSocketEngine::read(char *data, qint64 maxSize) qint64 readBytes = d->nativeRead(data, maxSize); - // Handle remote close - if (readBytes == 0 && (d->socketType == QAbstractSocket::TcpSocket -#ifndef QT_NO_SCTP - || d->socketType == QAbstractSocket::SctpSocket -#endif - )) { + // Handle remote close. + // Non-datagram socket types signal the EOF state with a zero read. + // Note that it is perfectly fine to have a 0-byte message with datagram + // sockets (SOCK_DGRAM or SOCK_SEQPACKET). + if (readBytes == 0 && d->socketType != QAbstractSocket::UdpSocket) { d->setError(QAbstractSocket::RemoteHostClosedError, QNativeSocketEnginePrivate::RemoteHostClosedErrorString); close(); diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 0671854ccee..bcd9aecdea9 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -11,6 +11,7 @@ #include "qhostaddress.h" #include "qvarlengtharray.h" #include "qnetworkinterface.h" +#include "qnetworkinterface_p.h" #include "qendian.h" #ifdef Q_OS_WASM #include <private/qeventdispatcher_wasm_p.h> @@ -82,6 +83,9 @@ static void convertToLevelAndOption(QNativeSocketEngine::SocketOption opt, case QNativeSocketEngine::MaxStreamsSocketOption: Q_UNREACHABLE(); + case QNativeSocketEngine::BindInterfaceIndex: + Q_UNREACHABLE(); // handled directly in setOption() + case QNativeSocketEngine::BroadcastSocketOption: n = SO_BROADCAST; break; @@ -236,6 +240,20 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc return false; } + // Attempt to enable dual-stack + if (domain == AF_INET6) { + const int ipv6only = 0; + [[maybe_unused]] const int ret = ::setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY, + &ipv6only, sizeof(ipv6only)); +#if defined (QNATIVESOCKETENGINE_DEBUG) + if (ret != 0) { + qDebug("QNativeSocketEnginePrivate::createNewSocket(%d, %d): " + "failed to set IPV6_V6ONLY to %d.", + socketType, socketProtocol, ipv6only); + } +#endif + } + #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::createNewSocket(%d, %d) == true", socketType, socketProtocol); @@ -359,7 +377,27 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt #endif return false; } - + case QNativeSocketEngine::BindInterfaceIndex: { +#if defined(SO_BINDTOIFINDEX) // seen on Linux + return ::setsockopt(socketDescriptor, SOL_SOCKET, SO_BINDTOIFINDEX, + &v, sizeof(v)) == 0; +#elif defined(IPV6_BOUND_IF) && defined(IP_BOUND_IF) // seen on Darwin + // note: on Darwin, this only limits sending the data, not receiving it + if (socketProtocol == QAbstractSocket::IPv6Protocol + || socketProtocol == QAbstractSocket::AnyIPProtocol) { + return ::setsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_BOUND_IF, &v, sizeof(v)) == 0; + } else { + return ::setsockopt(socketDescriptor, IPPROTO_IP, IP_BOUND_IF, &v, sizeof(v)) == 0; + } +#elif defined(SO_BINDTODEVICE) && QT_CONFIG(networkinterface) + // need to convert to interface name + const QByteArray name = QNetworkInterfaceManager::interfaceNameFromIndex(v).toLatin1(); + return ::setsockopt(socketDescriptor, SOL_SOCKET, SO_BINDTODEVICE, + name.data(), socklen_t(name.size())) == 0; +#else + return false; +#endif + } default: break; } @@ -1206,6 +1244,7 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters() QT_SOCKOPTLEN_T valueSize = sizeof(int); if (::getsockopt(socketDescriptor, SOL_SOCKET, SO_TYPE, &value, &valueSize) == 0) { if (value == SOCK_STREAM) { + socketType = QAbstractSocket::TcpSocket; #ifndef QT_NO_SCTP if (option(QNativeSocketEngine::MaxStreamsSocketOption) != -1) { socketType = QAbstractSocket::SctpSocket; @@ -1228,17 +1267,23 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters() return false; } } - } else { - socketType = QAbstractSocket::TcpSocket; } -#else - socketType = QAbstractSocket::TcpSocket; +#endif + } else if (value == SOCK_DGRAM) { + socketType = QAbstractSocket::UdpSocket; +#ifdef SOCK_SEQPACKET + } else if (value == SOCK_SEQPACKET) { + // We approximate the SEQPACKET socket type to TCP, because + // this enum is actually used to determine if the socket type has + // a notion of connection. SOCK_DGRAM are connectionless, while + // SOCK_STREAM and SOCK_SEQPACKET are connection-orientired. + // This mapping is still suboptimal, because it is possible to send + // a 0-byte packet via SEQPACKET socket and Qt will treat it as + // a disconnect. + socketType = QAbstractSocket::TcpSocket; #endif } else { - if (value == SOCK_DGRAM) - socketType = QAbstractSocket::UdpSocket; - else - socketType = QAbstractSocket::UnknownSocketType; + socketType = QAbstractSocket::UnknownSocketType; } } #if defined (QNATIVESOCKETENGINE_DEBUG) diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index d414fac7167..598467ef629 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -153,6 +153,9 @@ static void convertToLevelAndOption(QNativeSocketEngine::SocketOption opt, case QNativeSocketEngine::MaxStreamsSocketOption: Q_UNREACHABLE(); + case QNativeSocketEngine::BindInterfaceIndex: + Q_UNREACHABLE(); // handled directly in setOption() + case QNativeSocketEngine::ReceiveBufferSocketOption: n = SO_RCVBUF; break; @@ -199,13 +202,7 @@ static void convertToLevelAndOption(QNativeSocketEngine::SocketOption opt, } break; case QNativeSocketEngine::ReceivePacketInformation: - if (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) { - level = IPPROTO_IPV6; - n = IPV6_PKTINFO; - } else if (socketProtocol == QAbstractSocket::IPv4Protocol) { - level = IPPROTO_IP; - n = IP_PKTINFO; - } + Q_UNREACHABLE(); // handled in setOption() directly now break; case QNativeSocketEngine::ReceiveHopLimit: if (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) { @@ -330,6 +327,13 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc &sendmsg, sizeof(sendmsg), &bytesReturned, NULL, NULL) == SOCKET_ERROR) sendmsg = 0; + // Attempt to enable dual-stack + if (protocol == AF_INET6) { + int ipv6only = 0; + ::setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY, + reinterpret_cast<char *>(&ipv6only), sizeof(ipv6only)); + } + socketDescriptor = socket; this->socketProtocol = socketProtocol; this->socketType = socketType; @@ -418,6 +422,86 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt case QNativeSocketEngine::MaxStreamsSocketOption: return false; + case QNativeSocketEngine::ReceivePacketInformation: { + if (socketProtocol == QAbstractSocket::IPv6Protocol + || socketProtocol == QAbstractSocket::AnyIPProtocol) { + // set the IPv6 option + if (::setsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_PKTINFO, + reinterpret_cast<char *>(&v), sizeof(v)) != 0) { + WS_ERROR_DEBUG(WSAGetLastError()); + return false; + } + } + // Try to set the IPv4 option in any case, but fail only if the + // protocol is IPv4 + if (::setsockopt(socketDescriptor, IPPROTO_IP, IP_PKTINFO, + reinterpret_cast<char *>(&v), sizeof(v)) != 0) { + if (socketProtocol == QAbstractSocket::IPv4Protocol) { + WS_ERROR_DEBUG(WSAGetLastError()); + return false; + } + } + return true; + } + + case QNativeSocketEngine::BindInterfaceIndex: { + int ret = 0; + if (socketProtocol == QAbstractSocket::IPv6Protocol + || socketProtocol == QAbstractSocket::AnyIPProtocol) { + // IPv6 - uses host byte order + // Bind outgoing datagrams to the interface + if (!ret) { + ret = ::setsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_UNICAST_IF, + reinterpret_cast<char *>(&v), sizeof(v)); + } + if (!ret) { + ret = ::setsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_MULTICAST_IF, + reinterpret_cast<char *>(&v), sizeof(v)); + } + // Bind incoming datagrams to the interface + if (!ret) { + const int enable = 1; + ret = ::setsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_IFLIST, + reinterpret_cast<const char *>(&enable), sizeof(enable)); + if (!ret) { + ret = ::setsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_ADD_IFLIST, + reinterpret_cast<char *>(&v), sizeof(v)); + } + } + } + bool result = !ret; + if (result) { + // Try to set the IPv4 options unconditionally, but ignore + // the result if the protocol is not IPv4-only + + // IPv4 - uses network byte order + int netIdx = htonl(v); + // Bind outgoing datagrams to the interface + if (!ret) { + ret = ::setsockopt(socketDescriptor, IPPROTO_IP, IP_UNICAST_IF, + reinterpret_cast<char *>(&netIdx), sizeof(netIdx)); + } + if (!ret) { + ret = ::setsockopt(socketDescriptor, IPPROTO_IP, IP_MULTICAST_IF, + reinterpret_cast<char *>(&netIdx), sizeof(netIdx)); + } + // Bind incoming datagrams to the interface + if (!ret) { + const int enable = 1; + ret = ::setsockopt(socketDescriptor, IPPROTO_IP, IP_IFLIST, + reinterpret_cast<const char *>(&enable), sizeof(enable)); + if (!ret) { + // uses host byte order here + ret = ::setsockopt(socketDescriptor, IPPROTO_IP, IP_ADD_IFLIST, + reinterpret_cast<char *>(&v), sizeof(v)); + } + } + if (socketProtocol == QAbstractSocket::IPv4Protocol) + result = !ret; + } + return result; + } + default: break; } diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index b3be3490d8e..93123b6553b 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -2423,8 +2423,10 @@ void QSslSocketPrivate::setPaused(bool p) paused = p; } -bool QSslSocketPrivate::bind(const QHostAddress &address, quint16 port, QAbstractSocket::BindMode mode) +bool QSslSocketPrivate::bind(const QHostAddress &address, quint16 port, QAbstractSocket::BindMode mode, + const QNetworkInterface *iface) { + Q_UNUSED(iface); // only relevant for QUdpSocket for now // this function is called from QAbstractSocket::bind if (!initialized) init(); diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index 563851b191f..fb8da65dac1 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -99,7 +99,7 @@ public: static std::shared_ptr<QSslContext> sslContext(QSslSocket *socket); bool isPaused() const; void setPaused(bool p); - bool bind(const QHostAddress &address, quint16, QAbstractSocket::BindMode) override; + bool bind(const QHostAddress &address, quint16, QAbstractSocket::BindMode, const QNetworkInterface *iface = nullptr) override; void _q_connectedSlot(); void _q_hostFoundSlot(); void _q_disconnectedSlot(); diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 5843430c1cf..13f1a19a360 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -442,8 +442,9 @@ QPlatformKeyMapper *QCocoaIntegration::keyMapper() const void QCocoaIntegration::setApplicationIcon(const QIcon &icon) const { // Fall back to a size that looks good on the highest resolution screen available - auto fallbackSize = NSApp.dockTile.size.width * qGuiApp->devicePixelRatio(); - NSApp.applicationIconImage = [NSImage imageFromQIcon:icon withSize:fallbackSize]; + // for icon engines that don't have an intrinsic size (like SVG). + auto fallbackSize = QSizeF::fromCGSize(NSApp.dockTile.size) * qGuiApp->devicePixelRatio(); + NSApp.applicationIconImage = [NSImage imageFromQIcon:icon withSize:fallbackSize.toSize()]; } void QCocoaIntegration::setApplicationBadge(qint64 number) diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index 5465d6c7f45..ca43ab421e0 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -375,7 +375,7 @@ NSMenuItem *QCocoaMenuItem::sync() const QIcon::Mode mode = m_enabled ? QIcon::Normal : QIcon::Disabled; const QIcon::State state = m_checked ? QIcon::On : QIcon::Off; - m_native.image = [NSImage imageFromQIcon:m_icon withSize:m_iconSize + m_native.image = [NSImage imageFromQIcon:m_icon withSize:QSize(m_iconSize, m_iconSize) withMode:mode withState:state]; diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 8f8d32276c4..f9094a8f665 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -15,6 +15,7 @@ #include "qcocoahelpers.h" #include <QtCore/qfileinfo.h> +#include <QtCore/qstandardpaths.h> #include <QtCore/private/qcore_mac_p.h> #include <QtGui/private/qfont_p.h> #include <QtGui/private/qguiapplication_p.h> @@ -36,6 +37,7 @@ #include "qcocoamessagedialog.h" #include <CoreServices/CoreServices.h> +#include <UniformTypeIdentifiers/UniformTypeIdentifiers.h> QT_BEGIN_NAMESPACE @@ -356,9 +358,16 @@ QPixmap QCocoaTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const case MessageBoxCritical: iconType = kAlertStopIcon; break; - case DesktopIcon: - iconType = kDesktopIcon; - break; + case DesktopIcon: { + auto desktop = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); + NSImage *icon = [NSWorkspace.sharedWorkspace iconForFile:desktop.toNSString()]; + return qt_mac_toQPixmap(icon, size); + } + case DirHomeIcon: { + auto home = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); + NSImage *icon = [NSWorkspace.sharedWorkspace iconForFile:home.toNSString()]; + return qt_mac_toQPixmap(icon, size); + } case TrashIcon: iconType = kTrashIcon; break; @@ -379,12 +388,13 @@ QPixmap QCocoaTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const iconType = kGenericNetworkIcon; break; case DirOpenIcon: - iconType = kOpenFolderIcon; - break; + case DirLinkOpenIcon: + case DirIcon: case DirClosedIcon: - case DirLinkIcon: - iconType = kGenericFolderIcon; - break; + case DirLinkIcon: { + NSImage *icon = [NSWorkspace.sharedWorkspace iconForContentType:UTTypeFolder]; + return qt_mac_toQPixmap(icon, size); + } case FileLinkIcon: case FileIcon: iconType = kGenericDocumentIcon; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index db6d7e562a1..0905ba3e644 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1073,8 +1073,9 @@ void QCocoaWindow::setWindowIcon(const QIcon &icon) iconButton.image = [NSWorkspace.sharedWorkspace iconForFile:m_view.window.representedFilename]; } else { // Fall back to a size that looks good on the highest resolution screen available - auto fallbackSize = iconButton.frame.size.height * qGuiApp->devicePixelRatio(); - iconButton.image = [NSImage imageFromQIcon:icon withSize:fallbackSize]; + // for icon engines that don't have an intrinsic size (like SVG). + auto fallbackSize = QSizeF::fromCGSize(iconButton.frame.size) * qGuiApp->devicePixelRatio(); + iconButton.image = [NSImage imageFromQIcon:icon withSize:fallbackSize.toSize()]; } } diff --git a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandglcontext.cpp index 651c5244817..d5250aefe30 100644 --- a/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandglcontext.cpp +++ b/src/plugins/platforms/wayland/plugins/hardwareintegration/wayland-egl/qwaylandglcontext.cpp @@ -384,13 +384,15 @@ void QWaylandGLContext::endFrame() if (!m_currentWindow) return; + QWaylandEglWindow *currentWindow = m_currentWindow; + if (m_doneCurrentWorkAround) { doneCurrent(); QOpenGLContextPrivate::setCurrentContext(nullptr); } if (m_supportNonBlockingSwap) - m_currentWindow->endFrame(); + currentWindow->endFrame(); } bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index d90125a164b..b853db21529 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -288,7 +288,7 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, cons const auto scale = waylandWindow->scale(); auto newBuffer = new QWaylandShmBuffer( mDisplay, window->size() * scale, mBackBuffer->image()->format(), - mBackBuffer->image()->devicePixelRatio(), mEventQueue); + mBackBuffer->image()->devicePixelRatio()); newBuffer->setDeleteOnRelease(true); QRect sourceRect(offset * scale, window->size() * scale); QPainter painter(newBuffer->image()); diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index d79d12849e8..82a86d6ff3a 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -4019,10 +4019,13 @@ void QWindowsWindow::requestUpdate() // request or we are waiting for the event loop to process // the Posted event on the GUI thread. if (m_vsyncUpdatePending.testAndSetAcquire(UpdateState::Requested, UpdateState::Posted)) { - QMetaObject::invokeMethod(w, [this, w] { - m_vsyncUpdatePending.storeRelease(UpdateState::Ready); - if (w->handle() == this) - deliverUpdateRequest(); + QMetaObject::invokeMethod(w, [w] { + auto *self = static_cast<QWindowsWindow *>(w->handle()); + if (self) { + // The platform window is still alive + self->m_vsyncUpdatePending.storeRelease(UpdateState::Ready); + self->deliverUpdateRequest(); + } }); } } diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 6dc3c90460b..e17602e2882 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -335,11 +335,11 @@ public: lower quality output than HighResolution and should only be used for drafts. - \value PrinterResolution This value is deprecated. It is - equivalent to ScreenResolution on Unix and HighResolution on - Windows and Mac. Due to the difference between ScreenResolution - and HighResolution, use of this value may lead to non-portable - printer code. + \value PrinterResolution This value is deprecated. For printers, + it is equivalent to ScreenResolution on Unix and HighResolution + on Windows and macOS. For PDF printing, it is not supported and + may result in undefined behavior. Using this value can lead to + non-portable printer code. \value HighResolution On Windows, sets the printer resolution to that defined for the printer in use. For PDF printing, sets the diff --git a/src/tools/macdeployqt/macdeployqt/main.cpp b/src/tools/macdeployqt/macdeployqt/main.cpp index 65c7927707f..f5e6ab8f31a 100644 --- a/src/tools/macdeployqt/macdeployqt/main.cpp +++ b/src/tools/macdeployqt/macdeployqt/main.cpp @@ -47,7 +47,7 @@ int main(int argc, char **argv) qDebug() << "plugins are always copied, unless \"-no-plugins\" is specified."; qDebug() << ""; qDebug() << "Qt plugins may use private API and will cause the app to be"; - qDebug() << "rejected from the Mac App store. MacDeployQt will print a warning"; + qDebug() << "rejected from the Mac App store. macdeployqt will print a warning"; qDebug() << "when known incompatible plugins are deployed. Use -appstore-compliant "; qDebug() << "to skip these plugins. Currently two SQL plugins are known to"; qDebug() << "be incompatible: qsqlodbc and qsqlpsql."; diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp index 1ca521eaf24..7dc0fda95df 100644 --- a/src/widgets/dialogs/qerrormessage.cpp +++ b/src/widgets/dialogs/qerrormessage.cpp @@ -147,7 +147,7 @@ QSize QErrorMessageTextView::sizeHint() const The \l{dialogs/standarddialogs}{Standard Dialogs} example shows how to use QErrorMessage as well as other built-in Qt dialogs. - \image qerrormessage.png + \image qerrormessage.png {Dialog with a network-related error message} \sa QMessageBox, QStatusBar::showMessage(), {Standard Dialogs Example} */ diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 4b3be13e667..d964c9667e6 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -66,7 +66,7 @@ Q_GLOBAL_STATIC(QUrl, lastVisitedDir) The QFileDialog class enables a user to traverse the file system to select one or many files or a directory. - \image qtquickdialogs-filedialog-gtk.png + \image qtquickdialogs-filedialog-gtk.png {Open file dialog} The easiest way to create a QFileDialog is to use the static functions, such as \l getOpenFileName(). @@ -395,7 +395,7 @@ QFileDialog::~QFileDialog() Then the file dialog looks like this: - \image filedialogurls.png + \image filedialogurls.png {Open file dialog with set URLs in sidebar} \sa sidebarUrls() */ diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index e7bfa035adf..541721a79b4 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -586,7 +586,7 @@ void QMessageBoxPrivate::helperClicked(QPlatformDialogHelper::StandardButton hel box. The rest of the GUI is blocked until the message box is dismissed. - \image msgbox1.png + \image msgbox1.png {Message box with a simple message and an OK button} A better approach than just alerting the user to an event is to also ask the user what to do about it. @@ -606,6 +606,7 @@ void QMessageBoxPrivate::helperClicked(QPlatformDialogHelper::StandardButton hel \snippet code/src_gui_dialogs_qmessagebox.cpp 6 \image msgbox2.png + {Message box with a "Save", "Don't Save", and "Cancel" buttons} The exec() slot returns the StandardButtons value of the button that was clicked. @@ -617,11 +618,12 @@ void QMessageBoxPrivate::helperClicked(QPlatformDialogHelper::StandardButton hel Depending on the platform the \l{QMessageBox::detailedText} {detailed text}, may require the user to click a \uicontrol{Show Details...} button to be shown. - \image msgbox3.png + \image msgbox3.png {Save message box with a "Show Details..." button} Clicking the \uicontrol{Show Details...} button displays the detailed text. \image msgbox4.png + {Save message box showing the detailed text} \section2 Rich Text and the Text Format Property @@ -653,19 +655,19 @@ void QMessageBoxPrivate::helperClicked(QPlatformDialogHelper::StandardButton hel \table \row - \li \image qmessagebox-quest.png + \li \image qmessagebox-quest.png {Question mark icon} \li \l Question \li For asking a question during normal operations. \row - \li \image qmessagebox-info.png + \li \image qmessagebox-info.png {Information icon} \li \l Information \li For reporting information about normal operations. \row - \li \image qmessagebox-warn.png + \li \image qmessagebox-warn.png {Warning icon} \li \l Warning \li For reporting non-critical errors. \row - \li \image qmessagebox-crit.png + \li \image qmessagebox-crit.png {Critical problem icon} \li \l Critical \li For reporting critical errors. \endtable diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 9714684ce8b..e23ed9f23ee 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -1807,14 +1807,14 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *) \li ModernStyle \li MacStyle \li AeroStyle - \row \li \inlineimage qtwizard-classic1.png - \li \inlineimage qtwizard-modern1.png - \li \inlineimage qtwizard-mac1.png - \li \inlineimage qtwizard-aero1.png - \row \li \inlineimage qtwizard-classic2.png - \li \inlineimage qtwizard-modern2.png - \li \inlineimage qtwizard-mac2.png - \li \inlineimage qtwizard-aero2.png + \row \li \inlineimage qtwizard-classic1.png {Wizard with ClassicStyle} + \li \inlineimage qtwizard-modern1.png {Wizard with ModernStyle} + \li \inlineimage qtwizard-mac1.png {Wizard with MacStyle} + \li \inlineimage qtwizard-aero1.png {Wizard with AeroStyle} + \row \li \inlineimage qtwizard-classic2.png {Wizard with ClassicStyle} + \li \inlineimage qtwizard-modern2.png {Wizard with ModernStyle} + \li \inlineimage qtwizard-mac2.png {Wizard with MacStyle} + \li \inlineimage qtwizard-aero2.png {Wizard with AeroStyle} \endtable Note: AeroStyle has effect only on a Windows Vista system with alpha compositing enabled. @@ -1858,7 +1858,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *) The diagram belows shows how QWizard renders these attributes, assuming they are all present and ModernStyle is used: - \image qtwizard-nonmacpage.png + \image qtwizard-nonmacpage.png {Attributes on a wizard page} When a \l{QWizardPage::}{subTitle} is set, QWizard displays it in a header, in which case it also uses the BannerPixmap and the @@ -1875,7 +1875,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *) If the wizard's style is MacStyle, the page looks radically different: - \image qtwizard-macpage.png + \image qtwizard-macpage.png {Attributes on a wizard page using MacStyle} The watermark, banner, and logo pixmaps are ignored by the MacStyle. If the BackgroundPixmap is set, it is used as the @@ -1992,7 +1992,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *) It provides several wizard pages; depending on which options are selected, the user can reach different pages. - \image licensewizard-flow.png + \image licensewizard-flow.png {Complex wizard page flow chart} In complex wizards, pages are identified by IDs. These IDs are typically defined using an enum. For example: diff --git a/src/widgets/doc/qtwidgets.qdocconf b/src/widgets/doc/qtwidgets.qdocconf index a72b68024c6..047241bef3d 100644 --- a/src/widgets/doc/qtwidgets.qdocconf +++ b/src/widgets/doc/qtwidgets.qdocconf @@ -97,3 +97,6 @@ manifestmeta.highlighted.names += \ # Enforce zero documentation warnings warninglimit = 0 + +reportmissingalttextforimages = true + diff --git a/src/widgets/doc/src/graphicsview.qdoc b/src/widgets/doc/src/graphicsview.qdoc index c4f06160202..5ad522f4d6d 100644 --- a/src/widgets/doc/src/graphicsview.qdoc +++ b/src/widgets/doc/src/graphicsview.qdoc @@ -106,7 +106,7 @@ scene coordinates: QGraphicsView::mapToScene() and QGraphicsView::mapFromScene(). - \image graphicsview-view.png + \image graphicsview-view.png {Grid of computer chips} \section2 The Item @@ -149,7 +149,7 @@ to provide your own collision detection, however, you can reimplement QGraphicsItem::collidesWith(). - \image graphicsview-items.png + \image graphicsview-items.png {Various shapes and graphics on a grid} \section1 Classes in the Graphics View Framework @@ -180,6 +180,7 @@ logical coordinates and device coordinates. \image graphicsview-parentchild.png + {Several coordinate system transformation} \section2 Item Coordinates diff --git a/src/widgets/doc/src/model-view-programming.qdoc b/src/widgets/doc/src/model-view-programming.qdoc index cecbe34b215..288564b19c3 100644 --- a/src/widgets/doc/src/model-view-programming.qdoc +++ b/src/widgets/doc/src/model-view-programming.qdoc @@ -48,6 +48,7 @@ \table \row \li \inlineimage modelview-overview.png + {Model, view, and delegate interaction diagram} \li \b{The model/view architecture} The model communicates with a source of data, providing an \e interface @@ -220,6 +221,7 @@ items are highlighted in both views. \image shareddirmodel.png + {Tree view and list view to display the same file system model} We set up a QFileSystemModel so that it is ready for use, and create some views to display the contents of a directory. This shows the simplest @@ -274,7 +276,7 @@ of data in the model, but they are not restricted in the way that they present this information to the user. - \image modelview-models.png + \image modelview-models.png {List model, table model, and tree model} Models also notify any attached views about changes to data through the signals and slots mechanism. @@ -332,6 +334,7 @@ \table 70% \row \li \inlineimage modelview-tablemodel.png + {Structure of the table model using rows and columns} \li \b{Rows and columns} The diagram shows a representation of a basic table model in which each @@ -364,6 +367,7 @@ \table 70% \row \li \inlineimage modelview-treemodel.png + {Structure of the tree model with parent, row, and column items} \li \b{Parents, rows, and columns} The diagram shows a representation of a tree model in which each item is @@ -394,7 +398,7 @@ \snippet code/doc_src_model-view-programming.cpp 6 \table 70% - \row \li \inlineimage modelview-roles.png + \row \li \inlineimage modelview-roles.png {Different roles in a model} \li \b{Item roles} The role indicates to the model which type of data is being referred to. @@ -556,7 +560,7 @@ in the form of a table, much like the layout of a spreadsheet application. - \image standard-views.png + \image standard-views.png {List view, tree view, and table view} The default behavior of the standard views shown above should be sufficient for most applications. They provide basic editing @@ -592,7 +596,7 @@ interface. When the user tries to edit an item, the view uses a default delegate to provide an editor widget. - \image stringlistmodel.png + \image stringlistmodel.png {List of text using a string list model} The above image shows how a QListView represents the data in the string list model. Since the model is editable, the view automatically allows @@ -615,6 +619,7 @@ view being used. \image sharedmodel-tableviews.png + {Two table views share a model, but not share the selection model} The above image shows two different views onto the same model, each containing a number of selected items. Although the data from the model @@ -657,6 +662,7 @@ the data and the selected items synchronized. \image sharedselection-tableviews.png + {Two table views with the same selection model} In the example shown above, two views of the same type were used to display the same model's data. However, if two different types of view @@ -718,6 +724,7 @@ the model, and this will use the custom delegate for editing. \image spinboxdelegate-example.webp + {Custom spin box delegate for editing} We subclass the delegate from \l QStyledItemDelegate because we do not want to write custom display functions. However, we must still provide @@ -970,6 +977,7 @@ of their previous state. The resulting selection is shown by the view. \image selected-items1.png + {Selection model of a table model is highlighted blue} The selection of items can be modified using various operations that are defined by the selection flags. The selection that results from @@ -1056,7 +1064,7 @@ The results of this operation are displayed in the table view, providing a convenient way of visualizing what we have achieved: - \image selected-items2.png + \image selected-items2.png {Updated selection model has inverted colors} By default, the selection commands only operate on the individual items specified by the model indexes. However, the flag used to @@ -1081,6 +1089,7 @@ the result of these two selections: \image selected-items3.png + {Updating whole columns or rows in the selection model} The commands performed on the example model have all involved accumulating a selection of items in the model. It is also possible @@ -1542,21 +1551,21 @@ \table 70% \row - \li \image selection-single.png + \li \image selection-single.png {Selecting a single item} \li \b{Single item selections:} Where the user needs to choose a single item from a widget, the default \c SingleSelection mode is most suitable. In this mode, the current item and the selected item are the same. \row - \li \image selection-multi.png + \li \image selection-multi.png {Selecting multiple items} \li \b{Multi-item selections:} In this mode, the user can toggle the selection state of any item in the widget without changing the existing selection, much like the way non-exclusive checkboxes can be toggled independently. \row - \li \image selection-extended.png + \li \image selection-extended.png {Selecting extended and adjacent items} \li \b{Extended selections:} Widgets that often require many adjacent items to be selected, such as those found in spreadsheets, require the \c ExtendedSelection mode. diff --git a/src/widgets/doc/src/modelview.qdoc b/src/widgets/doc/src/modelview.qdoc index 7dd7503d299..b2448a2c705 100644 --- a/src/widgets/doc/src/modelview.qdoc +++ b/src/widgets/doc/src/modelview.qdoc @@ -25,7 +25,7 @@ not only easy to grasp, but the many benefits of model/view programming also become clearer. - \image treeview.png + \image treeview.png {Directory and its contents in a tree view} In the process, we will learn about some basic technologies provided by Qt, such as: @@ -66,9 +66,11 @@ \row \li Standard widgets use data that is part of the widget. \li \image standardwidget.png + {Structure where the "view" is separate from the "data"} \row \li View classes operate on external data (the model) \li \image modelview.png + {Structure that uses a "view" and a "model" for the data } \endtable \section2 1.1 Standard Widgets @@ -113,22 +115,27 @@ (for use with external data) \row \li \inlineimage listview.png + {Directory displaying its contents as a list} \li \l QListWidget \li \l QListView \row \li \inlineimage tableview.png + {Directory displaying its contents as a table} \li \l QTableWidget \li \l QTableView \row \li \inlineimage treeview.png + {Directory displaying its contents as a tree} \li \l QTreeWidget \li \l QTreeView \row \li \inlineimage columnview.png + {Directory displaying its contents as columns} \li \li \l QColumnView shows a tree as a hierarchy of lists \row \li \inlineimage modelview-combobox.png + {Combobox showing an entry in the model} \li {2, 1} \l QComboBox can work as both a view class and also as a traditional widget \endtable @@ -146,13 +153,13 @@ \l QDataWidgetMapper is a great solution because it maps form widgets to a table row and makes it very easy to build forms for database tables. - \image widgetmapper.png + \image widgetmapper.png {Form with personal and other information} Another example of an adapter is \l QCompleter. Qt has \l QCompleter for providing auto-completions in Qt widgets such as \l QComboBox and, as shown below, \l QLineEdit. \l QCompleter uses a model as its data source. - \image qcompleter.png + \image qcompleter.png {Completer with suggestions for the characters "Em"} \section1 2. A Simple Model/View Application @@ -226,7 +233,9 @@ In addition to controlling what text the view displays, the model also controls the text's appearance. When we slightly change the model, we get - the following result: \image readonlytable_role.png + the following result: + + \image readonlytable_role.png {Table with custom formatting applied to its cells} In fact, nothing except for the \l{QAbstractItemModel::}{data()} method needs to be changed to set fonts, background colour, alignment and a @@ -291,7 +300,7 @@ \section2 2.3 A Clock inside a Table Cell - \image clock.png + \image clock.png {Table that displays the time in a cell} We still have a read only table, but this time the content changes every second because we are showing the current time. @@ -320,7 +329,7 @@ \section2 2.4 Setting up Headers for Columns and Rows Headers can be hidden via a view method: \c{tableView->verticalHeader()->hide();} - \image modelview-header.png + \image modelview-header.png {Table showing the column headers} The header content, however, is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: @@ -387,17 +396,18 @@ tree. No changes have to be made to the model. The tree won't have any hierarchies because there aren't any hierarchies in the model itself. - \image dummy_tree.png + \image dummy_tree.png {Tree view displaying table data with no hierarchy} QListView, QTableView and QTreeView all use a model abstraction, which is a merged list, table and tree. This makes it possible to use several different types of view classes from the same model. \image list_table_tree.png + {Diagram comparing list model, table model, and tree model} This is how our example model looks so far: - \image example_model.png + \image example_model.png {Diagram of current model structure} We want to present a real tree. We have wrapped our data in the examples above in order to make a model. This time we use QStandardItemModel, which @@ -406,7 +416,7 @@ with \l{QStandardItem}s, which are able to hold all the standard properties of items like text, fonts, checkboxes or brushes. - \image tree_2_with_algorithm.png + \image tree_2_with_algorithm.png {Diagram of the model and the view} (file source: examples/widgets/tutorials/modelview/6_treeview/mainwindow.cpp) \snippet tutorials/modelview/6_treeview/mainwindow.cpp Quoting ModelView Tutorial @@ -422,7 +432,7 @@ We want to access a selected item's content in order to output it into the window title together with the hierarchy level. - \image selection2.png + \image selection2.png {View of a model with the selected content in blue} So let's create a couple of items: @@ -498,7 +508,7 @@ Let's take a look at an example called \l{Star Delegate Example}{Star Delegate}, in which stars are used to show a rating: - \image stardelegate.png + \image stardelegate.png {Table showing songs and their star ratings} The view has a \l{QAbstractItemView::}{setItemDelegate()} method that replaces the default delegate and installs a custom delegate. diff --git a/src/widgets/doc/src/qtwidgets-examples.qdoc b/src/widgets/doc/src/qtwidgets-examples.qdoc index b864402dd5d..45677c471ba 100644 --- a/src/widgets/doc/src/qtwidgets-examples.qdoc +++ b/src/widgets/doc/src/qtwidgets-examples.qdoc @@ -7,7 +7,7 @@ \ingroup all-examples \group examples-widgets - \image widget-examples.png + \image widget-examples.png {Gallery of various widgets} Qt comes with a large range of standard widgets that users of modern applications have come to expect. @@ -28,6 +28,7 @@ \group examples-painting \image painting-examples.png + {Application showing different geometric shapes and styles} Qt's painting system is able to render vector graphics, images, and outline font-based text with sub-pixel accuracy using @@ -46,6 +47,7 @@ \group examples-richtext \image richtext-examples.png + {Application showing various rich text widgets} Qt provides powerful document-oriented rich text engine that supports Unicode and right-to-left scripts. Documents can be manipulated using a cursor-based @@ -61,6 +63,8 @@ \group examples-desktop \image desktop-examples.png + {Application showing widgets for desktop environments} + Qt provides features to enable applications to integrate with the user's preferred desktop environment. @@ -78,6 +82,7 @@ \brief Using Qt's standard dialogs and building and using custom dialogs. \image dialog-examples.png + {Application showing a dialog} Qt includes standard dialogs for many common operations, such as file selection, printing, and color selection. @@ -93,6 +98,7 @@ \group examples-itemviews \image itemviews-examples.png + {Application showing a tree model editor} Qt provides a lot of capabalities to display pre- and user-defined item models in different ways. @@ -109,6 +115,7 @@ \page examples-graphicsview.html \image graphicsview-examples.png + {Application showing various graphics options and views} Qt provides powerful graphics engine that supports easy visualization of items, with support for rotation and zooming. @@ -134,6 +141,7 @@ \brief Building applications around a main window. \image mainwindow-examples.png + {Application showing various widgets in a main window} All the standard features of application main windows are provided by Qt. @@ -150,6 +158,7 @@ \brief Using autocomplete features, regular expressions, and undo framework. \image completer-example.png + {Application showing different completer options and tools} Qt provides the functionality for autocomplete, Undo/Redo actions, and regular expressions for the Widget-based applications. diff --git a/src/widgets/doc/src/qtwidgets-index.qdoc b/src/widgets/doc/src/qtwidgets-index.qdoc index 8e36b1e9da5..eb50e4e72b7 100644 --- a/src/widgets/doc/src/qtwidgets-index.qdoc +++ b/src/widgets/doc/src/qtwidgets-index.qdoc @@ -19,7 +19,8 @@ interfaces should be grouped together. A widget that is not embedded in a parent widget is called a \l{Window and Dialog Widgets} {window}. - \image parent-child-widgets.png A parent widget containing various child widgets. + \image parent-child-widgets.png + {Parent widget containing various child widgets} The QWidget class provides the basic capability to render to the screen and to handle user input events. All UI elements that Qt @@ -43,9 +44,9 @@ interfaces \table \row - \li \image windowsvista-tabwidget.png - \li \image fusion-tabwidget.png - \li \image macos-tabwidget.png + \li \image windowsvista-tabwidget.png {Windows style tab widgets} + \li \image fusion-tabwidget.png {Fusion desktop style tab widgets} + \li \image macos-tabwidget.png {macOS style tab widgets} \endtable \l{Qt Style Sheets} are a powerful mechanism that lets you customize @@ -63,8 +64,8 @@ interfaces \table \row - \li \image qgridlayout-with-5-children.png - \li \image qformlayout-with-6-children.png + \li \image qgridlayout-with-5-children.png {5-children layout} + \li \image qformlayout-with-6-children.png {6-children layout} \endtable \l {Qt Widgets Designer} is a powerful tool for interactively creating and @@ -79,7 +80,7 @@ interfaces which use lists and tables are structured to separate the data and view using models, views, and delegates. - \image fusion-treeview.png + \image fusion-treeview.png {File directory using a tree view} \section1 Graphics View @@ -87,7 +88,7 @@ interfaces number of custom-made 2D graphical items, and a view widget for visualizing the items, with support for zooming and rotation. - \image graphicsview-items.png + \image graphicsview-items.png {Various shapes and graphics on a grid} \section1 Using the Module diff --git a/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc b/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc index 822cf1efff9..7d00a22f04e 100644 --- a/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/gallery.qdoc @@ -16,16 +16,20 @@ depending on the active theme. \image windows-style.png Windows Style + {Widget gallery using the "Windows" style} \caption The Windows style ("windows") is provided by QWindowsStyle. \image windows-vista-style.png Windows Vista Style + {Widget gallery using Windows' "Vista" style) \caption The Windows Vista style ("windowsvista") is provided by QWindowsVistaStyle. \image macos-style.png \macos Style + {Widget gallery using "macOS" style) \caption The macOS style ("macOS") is provided by QMacStyle. \image fusion-style.png Fusion Style + {Widget gallery using the "Fusion" style) \caption The Fusion style ("fusion") is provided by QFusionStyle. The Styles example displays the following widgets: @@ -49,9 +53,11 @@ Windows 10 and \macos: \image windows-style2.png + {Widget gallery running on Windows 10} \caption Calendar Widget example on Windows 10 \image macos-style2.png + {Widget gallery running on macOS} \caption Calendar Widget example on \macos \list diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc index 58180105555..62539b8bac1 100644 --- a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc @@ -65,18 +65,22 @@ \li A QHBoxLayout lays out widgets in a horizontal row, from left to right (or right to left for right-to-left languages). \image qhboxlayout-with-5-children.png + {Five buttons in horizontal layout} \li A QVBoxLayout lays out widgets in a vertical column, from top to bottom. \image qvboxlayout-with-5-children.png + {Five buttons in vertical layout} \li A QGridLayout lays out widgets in a two-dimensional grid. Widgets can occupy multiple cells. \image qgridlayout-with-5-children.png + {Five buttons in grid layout} \li A QFormLayout lays out widgets in a 2-column descriptive label- field style. \image qformlayout-with-6-children.png + {Three buttons with text fields in form layout} \endlist @@ -181,12 +185,12 @@ If we have three widgets laid out using a QHBoxLayout with no stretch factors set we will get a layout like this: - \image layout1.png Three widgets in a row + \image layout1.png {Three evenly spaced widgets in a row} If we apply stretch factors to each widget, they will be laid out in proportion (but never less than their minimum size hint), e.g. - \image layout2.png Three widgets with different stretch factors in a row + \image layout2.png {Three stretched widgets in a row} \section1 Custom Widgets in Layouts diff --git a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc index e23811f6e70..3583440b077 100644 --- a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc @@ -121,6 +121,7 @@ go through the individual widgets. \image javastyle/conceptualpushbuttontree.png + {Push button style tree and elements} Widgets are not necessarily drawn by asking the style to draw only one element. Widgets can make several calls to the style to @@ -546,7 +547,7 @@ We give an image of a checkbox and the style option to match it. - \image javastyle/checkboxexample.png A Java style checkbox + \image javastyle/checkboxexample.png {Checkbox using the Java style} The above checkbox will have the following state flags in its style option: @@ -817,7 +818,8 @@ top-down traversal of the tree, you get the sequence in which the elements should be drawn. - \image javastyle/pushbutton.png The style structure for push buttons + \image javastyle/pushbutton.png + {Push button style tree and elements} The layout of the buttons, with regard to element bounds, varies from style to style. This makes it difficult to show conceptual images @@ -835,7 +837,7 @@ any other purpose. This is also true for similar images for the other widgets. - \image javastyle/button.png + \image javastyle/button.png {Button labeled with its elements} The Java style, as well as all other styles implemented in Qt, does not use \c PE_FrameButtonBevel. It is usual that a button @@ -890,6 +892,7 @@ metric names: \image javastyle/checkbox.png + {Check and radio box style tree and elements} QStyleOptionButton is used as the style option for both check and radio buttons. We first give a table of the states that @@ -941,6 +944,7 @@ Here is the style structure for QTabWidget and QTabBar: \image javastyle/tab.png + {Tab widget and tab bar style tree and elements} The dotted lines indicate that the QTabWidget contains a tab bar, but does not draw the tab bar itself. QTabBar only draws its base line @@ -952,7 +956,7 @@ Here is a tab widget in the Java style: - \image javastyle/tabwidget.png + \image javastyle/tabwidget.png {Tab widget labeled with its elements} In the Java style, the tab bar shape and label have the same bounding rectangle as \c CE_TabBarTab. Notice that the tabs overlap with the @@ -974,6 +978,7 @@ the other tabs (if it is to be bigger). \image javastyle/windowstabimage.png + {Tab bar labeled with its elements} A table of the states a tab bar can set on its tabs follows: @@ -1066,6 +1071,7 @@ Here is the style structure for scrollbars: \image javastyle/scrollbar.png + {Scrollbar style tree and elements} QScrollBar simply creates its style option and then draws \c CC_ScrollBar. Some styles draw the background of add page and sub @@ -1079,6 +1085,7 @@ Here is an image of a scrollbar in the Java style: \image javastyle/scrollbarimage.png + {Scrollbar labeled with its elements} You may notice that the scrollbar is slightly different from Java's, as it has two line up indicators. We have done this to show @@ -1156,13 +1163,13 @@ draws itself, it creates the style option and calls \c drawComplexControl() with \c CC_Slider: - \image javastyle/slider.png + \image javastyle/slider.png {Slider style tree and elements} We also show a picture of a slider in the Java style. We show the bounding rectangles of the sub elements, as all drawing is done in \c CC_Slider. - \image javastyle/sliderimage.png + \image javastyle/sliderimage.png {Slider labeled with its elements} QSlider uses QStyleOptionSlider as all \l{QAbstractSlider}s do. We present a table with the members that affect QSlider: @@ -1223,9 +1230,9 @@ the indicator backgrounds. You can see an image below the tree showing the sub elements in QSpinBox in the Java style. - \image javastyle/spinbox.png + \image javastyle/spinbox.png {Spin box style tree and elements} - \image javastyle/spinboximage.png + \image javastyle/spinboximage.png {Spin box labeled with its elements} The QStyleOptionSpinBox, which is the style option for spin boxes. It can set the following states on the spin box: @@ -1274,6 +1281,7 @@ provide. \image javastyle/titlebar.png + {Title bar style tree and elements} In an image over a title bar in the Java style, we show the bounding rectangles of the sub elements supported by the Java style @@ -1282,6 +1290,7 @@ mandatory. \image javastyle/titlebarimage.png + {Title bar labeled with its elements} The style option for title bars is QStyleOptionTitleBar. Its members are: @@ -1320,11 +1329,13 @@ field itself is a QLineEdit that is a child of the combo box. \image javastyle/combobox.png + {Combo box style tree and elements} We show an image over a Java style combo box in which we have outlined its sub elements and sub element rectangles: \image javastyle/comboboximage.png + {Combo box labeled with its elements} Java combo boxes do not use the focus rect; it changes its background color when it has focus. The \c SC_ComboBoxEdit field is @@ -1385,6 +1396,7 @@ the following style element tree: \image javastyle/groupbox.png + {Group box style tree and elements} Qt does not impose restrictions on how the check box is drawn; the Java style draws it with \c CE_IndicatorCheckBox. See \l{Check and @@ -1394,6 +1406,7 @@ sub control rectangles drawn: \image javastyle/groupboximage.png + {Group box labeled with its elements} The style option for group boxes is QStyleOptionGroupBox. The following states can be set on it: @@ -1466,11 +1479,13 @@ only element used by this widget. We start with the style structure: \image javastyle/progressbar.png + {Progress bar style tree and elements} Here is a progress bar in the common style (the Java style bounding rectangles are equal): \image javastyle/progressbarimage.png + {Progress bar labeled with its elements} The style option for QProgressBar is QStyleOptionProgressBar. The bar does not set any state flags, but the other members of the @@ -1520,6 +1535,7 @@ Below is a tree of the widget's style structure: \image javastyle/toolbutton.png + {Tool button style tree and elements} Note that \c PE_FrameButtonTool and \c PE_IndicatorArrowDown are included in the tree as the Java style draws them, but they can @@ -1532,6 +1548,7 @@ the sub element bounding rectangles and sub controls. \image javastyle/toolbuttonimage.png + {Tool button labeled with its elements} Here is the states table for tool buttons: @@ -1614,6 +1631,7 @@ Here is the element tree for QToolBar: \image javastyle/toolbar.png + {Tool bar style tree and elements} The dotted lines indicate that the QToolBar keeps an instance of QToolBarLayout and that QToolBarSeparators are kept by @@ -1624,6 +1642,7 @@ Here is an image of a toolbar in the Java style: \image javastyle/toolbarimage.png + {Tool bar labeled with its elements} QToolBarSaparator uses QStyleOption for its style option. It sets the \c State_Horizontal flag if the toolbar it lives in is @@ -1677,7 +1696,7 @@ calculated for the menu's size hint and when the menu is displayed or resized. - \image javastyle/menu.png + \image javastyle/menu.png {Menu style tree and elements} The \c CE_MenuScroller and \c CE_MenuTearOff elements are handled by QCommonStyle and are not shown unless the menu is too large to fit @@ -1692,6 +1711,7 @@ as this is optional and varies from style to style. \image javastyle/menuimage.png + {Menu labeled with its elements} The style option for menu items is QStyleOptionMenuItem. The following tables describe its state flags and other members. @@ -1768,6 +1788,7 @@ bar follows: \image javastyle/menubar.png + {Menu bar style tree and elements} The panel and empty area are drawn after the menu items. The QPainter that the QMenuBar sends to the style has the bounding @@ -1777,6 +1798,7 @@ menu bar items are calculated. \image javastyle/menubarimage.png + {Menu bar labeled with its elements} QStyleOptionMenuItem is used for menu bar items. The members that are used by QMenuBar are described in the following table: @@ -1814,11 +1836,13 @@ \c PE_FrameFocusRect and \c PE_IndicatorItemViewItemCheck. \image javastyle/header.png + {Header style tree and elements} Here is a QTableWidget showing the bounding rects of a Java header: \image javastyle/headerimage.png + {Header labeled with its elements} The QHeaderView uses \c CT_HeaderSection, \c PM_HeaderMargin and \c PM_HeaderGripMargin for size and hit test calculations. The @@ -1914,6 +1938,7 @@ states you must be aware of are represented in the image. \image javastyle/branchindicatorimage.png + {Branch indicator style structure and drawing states} \section3 Tool Boxes @@ -1926,10 +1951,12 @@ boxes looks like this: \image javastyle/toolbox.png + {Tool box style tree and elements} We show an image of a tool box in the Plastique style: \image javastyle/toolboximage.png + {Tool box labeled with its elements} All elements have the same bounding rectangles in the Plastique style as well as the other built-in Qt styles. @@ -1958,9 +1985,9 @@ metric \c PM_SizeGripSize is currently unused by Qt. The element tree for an image in the Plastique style of QSizeGrip follows: - \image javastyle/sizegrip.png + \image javastyle/sizegrip.png {Size grip style tree and elements} - \image javastyle/sizegripimage.png + \image javastyle/sizegripimage.png {Size grip labeled with its elements} We show the size grip in \l{QMainWindow}'s bottom right corner. @@ -1982,12 +2009,13 @@ The \l{QRubberBand}'s style tree consists of two nodes. - \image javastyle/rubberband.png + \image javastyle/rubberband.png {Rubber band style tree and its elements} We present an image of a Java style window being moved in a QMdiArea with a rubber band: \image javastyle/rubberbandimage.png + {Rubber band labeled with its elements} The style option for rubber bands is QStyleOptionRubberBand. Its members are: @@ -2016,7 +2044,7 @@ rectangles of the float and close buttons with \c SE_DockWidgetCloseButton and \c SE_DockWidgetFloatButton. - \image javastyle/dockwidget.png + \image javastyle/dockwidget.png {Dock widget style tree and elements} The dotted lines indicate that the sender keeps instances of the recipient of the arrow (i.e., it is not a style element to draw). @@ -2026,7 +2054,7 @@ dock widget in both docked and floating state in the plastique style: - \image javastyle/dockwidgetimage.png + \image javastyle/dockwidgetimage.png {Dock widget labeled with its elements} The style option is QStyleOptionDockWidget: diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc index df64db9f2cf..841948b671f 100644 --- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -537,6 +537,7 @@ and select \uicontrol{Change styleSheet...} to set the style sheet. \image designer-stylesheet-options.png + {Editing a form in Qt Widgets Designer} In Qt 4.2 and later, \QD also includes a style sheet syntax highlighter and validator. The validator indicates @@ -544,11 +545,13 @@ Style Sheet} dialog. \image designer-validator-highlighter.png + {Editing and validating a stylesheet} When you click \uicontrol{OK} or \uicontrol{Apply}, \QD will automatically display the widget with its new stylesheet. \image designer-stylesheet-usage.png + {Preview of a form with the new stylesheet} */ /*! @@ -568,6 +571,7 @@ The four concentric rectangles appear conceptually as below: \image stylesheet-boxmodel.png + {Diagram of the CSS box model for layout design} \list \li The margin falls outside the border. @@ -3966,7 +3970,7 @@ However, the result is a boring, flat button with no borders: - \image stylesheet-redbutton1.png A flat red button + \image stylesheet-redbutton1.png {Flat red button} What happened is this: @@ -3985,7 +3989,7 @@ \snippet code/doc_src_stylesheet.qdoc 97 - \image stylesheet-redbutton2.png A red button with a beige border + \image stylesheet-redbutton2.png {Red button with a beige border} Things look already a lot better. But the button looks a bit cramped. Let's specify some spacing between the border and the @@ -3995,7 +3999,8 @@ \snippet code/doc_src_stylesheet.qdoc 98 - \image stylesheet-redbutton3.png A red button with a round beige border and big, bold text + \image stylesheet-redbutton3.png + {Red button with a round beige border and big, bold text} The only issue remaining is that the button doesn't react when we press it. We can fix this by specifying a slightly different @@ -4183,7 +4188,7 @@ style sheets. However, if one property or sub-control is customized, all the other properties or sub-controls must be customized as well. - \image progressBar-stylesheet.png + \image progressBar-stylesheet.png {Progress bar showing 30%} For example, we change the \l{stylesheet-reference.html#border-prop} {border} to grey and the \l{stylesheet-reference.html#chunk-sub}{chunk} @@ -4200,7 +4205,7 @@ A \l{stylesheet-reference.html#margin-prop}{margin} can be included to obtain more visible chunks. - \image progressBar2-stylesheet.png + \image progressBar2-stylesheet.png {Notched progress bar} In the screenshot above, we use a \l{stylesheet-reference.html#margin-prop}{margin} of 0.5 pixels. @@ -4235,7 +4240,7 @@ if one property or sub-control is customized, all the other properties or sub-controls must be customized as well. - \image stylesheet-scrollbar1.png + \image stylesheet-scrollbar1.png {Green stylized scroll bar} The scroll bar above has been styled in aquamarine with a solid grey border. @@ -4259,7 +4264,7 @@ \snippet code/doc_src_stylesheet.qdoc 136 The scroll bar using the above stylesheet looks like this: - \image stylesheet-scrollbar2.png + \image stylesheet-scrollbar2.png {Colorized scroll bar} To customize a vertical scroll bar use a style sheet similar to the following: @@ -4308,14 +4313,14 @@ \section2 Customizing QTabWidget and QTabBar - \image tabWidget-stylesheet1.png + \image tabWidget-stylesheet1.png {Image of several tabs} For the screenshot above, we need a stylesheet as follows: \snippet code/doc_src_stylesheet.qdoc 145 Often we require the tabs to overlap to look like below: - \image tabWidget-stylesheet2.png + \image tabWidget-stylesheet2.png {Image of overlapped tabs} For a tab widget that looks like above, we make use of \l{https://doc.qt.io/qt-5/stylesheet-customizing.html#the-box-model} @@ -4326,7 +4331,7 @@ \snippet code/doc_src_stylesheet.qdoc 146 To move the tab bar to the center (as below), we require the following stylesheet: - \image tabWidget-stylesheet3.png + \image tabWidget-stylesheet3.png {Several tabs centered in the widget} \snippet code/doc_src_stylesheet.qdoc 147 @@ -4341,7 +4346,7 @@ Suppose we'd like our selected item in QTableView to have bubblegum pink fade to white as its background. - \image tableWidget-stylesheet.png + \image tableWidget-stylesheet.png {Table view with custom style} This is possible with the \l{stylesheet-reference.html#selection-background-color-prop} @@ -4423,11 +4428,11 @@ \table \row - \li \inlineimage stylesheet-vline.png - \li \inlineimage stylesheet-branch-more.png - \li \inlineimage stylesheet-branch-end.png - \li \inlineimage stylesheet-branch-closed.png - \li \inlineimage stylesheet-branch-open.png + \li \inlineimage stylesheet-vline.png {Vertical line} + \li \inlineimage stylesheet-branch-more.png {Junction line for lists} + \li \inlineimage stylesheet-branch-end.png {Line for terminating the list} + \li \inlineimage stylesheet-branch-closed.png {Arrow pointing right} + \li \inlineimage stylesheet-branch-open.png {Arrow pointing down} \row \li vline.png \li branch-more.png @@ -4440,7 +4445,7 @@ The resulting tree view looks like this: - \image stylesheet-treeview.png + \image stylesheet-treeview.png {Tree view with styled branches} \sa {Supported HTML Subset}, QStyle @@ -4474,7 +4479,7 @@ This will produce a button looking like this: - \image stylesheet-border-image-normal.png + \image stylesheet-border-image-normal.png {Button with a background} The numbers after the url gives the top, right, bottom and left number of pixels, respectively. These numbers correspond to the border and should not @@ -4484,18 +4489,12 @@ will not. This makes the borders of the button look more natural, like this: - \table - \row - \li \inlineimage stylesheet-border-image-stretched.png - \row - \li With borders - \endtable + \image stylesheet-border-image-stretched.png + {Button with specified border sizes} + \caption With borders - \table - \row - \li \inlineimage stylesheet-border-image-wrong.png - \row - \li Without borders - \endtable + \image stylesheet-border-image-wrong.png + {Button without specified border sizes} + \caption Without borders */ diff --git a/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc b/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc index 79bb32b2d1e..64208c9898d 100644 --- a/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc @@ -19,13 +19,13 @@ \table \row - \li \image fusion-label.png - \li \image windowsvista-pushbutton.png - \li \image macos-progressbar.png + \li \image fusion-label.png {Label} + \li \image windowsvista-pushbutton.png {Cancel button} + \li \image macos-progressbar.png {Progress bar} \row - \li \image fusion-combobox.png - \li \image windowsvista-radiobutton.png - \li \image macos-lineedit.png + \li \image fusion-combobox.png {Combo box} + \li \image windowsvista-radiobutton.png {Radio box} + \li \image macos-lineedit.png {Line edit} \endtable \annotatedlist basicwidgets @@ -39,8 +39,11 @@ \table \row \li \image fusion-treeview.png + {Directory widget showing the contents using a tree view} \li \image fusion-calendarwidget.png + {Calendar widget showing the month, year, and a selected day} \li \image qundoview.png + {Undo stack showing list of commands} \endtable \annotatedlist advanced diff --git a/src/widgets/doc/src/widgets-tutorial.qdoc b/src/widgets/doc/src/widgets-tutorial.qdoc index f6212da636f..c2bf10be59b 100644 --- a/src/widgets/doc/src/widgets-tutorial.qdoc +++ b/src/widgets/doc/src/widgets-tutorial.qdoc @@ -116,6 +116,7 @@ \row \li \snippet tutorials/widgets/toplevel/main.cpp main program \li \inlineimage widgets-tutorial-toplevel.png + {Top-level widget application window} \endtable \enddiv @@ -140,6 +141,7 @@ \li \snippet tutorials/widgets/childwidget/main.cpp main program \row \li \inlineimage widgets-tutorial-childwidget.png + {Window with a button as its child} \endtable \enddiv @@ -164,6 +166,7 @@ \li \snippet tutorials/widgets/windowlayout/main.cpp main program \row \li \inlineimage widgets-tutorial-windowlayout.png + {Label next to a line edit in a horizontal layout} \endtable \enddiv @@ -204,6 +207,7 @@ \li \snippet tutorials/widgets/nestedlayouts/main.cpp first part \snippet tutorials/widgets/nestedlayouts/main.cpp last part \li \inlineimage widgets-tutorial-nestedlayouts.png + {Widgets for querying and displaying a model using a nested layout} \endtable \enddiv diff --git a/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc b/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc index 57ebc717818..970a3899376 100644 --- a/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc +++ b/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc @@ -86,7 +86,8 @@ widget's client geometry. This diagram shows most of the functions in use: - \image geometry.png Geometry diagram + \image geometry.png + {Window geometry with size dimensions and positions labeled} \section2 X11 Peculiarities @@ -234,6 +235,7 @@ corners of the main window in this layout. \image mainwindow-docks-example.png + {Placement of dock windows relative to a central widget} Once all the main window components have been set up, the central widget is created and installed by using code similar to the following: diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp index 91a6a0f1146..77a6e38c1fe 100644 --- a/src/widgets/effects/qgraphicseffect.cpp +++ b/src/widgets/effects/qgraphicseffect.cpp @@ -34,15 +34,21 @@ \table \row \li{2,1} \image graphicseffect-plain.png + {Image of a fish without any graphical effects} \row \li \image graphicseffect-blur.png + {Blur effect on an image of a fish} \li \image graphicseffect-colorize.png + {Blue color effect on an image of a fish} \row \li \image graphicseffect-opacity.png + {Opacity effect on an image of a fish} \li \image graphicseffect-drop-shadow.png + {Drop shadow effect on an image of a fish} \endtable \image graphicseffect-widget.png + {Opacity drop shadow effects applied on an application} For more information on how to use each effect, refer to the specific effect's documentation. @@ -567,6 +573,7 @@ void QGraphicsEffect::sourceChanged(ChangeFlags flags) By default, the color is light blue (QColor(0, 0, 192)). \image graphicseffect-colorize.png + {Blue color effect on an image of a fish} \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsOpacityEffect */ @@ -696,6 +703,7 @@ void QGraphicsColorizeEffect::draw(QPainter *painter) device coordinates. \image graphicseffect-blur.png + {Blur effect on an image of a fish} \sa QGraphicsDropShadowEffect, QGraphicsColorizeEffect, QGraphicsOpacityEffect */ @@ -857,6 +865,7 @@ void QGraphicsBlurEffect::draw(QPainter *painter) in device coordinates. \image graphicseffect-drop-shadow.png + {Drop shadow effect on an image of a fish} \sa QGraphicsBlurEffect, QGraphicsColorizeEffect, QGraphicsOpacityEffect */ @@ -1047,6 +1056,7 @@ void QGraphicsDropShadowEffect::draw(QPainter *painter) By default, the opacity is 0.7. \image graphicseffect-opacity.png + {Opacity effect on an image of a fish} \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsColorizeEffect */ diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp index 08703b62224..ac027f36446 100644 --- a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp @@ -21,7 +21,9 @@ are removed, all their anchors will be automatically removed. \div {class="float-left"} - \inlineimage simpleanchorlayout-example.png Using an anchor layout to align simple colored widgets. + \inlineimage simpleanchorlayout-example.png + {Three widgets using anchor layout to align to the widget edges} + \caption Using an anchor layout to align simple colored widgets. \enddiv Anchors are always set up between edges of an item, where the "center" is also considered to diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index b47fef8def2..8f0a348231a 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -16,7 +16,7 @@ painting implementation and item interaction through its event handlers. QGraphicsItem is part of the \l{Graphics View Framework} - \image graphicsview-items.png + \image graphicsview-items.png {Various shapes and graphics on a grid} For convenience, Qt provides a set of standard graphics items for the most common shapes. These are: @@ -96,6 +96,7 @@ transformation to all children. \image graphicsview-parentchild.png + {Several coordinate system transformations} \section1 Transformations @@ -164,6 +165,7 @@ order will be A, then B, then C. \image graphicsview-zorder.png + {Robot with numbered nodes and limbs} This example shows the stacking order of all limbs of the robot from the \l{graphicsview/dragdroprobot}{Drag and Drop Robot} example. The torso is @@ -8076,6 +8078,8 @@ QPainterPath QAbstractGraphicsShapeItem::opaqueArea() const returns the current path. \image graphicsview-pathitem.png + {Path drawn near the origin} + QGraphicsPathItem uses the path to provide a reasonable implementation of boundingRect(), shape(), and contains(). The @@ -8269,6 +8273,7 @@ QVariant QGraphicsPathItem::extension(const QVariant &variant) const returns the current rectangle. \image graphicsview-rectitem.png + {Rectangle drawn near the origin} QGraphicsRectItem uses the rectangle and the pen width to provide a reasonable implementation of boundingRect(), shape(), and @@ -8501,7 +8506,9 @@ QVariant QGraphicsRectItem::extension(const QVariant &variant) const \table \row \li \inlineimage graphicsview-ellipseitem.png + {Complete ellipse shape} \li \inlineimage graphicsview-ellipseitem-pie.png + {Ellipse shape with a start and span angle} \endtable To set the item's ellipse, pass a QRectF to QGraphicsEllipseItem's @@ -8801,6 +8808,7 @@ QVariant QGraphicsEllipseItem::extension(const QVariant &variant) const function. The polygon() function returns the current polygon. \image graphicsview-polygonitem.png + {Polygon drawn near the origin} QGraphicsPolygonItem uses the polygon and the pen width to provide a reasonable implementation of boundingRect(), shape(), and @@ -9025,6 +9033,7 @@ QVariant QGraphicsPolygonItem::extension(const QVariant &variant) const width of 0, but you can change this by calling setPen(). \image graphicsview-lineitem.png + {Line segment drawn near the origin} QGraphicsLineItem uses the line and the pen width to provide a reasonable implementation of boundingRect(), shape(), and contains(). The paint() @@ -9276,6 +9285,7 @@ QVariant QGraphicsLineItem::extension(const QVariant &variant) const reasonable implementation of boundingRect(), shape(), and contains(). \image graphicsview-pixmapitem.png + {Pixmap of the Qt logo drawn near the origin} The pixmap is drawn at the item's (0, 0) coordinate, as returned by offset(). You can change the drawing offset by calling setOffset(). @@ -9645,6 +9655,7 @@ QVariant QGraphicsPixmapItem::extension(const QVariant &variant) const Otherwise, you can call adjustSize() after setting the item's text. \image graphicsview-textitem.png + {Paragraph drawn near the origin} \note QGraphicsTextItem accepts \l{QGraphicsItem::acceptHoverEvents()}{hover events} by default. You can change this with \l{QGraphicsItem::}{setAcceptHoverEvents()}. @@ -10558,6 +10569,7 @@ void QGraphicsSimpleTextItemPrivate::updateBoundingRect() QGraphicsTextItem, which provides full text control capabilities. \image graphicsview-simpletextitem.png + {"Qt" text with custom fill and outline drawn near the origin} \sa QGraphicsTextItem, QGraphicsPathItem, QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsPixmapItem, QGraphicsPolygonItem, diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index 8d00bde1004..99db9748166 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -74,6 +74,7 @@ QT_BEGIN_NAMESPACE contents rect labeled. \image qgraphicsproxywidget-embed.png + {Proxy widget and its embedded widget with their positions} Alternatively, you can start by creating a new QGraphicsProxyWidget item, and then call setWidget() to embed a QWidget later. The widget() function diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 10f75774b83..657fc828074 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -96,7 +96,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < each frame. Call QOpenGLWidget::currentTargetBuffer() to query which buffer is currently being drawn to. - \image graphicsview-view.png + \image graphicsview-view.png {Grid of computer chips} \note Using an OpenGL viewport limits the ability to use QGraphicsProxyWidget. Not all combinations of widgets and styles can be supported with such a setup. diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp index 236bbd8604c..e010bee91a0 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.cpp +++ b/src/widgets/itemviews/qabstractitemdelegate.cpp @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE We give an example of drawing a progress bar in items; in our case for a package management program. - \image widgetdelegate.png + \image widgetdelegate.png {Package manager showing download progress} We create the \c WidgetDelegate class, which inherits from QStyledItemDelegate. We do the drawing in the paint() function: diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp index 54a1be0c1ca..44729cc81a7 100644 --- a/src/widgets/itemviews/qcolumnview.cpp +++ b/src/widgets/itemviews/qcolumnview.cpp @@ -35,7 +35,7 @@ QT_BEGIN_NAMESPACE QAbstractItemView class to allow it to display data provided by models derived from the QAbstractItemModel class. - \image qcolumnview.png + \image qcolumnview.png {Address information in a column view} \sa {Model/View Programming} */ diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 8b50bd4301c..e4d36e0bce7 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -42,7 +42,7 @@ extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); \ingroup advanced \inmodule QtWidgets - \image fusion-listview.png + \image fusion-listview.png {List of weather icons} A QListView presents items stored in a model, either as a simple non-hierarchical list, or as a collection of icons. This class is used diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index 1f810dd26ee..d175bf9c5a1 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -1178,7 +1178,7 @@ void QListWidgetPrivate::dataChanged(const QModelIndex &topLeft, \ingroup model-view \inmodule QtWidgets - \image fusion-listview.png + \image fusion-listview.png {List of weather icons} QListWidget is a convenience class that provides a list view similar to the one supplied by QListView, but with a classic item-based interface for diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index c36de15d8f0..ece9f05c738 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -1161,7 +1161,7 @@ int QTableViewPrivate::heightHintForIndex(const QModelIndex &index, int hint, QS \ingroup advanced \inmodule QtWidgets - \image fusion-tableview.png + \image fusion-tableview.png {Table of months and amounts} A QTableView implements a table view that displays items from a model. This class is used to provide standard tables that were @@ -1207,6 +1207,7 @@ int QTableViewPrivate::heightHintForIndex(const QModelIndex &index, int hint, QS \table \row \li \inlineimage qtableview-resized.png + {Table of names, addresses, and quantity} \li By default, the cells in a table do not expand to fill the available space. You can make the cells fill the available space by stretching the last diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp index 9ef3c77e079..85b399746b1 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -1549,7 +1549,7 @@ QTableWidgetItem &QTableWidgetItem::operator=(const QTableWidgetItem &other) \ingroup model-view \inmodule QtWidgets - \image fusion-tableview.png + \image fusion-tableview.png {Table of months and amounts} Table widgets provide standard table display facilities for applications. The items in a QTableWidget are provided by QTableWidgetItem. diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 57a2d2939e9..da1fbbd60df 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -40,6 +40,7 @@ QT_BEGIN_NAMESPACE \inmodule QtWidgets \image fusion-treeview.png + {Directory widget showing the contents using a tree view} A QTreeView implements a tree representation of items from a model. This class is used to provide standard hierarchical lists that diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 748f8627578..6b03b6f9f1a 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -2401,7 +2401,7 @@ void QTreeWidgetPrivate::dataChanged(const QModelIndex &topLeft, \ingroup model-view \inmodule QtWidgets - \image fusion-treeview.png + \image fusion-treeview.png {Directory displaying its contents as a tree} The QTreeWidget class is a convenience class that provides a standard tree widget with a classic item-based interface similar to that used by diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp index ad3744986d7..312297fd603 100644 --- a/src/widgets/kernel/qboxlayout.cpp +++ b/src/widgets/kernel/qboxlayout.cpp @@ -432,7 +432,7 @@ int QBoxLayoutPrivate::validateIndex(int index) const the parentWidget()), divides it up into a row of boxes, and makes each managed widget fill one box. - \image qhboxlayout-with-5-children.png Horizontal box layout with five child widgets + \image qhboxlayout-with-5-children.png {Five buttons in horizontal layout} If the QBoxLayout's orientation is Qt::Horizontal the boxes are placed in a row, with suitable sizes. Each widget (or other box) @@ -440,7 +440,7 @@ int QBoxLayoutPrivate::validateIndex(int index) const Any excess space is shared according to the stretch factors (more about that below). - \image qvboxlayout-with-5-children.png Vertical box layout with five child widgets + \image qvboxlayout-with-5-children.png {Five buttons in vertical layout} If the QBoxLayout's orientation is Qt::Vertical, the boxes are placed in a column, again with suitable sizes. @@ -1225,7 +1225,8 @@ QBoxLayout::Direction QBoxLayout::direction() const object onto \c window. At that point, the widgets in the layout are reparented to have \c window as their parent. - \image qhboxlayout-with-5-children.png Horizontal box layout with five child widgets + \image qhboxlayout-with-5-children.png + {Five buttons in horizontal layout} \sa QVBoxLayout, QGridLayout, QStackedLayout, {Layout Management}, {Basic Layouts Example} */ @@ -1298,7 +1299,8 @@ QHBoxLayout::~QHBoxLayout() object onto \c window. At that point, the widgets in the layout are reparented to have \c window as their parent. - \image qvboxlayout-with-5-children.png Horizontal box layout with five child widgets + \image qvboxlayout-with-5-children.png + {Horizontal box layout with five child widgets} \sa QHBoxLayout, QGridLayout, QStackedLayout, {Layout Management}, {Basic Layouts Example} */ diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index 3cc7256d957..e94ca478ef7 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -1074,9 +1074,13 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem) \li Qt Extended styles \row \li \inlineimage qformlayout-win.png + {Form layout in traditional desktop style} \li \inlineimage qformlayout-mac.png + {Form layout in macOS Aqua style} \li \inlineimage qformlayout-kde.png + {Form layout in KDE Plastique style} \li \inlineimage qformlayout-qpe.png + {Form layout in Qt Extended style} \row \li Traditional style used for Windows, GNOME, and earlier versions of KDE. Labels are left aligned, and expanding diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp index 736c95ac296..14e4a345fa3 100644 --- a/src/widgets/kernel/qgesture.cpp +++ b/src/widgets/kernel/qgesture.cpp @@ -196,7 +196,7 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const \ingroup gestures \inmodule QtWidgets - \image pangesture.png + \image pangesture.png {Demonstration of moving an image with pan gesture} For an overview of gesture handling in Qt and information on using gestures in your applications, see the \l{Gestures in Widgets and Graphics View} document. @@ -327,7 +327,7 @@ void QPanGesture::setAcceleration(qreal value) For an overview of gesture handling in Qt and information on using gestures in your applications, see the \l{Gestures in Widgets and Graphics View} document. - \image pinchgesture.png + \image pinchgesture.png {Demonstration of pinch gesture with two fingers} Instead of repeatedly applying the same pinching gesture, the user may continue to touch the input device in one place, and apply a second touch @@ -591,7 +591,7 @@ void QPinchGesture::setRotationAngle(qreal value) \ingroup gestures \inmodule QtWidgets - \image swipegesture.png + \image swipegesture.png {Demonstration of swipe gesture} For an overview of gesture handling in Qt and information on using gestures in your applications, see the \l{Gestures in Widgets and Graphics View} document. diff --git a/src/widgets/kernel/qrhiwidget.cpp b/src/widgets/kernel/qrhiwidget.cpp index dbea5f16240..e7c23572ce4 100644 --- a/src/widgets/kernel/qrhiwidget.cpp +++ b/src/widgets/kernel/qrhiwidget.cpp @@ -91,7 +91,7 @@ QT_BEGIN_NAMESPACE The result is a widget that shows the following: - \image qrhiwidget-intro.jpg + \image qrhiwidget-intro.jpg {Multicolored triangle on a green background} For a complete, minimal, introductory example check out the \l{Simple RHI Widget Example}. diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 75e916fa511..bc91c76494e 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE the appropriate help text is shown. The mode is left when help is given or when the user presses Esc. - \image whatsthis.png + \image whatsthis.png {"What's This?" mode for New File button} You can enter "What's This?" mode programmatically with enterWhatsThisMode(), check the mode with inWhatsThisMode(), and diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index dcd10d66240..36446c3e5c4 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -390,7 +390,9 @@ void QWidget::setAutoFillBackground(bool enabled) example, it is possible to display a button as a top-level window, but most people prefer to put their buttons inside other widgets, such as QDialog. - \image parent-child-widgets.png A parent widget containing various child widgets. + \image parent-child-widgets.png + {Appointment widget with labeled child widgets} + \caption A parent widget containing various child widgets. The diagram above shows a QGroupBox widget being used to hold various child widgets in a layout provided by QGridLayout. The QLabel child widgets have @@ -690,6 +692,8 @@ void QWidget::setAutoFillBackground(bool enabled) can be fine-tuned to achieve different effects. \image propagation-custom.png + {Three pixmaps of a house with different background properties: + transparent, filled with white, and uninitialized} In the above diagram, a semi-transparent rectangular child widget with an area removed is constructed and added to a parent widget (a QLabel showing @@ -733,6 +737,8 @@ void QWidget::setAutoFillBackground(bool enabled) in a non-standard way, as shown in the diagram below. \image propagation-standard.png + {One widget has a transparent background + and the other widget has a filled background} The scope for customizing the painting behavior of standard Qt widgets, without resorting to subclassing, is slightly less than that possible for @@ -11161,6 +11167,7 @@ void QWidget::scroll(int dx, int dy) for (const QRect &rect : d->dirty) proxy->update(rect.translated(dx, dy)); proxy->scroll(dx, dy, proxy->subWidgetRect(this)); + d->scrollChildren(dx, dy); // QTBUG-138381: scroll item view cell widgets return; } #endif @@ -13139,7 +13146,7 @@ void QWidget::initPainter(QPainter *painter) const const QPalette &pal = palette(); painter->d_func()->state->pen = QPen(pal.brush(foregroundRole()), 1); painter->d_func()->state->bgBrush = pal.brush(backgroundRole()); - QFont f(font(), const_cast<QWidget *>(this)); + QFont f(font(), this); painter->d_func()->state->deviceFont = f; painter->d_func()->state->font = f; } diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 464f51e2b77..c4b78539114 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5823,6 +5823,7 @@ QIcon QCommonStylePrivate::iconFromMacTheme(QCommonStyle::StandardPixmap standar case QStyle::SP_MessageBoxWarning: case QStyle::SP_MessageBoxCritical: case QStyle::SP_DesktopIcon: + case QStyle::SP_DirHomeIcon: case QStyle::SP_TrashIcon: case QStyle::SP_ComputerIcon: case QStyle::SP_DriveFDIcon: @@ -5833,6 +5834,7 @@ QIcon QCommonStylePrivate::iconFromMacTheme(QCommonStyle::StandardPixmap standar case QStyle::SP_DirOpenIcon: case QStyle::SP_DirClosedIcon: case QStyle::SP_DirLinkIcon: + case QStyle::SP_DirLinkOpenIcon: case QStyle::SP_FileLinkIcon: case QStyle::SP_FileIcon: case QStyle::SP_ToolBarHorizontalExtensionButton: diff --git a/src/widgets/styles/qfusionstyle_p_p.h b/src/widgets/styles/qfusionstyle_p_p.h index f37ac1b72ca..dcb79f9e93c 100644 --- a/src/widgets/styles/qfusionstyle_p_p.h +++ b/src/widgets/styles/qfusionstyle_p_p.h @@ -71,7 +71,10 @@ public: } if (pal.window().style() == Qt::TexturePattern) return QColor(0, 0, 0, 160); - return pal.window().color().darker(140); + auto windowColor = pal.window().color(); + if (!windowColor.isValid()) + windowColor = QPalette().window().color(); + return windowColor.darker(140); } QColor highlightedOutline(const QPalette &pal) const { diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 79ab0f6d2e4..d1869d9b6a6 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -79,6 +79,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C is a zero pointer. \image paintsystem-stylepainter.png + {Diagram showing QStylePainter inherits from QPainter} The paint system also provides the QStylePainter class inheriting from QPainter. QStylePainter is a convenience class for drawing @@ -89,7 +90,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C \table 100% \row - \li \inlineimage paintsystem-icon.png + \li \inlineimage paintsystem-icon.png {Icon used in Qt} \li \b QIcon The QIcon class provides scalable icons in different modes and states. @@ -129,7 +130,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C native widgets. The diagram below shows a QComboBox in nine different styles. - \image qstyle-comboboxes.png Nine combo boxes + \image qstyle-comboboxes.png {Nine combo boxes showing different styles} Topics: diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 21fa5f3ea65..58aa637c093 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -1070,6 +1070,7 @@ QStyleOptionToolBar::QStyleOptionToolBar(int version) \enum QStyleOptionToolBar::ToolBarPosition \image qstyleoptiontoolbar-position.png + {Diagram of thee toolbar line and the positions relative to the line} This enum is used to describe the position of a toolbar line, as well as the toolbar's position within the line. diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 83f3e298216..9b06822c218 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -164,7 +164,7 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e) This style is Qt's default GUI style on Windows. - \image qwindowsstyle.png + \image qwindowsstyle.png {Gallery of widgets using the default GUI style} \sa QWindowsVistaStyle, QMacStyle, QFusionStyle */ diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp index 7be4afe3bf5..1f7385b4c15 100644 --- a/src/widgets/util/qundoview.cpp +++ b/src/widgets/util/qundoview.cpp @@ -230,7 +230,7 @@ QIcon QUndoModel::cleanIcon() const be set with setGroup(). The view will then update itself automatically whenever the active stack of the group changes. - \image qundoview.png + \image qundoview.png {Undo stack showing list of commands} */ class QUndoViewPrivate : public QListViewPrivate diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 3b8e44df8bc..00718d60848 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -157,7 +157,9 @@ QAbstractSpinBox::~QAbstractSpinBox() in a spin box. \inlineimage qspinbox-updown.png + {Spinbox with the up and down arrow symbols} \inlineimage qspinbox-plusminus.png + {Spinbox with the plus and minus symbols} \value UpDownArrows Little arrows in the classic style. \value PlusMinus \b{+} and \b{-} symbols. diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index b047016d932..53092bdc159 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -2016,6 +2016,7 @@ void QCalendarWidgetPrivate::_q_editingFinished() \inmodule QtWidgets \image fusion-calendarwidget.png + {Calendar widget showing the month, year, and a selected day} The widget is initialized with the current month and year, but QCalendarWidget provides several public slots to change the year @@ -2054,6 +2055,7 @@ void QCalendarWidgetPrivate::_q_editingFinished() \table \row \li \image qcalendarwidget-grid.png + {Calendar widget with a visible grid} \row \li \snippet code/src_gui_widgets_qcalendarwidget.cpp 0 \endtable @@ -2484,6 +2486,7 @@ void QCalendarWidget::showToday() \table \row \li \image qcalendarwidget-minimum.png + {Calendar widget with the disabled dates before the minimum date} \row \li \snippet code/src_gui_widgets_qcalendarwidget.cpp 1 @@ -2540,6 +2543,7 @@ void QCalendarWidget::clearMinimumDate() \table \row \li \image qcalendarwidget-maximum.png + {Calendar widget with the disabled dates after the maximum date} \row \li \snippet code/src_gui_widgets_qcalendarwidget.cpp 2 @@ -2714,6 +2718,7 @@ void QCalendarWidget::setVerticalHeaderFormat(QCalendarWidget::VerticalHeaderFor \table \row \li \inlineimage qcalendarwidget-grid.png + {Calendar widget set to be visible} \row \li \snippet code/src_gui_widgets_qcalendarwidget.cpp 5 diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp index 2f1492bd502..2386488c0d8 100644 --- a/src/widgets/widgets/qcheckbox.cpp +++ b/src/widgets/widgets/qcheckbox.cpp @@ -41,7 +41,7 @@ public: \ingroup basicwidgets \inmodule QtWidgets - \image fusion-checkbox.png + \image fusion-checkbox.png {Check box for the save option} A QCheckBox is an option button that can be switched on (checked) or off (unchecked). Checkboxes are typically used to represent features in an @@ -56,7 +56,9 @@ public: \table \row \li \inlineimage checkboxes-exclusive.png + {Check box group that allows only one option checked} \li \inlineimage checkboxes-non-exclusive.png + {Check box group that allows multiple options checked} \endtable Whenever a checkbox is checked or cleared, it emits the signal diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index cddf0b3484d..6f25b8bde67 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -979,9 +979,11 @@ QComboBox::QComboBox(QComboBoxPrivate &dd, QWidget *parent) \table \row \li \image collapsed_combobox.png + {Combo box with collapsed options list} \caption Collapsed QCombobox \li \image expanded_combobox.png + {Combo box with expanded options list} \caption Expanded QCombobox \endtable diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index 3b862dea8fe..d419c3e6e15 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -42,7 +42,7 @@ using namespace Qt::StringLiterals; \ingroup basicwidgets \inmodule QtWidgets - \image fusion-datetimeedit.png + \image fusion-datetimeedit.png {Widget for editing time and date} QDateTimeEdit allows the user to edit dates by using the keyboard or the arrow keys to increase and decrease date and time values. The @@ -1608,7 +1608,7 @@ void QDateTimeEdit::mousePressEvent(QMouseEvent *event) \ingroup basicwidgets \inmodule QtWidgets - \image fusion-timeedit.png + \image fusion-timeedit.png {Editable time} Many of the properties and functions provided by QTimeEdit are implemented in QDateTimeEdit. These are the relevant properties of this class: @@ -1679,7 +1679,7 @@ QTimeEdit::~QTimeEdit() \ingroup basicwidgets \inmodule QtWidgets - \image fusion-dateedit.png + \image fusion-dateedit.png {Editable date} Many of the properties and functions provided by QDateEdit are implemented in QDateTimeEdit. These are the relevant properties of this class: diff --git a/src/widgets/widgets/qdial.cpp b/src/widgets/widgets/qdial.cpp index fc0029d2378..92e446e8510 100644 --- a/src/widgets/widgets/qdial.cpp +++ b/src/widgets/widgets/qdial.cpp @@ -144,7 +144,7 @@ int QDialPrivate::valueFromPoint(const QPoint &p) const \ingroup basicwidgets \inmodule QtWidgets - \image fusion-dial.png + \image fusion-dial.png {Round dial with notches} QDial is used when the user needs to control a value within a program-definable range, and the range either wraps around diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 695b2a42966..db214c114ce 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -67,13 +67,21 @@ QT_BEGIN_NAMESPACE Currently the buttons are laid out in the following way if the button box is horizontal: \table - \row \li \inlineimage buttonbox-gnomelayout-horizontal.png GnomeLayout Horizontal + \row \li \inlineimage buttonbox-gnomelayout-horizontal.png + {Several buttons using the GnomeLayout horizontal layout} + GnomeLayout Horizontal \li Button box laid out in horizontal GnomeLayout - \row \li \inlineimage buttonbox-kdelayout-horizontal.png KdeLayout Horizontal + \row \li \inlineimage buttonbox-kdelayout-horizontal.png + {Several buttons using the KdeLayout horizontal layout} + KdeLayout Horizontal \li Button box laid out in horizontal KdeLayout - \row \li \inlineimage buttonbox-maclayout-horizontal.png MacLayout Horizontal + \row \li \inlineimage buttonbox-maclayout-horizontal.png + {Several buttons using the MacLayout horizontal layout} + MacLayout Horizontal \li Button box laid out in horizontal MacLayout - \row \li \inlineimage buttonbox-winlayout-horizontal.png WinLayout Horizontal + \row \li \inlineimage buttonbox-winlayout-horizontal.png + {Several buttons using the WinLayout horizontal layout} + WinLayout Horizontal \li Button box laid out in horizontal WinLayout \endtable @@ -84,10 +92,18 @@ QT_BEGIN_NAMESPACE \li KdeLayout \li MacLayout \li WinLayout - \row \li \inlineimage buttonbox-gnomelayout-vertical.png GnomeLayout Vertical - \li \inlineimage buttonbox-kdelayout-vertical.png KdeLayout Vertical - \li \inlineimage buttonbox-maclayout-vertical.png MacLayout Vertical - \li \inlineimage buttonbox-winlayout-vertical.png WinLayout Vertical + \row \li \inlineimage buttonbox-gnomelayout-vertical.png + {Several buttons using the GnomeLayout vertical layout} + GnomeLayout Vertical + \li \inlineimage buttonbox-kdelayout-vertical.png + {Several buttons using the KdeLayout vertical layout} + KdeLayout Vertical + \li \inlineimage buttonbox-maclayout-vertical.png + {Several buttons using the MacLayout vertical layout} + MacLayout Vertical + \li \inlineimage buttonbox-winlayout-vertical.png + {Several buttons using the WinLayout vertical layout} + WinLayout Vertical \endtable Additionally, button boxes that contain only buttons with ActionRole or @@ -95,9 +111,13 @@ QT_BEGIN_NAMESPACE \table \row \li modeless horizontal MacLayout - \li \inlineimage buttonbox-mac-modeless-horizontal.png Screenshot of modeless horizontal MacLayout + \li \inlineimage buttonbox-mac-modeless-horizontal.png + {Several buttons using the horizontal modeless style on macOS} + Screenshot of modeless horizontal MacLayout \row \li modeless vertical MacLayout - \li \inlineimage buttonbox-mac-modeless-vertical.png Screenshot of modeless vertical MacLayout + \li \inlineimage buttonbox-mac-modeless-vertical.png + {Several buttons using the horizontal modeless style on macOS} + Screenshot of modeless vertical MacLayout \endtable When a button is clicked in the button box, the clicked() signal is emitted diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 812c872b9f6..01f0c0df08b 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1276,6 +1276,7 @@ void QDockWidgetPrivate::setWindowState(WindowStates states, const QRect &rect) QMainWindow. \image mainwindow-docks.png + {Diagram of dock widget within toolbars and a container for widgets} Dock windows can be moved inside their current area, moved into new areas and floated (e.g., undocked) by the end-user. The diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp index 437ed74ee3a..fb5379c1907 100644 --- a/src/widgets/widgets/qgroupbox.cpp +++ b/src/widgets/widgets/qgroupbox.cpp @@ -114,7 +114,7 @@ void QGroupBoxPrivate::click() \ingroup geomanagement \inmodule QtWidgets - \image fusion-groupbox.png + \image fusion-groupbox.png {Group box displaying several radio button items} A group box provides a frame, a title on top, a keyboard shortcut, and displays various other widgets inside itself. The keyboard shortcut moves diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index dc72c97259f..784ce2c8d19 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -52,7 +52,9 @@ QLabelPrivate::~QLabelPrivate() \ingroup basicwidgets \inmodule QtWidgets - \image fusion-label.png + \image fusion-label.png {Label} + + QLabel is used for displaying text or an image. No user interaction functionality is provided. The visual appearance of diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp index 4c68da35eb2..2c4b4e334d5 100644 --- a/src/widgets/widgets/qlcdnumber.cpp +++ b/src/widgets/widgets/qlcdnumber.cpp @@ -39,7 +39,7 @@ public: \ingroup basicwidgets \inmodule QtWidgets - \image fusion-lcdnumber.png + \image fusion-lcdnumber.png {"1234" with LCD-like digital appearance} It can display a number in just about any size. It can display decimal, hexadecimal, octal or binary numbers. It is easy to diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index fc0be5aaa30..bf26723484c 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -100,7 +100,7 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const \ingroup basicwidgets \inmodule QtWidgets - \image fusion-lineedit.png + \image fusion-lineedit.png {Line edit showing a text greeting} A line edit allows users to enter and edit a single line of plain text with useful editing functions, including undo and redo, cut and diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index f6467a3b081..ef813726f56 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -131,6 +131,7 @@ void QMainWindowPrivate::init() layout below. \image mainwindowlayout.png + {Diagram of main window and the position of its components} \section1 Creating Main Window Components diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 1e4836c5065..95931042265 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -53,7 +53,9 @@ \table \row \li \inlineimage mdi-cascade.png + {MDI windows in cascading order} \li \inlineimage mdi-tile.png + {MDI windows in a tiling pattern} \endtable \note The default scroll bar property for QMdiArea is Qt::ScrollBarAlwaysOff. diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 02f4271cf79..1ca6b8a47a1 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -17,6 +17,7 @@ title bar and a center area for the internal widget. \image qmdisubwindowlayout.png + {MDI window with a title bar and an internal widget} The most common way to construct a QMdiSubWindow is to call QMdiArea::addSubWindow() with the internal widget as the argument. diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index e67eec343b0..97fdbb86226 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1654,7 +1654,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) \ingroup basicwidgets \inmodule QtWidgets - \image fusion-menu.png + \image fusion-menu.png {Menu containing several action items} A menu widget is a selection menu. It can be either a pull-down menu in a menu bar or a standalone context menu. Pull-down menus diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp index 440f079e508..4c29f5e6926 100644 --- a/src/widgets/widgets/qprogressbar.cpp +++ b/src/widgets/widgets/qprogressbar.cpp @@ -156,7 +156,7 @@ bool QProgressBarPrivate::repaintRequired() const \ingroup basicwidgets \inmodule QtWidgets - \image fusion-progressbar.png + \image fusion-progressbar.png {Progress bar showing 42%} A progress bar is used to give the user an indication of the progress of an operation and to reassure them that the application diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index d06e3d17c72..aabf9554653 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE \inmodule QtWidgets \image fusion-pushbutton.png + {Push button for creating a new document} The push button, or command button, is perhaps the most commonly used widget in any graphical user interface. Push (click) a button @@ -513,7 +514,8 @@ bool QPushButton::hitButton(const QPoint &pos) const Ownership of the menu is \e not transferred to the push button. - \image fusion-pushbutton-menu.png Screenshot of a Fusion style push button with popup menu. + \image fusion-pushbutton-menu.png + {Push button with popup menu} A push button with popup menus shown in the \l{Qt Widget Gallery} {Fusion widget style}. diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp index 81ebfb28447..4dc84b862c0 100644 --- a/src/widgets/widgets/qradiobutton.cpp +++ b/src/widgets/widgets/qradiobutton.cpp @@ -48,7 +48,7 @@ void QRadioButtonPrivate::init() \ingroup basicwidgets \inmodule QtWidgets - \image fusion-radiobutton.png + \image fusion-radiobutton.png {Two radio buttons representing two options} A QRadioButton is an option button that can be switched on (checked) or off (unchecked). Radio buttons typically present the user with a "one diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp index a6403172772..95a02db8b1c 100644 --- a/src/widgets/widgets/qscrollarea.cpp +++ b/src/widgets/widgets/qscrollarea.cpp @@ -40,8 +40,12 @@ QT_BEGIN_NAMESPACE \table \row \li \inlineimage qscrollarea-noscrollbars.png + {Image without the scroll bar} \li \inlineimage qscrollarea-onescrollbar.png + {Image with a horizontal scroll bar} \li \inlineimage qscrollarea-twoscrollbars.png + {Image with a horizontal and a vertical scroll bar} + \endtable The scroll bars appearance depends on the currently set \l diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp index 9b510e1cff7..75a3d7acfd2 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -57,6 +57,8 @@ using namespace Qt::StringLiterals; \table \row \li \image qscrollbar-picture.png + {The parts of the scroll bar such as slider, scroll arrows, + and page control} \li Scroll bars typically include four separate controls: a slider, scroll arrows, and a page control. @@ -109,6 +111,8 @@ using namespace Qt::StringLiterals; \table \row \li \inlineimage qscrollbar-values.png + {The document length, scrolling range, and page step + of a scroll bar} \li The relationship between a document length, the range of values used in a scroll bar, and the page step is simple in many common situations. The scroll bar's range of values is determined by subtracting a diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp index ab254d66c0f..78fa230dbac 100644 --- a/src/widgets/widgets/qsizegrip.cpp +++ b/src/widgets/widgets/qsizegrip.cpp @@ -144,11 +144,9 @@ Qt::Corner QSizeGripPrivate::corner() const guideline, and won't show unless used in a QMdiSubWindow. Set another style on size grips that you want to be visible in main windows. - \table 50% - \row \li \inlineimage fusion-statusbar-sizegrip.png Screenshot of a Fusion style size grip - \li A size grip widget at the bottom-right corner of a main window, shown in the + \image fusion-statusbar-sizegrip.png {Size grip at the bottom-right corner} + \caption A size grip widget at the bottom-right corner of a main window, shown in the \l{Qt Widget Gallery}{Fusion widget style}. - \endtable The QSizeGrip class inherits QWidget and reimplements the \l {QWidget::mousePressEvent()}{mousePressEvent()} and \l diff --git a/src/widgets/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp index d8918556c6a..6daac61dd02 100644 --- a/src/widgets/widgets/qslider.cpp +++ b/src/widgets/widgets/qslider.cpp @@ -178,7 +178,7 @@ QStyle::SubControl QSliderPrivate::newHoverControl(const QPoint &pos) \ingroup basicwidgets \inmodule QtWidgets - \image fusion-slider.png + \image fusion-slider.png {Horizontal slider with tick marks} The slider is the classic widget for controlling a bounded value. It lets the user move a slider handle along a horizontal or vertical diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp index c224d5a6ddd..6691aa37b52 100644 --- a/src/widgets/widgets/qspinbox.cpp +++ b/src/widgets/widgets/qspinbox.cpp @@ -83,7 +83,7 @@ public: \ingroup basicwidgets \inmodule QtWidgets - \image fusion-spinbox.png + \image fusion-spinbox.png {Spin box widget displaying an integer} QSpinBox is designed to handle integers and discrete sets of values (e.g., month names); use QDoubleSpinBox for floating point @@ -554,7 +554,7 @@ void QSpinBox::fixup(QString &input) const \ingroup basicwidgets \inmodule QtWidgets - \image fusion-doublespinbox.png + \image fusion-doublespinbox.png {Spin box displaying a double} QDoubleSpinBox allows the user to choose a value by clicking the up and down buttons or by pressing Up or Down on the keyboard to diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index b0eb99c048b..0b562a47879 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -281,9 +281,9 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const returns the visual geometry of a single tab. \table 100% - \row \li \inlineimage {fusion-tabbar.png} {Screenshot of a Fusion style tab bar} + \row \li \inlineimage {fusion-tabbar.png} {Tab bar with three tabs} \li A tab bar shown in the \l{Qt Widget Gallery}{Fusion widget style}. - \row \li \inlineimage {fusion-tabbar-truncated.png} {Screenshot of a truncated Fusion tab bar} + \row \li \inlineimage {fusion-tabbar-truncated.png} {Truncated tab bar} \li A truncated tab bar shown in the Fusion widget style. \endtable diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index f507e70874d..b4e26075b4d 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -30,7 +30,7 @@ using namespace Qt::StringLiterals; \ingroup basicwidgets \inmodule QtWidgets - \image fusion-tabwidget.png + \image fusion-tabwidget.png {Tab widget with two tabs} A tab widget provides a tab bar (see QTabBar) and a "page area" that is used to display pages related to each tab. By default, the diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 11b90f53922..e6f7edc1ac1 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -131,11 +131,10 @@ bool QToolButtonPrivate::hasMenu() const of possible pages to jump to. The timeout is style dependent, see QStyle::SH_ToolButton_PopupDelay. - \table 100% - \row \li \inlineimage assistant-toolbar.png Qt Assistant's toolbar with tool buttons - \row \li Qt Assistant's toolbar contains tool buttons that are associated + \image assistant-toolbar.png {Qt Assistant's toolbar with tool buttons} + \caption Qt Assistant's toolbar contains tool buttons that are associated with actions used in other parts of the main window. - \endtable + \sa QPushButton, QToolBar, QMainWindow, QAction */ |