Commit Graph

6848 Commits

Author SHA1 Message Date
Anton Kudryavtsev
aa60e2d777 QStringRef: add isRightToLeft()
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>
2016-10-25 05:13:46 +00:00
Friedemann Kleint
0d9cd98c07 qsettings_win.cpp: Use qt_error_string()
Remove the errorCodeToString() which is duplicating
the functionality and does apparently not work.

Change-Id: Ib1ca2dfed630b10d01c0acf278c42eb851405b46
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-10-24 16:26:55 +00:00
Anton Kudryavtsev
9c02bfdb73 QStringRef: add constBegin() and constEnd()
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>
2016-10-24 09:07:37 +00:00
Alex Trotsenko
9cac65bc66 QRingBuffer::reserve(): remove superfluous assert
'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>
2016-10-22 08:06:28 +00:00
Friedemann Kleint
0c85e3cdb5 Add header guard and We-mean-it comment to qoperatingsystemversion_p.h
Amends change 26b2ad5a18

Change-Id: I64c3a2338b6fa821f6951edffe6ddc050b513743
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-19 10:55:42 +00:00
Anton Kudryavtsev
ef826d9268 Nitpick: fix style in QtCore code
Change-Id: I60b3539f6c8cc36e4ad6988799d3cf9c565bdb21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-19 05:12:24 +00:00
Friedemann Kleint
45580aa925 QFileSystemWatcher/Win32: Listen for WM_DEVICECHANGE
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>
2016-10-18 07:52:22 +00:00
Liang Qi
dfc177e3a9 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	qmake/library/qmakeevaluator.cpp
	(cherry picked from commit 1af6dc2c8fb4d91400fddc5050166f972ae57c9a in qttools)
	src/corelib/kernel/qcore_mac_objc.mm
	src/gui/painting/qcolor.h
	src/plugins/platforms/cocoa/qcocoawindow.mm

Change-Id: I5b3ec468a5a9a73911b528d3d24ff8e19f339f31
2016-10-13 09:49:38 +02:00
Lars Knoll
93b78e7c61 Fix build with various features disabled
Change-Id: I95cb3cf3434306344af3f4c7556f45dbfa0b08d6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-10-11 14:20:34 +00:00
Lars Knoll
369857d294 Add configure feature for QUrl::topLevelDomain
Change-Id: I237af8c60a9572c707e7004c9a284dd6cd3306ce
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-10-11 14:20:27 +00:00
Lars Knoll
5574a814ff Add configure feature for QCommandLineParser
Change-Id: I78c1159d29e12ad03b9a3c076a40ee533958af8a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-10-11 14:20:24 +00:00
Lars Knoll
93178d26f8 Add configure feature for time zone support
Change-Id: I6ea02dab33e67e7f312a62d94d82eaf1fbe9d9bc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-10-11 14:20:19 +00:00
Liang Qi
e166d7d135 Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8 2016-10-11 14:14:31 +00:00
Allan Sandfeld Jensen
a6dc284869 Avoid auto-vectorization of epilogues of manual vectorization
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>
2016-10-11 07:38:29 +00:00
Lars Knoll
dee8b4d6b1 Save 100k by not using bloated sha3 code
Probably makes sha3 calculations somewhat slower.

Change-Id: Ie082c163b91d4e2282ad68b810e56b2437a1eb8a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-10-11 06:05:13 +00:00
Lars Knoll
8d330f55ba Fix build with statemachine feature disabled
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>
2016-10-11 06:05:09 +00:00
Lars Knoll
267dd9133d Clean up building of bootstrap lib and tools
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>
2016-10-11 06:04:54 +00:00
Liang Qi
905329200f Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	src/gui/image/qpixmap.cpp
	src/widgets/kernel/qformlayout.cpp

Change-Id: I8a8391a202adf7f18464a22ddf0a6c4974eab692
2016-10-11 07:40:32 +02:00
Jørn Bersvendsen
91cde06296 Extracted cleanup from QCoreApplication::exec() into separate function
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>
2016-10-10 17:44:56 +00:00
Marc Mutz
7eddca359d Q_FALLTHROUGH: use GCC extensions in non-C++17-code
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>
2016-10-10 17:17:54 +00:00
Liang Qi
3e71810cf3 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/network/access/qhttpnetworkconnection.cpp
	src/network/access/qhttpnetworkconnection_p.h

Change-Id: I11f8641ef482efa8cee1b79977d19cc3182814b4
2016-10-08 17:15:55 +02:00
Giuseppe D'Angelo
dca8678efa QSysInfo: shut down the deprecation warning
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>
2016-10-07 23:38:36 +00:00
Laszlo Agocs
dcbff0a9e1 Fix signed-unsigned mismatch with gcc 4.9.0
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>
2016-10-07 12:06:46 +00:00
Erik Verbruggen
eda095ebb4 Darwin: correct state restore when FSEventsStream starting fails
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>
2016-10-07 09:13:34 +00:00
Sune Vuorela
4268dde1f1 QTemporaryFile's setFileTemplate operates not only on XXXXXX in the end
Is even covered by unit tests.

Change-Id: I7b22da2a338868fdb99c6238925f944bfea88190
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-06 21:33:29 +00:00
Liang Qi
ef25620ac1 Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	mkspecs/features/mac/default_pre.prf
	mkspecs/features/qpa/genericunixfontdatabase.prf
	mkspecs/features/uikit/default_post.prf
	mkspecs/features/uikit/resolve_config.prf
	mkspecs/macx-ios-clang/features/default_post.prf
	mkspecs/macx-ios-clang/features/resolve_config.prf
	src/corelib/io/qiodevice.cpp

Change-Id: I6f210f71f177a3c3278a4f380542195e14e4b491
2016-10-06 20:12:27 +02:00
Kai Koehne
8f4054a7e6 Doc: Document that by default, QTimer is not single-shot
Change-Id: I586997ddb5ed55d68f53ddfe9302b961296cc4eb
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-10-06 13:51:48 +00:00
Tor Arne Vestbø
669add92d9 Replace QCFString::to(CF/NS/Q)String usage with QString methods
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>
2016-10-06 08:02:59 +00:00
Tor Arne Vestbø
fd7e00aff5 Don't truncate QDateTime milliseconds when storing QSettings on Apple platforms
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>
2016-10-05 18:45:04 +00:00
Liang Qi
6feec9da93 Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I34b5e290233d0869fbafac094a939aec2bf83fd5
2016-10-05 19:33:26 +02:00
Frederik Schwarzer
c3605980d9 Fix some typos and minor sentence structure issues in docs
Change-Id: Ibede1aeb046e2df6723e3041152bfae22a9fde32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-05 15:00:24 +00:00
Tor Arne Vestbø
764f5bf48c Apple OS: Handle QSetting strings with embedded zero-bytes
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>
2016-10-05 11:57:41 +00:00
Maurice Kalinowski
d44925507b winrt: Fix compilation for projects using C++/CX extensions
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>
2016-10-05 06:33:33 +00:00
Tor Arne Vestbø
f2b90b4e82 Apple OS: Resolve QStandardPaths test data locations based on real locations
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>
2016-10-04 21:22:05 +00:00
Peter Varga
37ad51a44e Revert "Doc: Added enums in qnamespace.qdoc"
Remove duplicated enum values from doc.

This reverts commit dfb55da5d6.

Change-Id: I27c85f66123731e0106bd702e843a24d7e9b5931
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-10-04 17:58:57 +00:00
Allan Sandfeld Jensen
f3d19244cd Fix PrintScreen mapping on macOS and more
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>
2016-10-04 12:53:08 +00:00
Giuseppe D'Angelo
e02adc3e68 QObject::dumpObject*: add const overloads
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>
2016-10-03 19:42:48 +00:00
Tor Arne Vestbø
be7f671ac9 Round to nearest millisecond in QDateTime::fromCFDate()
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>
2016-10-02 13:07:18 +00:00
Alex Trotsenko
4518345b80 QIODevice: add CHECK_MAXBYTEARRAYSIZE macro
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>
2016-10-01 17:36:50 +00:00
Liang Qi
e66d181e65 Merge remote-tracking branch 'origin/5.8' into dev
Change-Id: I3b51bb706e401edfda09a433c67aa58e44f33e83
2016-09-29 12:58:41 +02:00
Liang Qi
75aea3ff5e Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8 2016-09-29 07:42:39 +00:00
Aleix Pol
433e5ccf50 Reduce memory allocations when reading the QMimeType list
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>
2016-09-29 02:59:05 +00:00
Liang Qi
cdb56c42fc Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	mkspecs/features/uikit/xcodebuild.mk
	tests/auto/other/lancelot/tst_lancelot.cpp
	tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
	tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp

Change-Id: Ia0ae2de86094120281abd445138877c2cc3e882c
2016-09-29 00:38:01 +02:00
Palo Kisa
4758555f3e QSettings: Add proper support for XDG_CONFIG_DIRS
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>
2016-09-27 22:03:11 +00:00
Palo Kisa
ee35fbbf52 qsettings: Simplify confFiles logic
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>
2016-09-27 22:03:04 +00:00
Simon Hausmann
bdb81d0bd1 Avoid re-use of QFileSystemMetaData instance in dir entry listing
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>
2016-09-27 15:45:04 +00:00
Nico Vertriest
3efb84ffdb Doc: several minor doc issues
- linking errors
- parameter definition

Change-Id: I879b38c159822900ab9851407f0e9067b318ca1f
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2016-09-27 08:30:30 +00:00
Liang Qi
06bd93c4ac Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	src/plugins/platforms/ios/qiosmessagedialog.mm

Change-Id: Icfbf55c3215ec088e552d0b42a5c94d04b17c65f
2016-09-26 21:43:25 +02:00
Alex Trotsenko
bafad505a0 QDataStream: refactor (de)serialization of containers
- 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>
2016-09-26 16:00:35 +00:00
Sérgio Martins
4d676acdc5 Fix event names on comment about QChildEvent
Change-Id: If9901471e459acb374807649e0affb84d82f7b8b
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-25 18:53:51 +00:00