Commit Graph

31862 Commits

Author SHA1 Message Date
Thiago Macieira
ef26467eb2 Reintroduce a directed QMetaType::typeName array
Commit fb376e0fcc removed an array that
facilitated returning the names of built-in types, to avoid the jump tables
from the switch statement. This commit brings it back but makes the array a
compile-time constant string offset table.

The array is created by way of a set of C++11 constexpr functions, so we
require that compiler feature. I've tested that MSVC 2015 does support
it as well as the ICC 17 when masquerading as MSVC 2015, so I've enabled
for that too. The only compiler left out is MSVC 2013.

If we didn't need to support MSVC 2015, this could have been written
more simply with C++14 relaxed constexpr.

This also adds unit tests to confirm that QMetaType::typeName() does
return null when we said it would. We're testing QMetaType::User-1
(which we'll likely never use) and QMetaType::LastWidgetsType-1 to
select something inside the range of the built-in types.

Task-number: QTBUG-58851
Change-Id: I4139d5f93dcb4b429ae9fffd14a33982891e2ac1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-09 14:56:35 +00:00
Andy Shaw
65bafcc29d Android: Enable the usage of QPrinter
Since QPrinter can be used to write to PDF and this was working in
previous versions, there is no reason not to enable it here.

Task-number: QTBUG-58376
Change-Id: I5760b74881995679e8df657b7d770bba00a33551
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-03-09 11:04:03 +00:00
Paul Olav Tvete
f8218637e9 Build fix for -no-feature-slider
Change-Id: Ibd7d0c2182c6a11f6d595b6d1015ee7de2d35866
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-09 10:51:42 +00:00
Oleg Yadrov
175f33ed85 QMacStyle: update QTabBar style
Task-number: QTBUG-58266
Change-Id: I135e4dae44e2e97d73b7c7c97d8e682bcf459d75
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-03-08 18:39:01 +00:00
Olivier Goffart
5675334b6e moc: Add support for C++17 nested namespaces (N4230)
[ChangeLog][moc] Added Support for C++17 nested namespaces

Change-Id: Ib83fc5bf48f66546fa97b49710582fbf9c984503
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-08 17:34:38 +00:00
Thiago Macieira
7fd483f3de QDateTimeParser: Merge the code to parse names of months and weekdays
Simplifies everything and avoids bugfixes in one not propagating to the
other.

Change-Id: I95c9e502ccc74af3bcf0fffd14a69f0cde60cc8c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-08 16:44:54 +00:00
Kevin Funk
375bbcdd01 qlalr: Fix and re-run qlalr on its own sources
So the generated files are up-to-date again.

Generated with:
  qlalr --qt --no-lines --no-debug lalr.g

Change-Id: I3c4adb0083be7e66fed3db92c079493b574295aa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-03-08 15:05:55 +00:00
Timur Pocheptsov
8b9d246225 QHttpNetworkConnection: fall back gracefully to HTTP/1.1
Both SPDY and HTTP/2 work with a single qhttpnetworkchannel (and this means one
socket per qhttpnetworkconnection). Normally, HTTP/1.1 connection is using up to 6
channels/sockets though. At the moment a failure to negotiate SPDY/HTTP/2 leaves us
with a downgraded HTTP/1.1 connection (with only one channel vs. default 6).
Since we initialize channels (and establish connections) in a 'lazy' manner
it's ok to pre-allocate all 6 channels and then either use 1 (if SPDY/HTTP/2
indeed was negotiated) or switch back to 6 in case of failure.

Change-Id: Ia6c3061463c4d634aaed05ce0dde47bfb5e24dd8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-03-08 14:14:26 +00:00
Olivier Goffart
11d60dcad6 moc: Fix parsing of digit separator
[ChangeLog][moc] Fixed parsing errors in presence of
C++14 digit separators.

Task-number: QTBUG-59351
Change-Id: Iea38ea7388853d84b819c2beb78a59371f57bf7d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-08 12:34:12 +00:00
Stephan Binner
b53d7664c9 Add feature.abstractslider
Change-Id: Ib5d0186162fc3b750e6440c74b1181787093ef97
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-03-08 12:05:43 +00:00
Topi Reinio
cf7d3b524d Doc: QSizePolicy: Fix documentation warnings
warning: Can't link to 'controlType()'
warning: Can't link to 'horizontalPolicy()'
warning: Can't link to 'verticalPolicy()'

Change-Id: I6b31acebf183defee7b4ab36976034ed4a3fc98a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-08 11:11:54 +00:00
Kai Koehne
8d11df83d4 Document QT_DEPRECATED_WARNINGS
Task-number: QTBUG-58468
Change-Id: I0f822c2dd14878d70b74ddd2db89b11ba54f687b
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-03-08 09:45:09 +00:00
Allan Sandfeld Jensen
2e6ec59d47 Avoid QRgba64 arrays in the generic text-rendering routines
Like in other functions, allocate arrays of quint64 instead of QRgba64
to avoid the cost of initializing large arrays on every small scanline.

Change-Id: Ie132b3157003a18a444ca5c4f94ae668d17327fd
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
2017-03-08 09:45:05 +00:00
Timur Pocheptsov
075e669cbe QHstsPolicy: Replace bool with QFlags
As pointed out in the previous code-review:

Replace a bool ctor parameter with QFlags<enum> to conform to
Qt API Design Principles (Boolean Parameter Trap).

Since the bool with its many unwanted implicit conversions is
gone from the ctor parameter list now, drop the explicit
keyword again. It was requested because of the boolean parameter
in the first place.

Change-Id: Ibaf287a6a3e38c22f033fd5d9e024c54f30a1fd4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-08 09:42:01 +00:00
Jocelyn Turcotte
8afc6146be Windows QPA: Better recover from removed screens when fullscreen
QWindowsWindow::handleResized would call isFullScreen_sys which checks
if the window's screen geometry matches the one of the window. When
switching back from fullscreen, Windows will have set the geometry to
fill the next window, but we don't switch QScreen until later in that
function, inside handleGeometryChange. This would result in our window
to take the whole screen geometry, but the FullScreen state wouldn't
be transferred to the new screen.

Fix the issue by using screenForGeometry and check if we are fullscreen
on any screen.

Also make sure that we check the validity of m_savedFrameGeometry when
restoring after a screen remove, since we would previously restore to an
area not covered by any screen anymore.

Change-Id: I43bc02738007918e9a26c1d27a699c51d3365034
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-03-08 09:23:44 +00:00
Paolo Angelelli
40ace7a2a0 Fix computegles31 example
This patch fixes the example that contained problems showing up
with mesa/nouveau drivers.

Change-Id: Ic90f6028e394138781f00bcc00c145c56134f441
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
2017-03-08 09:19:39 +00:00
Friedemann Kleint
535b142393 QWidgetWindow::event(): Call base implementation for QEvent::WindowStateChange
The base implementation takes care of updating visibility and emitting
signals.

Task-number: QTBUG-59313
Change-Id: I270b37c894420902488d89dc0c79f4c12b8d9a29
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-03-08 09:04:03 +00:00
Andy Shaw
32463399f7 Add documentation for QMAKE_LINK variable
Change-Id: I39f11f42750c705feabf5e1a87bcd277693af1fb
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-03-08 07:56:29 +00:00
Marc Mutz
da730c90a3 QStyleSheetStyle: introduce class Tampered<QPalette|QFont>
... as a replacement for two QPairs and move some common
QFont/QPalette functionality into it.

Change-Id: Iaab92130dd54eaa7900ac2048014a80cbd04bfb6
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-03-08 07:19:53 +00:00
Marc Mutz
9e7d769462 Use the same timeout value for all QTest::qWaitForWindow*() functions
Some were 5s, others 1s. Pick one (the higher).

Change-Id: I81929d4f49c2e41b4d4b75c3e2bf8ff75af868ad
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-03-08 07:19:45 +00:00
Thiago Macieira
3a1f4b186d Stop trying to discover the system timer resolution on Windows
Let's take the beginning of the description: WaitForSingleObjectEx can
be up to 16 milliseconds early. This is proven by the fact that there
are tests doing:

    wait(waitTime);
    QVERIFY(timer.elapsed() >= waitTime - systemTimersResolution);

and failing.

Task-number: QTBUG-59337
Change-Id: Iae839f6a131a4f0784bffffd14a9a79523d69d94
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-03-08 05:52:47 +00:00
Samuel Gaist
2d81968c3b Example: migrate treemodelcompleter example to use QRegularExpression
Update the treemodelcompleter example to use the new QRegularExpression
class in place of the deprecated QRegExp.

Change-Id: I9fa91ca6e847603de37019e4ca86fc69a51a3772
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
2017-03-07 23:11:31 +00:00
Samuel Gaist
9e933de7f2 Example: fix memory leak in relationnaltablemodel example
The example creates a view on the heap but doesn't delete it on
application end. This patch uses a QScopedPointer to fix that.

Change-Id: I3b0c8589999d243c193bd02e1470c03eabfabe40
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
2017-03-07 23:11:20 +00:00
Nikita Krupenko
895b4e6f89 Enable QStyleHints::useHoverEffects for KDE and other unix systems
By default, it enabled only for Gnome

Task-number: QTBUG-59298
Change-Id: Ib44f52b3175ed1904f24ec9e21f00ea3f3334287
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
2017-03-07 15:22:17 +00:00
Joerg Bornemann
a12a3c6c8c Fix MSVC Makefiles when SOURCES is empty
Call sites of NmakeMakefileGenerator::writeResponseFileFiles expect that
the output is terminated with '\n'. Do not bail out if files is empty.

Task-number: QTBUG-59305
Change-Id: Id3fef8dbc506dad1868e6b352119f5f27b50a368
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-03-07 13:54:57 +00:00
Thiago Macieira
e7295c959b Add -Wfloat-equal to Qt's header clean check
Task-number: QTBUG-57649
Change-Id: I15b62e0f9cec482fbb40fffd1490d802c54bf0fe
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-07 10:51:54 +00:00
Andy Shaw
7eb11df19e Don't call releaseKey a second time if the insertion fails
When the insertion into the cache fails then it will delete the entry
for us which already calls releaseKey(). So we should not call it a
second time.

Task-number: QTBUG-58259
Change-Id: I816c6f29ef97fe3a245f145c4faf1e0649f72dc5
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-03-07 08:15:54 +00:00
Sze Howe Koh
58cc126def Doc: Replace std::bind() with lambdas in Qt Concurrent
Lambda functions provide all the benefits of std::bind() plus more

Change-Id: Iec30b20bb35ac0fae560435b323f80af2f2e5fce
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-03-07 04:35:23 +00:00
Giuseppe D'Angelo
9390c44338 QtXml: add some missing Q_DECLARE_TYPEINFO
Change-Id: I4b58aad1c337fe5fdfb70eb517a66b15a34dffc4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-07 01:55:44 +00:00
Jake Petroules
c0af8cef2f Don't pass -headerpad_max_install_names when using Bitcode
It is ignored (and is unnecessary to begin with) in that case,
and emits an annoying warning which this patch silences.

Change-Id: I6059969724b203d6e0e2eea81ad3e3e8f8d536d6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-03-07 01:05:16 +00:00
Stephan Binner
00e6863552 Add feature.pushbutton
Change-Id: I654d91635e60b177df16f6dfe00acc940132f66a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-06 20:35:07 +00:00
Stephan Binner
0884e42410 Add feature.checkbox
Change-Id: Ib387390b796c3cab6de4ce94e0d217280a300df8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-06 20:34:58 +00:00
Stephan Binner
5c62fd9a2e Add feature.dialogbuttonbox
Change-Id: I8c136024c3bf431529033a806be646d867919daa
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-06 20:34:42 +00:00
Oswald Buddenhagen
473248df14 put load(qt_plugin) at end of project file
amends a28364bc1.

Change-Id: I8e6044abcbfffde8688d87cd3aa722c0c362534c
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-03-06 18:43:26 +00:00
Olivier Goffart
6797570a59 Fix UB in QFutureInterface: invalid casts from ResultStoreBase to ResultStore<>
ResultStore never actually exists, only ResutStoreBase does. So casting to
ResultStore<T> and calling its  member functions is UB. Put the type dependent
function as template member functions within ResultStoreBase and so we don't
need QtPrivate::ResultStore anymore.
Same goes for the iterator.

Change-Id: I739b9d234ba2238977863df77fde3a4471a9abd2
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-06 18:32:28 +00:00
Paul Olav Tvete
0b109a952b Build fix for -no-feature-formlayout
Change-Id: I10a1c4b742bb446f7baa219d4118a03d9f60495c
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-06 15:32:38 +00:00
Ulf Hermann
a170c974a5 Fix building of various examples and tools with -no-feature-process
We should not check for platforms, but rather for features. Also, if
dbus is available it doesn't automatically mean that QProcess is.

Change-Id: I27ef5863fcb107cca1aa47abba95b734962adc33
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-03-06 14:16:13 +00:00
Ulf Hermann
c925400bde qmake: Check for QT_CONFIG(process) in qmakebuiltins
The code in question is obviously checking for support of QProcess, not
for general bootstrap mode. You can manually disable QProcess, in which
case it is still not available after bootstrapping is done.

Change-Id: Ia99810b8900621911a31912034358a01af4f18a0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-03-06 14:16:08 +00:00
Topi Reinio
8a1880029d Doc: Add macro for embedding YouTube videos
This macro adds a \youtube <ID> command that embeds a YouTube link
into the documentation.

The video container scales to a specified percentage of the available
horizontal area. It assumes a source aspect ratio of 16:9, but looks
acceptable with other ratios.

For backends that do not support <iframe> (e.g. QTextBrowser), shows
a clickable video thumbnail that open the YouTube link in an external
browser window. Unfortunately, QTextBrowser cannot load images from
a remote URL, so we need to store a thumbnail image in the .qch file.

Change-Id: I3a3a0c5a20dd90e5cec6357ba70a23ee47dbe825
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-03-06 13:43:58 +00:00
Ulf Hermann
d6330a19b2 Use QT_CONFIG(library) instead of QT_NO_LIBRARY
For the windows file system engine, we add an extra macro to use
library loading if configured to do so, but avoid it on WinRT, as
none of the symbols would be found.

We also QT_REQUIRE_CONFIG(library) in the library headers and
exclude the sources from the build if library loading is disabled.
This, in turn, makes it necessary to clean up some header inclusions.

Change-Id: I2b152cb5b47a2658996b6f4702b038536a5704ec
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-03-06 11:27:20 +00:00
Marc Mutz
f31dbeb4c7 tst_QVersionNumber: fix Clang warning about superfluous move
Parameters passed by value, like local function variables, are subject
to NRVO/return-by-move already, so adding std::move, even disguised as
qMove(), makes Clang warn about a pessimizing move.

Change-Id: I7d59bfee4cf7ecddee0874ee489367044c702643
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-03-06 11:13:17 +00:00
Olivier Goffart
80cbe30798 Remove unused src/tools/moc/mwerks_mac.* files
These files are unused.
They still contains Qt3 code (QCString for example)

Task-number: QTBUG-59302
Change-Id: I661f08db4092311df1d6c7d54b9780d86adab8aa
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-06 10:11:25 +00:00
Thiago Macieira
37fd42459e forkfd: fix calling the old signal handler when there wasn't one
On some stupid systems, execve() may clear the handler but not clear
the SA_SIGINFO flag.

This change now requires that sa_handler and sa_sigaction be in a union
together. We can't operate otherwise.

Task-number: QTBUG-59246
Change-Id: I33850dcdb2ce4a47878efffd14a84b48a8f6b1e8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-06 09:56:35 +00:00
Edward Welbourne
a1c27748d2 Make QLocale consistent about special handling of the C locale
QLocale::matchingLocales() simply created each locale using the basic
data, without (unless the matching conditions stipulated Language C)
applying number-options hacks that it applies everywhere else, when
creating the C locale.  Thus the C locale in its returned list (if it
wasn't the only entry) ended up with the default number options,
without omiting separators in numbers.  Thus QLocale::c() didn't
actually appear as an entry in the list.  Discovered while
investigating QTBUG-58947.

Added a dumb autotest that checks various ways of getting the C locale
do actually give us equal locale objects.  Fixed matchingLocales() to
apply the same hack as is used elsewhere for the C locale.

Change-Id: I263f31da623052b63171f5b5a83c65802383df21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-06 09:51:49 +00:00
Thiago Macieira
3a2f4bde14 QStaticByteArrayMatcher: enforce alignment
The data is 256 bytes, so might as well align it on a 16-byte boundary
to facilitate copying (if that happens). We should consider similar for
QByteArrayMatcher in 6.0.

Change-Id: I74966ed02f674a7295f8fffd14a8c64526d734bb
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-06 09:42:45 +00:00
Thiago Macieira
03b3f7a3af Make new QtCore code conform to the coding style
Change-Id: I74966ed02f674a7295f8fffd14a8c6389da538c1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-06 09:42:23 +00:00
Marc Mutz
51bec76d10 QLineEditPrivate: introduce SideWidgetLocation class
... as a replacement for QPair<enum, int>, and move some
repsonsibilities into it.

This avoids the repeated use of the magic number -1 to indicate
invalid locations and does away with the confusing .first and .second,
replacing them instead with proper names, .position and .index.

Change-Id: If904c5333cecf8ce3d5160ca4be9264a13a2b72a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-03-06 09:19:58 +00:00
Paul Olav Tvete
d5fe06a94e Make uic handle -no-feature-shortcut
Change-Id: I0f8c9fdc8b0fe573443cfc126f21e473544ddcba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-06 09:08:34 +00:00
Oleg Yadrov
f2e103296f QMenu: make wide submenu appear on the same screen with its parent menu
On a multi-display system wide submenu might either appear on wrong
screen or not appear at all (depending on the specific display
configuration).

Task-number: QTBUG-56917
Change-Id: I40013b0bee340a01ae1c08a5e074afa63da4dbfd
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
2017-03-04 05:37:30 +00:00
Oleg Yadrov
ad5565b643 Wide QMenu: fix size and position
This patch fixes 2 issues related to wide menus:
1) Menu took on full screen height when menu width was larger than
screen width;
2) On a multi-display system wide menu might appear on wrong monitor
(not the one where show event was triggered).

The idea is we limit parent menu and all its submenus within the screen
where it was opened.

Note that this patch fixes only geometry-related issues and there are
also some style flaws which need to be addressed (for example, currently
the text does not elide if it doesn’t fit to the menu’s width).

Task-number: QTBUG-56917
Change-Id: I7e9ff4a48bf03060d76e34d33a13ad6cc890c133
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-03-04 00:43:50 +00:00