Commit Graph

28583 Commits

Author SHA1 Message Date
Thiago Macieira
aca0e367be Fix the Q_ATOMIC_xxx_IS_www_NATIVE macros with C++11
When I introduced this code in Qt 5.0, I made INT and POINTER be
SOMETIMES_NATIVE, but then later I made the specific sizes be
ALWAYS_NATIVE. That doesn't make sense.

Instead, use the macros from the C++11 <atomic> header.

Note that the member isXxxxNative() functions should not have been
constexpr. That's a defect I introduced in Qt 5.0.

Task-number: QTBUG-51315
Change-Id: I0c94a5c2846b48c8aea7ffff1436013e8686c153
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-07-13 21:15:30 +00:00
Gabriel de Dietrich
21c8a66a15 QCocoaMenuBar: Sync items only when they are attached to a menu
Another one of Cocoa's capricious behaviors. Evidence shows that
the menu item's submenu property needs to be set before we can
set the item's hidden property. We ensure this is the case by
getting the NSMenuItem through QCocoaMenu::attachedItem() instead
of QCocoaMenuBar::nativeItemForMenu() in QCocoaMenuBar::syncMenu().

Change-Id: Id50356dae5f556fa3d745ba9a5982e5a72bf0ac2
Task-number: QTBUG-54637
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Jason Haslam <jason@scitools.com>
2016-07-13 17:48:06 +00:00
Andy Shaw
1e843b41b6 Mac: Read in the string with QString::fromUtf8() as it is UTF8 encoded
Task-number: QTBUG-47358
Change-Id: I50943867d3a57c4db4fe20e55e60d097742e9104
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: jian liang <jianliang79@gmail.com>
2016-07-13 16:55:48 +00:00
Jake Petroules
5cbe16be78 Set library strip flags on Apple platforms
This was missed in ab599a3931 when
QMAKE_STRIP was set as a side effect of adding support for separate
debug info.

Task-number: QTBUG-54212
Change-Id: I86dd040dbefec4c58879c7d029ed89dd8bad3daf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-13 16:50:47 +00:00
Oswald Buddenhagen
a42c9cfc28 generalize references to exclusive builds
exclusive_builds_post.prf (via default_post.prf) processes
debug_and_release into BUILDS, so .prfs which can rely on being
executed later (because they are loaded via CONFIG) can rely on BUILDS
and related variables.

Change-Id: I5677079ad5145bf493af17b4b60347208572fd21
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-13 14:27:07 +00:00
Oswald Buddenhagen
fc57a6587b remove redundant condition from private module use warning
the whole point of the check is ensuring that the message is printed
only once for each sub-project, so !build_pass alone is fully adequate.

Change-Id: Ib8f821ead6709efc9bfa935e1d05f8caba02a814
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-07-13 14:27:04 +00:00
Oswald Buddenhagen
3c8134958c fix raw data leak in $$absolute_path()
when the file name is empty, the path will be returned verbatim. this
must be considered when constructing the return value.

Task-number: QTBUG-54550
Change-Id: Ie108ed52275e66a154ef63bd6f7193f55b3e0454
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-07-13 14:27:01 +00:00
Oswald Buddenhagen
d459a6b0e0 fix calculations of worst-case size requirements for token buffer
Change-Id: I3aa4c736acec44f95a0a33c7baae9276568f684f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-13 14:26:58 +00:00
Oswald Buddenhagen
dacf3994ba fix custom functions inheriting other functions' arguments
Task-number: QTBUG-41830
Change-Id: Iba3eee4975a1ee671b7190e52c0efc9a18147c62
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-13 14:26:54 +00:00
Oswald Buddenhagen
1b4ea11332 make error() propagate from requires() and REQUIRES=
that can make sense if a function which determines the availability of
a dependency fails to do so for unexpected reasons.

Change-Id: If6cd113df25aee66830c120a2fab067c822a4543
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-07-13 14:26:49 +00:00
Oswald Buddenhagen
339b9706cc make error() propagate from custom replace functions
it didn't, which is rather unexpected.

Change-Id: I8cdb7b1490a8c2207809812b93cc65fbe23a1b98
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-07-13 14:26:46 +00:00
Oswald Buddenhagen
b27d4835c2 fix error() not propagating through if()
if() would simply "downgrade" a fatal error to a false condition, which
is certainly not expected.

Change-Id: Ie9c54f2bddf588856498bf795007b341b7c9363a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-07-13 14:26:42 +00:00
Samuel Gaist
07d3cbbe84 Add warning when using pkg-config with a Qt build with it disabled
This patch adds a warning that will be shown when link_pkgconfig is used
in a project but Qt's configuration has it disabled. This can happen
when Qt is built before pkg-config has been installed or if it's not
detected.

This will avoid user losing time trying to make pkg-config work while Qt
just ignores it.

Change-Id: Ieeff8dd6784b9430cfebef355855ec1be91bc96e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-13 14:26:38 +00:00
Friedemann Kleint
9131f6e561 QCompleter::setModel(): Restore completion role
When setting a QFileSystemModel as model, the completion role
is set to QFileSystemModel::FileNameRole. This needs to be reset
to the default Qt::EditRole when setting another model.

Task-number: QTBUG-54642
Change-Id: Ie78d5d417e008ad05a2f995bdbc218b3ad1bc49c
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2016-07-13 13:45:44 +00:00
Ralf Nolden
4397a1b26c FreeBSD: move order of includes for compiling
The previous patch works for FreeBSD 10 but however not for 9 and 11
due to the order of includes. Move <sys/user.h> down to fix those compile
issues due to unknown types when user.h is included first.

Change-Id: Ica3d3ddf335a543c4a473e8b80d1667cb81667cf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-13 06:50:05 +00:00
Ralf Nolden
d6177b55ea OpenBSD: add X11R6/lib to QMAKE_RPATHDIR
As OpenBSD ships its own X11, linker errors occur when not explicitly
adding the X11R6/lib dir to rpath dirs.

Change-Id: I75991e9d7de115d2d212a017d9c8f9aa93cecc27
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-13 06:50:00 +00:00
Marc Mutz
5c46d07a7c Optimize QString::insert()
When the insertion position is not beyond end(), call
resize() instead of expand(), which fills the new size
with spaces, which, however would just be overwritten
by the following memmove().

Add some Q_UNLIKELY to indicate that we strongly
expect the resize() case to be the more common.

Change-Id: Iaf3215dd53c2cbd18f2fd8a5f80af8f6844944da
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-13 06:33:07 +00:00
Oliver Wolff
49f9328175 configure.exe: Show error on "-target xp" option
The option was removed in dev but should have been removed in 5.7. In
order not to complicate merges most of the code that was removed in dev
has been kept as is and only the "bare minimum" was removed.

Task-number: QTBUG-54674
Change-Id: I5118fe344de014bdcf008cccfe9eca112896d23a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-12 14:10:38 +00:00
Gabriel de Dietrich
8beddf8328 QSslSocketBackendPrivate: Remove QString warnings
Change-Id: I2ab758fe61ea1ba9b84672ac05ac219b85e3de6a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-07-12 10:46:55 +00:00
Edward Welbourne
e21bf5e6b3 QString::replace(): protect sought text and replacement
When replacing each copy of one text with a copy of another, we do so
in batches of 1024; if we get more than one batch, we need to keep a
copy of the sought text and replacement if they're part of the string
we're modifying, for use in later batches.

Also do the replacements in full batches of 1024, not 1023 (which left
the last entry in an array unused); marked some related tests as
(un)likely; and move some repeated code out into a pair of little
local functions to save duplcation.

Those new functions can also serve replace_helper(); and it can shed a
const_cast and some conditioning of free() by using them the same way
replace() now does.  (There was also one place it still used the raw
after, rather than the replacement copy; which could have produced
errors if memcpy were to exercise its right to assume no overlap in
arrays.  This error is what prompted me to notice all of the above.)

Added tests.  The last error proved untestable as my memcpy is in fact
as fussy as memmove.  The first two tests added were attempts to get a
failure out of it.  The third did get a failure, but also tripped over
the problem in replace() itself.  Added to an existing test function
and renamed it to generally cover extra tests for replace.

Change-Id: I9ba6928c84ece266dbbe52b91e333ea54ab6d95e
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-07-12 10:22:25 +00:00
Edward Welbourne
9a3bcd1c3d QString::replace(): Commentary clarifications.
Also skip doing a += 0 when we had to test whether the relevant rhs
was zero anyway (because we want to ++ there instead of +=ing).

Change-Id: Ibd5f21eb9aaf410b09c9db8450b2d61618e628fc
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2016-07-12 10:22:17 +00:00
Nico Vertriest
7cfdbe5102 Doc: corrected link to Qt Widgets Examples
qwidget.cpp:498: warning: Can't link to 'Qt Examples'

Change-Id: I5eed4ac4fd5514a1e1ff7130997df8449d5c5e7f
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
2016-07-12 09:09:06 +00:00
Tim Blechmann
8ba3fee610 QWindowsOpenGLTester: fall back to built-in blacklist if buglist file cannot be resolved
if the environment variable is set, but the buglist file cannot be found,
we should fall back to the built-in buglist instead of not using any.

Change-Id: I370a1f21238efd155b46f0e7071734f5d3c6c343
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-07-12 07:33:31 +00:00
Takumi ASAKI
7a2f53647b Bearer/ConnMan: Fix No such slot
Change-Id: Icf403b2e2e86d1cb58fd74c0df054bcc43cf9210
Reviewed-by: Lorn Potter <lorn.potter@canonical.com>
2016-07-12 01:18:53 +00:00
Marc Mutz
e6a5be1d81 QPair: add test for pair of references
std::pair explicitly supports this (cf. std::tie),
so check we do, too.

Change-Id: Idc3c1739a4bc64a0da120dcf953def7e432f6f71
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-11 20:02:41 +00:00
Marc Mutz
6a7bae9a26 QHashFunctions: test for hash equality of null and empty string types
In Qt, null QStrings compare equal to empty ones, so add an explicit
check that the corresponding hash values are identical, too.

Ditto for QByteArray.

Change-Id: I190fc95a765305928d9b6b0e4955433865b6b247
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-11 20:02:15 +00:00
Marc Mutz
7c279d779b QWindowsTabletSupport: fix new[]/delete mismatch
QScopedPointer deletes with delete, but a pointer returned from
new[] needs to be deleted with delete[].

Fix by using QVarLengthArray instead of QScopedPointer(new TCHAR[]).

Change-Id: I2f1f252379a9ac1ee919901b5efcec9cec31261e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-07-11 20:01:17 +00:00
Timur Pocheptsov
f8dc769655 QMacTimeZonePrivate - correctly initialize m_nstz data-member
The default ctor never initializes m_nstz but calls init with
[NSTimeZone systemTimeZone].name. Init (re)sets m_nstz _only_
if this ianaId is in [NSTimeZone knownTimeZoneName], which is not guaranteed
(a good example is "US/Pacific" that can be returned by systemTimeZoneId() -
the similar problem is described in [*]. Set m_nstz to nil in ctor,
so if 'init' fails we still have a valid (nil) pointer.

[*] http://stackoverflow.com/questions/19819268/convert-ios-localtimezone-to-a-knowntimezone.

Task-number: QTBUG-54330
Change-Id: I68917926350aad3158d44a06f06721f25b3fdb74
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-11 17:51:21 +00:00
Marc Mutz
8cee6864c6 QStringBuilderCommon: drop const from resolved() result type
The const qualification prevented toUpper() etc from
calling the rvalue overloads of the corresponding QString
functions. Since resolved() always returns a non-shared
object, the rvalue overloads can re-use the object's
capacity for storing their result, saving up to one memory
allocation per QStringBuilderCommon::to*() invocation.

Change-Id: Ica97fcd906cdd949ffe56055654578b93407e2d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-11 13:57:51 +00:00
Anton Kudryavtsev
e27c07389b QString: adapt chop() auto test as data-driven test
Thiago Macieira asked to do that.

Change-Id: I9a07dad7ff2bfebc2f863e0e9f151aab66450bcf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-11 13:22:46 +00:00
Nico Vertriest
4f6c6ef65f Doc: added doc for parameter isMask
Error message: Undocumented parameter 'isMask' in QIcon::setIsMask()

Change-Id: If16d232b6856ff6d5104ac7c32d3b8c0ac4081f9
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2016-07-11 09:10:06 +00:00
Thiago Macieira
a2ff5afffa Correct indentation in qsettings.cpp
Introduced in 9c49d8c411, despite my
pointing out.

Change-Id: Ie585843cfb684bc3b6e3fffd14600c99f7fde591
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
2016-07-11 06:33:26 +00:00
Sérgio Martins
a0bb2fc406 Fix typo in QStyle documentation
Change-Id: Id1f65dcc473effbdd0ccd7362b2986382c827ed8
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
2016-07-09 10:39:19 +00:00
Anton Kudryavtsev
9c49d8c411 QSettings: optimize string usage
Use QStringBuilder and QString::asprintf more.
Use += operator to reserve extra capacity for
possible free following append/prepend/+= call.

Change-Id: Ia534bec28cb96b688a68a5051a855cda1eb5db4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-09 08:37:10 +00:00
Gabriel de Dietrich
38b09d3421 QCocoaMenu: Attach late items to their submenu
Because the QMenu::aboutToShow() signal is emitted
way after -[QCocoaMenuDelegate menu:updateItem:
atIndex:shouldCancel:], we miss the opportunity to
attach the submenu to the menu item.

The solution is to track the "open" state of the
NSMenu. Then, if any submenu item gets added while
the NSMenu is open, then we immediately attach the
native item to the menu.

Change-Id: I1f3a84ed3832520344da07e06cb3483ad6bd4ffd
Task-number: QTBUG-54633
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-07-08 20:18:20 +00:00
Anton Kudryavtsev
6bafb9da71 QString: fix incomplete doc of chop()
Change-Id: I84de848681e793e68e0c290719a7f961aca48f4e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-08 06:43:06 +00:00
Anton Kudryavtsev
2788fccd29 Use QStringLiteral more judiciously
Replace it with QL1S in QStringBuilder expressions
and in overloaded functions.

Replace patterns 'QString::number() + QStringLiteral'
and 'QStringLiteral + QString::number()' with
QString::asprintf.

Saves some text size.

Change-Id: Ib39b2332264dfc3df04e77f2c101b47a1030cef4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-08 06:43:02 +00:00
Andy Shaw
deb2728a86 [macOS] Check that the screen's index is still valid after updating
It is possible for a screen to be disconnected while it is doing an
update of the available screens. Therefore before returning the pointer
to the screen then it should be rechecked that the index is still within
the range of available screens.

Change-Id: Iaa08070e79a72cb309d8a24cea786a5dccf6b719
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-07-08 05:19:32 +00:00
Friedemann Kleint
14c6f80f4b Testlib: Replace QString::arg() formatting by snprintf()
Formatting of values needs to be fast since QTestlib always
pessimistically formats the values passed to QCOMPARE even if
they match.
Speeds up tst_qrect by factor 1.5..2.

Task-number: QTBUG-38890
Change-Id: I3627db77a305a46c1d51a14c04b88db8018faa60
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-08 05:06:32 +00:00
Boris Pek
c8aa7eda3a Fix build of the minimal platform plugin for MS Windows
when qtbase is configured with -fontconfig and -system-freetype.

This fix is necessary after 060e0f6628.
Used the same approach as in 16864c42d6.

Change-Id: Idece0dc11d89e38266c95de1769be751c06324ef
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-07-07 19:26:20 +00:00
Friedemann Kleint
145d8462e3 Windows QPA: Accept foreign windows when checking for wheel receivers
After change 14efcaa392, foreign
windows no longer have a corresponding QWindowsWindow. This should
not block wheel events when checking for blocking modal windows.

Amends change 14efcaa392.

Task-number: QTBUG-54430
Change-Id: I1ac87445844946bafc214024e27da08c4f884d79
Reviewed-by: Tim Blechmann <tim@klingt.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-07-07 16:56:27 +00:00
Anton Kudryavtsev
b36c6bab8d QString: add auto test for chop()
Change-Id: I8fc65c65776a64cc92e8cba3993d17746be81ba1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-07 15:03:30 +00:00
Alexandru Croitor
b6c10cf331 Improve lookup speed for QAccessible::uniqueId
When QAccessible::uniqueId was called, it would call QHash::key(),
which has linear time performance. This can cause application
slowdown if a big number of QAccessibleInterface Ids have to be found.

The patch adds an additional QHash to keep track of the inverse
relationship from QAccessibleInterface pointers to their Ids.

Change-Id: I975e3dc0e6c628e2ea701323d8b87184ad133cfb
Task-number: QTBUG-54491
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2016-07-07 14:50:00 +00:00
Ralf Nolden
3658354a7d OpenBSD: redefine g++/gcc commands to eg++/egcc to use newer gcc 4.9
On OpenBSD, the system compiler shipped is still gcc 4.2.1 but for proper
C++11 support in Qt, QtCreator and Qt-based projects we need to use
the compilers provided in ports/packages which have the binaries renamed
to eg++/egcc. Therefore, redefine the variables from g++-base.conf to
use the newer compilers.

Change-Id: Ic8ea1c5d2c2c0263dad5ae85c8c747bcd3985b7d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-07 09:24:53 +00:00
Anton Kudryavtsev
5dc739ba9b Replace QString::trimmed() with QStringRef::trimmed()
... where it's possible. Reduce allocations.

Change-Id: I023adfd316f94948fe50749f60bf55748dca56e2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-06 18:30:26 +00:00
Roger Maclean
abc29084fa QNX: Ensure invisible 1x1 raster windows are posted.
Non-top level raster windows still have screen windows associated
with them though they are not intended to be visible.

This causes problems if they have children (as they do when QGLWidgets
are used) since their children will also not be visible.

So, if we have a window with a parent, force them to post but set the
transparency to discard so they remain invisible.

This allows the example hellogl_es2 to run correctly.

Change-Id: I67e24dc59b29ce789376498c2477349fa50020e1
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
2016-07-06 18:15:48 +00:00
Thiago Macieira
1575f2fc3c XCB: Update the high DPI scaling in more conditions
I don't think fae8ee8b42 was enough. I've
started getting small fonts in Qt Creator under some other
circumstances.

Change-Id: I1cc7601489634e96833cfffd1456caea823aa84a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2016-07-06 18:09:19 +00:00
Gabriel de Dietrich
16fefc258e Remove QCoreTextFontEngine::supportsColorGlyphs
This is always true on the versions we currently support.

Change-Id: I1aecbbd1f41e0f4f03b380358cd762ca00bb1e97
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-07-06 17:37:24 +00:00
Gabriel de Dietrich
9d620483c6 QCocoaTheme: Remove unreachable code
The condition
    iconType != kGenericApplicationIcon
is never false, therefore we will never execute
the else statement. Consequently, overlyaIcon
will always be null.

This was triggered by the deprecation of
ProcessSerialNumber related APIs since 10.9.

Change-Id: If9eec1d2cc6e7e5b0c5323d4550f0c823a5eb0d8
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-07-06 17:37:04 +00:00
Anton Kudryavtsev
802c31bdbd QDateTimeEdit: de-duplicate calls and cache results
Change-Id: I32162846f5f412c7563e66015ea371f9a1af7748
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-06 14:18:08 +00:00