isRightToLeft() was missing in the API.
Change-Id: I49bc30e4c50f5693eb613c200587acba85074f33
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Remove the errorCodeToString() which is duplicating
the functionality and does apparently not work.
Change-Id: Ib1ca2dfed630b10d01c0acf278c42eb851405b46
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
These methods were missing in the API. constBegin, constEnd
are the more Qt-ish names.
Also it makes porting client code from QString to QStringRef easier.
Change-Id: I3fce1d206073d26259fe0fa44d0f7ca718504ec3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
'bytes' is checked against MaxByteArraySize in the beginning and
remains unchanged in the function.
Change-Id: Ibd4091b95837db16cf45f845d485bfb189317125
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add a class QWindowsRemovableDriveListener to
QWindowsFileSystemWatcherEngine listening to the WM_DEVICECHANGE messages
sent to the top level windows to detect insertion and removal of USB drives.
In addition, hook into QWindowsFileSystemWatcherEngine::addPaths() when
watching on removable drives, registering a notification for a
volume-lock-for-removal message on the internal window handle obtained from
QEventDispatcherWin32. When a request to lock the volume for removal is
received, remove the paths from the watcher, enabling removal.
The class instance is set as a dynamic property on the QFileSystemWatcher where
it can be retrieved from clients. This is primarily intended for use by
QFileInfoGatherer/QFileSystemModel.
Task-number: QTBUG-14290
Task-number: QTBUG-18729
Task-number: QTBUG-55459
Change-Id: Ic95b9d9291b1ec6f426c0702bad896bb064b9346
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Defines a structure that tells the compiler in no uncertain terms the
maximum number of times a loop can be run.
The reduces the size of qdrawhelper_avx2.o from 22kbytes to 11kbytes.
Change-Id: Ie3d6281b04b4be3332497c15f3dfe9f185e20507
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The sources of the state machine are excluded completely at the build
system level instead of littering them with #ifs.
All remaining usages of QT_NO_STATEMACHINE are converted to
QT_CONFIG(statemachine) or a QT_REQUIRE_CONFIG(statemachine).
Also make the qeventtransition feature dependent on statemachine.
Change-Id: Ib05c7ca263a02042523fff8f794fa87342df1069
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Add a qconfig-bootstrap.h, which contains all the defines required
to build the bootstrapped tools. This will be required anyway when
moving more code over to use QT_CONFIG(foo) instead of QT_NO_FOO.
Change-Id: I783d0aa0100b9190fe2d422bee4a95b05720aebe
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Not all Qt integration points can call QCoreApplication::exec(), in
particular, ActiveQt. When an ActiveQt server is loaded, it tries to
mimic the behavior of calling QCoreApplication::exec() by setting
QCoreApplicationPrivate::in_exec = true. However, when unloading the
DLL it is necessary to call the same clean-up (e.g. deferred delete)
that QCoreApplication::exec() does. Extracting the cleanup in a separate
function means implementation does not have to be duplicated.
Task-number: QTBUG-56172
Change-Id: I061f1c06f38881032ad7044416c12c91e536478a
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
GCC defines the [[gnu::fallthrough]] attribute for C++11 and C++14
code, as well as __attribute__((fallthrough)) for C++98 and C code.
Use them.
Change-Id: I66aa178c2a96e2ff9ac3f6f02821c978b4ec3696
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Since this is a GCC bug, just disable the deprecation there.
Task-number: QTBUG-56122
Change-Id: I32884a4c19eb79d9c68343f29cdb619eb0d1b217
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Android NDK r10d with gcc 4.9.0 fails with:
gglobal/qoperatingsystemversion.cpp: In static member function 'static QOperatingSystemVersion QOperatingSystemVersion::current()':
global/qoperatingsystemversion.cpp:150:25: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if (sdk >= 1 && sdk <= sizeof(versions) / sizeof(versions[0])) {
Switch to size_t and store the array index in order to simplify.
Code is new in dev, introduced in 26b2ad5a18
Change-Id: Ia19cfcb9789e225760f4d1a05c91463f4c7c2302
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The previous state was not restored completely when adding/removing
paths resulted in a stream start failure.
It also removes an autoreleasepool in restartStream, because both
stopStream and startStream do already create an autoreleasepool of their
own. (So, this pool will always be empty.)
Change-Id: Idc674e9c040f346703ab3ec256957e787a0ade73
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Slims down QCFString and leaves only one implementation of converting
back and forth between CF/NS strings and QStrings.
Change-Id: I068568ffa25e6f4f6d6c99dcf47078b7a8e70e10
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
The fix is trivial, but the patch adds a new QSettings tests that iterates most
of the QMetaTypes and verifies that storing and retrieving them again gives the
same value. This is a more complete test than the testVariantTypes tests, which
is limited to a subset of the QVariant types. The new tests borrows logic from
the QMetaType test machinery.
QSettings has been Q_ENUM'ified in the process, for improved debug output.
Note that on backends such as the INI backend, the metatype of the QVariant read
from the settings will be a string, so it won't match the input QVariant type,
but the result of converting that to the original value type should still work.
Task-number: QTBUG-56124
Change-Id: Ib03a26abf77c9fb449b94160d28bc4baeb095f25
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Saving strings with embedded zero-bytes (\0) as CFStrings would
sometimes fail, and only write the part of the string leading
up to the first zero-byte, instead of all the way to the final
zero-terminator. This bug was revealed by the code-path that
falls back to storing e.g. QTime as strings, via the helper
method QSettingsPrivate::variantToString().
We now use the same approach as on platforms such as Windows
and WinRT, where the string produced by variantToString() is
checked for null-bytes, and if so, stored using a binary
representation instead of as a string. For our case that
means we fall back to CFData when detecting the null-byte.
To separate strings from regular byte arrays, new logic has
been added to variantToString() that wraps the null-byte
strings in @String(). That way we can implement a fast-path
when converting back from CFData, that doesn't go via the
slow and lossy conversion via UTF8, and the resulting QVariant
will be of type QVariant::ByteArray. The reason for using
UTF-8 as the binary representation of the string is that
in the case of storing a QByteArray("@foo") we need to
still be able to convert it back to the same byte array,
which doesn't work if the on-disk format is UTF-16.
Task-number: QTBUG-56124
Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In case a project uses C++/CX extensions via /ZW compile flag including
qfunctions_winrt.h resulted in a compile error about duplicate
definition of Started due to namespace usages.
Change-Id: I8913522eafbabae77dd7d17187f202e555b0275f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Instead of the manual logic for computing test data locations, we use the
locations from baseWritableLocation, but make sure to put them all under
'.qttest' in the home directory. This approach handles more cases for test
data, and also plays nice with locations that are not in the home directory
due to being containerized (and hence do not need a separate test data scope).
Change-Id: Iea4f21acb75c0191be35a3619c05143e8929bd6e
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Fixes the mapping of the rare multimedia Print key, adds the real
mapping of the Print Screen key.
Also adds a mapping for few other short-cut keys that were added in 5.6
Change-Id: I931bf1eed062536e1be2aa6aa6f19d773bb5ec55
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
They don't modify "this", so they should be const. Mark
the existing non-const overloads for removal in Qt 6.
[ChangeLog][QtCore][QObject] QObject::dumpObjectInfo and
QObject::dumpObjectTree now have const overloads.
Change-Id: If9fb15692d2d1536930f86d043d688236d4b778a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
CFAbsoluteTime is measured in seconds, represented by a double,
so when converting milliseconds to CFAbsoluteTime we may get a
slight error due to missing precision in double to represent
the milliseconds exactly. By rounding to the closest millisecond
when converting back, we avoid truncating and being one ms off.
Change-Id: If1e99f97b000fb8cb893ddfc5d7ba81096c0ea88
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
It unifies handling of QByteArray's size limit in read(), readLine()
and will be used in a follow-up change which optimizes the performance
of QIODevice::peek() function.
Change-Id: Idb9fbbe14d9632ee267d2a0e47c8a88603c024a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use QTextStream::readLineInto instead of using N internal buffers
temporarily to read the mime types file into a QSet<QString>.
Change-Id: I05110a4d484cc9485ceb3bc2be2fc7c78f4b2434
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Update fallback mechanism for Q_XDG_PLATFORM based systems to follow the
Xdg specification.
[ChangeLog][QtCore][QSettings] Added proper support for system-wide
configuration file lookup based on Xdg spec (XDG_CONFIG_DIRS) on Unix
based systems
Task-number: QTBUG-34919
Change-Id: Ieddee1c0b3b1506bf19aa865bdab87fc81d58cfd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use a QVector to hold the QConfFile(s) to allow more configuration
files than the statically defined number -> this will allow considering
multiple system-wide configuration files if needed.
To use a dynamic container we get rid of use QScopedSharedPointer, which
actually wasn't needed anyway, as the "deref" logic was/is done manually
in the QConfFileSettingsPrivate destructor.
Change-Id: Ie9341da2cbe2e2b1379f9e2538cb4c9ebbd6fc97
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We've observed that on machines with SELinux installed but disabled, the
behavior of readdir() changes slightly. In the case of tst_qdir's
entryList QDir::Hidden test case, the listing of the directory contents
returns DT_UNKNOWN for the files and (broken) symlink(s) that are
present. When SELinux is enabled, we do see DT_REG and DT_LNK. Our
fallback to DT_UNKNOWN however resets merely the knownFlags, it does not
reset entryFlags, as all the other cases do.
The bug comes when QDirIteratorPrivate::advance() re-uses the
QFileSystemMetaData instance across iterations, and this way we get the
entryFlags values from a previous iteration (with != DT_UNKNOWN) into
the evaluation of an entry with DT_UNKNOWN.
The more conservative approach to fixing this is here by assuming that
QFileSystemMetaData is not designed for re-use and re-initialize it
explicitly in the iteration.
Change-Id: I875856f5ee63a7072d172033e90d02cf41bcab20
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
- Introduce templates to (de)serialize the different types of
containers;
- Unify the naming of parameters;
- Fix style issues.
Change-Id: Ie096b7c0846a280a32282c5427f4836e6a8eefed
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>