Commit Graph

30588 Commits

Author SHA1 Message Date
Marc Mutz
1d1b60dee4 QStylesheetStyle: don't lose precision when drawing a progress bar
When qreal is float, it cannot represent all values an int can take,
so we may lose precision in the expression

  qreal(a) / b

as opposed to the double result

  double(a) / b

For lack of trying, I do not know of a value where this would change
the resulting 'fillWidth' value, but better be safe than sorry, and
use double instead of qreal arithmetic.

Also, when calculating fillRatio, we were converting values back and
forth between qreal and double. Using double everywhere avoids that.

Found while reviewing integer arithmetic in QProgressBar as part of
the fix for QTBUG-57857.

Change-Id: I054cb11d35e3ecf5bf79b5c8ee39029bd23bcf49
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-07 10:48:45 +00:00
Marc Mutz
555a0f3c51 QFusionStyle: don't lose precision when drawing a progress bar
When qreal is float, it cannot represent all values an int can take,
so we may lose precision in the expression

  qreal(value) - minimum

as opposed to the exact result

  qint64(value) - minimum'

For lack of trying, I do not know of a value where this would change
the resulting 'progressBarWidth' value, but better be safe than sorry,
and use the 64-bit integer expression instead of floating-point.

Found while reviewing integer arithmetic in QProgressBar as part of
the fix for QTBUG-57857.

Change-Id: I0240c143bb75af6986910489b34042ce9b3a8caa
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-07 10:48:38 +00:00
Kavindra Palaraja
894cd9bcfc Remove strange, incoherent sentences in QColor docs
There were some strange sentences that did not add to the documentation
of HSL vs. HSV.

Task-number: QTBUG-52483
Change-Id: I5f2b8c3bd420fe9cabc74a94af4b78945723b6cf
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2017-01-07 09:15:32 +00:00
Marc Mutz
3f996edbb6 QPixmapStyle: do not assume minimum == 0 when painting progress bars
The arithmetic used to calculate the size of the progress bar fill in
QPixmapStyle assumed minimum == 0, but that does not necessarily
hold, since the minimum value is user-defined.

So, fix the arithmetic to take the minimum into account, taking care,
as done elsewhere, to avoid signed integer and qreal=float overflows,
by using qint64 and double, respectively.

[ChangeLog][QtWidgets][QPixmapStyle] Now handles progress bars with
minimum != 0 correctly.

Change-Id: I738ded56e8234716c36a5e9fde15bae691c43a35
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-07 08:19:38 +00:00
Marc Mutz
a3d0983f59 QProgressBar: don't lose precision in text()
When qreal is float, it cannot represent all values an int can take,
so we may lose precision in the expression

  qreal(d->value) - d->minimum

as opposed to the exact result

  qint64(d->value) - d->minimum'

For lack of trying, I do not know of a value where this would change
the resulting 'progress' value, but better be safe than sorry, and use
the 64-bit integer expression instead.

Found while reviewing integer arithmetic in QProgressBar as part of
the fix for QTBUG-57857.

While touching the line, make the (intended) double → int truncation
explicit, by using a static_cast.

Change-Id: I03dbfce24c709310c3bbad9487a2bf0d1d78137a
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-07 08:19:31 +00:00
Marc Mutz
e35c993020 QProgressBar: remove unneeded ctor-style no-op cast
The expression '100' already has type int, so the cast is not necessary,
and confusing.

Remove it.

Change-Id: Id63f56645b1b13532f73e481547c2a606dfc9c9a
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-07 08:19:23 +00:00
Oswald Buddenhagen
342691b802 fix configure --opt=val syntax
the second dash would end up in the option name, which made it obviously
unrecognizable.
but the second dash isn't optional in the first place (as evidenced one
line up), so remove the question marks.

Task-number: QTBUG-57908
Change-Id: I6622fef7d11d7b3c485f16698349d1912037a41e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-06 20:10:56 +00:00
Oswald Buddenhagen
623b191c10 track plugins' qt dependencies
plugins may pull in additional qt modules which may require additional
plugins in turn.

Change-Id: I22264b39c1397666b2dc9079048ed1fc64aa84d9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-06 20:10:46 +00:00
Oswald Buddenhagen
ac740d9d28 statically link plugins for transitive deps' private deps as well
while we already linked the plugins for our own private deps, we failed
to do so for our transitive deps.

this also fixes linking qml plugins if qml is linked only indirectly and
privately.

the code for setting up rpath-link is slightly refactored as a side
effect, with no functional change.

the code for setting up rpath now also sees the longer list of
dependencies, but that's irrelevant, as qtcore always ends up among the
direct deps anyway iff any non-bootstrapped modules are used.

Change-Id: I90dca81a2836c6191ce5d092e16bf7660ee820bc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-06 20:10:37 +00:00
Oswald Buddenhagen
9576b71fe8 import static plugins also into dlls
static plugins must be actually linked into the target whenever it is
not a static library itself.

apart from fixing qml plugin linkage, this also provides a more generic
fix for the already fixed linking of activeqt controls.

Task-number: QTBUG-28215
Task-number: QTBUG-55279
Change-Id: I9661369bf3dfc6bcf3a5ed563e6716eb3ef6e76e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-06 20:10:24 +00:00
Oswald Buddenhagen
696c3f9af8 complain about various invalid configuration attempts
Task-number: QTBUG-56049
Change-Id: Id5eeb014c2b88195d2d14566a62dcb9185206b37
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-06 20:10:10 +00:00
Oswald Buddenhagen
44a68aff66 name top-level configure scope after the project file
... instead of the directory it resides in, to make it independent of
the user's fs layout. this makes logs more comparable, and little else.

Change-Id: I0ab3e968dad74ef86577f388c8ca1557e3c17ce4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-06 20:10:01 +00:00
Oswald Buddenhagen
d6778c3597 make skipping of configure in sub-repos less arcane
this was introduced in 60e5a1c8 for no apparent reason.

Change-Id: Idcbc6df3df4e4846c76b3e4215d753a1c97e2eec
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-06 20:09:45 +00:00
Oswald Buddenhagen
34cc41d8a1 don't pass qmake configure arguments to sub-projects
the arguments after '--' are by definition meant only for the top-level
project, as that's where configure is invoked from. passing them to
sub-projects just adds noise to the make output and misleads users.

note that this specifically does not support qmake -r, which will break
if the subprojects rely on the arguments being absent. this isn't a
problem, because the qt build doesn't support qmake -r anyway.

Change-Id: I7ecff6212ce3137526005fc324a4a7ae45e3345e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-06 20:09:18 +00:00
Oswald Buddenhagen
52d64fca66 revert to building qmake with qconfig.cpp
turns out that just appending builtin-qt.conf isn't a good idea:
executable-editing tools (objcopy, prelink, etc.) will happily drop the
"attachment".

a safe method would be adding a proper section to the executable, but
there doesn't appear to be an objcopy equivalent in msvc, and using
entirely different methods of embedding the file with different
toolchains seems like a rather bad idea.

so instead go back to the old method of building qmake with a generated
qconfig.cpp. of course, as said file is now created by qmake itself, we
have to compile qlibraryinfo.cpp a second time, and link a second qmake
executable.

Task-number: QTBUG-57803
Change-Id: I9e232693550aa870cec154e49cc06add13017cc2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-06 20:09:08 +00:00
Oswald Buddenhagen
17b6967f68 don't unnecessarily pass -qtconf to qmake
it makes the call more noisy for no particular reason.
and the new code is even easier to read ...

Change-Id: Ib4dfd373f351eeaca99e6bfc42b631f931ec987d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-06 20:09:02 +00:00
Oswald Buddenhagen
cfba3fff05 move emission of final messages to qmake-based configure
now qmake is the last command called by the unix configure script.
as it happens, this was already the case in the windows script, but only
because it didn't print these messages at all, which it implicitly does
now.

another effect of this is that repositories outside qtbase will now also
get the installation note in modular builds, which makes sense.

Change-Id: I567146936b216185a8e0f61e445222215608bf13
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-06 20:08:56 +00:00
Ulf Hermann
20e0bca834 Add a feature for Qt Xml
... so that we can turn it off if we don't want to build it.

Change-Id: Ia330dfa1477bcd2dc8e24eb55400e100fca156b5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-06 17:19:13 +00:00
Ulf Hermann
f704aba7fc Add a feature for Qt Testlib
... so that we can turn it off if we don't want to build it.

Change-Id: Ib27386da4754d843d4e4cbb05f9542852efefb88
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-06 17:18:35 +00:00
Ulf Hermann
3b609fc76f Add a feature for Qt Sql
This way we can disable it by passing -no-feature-sql to configure.

Change-Id: Ia47d72101de0788478997fa1854cedcd1742f6fd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-06 17:12:51 +00:00
Ulf Hermann
5c207c6c79 Add a feature for Qt Network
This way you can disable support for QtNetwork by specifying
-no-feature-network on the configure line.

Change-Id: I46217ccc525a9e2c85394ed4eb6db0e2b60b6d86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-06 17:12:21 +00:00
Marc Mutz
afefed0695 QAndroidStyle: fix UB (signed integer overflow) in AndroidProgressBarControl::drawControl()
The expression 'maximum - minimum' has undefined behavior when
'qint64(maximum) - minimum > INT_MAX'. Use 64-bit arithmetic
instead.

Also fix calculation of the progress when minimum != 0.

Rename QStyleOptionProgressBar* variable to avoid line wraps.

Change-Id: I1d48a7930e7f6d69798c2e878bb0045d55c2f057
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-06 16:59:40 +00:00
Marc Mutz
f4d3c87f0c Fix UB (signed integer overflows) in QProgressBar
The expression 'minimum - 1' invokes UB when 'minimum == INT_MIN'.
Likewise, the expression 'maximum - minimum' invokes UB when
'qint64(maximum) - minimum > INT_MAX'.

Fix by restructuring the code or else by using 64-bit arithmetic.

Change-Id: I352eafa72f28ae907f41c8f88abcf0a81705c718
Task-number: QTBUG-57857
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-06 16:20:26 +00:00
David Faure
fb85a72325 Fix deleting of QOpenGLVersionFunctionsBackend
Since the destructor is not virtual we need to
cast to the proper class when deleting otherwise the wrong
destructor is called and the object memory is not entirely freed.

Change-Id: Ie4e0e91bfa6e802c7d72fd1f137f5c7f3f31c8a0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-01-06 12:42:29 +00:00
Kavindra Palaraja
afbdf20fed Fixed docs explaining the Frameworks usage
Used the correct variable

Task-number: QTBUG-48941
Change-Id: I832fa40d27ebba8e1787d5a8e819b9f5c17cf721
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-06 12:42:24 +00:00
Frederik Gladhorn
d330ae0da2 Accessibility macOS: check for valid interfaces
There are a few places that did not check if the returned interface is valid.

Task-number: QTBUG-52536
Change-Id: I56ca0952fec0b44dfd4b3991aa94554e9c829642
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2017-01-05 19:45:21 +00:00
Frederik Gladhorn
fafdb171e0 Accessibility macOS: fix parentElement
Try to return the immediate parent first, nothing else makes sense. The
original code relied on the window pointer usually being nullptr, which
is not reliable.

Make sure to check the validity of the handle returned, since it's
possible to have the platform window being nullptr. It's not quite clear
to me how to end up with a null window though.

Task-number: QTBUG-52304
Change-Id: Id3e70cdab980fb0a86cebbb7c10d824d8a7dd80b
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2017-01-05 15:17:54 +00:00
Andy Shaw
47de2ef27f QOCIDriver: Ensure the where clause is correctly setup
Commit 88e043a8 introduced two bugs:

1. When constructing the WHERE clause, the closing ' around the owner
   name was dropped.
2. When constructing QLatin1Strings for comparison with system owners,
   a size of -1 was passed, with the comment "force strlen call". But,
   unlike QString, QLatin1String does not invoke strlen(), but stores
   the negative length unchanged, making the comparisons always fail.

Change-Id: Ie2835b76877c31ee32c900f67eb0853df7110dbb
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-01-05 10:32:14 +00:00
Andy Shaw
af5c8d04fb Win: Account for windows which are WindowTransparentForInput
Task-number: QTBUG-57864
Change-Id: I8793aaa3719fbcf97f95ae462135cbf6b5823097
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-01-05 09:31:32 +00:00
Ulf Hermann
2ed9a52ebf Fix compilation without sharedmemory
We have to enable qt_safe_ftok with either sharedmemory or
systemsemaphore. In order to make the resulting QT_CONFIG work with the
bootstrap library we switch the features off for bootstrapping. Some
tests and examples have to be excluded when sharedmemory is not
available.

Change-Id: I3fc3926d160202b378be2293fba40201a4bf50c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-05 08:38:33 +00:00
Ulf Hermann
b49660bba4 Make filesystemmodel feature depend on itemmodel
QFileSystemModel inherits from QAbstractItemModel, so it has to be
disabled if the latter is not available.

Change-Id: Ifc56f7e311d84bd15e8b4ed95d67bf9ad9aba888
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-04 18:18:39 +00:00
Ulf Hermann
9ba39c4b05 Remove pointless QT_NO_THREAD ifdefs from qpropertyanimation.cpp
Change-Id: I7b7e80abbddf4d43c6135775136d993196d708b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-04 17:39:55 +00:00
Ulf Hermann
99245e9576 Avoid zero-as-nullpointer warnings in QThread
Change-Id: I3fd557a54d63c2dcabe58fab65326538896d02a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-01-04 16:17:44 +00:00
Aleksey Lysenko
1b82a9aea5 Doc: add note about unsupported platforms for QProcess
Task-number: QTBUG-57840
Change-Id: I46a26a9c4c6ad0aa6994945091a2904c3b51080f
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-01-04 07:20:06 +00:00
Ulf Hermann
c96a4058f1 Avoid compile warnings in qabstractanimation.cpp
Change-Id: I57f90fc335b50231fb2093f096ad38168d476145
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-01-03 16:29:07 +00:00
Frederik Schwarzer
1c3c2486c6 Fix broken link in documentation
Task-number: QTBUG-57530
Change-Id: Iecb1a26f6b8a7e8a506d768668cde1c277d15dde
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-01-03 15:08:20 +00:00
David Faure
a8ae8e3130 QDateTime::fromString(): improve performance by 33%
getMaximum() and getMinimum(), called during parsing, create new
QDateTime instances, which on Linux end up calling mktime().
Making these static (for the common case of LocalTime spec)
improves performance dramatically, when parsing several date/times.

tests/benchmarks/corelib/tools/qdatetime/ (after fixing it to
actually parse a valid date/time) says:
 RESULT : tst_QDateTime::fromString():
-     36,742,060 instruction reads per iteration (total: 36,742,060, iterations: 1)
+     24,230,060 instruction reads per iteration (total: 24,230,060, iterations: 1)

Change-Id: I0c3931285475bf19a5be8cba1486ed07cbf5e134
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-03 13:37:49 +00:00
Thiago Macieira
9449325f2b Partially revert "Windows: stop using _beginthreadex on regular builds"
This pertially reverts commit 3ec57107ce
and brings back the hack to prevent the DLL from being unloaded. It
should have been enough, but we've got reports that it's still causing
trouble. Since it causes not much harm to keep the DLL loaded (worst
case scenario is that QtDBus and QtCore remain loaded after a plugin
gets unloaded), we'll keep it.

Note: Microsoft is aware that their way of killing threads on process
exit is a flaw. See https://blogs.msdn.microsoft.com/oldnewthing/20070502-00/?p=27023/

Task-number: QTBUG-53031
Change-Id: I2962773739e34633b033fffd1493dce695b008c0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-01-03 13:28:24 +00:00
Oswald Buddenhagen
e2ab932276 Bump version
Change-Id: Ie05effe65812e0df13a14e641a026f0b15ff511e
2017-01-03 13:25:46 +01:00
Simon Hausmann
3986be6d98 Improve reliability of network bearer tests
May of the tests initiate a scan / update of the network configuration
and expect the API to deliver exactly one update. This turns out to be a
race condition as the update may be emitted multiple times, as
QNetworkConfigurationManagerPrivate::updateConfigurations() is called
via posted events (queued signal emissions) from the bearer thread, and
so after creating the spy we may receive an update from _before_ and end
up emitting the signal multiple times.

Task-number: QTQAINFRA-1040
Change-Id: I931e2907f0cb86d48b4ab1a8795d75206035ea11
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-02 21:03:29 +00:00
Oswald Buddenhagen
47784b4352 re-introduce config.summary
Task-number: QTBUG-56225
Change-Id: I954cc1055ab0168c06b6618d02b06f63b4122add
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-12-30 10:25:53 +00:00
Oswald Buddenhagen
7af6e9bbe6 print help from all modules in top-level builds
this is rather hacky. a proper solution would auto-generate help from
the command line argument definitions, at the cost of needing to
bootstrap qmake first.

Change-Id: Iada6e25d5b31d7db0595309887f2d13295bbc1e3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-12-30 10:25:47 +00:00
Oswald Buddenhagen
7549bbbacb fail early after command line parsing error
we don't want to do the (possibly interactive) license check when the
command line is not valid.

Task-number: QTBUG-18459
Change-Id: I68c3b7ed4646e49865922ab5612f971930698356
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-12-30 10:25:42 +00:00
Oswald Buddenhagen
8292326f1b configure: make library sources fail more verbosely
log a message in all unsuccessful exit paths.

Task-number: QTBUG-57217
Change-Id: I8b0f2685d327da583c3e42c8149327e05b2a66cc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-12-30 10:25:38 +00:00
Oswald Buddenhagen
70a7276840 de-duplicate {mac,uikit}/default_post.prf re valid architectures
Change-Id: Ie9d5a35a7f8578a2588ec004aab086d74986b0eb
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-12-30 10:25:32 +00:00
Oswald Buddenhagen
b5c809eb96 remove redundant arch list truncation in single_arch case
beyond this point, simulator_archs is only used to determine from which
one of the lists the remaining arch came from (and device_archs is
actually never used again). the lists are assumed to be mutually
exclusive, so truncating them won't affect in which of them the first
element of their concatenation is found.

Change-Id: I4736ed7e51f6623efa6bd37892ab1fcf8c83ae8b
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-12-30 10:25:28 +00:00
Oswald Buddenhagen
afd82630c2 delay resolution of darwin deployment target and architectures
there appears to be no particular reason why this ended up in sdk.prf,
and it has become an actual problem now that the sdk is resolved from
default_pre.prf already, making it impossible for projects to override
the deployment target.

Task-number: QTBUG-56965
Change-Id: I8e319d10cdfb95acc1da1f431c8b8d4f76d1168e
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-12-30 10:25:22 +00:00
Oswald Buddenhagen
bbf7fa1368 remove pointless conditionals
uikit already implies !host_build, as host builds are executed with the
host spec. and the only darwin alternative to uikit is macos.

Change-Id: I6b47d68bad5d4427640901ff1e32dacf9a4e352b
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-12-30 10:25:17 +00:00
Oswald Buddenhagen
612f1f4668 centralize QMAKE_COMPILER_DEFINES+=_WIN32 also for winrt specs
this is mostly for appearances (as evidenced by everything working
despite it being missing from some specs), as the variable is just a
fallback for moc.prf's automatic detection.

Change-Id: Ie4af24c02ec03aaa1810281d1bb6876ea38cedf8
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-12-30 10:25:11 +00:00
David Faure
77a8e90cdd QHeaderView: fix restoreState() on a model with more columns
When saving state for a 3-columns headerview and then restoring that
state onto a 5-column headerview, the headerview shouldn't suddenly think
it has 3 columns.

Rather than making restoreState() fail, we adjust for the additional
columns, so that we can still apply the customizations from the user to
all other columns (hiding, moving, etc.).

Change-Id: I3f220aa322ea8b629d2fe345f8cde13e0ea615d6
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2016-12-29 17:32:58 +00:00