diff options
-rwxr-xr-x | configure | 3 | ||||
-rw-r--r-- | doc/global/includes/standardpath/functiondocs.qdocinc | 129 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 21 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 11 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 4 | ||||
-rw-r--r-- | src/corelib/io/qstandardpaths.cpp | 66 | ||||
-rw-r--r-- | src/gui/image/qicon.cpp | 12 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgetlinecontrol_p.h | 2 | ||||
-rw-r--r-- | tests/auto/corelib/text/qlocale/tst_qlocale.cpp | 6 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp | 8 |
10 files changed, 177 insertions, 85 deletions
@@ -446,8 +446,7 @@ while [ "$#" -gt 0 ]; do -android-ndk| \ -android-ndk-platform| \ -android-ndk-host| \ - -android-arch| \ - -android-toolchain-version) + -android-arch) VAR=`echo $1 | sed 's,^-\(.*\),\1,'` shift VAL="$1" diff --git a/doc/global/includes/standardpath/functiondocs.qdocinc b/doc/global/includes/standardpath/functiondocs.qdocinc new file mode 100644 index 0000000000..4385b6446d --- /dev/null +++ b/doc/global/includes/standardpath/functiondocs.qdocinc @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [displayName] + + Returns a localized display name for the given location \a type + or an empty QString if no relevant location can be found. + +//! [displayName] + + +//! [findExecutable] + + Finds the executable named \a executableName in the specified + \a paths, or the system paths if paths is empty. + + On most operating systems the system path is determined by the + \c PATH environment variable. The directories where to search for + the executable can be set in the paths argument. To search in + both your own paths and the system paths, call findExecutable + twice, once with paths set and once with paths empty. + Symlinks are not resolved in order to preserve behavior for the + case of executables whose behavior depends on the name they are + invoked with + . + \note On Windows, the usual executable extensions (from the PATHEXT + environment variable) are automatically appended. For example, the + findExecutable("foo") call finds \c foo.exe or \c foo.bat if + present. + + Returns the absolute file path to the executable, or an empty + string if not found. + +//! [findExecutable] + +//! [locate] + + Finds a file or directory called \a fileName in the standard + locations for \a type. + + The \a options flag lets you specify whether to look for files + or directories. By default, this flag is set to \c LocateFile. + + Returns the absolute path to the first file or directory found, + otherwise returns an empty string. + +//! [locate] + +//! [locateAll] + + Finds all files or directories by the name, \a fileName, in the + standard locations for \a type. + + The \a options flag lets you specify whether to look for files + or directories. By default, this flag is set to \c LocateFile. + + Returns the list of all the files that were found. + +//! [locateAll] + +//! [setTestModeEnabled] + + If \a testMode is \c true, this enables a special "test mode" in + QStandardPaths, which changes writable locations to point to + test directories. This prevents auto tests from reading + or writing to the current user's configuration. + + It affects the locations into which test programs might write + files: \c GenericDataLocation, \c DataLocation, \c ConfigLocation, + \c GenericConfigLocation, \c AppConfigLocation, + \c GenericCacheLocation, and \c CacheLocation. Other locations + are not affected. + + On Unix, \c XDG_DATA_HOME is set to \c{~/.qttest/share}, + \c XDG_CONFIG_HOME is set to \c{~/.qttest/config}, and + \c XDG_CACHE_HOME is set to \c{~/.qttest/cache}. + + On macOS, data goes to \c{~/.qttest/Application Support}, + cache goes to \c{~/.qttest/Cache}, and config goes to + \c{~/.qttest/Preferences}. + + On Windows, everything goes to a "qttest" directory under + \c{%APPDATA%}. + +//! [setTestModeEnabled] + +//! [standardLocations] + + Returns all the directories where files of \a type belong. + + The list of directories is sorted from high to low priority, + starting with writableLocation() if it can be determined. + This list is empty if no locations for type are defined. + +//! [standardLocations] + +//! [writableLocation] + + Returns the directory where files of \a type should be written to, + or an empty string if the location cannot be determined. + + \note The storage location returned may not exist; that is, + it may need to be created by the system or the user. + +//! [writableLocation] diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index e56e8c41b6..f7bd6dc663 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -208,15 +208,15 @@ UnixMakefileGenerator::init() escapeFilePath(pchBaseName + language + headerSuffix)); const ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS"); for (const ProString &arch : pchArchs) { - QString suffix = headerSuffix; - suffix.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString()); + QString file = pchBaseName + language + headerSuffix; + file.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString()); if (project->isActiveConfig("clang_pch_style") - && (suffix.endsWith(QLatin1String(".pch")) - || suffix.endsWith(QLatin1String(".gch")))) { - suffix.chop(4); // must omit header suffix for -include to recognize the PCH + && (file.endsWith(QLatin1String(".pch")) + || file.endsWith(QLatin1String(".gch")))) { + file.chop(4); // must omit header suffix for -include to recognize the PCH } pchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT_") + arch + QLatin1Char('}'), - escapeFilePath(pchBaseName + language + suffix)); + escapeFilePath(file)); } } } @@ -363,10 +363,11 @@ QStringList if (pchArchs.isEmpty()) pchArchs << ProString(); // normal single-arch PCH for (const ProString &arch : qAsConst(pchArchs)) { - QString suffix = header_suffix; - if (!arch.isEmpty()) - suffix.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString()); - QString precompiledHeader = header_prefix + language + suffix; + QString precompiledHeader = header_prefix + language + header_suffix; + if (!arch.isEmpty()) { + precompiledHeader.replace(QLatin1String("${QMAKE_PCH_ARCH}"), + arch.toQString()); + } if (!ret.contains(precompiledHeader)) ret += precompiledHeader; } diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 20f2c88444..550fa9d834 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1017,10 +1017,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if (pchArchs.isEmpty()) pchArchs << ProString(); // normal single-arch PCH for (const ProString &arch : qAsConst(pchArchs)) { - auto suffix = header_suffix.toQString(); + QString file = precomph_out_dir + header_prefix + language + header_suffix; if (!arch.isEmpty()) - suffix.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString()); - precomp_files += precomph_out_dir + header_prefix + language + suffix; + file.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString()); + precomp_files += file; } } } @@ -1140,7 +1140,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\n\techo \"// Automatically generated, do not modify\" > " << sourceFile_f << "\n\trm -f " << escapeFilePath(pchArchOutput); } else { - t << "\n\t" << mkdir_p_asstring(pchOutputDir); + QString outDir = pchOutputDir; + if (!arch.isEmpty()) + outDir.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString()); + t << "\n\t" << mkdir_p_asstring(outDir); } auto pchArchFlags = pchFlags; diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index aa83cf2bcc..1ebffd9f49 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -892,10 +892,10 @@ void qt_core_boilerplate() "\n" "Installation prefix: %s\n" "Library path: %s\n" - "Include path: %s\n", + "Plugin path: %s\n", qt_configure_prefix_path_str + 12, qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::LibrariesPath - 1], - qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::HeadersPath - 1]); + qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::PluginsPath - 1]); QT_PREPEND_NAMESPACE(qDumpCPUFeatures)(); diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp index 3b5f2f97da..6ebef3ee20 100644 --- a/src/corelib/io/qstandardpaths.cpp +++ b/src/corelib/io/qstandardpaths.cpp @@ -357,22 +357,14 @@ QT_BEGIN_NAMESPACE /*! \fn QString QStandardPaths::writableLocation(StandardLocation type) - Returns the directory where files of \a type should be written to, or an empty string - if the location cannot be determined. - - \note The storage location returned can be a directory that does not exist; i.e., it - may need to be created by the system or the user. + \include standardpath/functiondoc.qdocinc writableLocation */ /*! \fn QStringList QStandardPaths::standardLocations(StandardLocation type) - Returns all the directories where files of \a type belong. - - The list of directories is sorted from high to low priority, starting with - writableLocation() if it can be determined. This list is empty if no locations - for \a type are defined. + \include standardpath/functiondoc.qdocinc standardLocations \sa writableLocation() */ @@ -396,11 +388,7 @@ static bool existsAsSpecified(const QString &path, QStandardPaths::LocateOptions } /*! - Tries to find a file or directory called \a fileName in the standard locations - for \a type. - - The full path to the first file or directory (depending on \a options) found is returned. - If no such file or directory can be found, an empty string is returned. + \include standardpath/functiondoc.qdocinc locate */ QString QStandardPaths::locate(StandardLocation type, const QString &fileName, LocateOptions options) { @@ -414,12 +402,7 @@ QString QStandardPaths::locate(StandardLocation type, const QString &fileName, L } /*! - Tries to find all files or directories called \a fileName in the standard locations - for \a type. - - The \a options flag allows to specify whether to look for files or directories. - - Returns the list of all the files that were found. + \include standardpath/functiondoc.qdocinc locateAll */ QStringList QStandardPaths::locateAll(StandardLocation type, const QString &fileName, LocateOptions options) { @@ -492,23 +475,7 @@ static inline QString #endif // Q_OS_WIN /*! - Finds the executable named \a executableName in the paths specified by \a paths, - or the system paths if \a paths is empty. - - On most operating systems the system path is determined by the PATH environment variable. - - The directories where to search for the executable can be set in the \a paths argument. - To search in both your own paths and the system paths, call findExecutable twice, once with - \a paths set and once with \a paths empty. - - Symlinks are not resolved, in order to preserve behavior for the case of executables - whose behavior depends on the name they are invoked with. - - \note On Windows, the usual executable extensions (from the PATHEXT environment variable) - are automatically appended, so that for instance findExecutable("foo") will find foo.exe - or foo.bat if present. - - Returns the absolute file path to the executable, or an empty string if not found. + \include standardpath/functiondoc.qdocinc findExecutable */ QString QStandardPaths::findExecutable(const QString &executableName, const QStringList &paths) { @@ -566,10 +533,7 @@ QString QStandardPaths::findExecutable(const QString &executableName, const QStr } /*! - \fn QString QStandardPaths::displayName(StandardLocation type) - - Returns a localized display name for the given location \a type or - an empty QString if no relevant location can be found. + \include standardpath/functiondoc.qdocinc displayName */ #if !defined(Q_OS_MAC) && !defined(QT_BOOTSTRAPPED) @@ -626,23 +590,7 @@ QString QStandardPaths::displayName(StandardLocation type) /*! \fn void QStandardPaths::setTestModeEnabled(bool testMode) - If \a testMode is true, this enables a special "test mode" in - QStandardPaths, which changes writable locations - to point to test directories, in order to prevent auto tests from reading from - or writing to the current user's configuration. - - This affects the locations into which test programs might write files: - GenericDataLocation, DataLocation, ConfigLocation, GenericConfigLocation, - AppConfigLocation, GenericCacheLocation, CacheLocation. - Other locations are not affected. - - On Unix, \c XDG_DATA_HOME is set to \e ~/.qttest/share, \c XDG_CONFIG_HOME is - set to \e ~/.qttest/config, and \c XDG_CACHE_HOME is set to \e ~/.qttest/cache. - - On \macos, data goes to \e ~/.qttest/Application Support, cache goes to - \e ~/.qttest/Cache, and config goes to \e ~/.qttest/Preferences. - - On Windows, everything goes to a "qttest" directory under Application Data. + \include standardpath/functiondoc.qdocinc setTestModeEnabled */ static bool qsp_testMode = false; diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index df8220a0c6..84e387e317 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -165,6 +165,11 @@ QIconPrivate::QIconPrivate(QIconEngine *e) qreal QIconPrivate::pixmapDevicePixelRatio(qreal displayDevicePixelRatio, const QSize &requestedSize, const QSize &actualSize) { QSize targetSize = requestedSize * displayDevicePixelRatio; + if ((actualSize.width() == targetSize.width() && actualSize.height() <= targetSize.height()) || + (actualSize.width() <= targetSize.width() && actualSize.height() == targetSize.height())) { + // Correctly scaled for dpr, just having different aspect ratio + return displayDevicePixelRatio; + } qreal scale = 0.5 * (qreal(actualSize.width()) / qreal(targetSize.width()) + qreal(actualSize.height() / qreal(targetSize.height()))); return qMax(qreal(1.0), displayDevicePixelRatio *scale); @@ -185,7 +190,12 @@ QPixmapIconEngine::~QPixmapIconEngine() void QPixmapIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) { - QSize pixmapSize = rect.size() * qt_effective_device_pixel_ratio(0); + qreal dpr = 1.0; + if (QCoreApplication::testAttribute(Qt::AA_UseHighDpiPixmaps)) { + auto paintDevice = painter->device(); + dpr = paintDevice ? paintDevice->devicePixelRatioF() : qApp->devicePixelRatio(); + } + const QSize pixmapSize = rect.size() * dpr; QPixmap px = pixmap(pixmapSize, mode, state); painter->drawPixmap(rect, px); } diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h index 8ebed25084..a8fffd23dc 100644 --- a/src/widgets/widgets/qwidgetlinecontrol_p.h +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -217,7 +217,7 @@ public: void cursorWordBackward(bool mark) { moveCursor(m_textLayout.previousCursorPosition(m_cursor, QTextLayout::SkipWords), mark); } void home(bool mark) { moveCursor(0, mark); } - void end(bool mark) { moveCursor(text().length(), mark); } + void end(bool mark) { moveCursor(m_text.length(), mark); } int xToPos(int x, QTextLine::CursorPosition = QTextLine::CursorBetweenCharacters) const; QRect rectForPos(int pos) const; diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 3aa3d97dbc..20ed7500b5 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -595,10 +595,7 @@ void tst_QLocale::emptyCtor_data() ADD_CTOR_TEST("zz_zz", "C"); ADD_CTOR_TEST("zz...", "C"); ADD_CTOR_TEST("en.bla", "en_US"); -#if !(defined(Q_OS_DARWIN) && QT_HAS_FEATURE(address_sanitizer)) - // See QTBUG-69875 ADD_CTOR_TEST("en@bla", "en_US"); -#endif ADD_CTOR_TEST("en_blaaa", "en_US"); ADD_CTOR_TEST("en_zz", "en_US"); ADD_CTOR_TEST("en_GB.bla", "en_GB"); @@ -607,10 +604,7 @@ void tst_QLocale::emptyCtor_data() // Empty optional fields, but with punctuators supplied ADD_CTOR_TEST("en.", "en_US"); -#if !(defined(Q_OS_DARWIN) && QT_HAS_FEATURE(address_sanitizer)) - // See QTBUG-69875 ADD_CTOR_TEST("en@", "en_US"); -#endif ADD_CTOR_TEST("en.@", "en_US"); ADD_CTOR_TEST("en_", "en_US"); ADD_CTOR_TEST("en_.", "en_US"); diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 5988987d0d..b57c750cfa 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -762,6 +762,14 @@ void tst_QLineEdit::keypress_inputMask_data() } { QTestEventList keys; + // inserting at end + addKeySequenceStandardKey(keys, QKeySequence::MoveToEndOfLine); + keys.addKeyClick(Qt::Key_Left); + keys.addKeyClick(Qt::Key_0); + QTest::newRow("insert at end") << QString("9-9-9") << keys << QString("--0") << QString(" - -0"); + } + { + QTestEventList keys; // inserting '12.12' then two backspaces addKeySequenceStandardKey(keys, QKeySequence::MoveToStartOfLine); keys.addKeyClick(Qt::Key_1); |