Commit Graph

29761 Commits

Author SHA1 Message Date
Oswald Buddenhagen
7b4c52c7e6 remove stray dbus/-menu dependency from xcb plugin
amends 26a05fc09 (which in turn was a cleanup of 38abd6537).

Change-Id: I6159a3cfe468db048faf1c396143dd3869f7e72b
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-04 20:21:15 +00:00
Oswald Buddenhagen
72fe67353d rely on module include paths for qpa includes
Change-Id: I9a28a5ec9b0050786c4abc39c6ac298e95cf8fad
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2016-10-04 20:21:09 +00:00
Oswald Buddenhagen
db732a07c0 remove apparently useless egl include
this file does not directly access egl.

Change-Id: I8b52aef9ee3a69a12370c3c6a1f9e2bb23051603
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2016-10-04 20:21:03 +00:00
Oswald Buddenhagen
5976fbf5e0 convert apparently forgotten QT_CONFIG/fontconfig reference to qtConfig()
Change-Id: I69d7247747c6e5a7b29051ba7b86b29c27936e65
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-04 20:20:56 +00:00
Oswald Buddenhagen
9d8f7bcaa1 clean up freetype conditionals
there is no point in testing !win32 explicitly any more, as configure
will take this into account already.

Change-Id: Idfca46feece6451509b405a4afc2b7205667c5bb
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-04 20:20:51 +00:00
Oswald Buddenhagen
57987ad571 fix freetype/fontconfig configure system
convert the ugly config.tests/[...]/freetype.pri file into a custom
callback in configure.pri, and reinstate pkg-config use for freetype.
subsequently, use QMAKE_USE for the actual library references.

this fixes in particular cross-builds, as the new configure was not
passing the necessary information to the test any more, so the old .pri
file misbehaved.

Task-number: QTBUG-54911
Change-Id: I5fc9c254334a2675f7db4d54df4c77637e8e2487
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2016-10-04 20:20:39 +00:00
Oswald Buddenhagen
cd8b7fb865 make QMAKE_USE parameterizable
it's now possible to declare references which don't cause linking (or
cause only linking).

make use of this in the xcb-static library.

Change-Id: Ic429e0a1200b3a333738ea8d8e576ff64b6cac21
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-10-04 20:20:18 +00:00
Oswald Buddenhagen
1e97037ed9 factor out QMAKE_USE* processing to a separate prf file
this makes it possible for features added via CONFIG to use QMAKE_USE*,
as default_post.prf is processed before all features in CONFIG.

Change-Id: Id0812a0fb1aa5e658548bd2bc6003234085545e7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-04 20:20:06 +00:00
Jake Petroules
0059bf944d Don't add -spec XXX more than once to system command in xcodebuild.prf
The "args" variable would contain the original -spec XXX flags in
addition to the -spec macx-xcode passed in the system command invocation
below. The last use of -spec takes effect, so this code was entirely
ineffective. Consequently, uikit/default_post.prf in the nested qmake
call thought it's still the top-level call and thus added xcodebuild
again, which caused an infinite recursion.

Change-Id: Ie98d8a7f3c1cd875f4a4146af9a66a66b48cc6cb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-10-04 18:33:34 +00:00
Eskil Abrahamsen Blomfeldt
4d552815cf Fix plain text QStaticText with line breaks
The layout isn't actually created until endLayout() or setLineWidth() is
called. So in the case where this was not done, the height of the line
would be 0, thus multiple lines would be placed on top of each other, at
y == 0.

[ChangeLog][QtGui][Text] Fixed QStaticText when manually breaking lines
and no text width was set.

Task-number: QTBUG-56346
Change-Id: I7f6ed6260545882f05fe39b21134315eca7401b9
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-10-04 14:30:13 +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
Oswald Buddenhagen
546191b03f fix parsing of -system-proxies
this is, in fact, not the same as --proxies=system, and the old
configure handles this by putting special cases before the catch-all
patterns. we achieve this by trying the verbatim names (of all options,
which is admittedly a tad inefficient) before applying the -qt/-system
transformation.

Change-Id: Ic85a9d76d6e8ca95b2e1b5566f047f4b7ac38b98
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-04 08:26:49 +00:00
Oswald Buddenhagen
0872b62b2e make command line parsing more compliant with configure script
- generic --* options are defined to be booleans, without the
  possibility of having an additional parameter
- -qt and -system options don't exist in the --* form
- --foo=bar options exist only in the --* form

Task-number: QTBUG-55610
Change-Id: Ib0480ac6f479df48045c9de8e854a525862ee363
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-04 08:26:39 +00:00
Oswald Buddenhagen
d01133a7fc remove redundant load(qt_build_config)
every repo's .qmake.conf is expected to do it already.

Change-Id: I87ed75d80493d8f1c4548c5b9dadfdaf07b86d7e
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-04 08:25:40 +00:00
Oswald Buddenhagen
05786de946 remove obsolete module warning
this is a relic from the early times of the modularization.

Change-Id: I9ca46fa6457bf9ca207b6be1f0637f0349569ddf
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-04 08:25:34 +00:00
Oswald Buddenhagen
4a561c6baf remove redundant conditionals regarding ssl
this actually fixes the build when ssl is not enabled, as the openssl
features are in the not included network-private module.

Change-Id: Ibafae9867af493da184a45cf3981628d475d37a6
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-04 08:25:24 +00:00
Oswald Buddenhagen
5a4d469dcb rename configure.exe => configureapp.exe
now that the bat file is responsible for displaying the help in addition
to bootstrapping configure, the exe file should not shadow it any more.

amends c027cffbe.

Change-Id: I5c8a52f59ff455575e646fae55cd214db98a3736
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-04 08:25:08 +00:00
Oswald Buddenhagen
9e048799b8 fix msvc build in dirs with spaces
Change-Id: I2df71cce68e59b8d7565fb43953947a9a84970b3
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-04 08:24:58 +00:00
Marc Mutz
a4fc6a3047 QXmlAttributes: mark as shared-come-qt6
Requires adding a member-swap() function.

Change-Id: I47f9fac84a6f41bb1e487c27fdcf6879b5a771d1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-04 06:25:54 +00:00
Tor Arne Vestbø
e8c8c9fea7 Exclude tst_QSettings::rainersSyncBugOnMac() on all Apple OSes
It fails on iOS as well, and likely also tvOS and watchOS.

Change-Id: Idfce98a5aeccb5680f6b4c6e66b526dd7922156d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-03 21:40:33 +00:00
Marc Mutz
3b5107a118 Speed up compilation of tst_qgraphicsview_2.cpp
Turn the list of newRow() calls into a for loop over a constexpr
data structure.

Fixes the GCC note:

   tst_qgraphicsview_2.cpp:47:13: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without

and speeds up compilation of the file from 13s to 2.5s on my
machine.

Task-number: QTBUG-38890
Change-Id: I4f0b3565c7df64b286d1d32eb3f3d6bf4df92609
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-10-03 14:59:56 +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
Tor Arne Vestbø
c6fa0222e2 Remove QCocoaWindowPointer in favor of QCocoaWindow inheriting QObject
As already done by the iOS, Mir, and Haiku platform plugins.

Change-Id: I449f396dbf234e27206625b178c7d20e3f5b956f
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-10-01 13:12:29 +00:00
Marc Mutz
1bde907a23 QFileSystemNode: simplify three loops over the children hash
In the dtor, simply call qDeleteAll(children) instead of looping
manually.

In updateIcon() and retranslateStrings() replace a manual loop
with C++11 ranged for. At least I only saw 'iterator' everywhere
(who names an iterator 'iterator' instead of 'it'??).

Change-Id: Ib0047dece3c88244bb4364cd4491cd04514a91bb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-30 23:17:02 +00:00
Marc Mutz
8a25006fad QFileSystemModel: add an assert to prevent leaks
Private::addNode() adds the new node to the parent's hash without
checking whether a node already exists. If it does, then the old
node is leaked.

Add an assertion to check for this condition.

Change-Id: Ib949d71c86c28d1152a538756c0efc283c793c24
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-30 23:16:45 +00:00
Marc Mutz
b5662ba603 QFileSystemModel: reuse an existing variable
... to improve readability.

The variable 'oldName' was defined one line up from the same
expression as the RHS of the if, so use the variable instead.

Change-Id: Ifcd119317e8c9594f5280f294bc3301f681b94be
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-30 23:16:18 +00:00
Jake Petroules
156e3981db Reorder arguments to qmake self-invocation in xcodebuild.prf
26d44fce3d added support for passing the
configure options to qmake following a "--" argument. This interacted
badly with xcodebuild.prf as the "args" variable would contain the
standard qmake arguments AND the extra arguments following "--"... which
were placed prior to -spec macx-xcode and the path of the .pro file,
causing them to be ignored and thus qmake to print its usage when
attempting to generate Xcode projects for Qt apps on UIKit platforms.

Amends 6a9f38a11d, which fixed the same
issue inside qmake itself.

Change-Id: I3056bd811c2ce958952fec8e05ddef7a063c0646
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-09-30 18:26:49 +00:00
Allan Sandfeld Jensen
116e7a267e Fix qt_blend_rgb32_on_rgb32_avx2
The order of the arguments to testc was wrong, it should have been the
other way. Replaced with testz to also get rid of setzero.

Change-Id: Iff968c140f9ca34c6bd7c7f04a3623fd8ec42e1c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-09-30 11:41:38 +00:00
Eskil Abrahamsen Blomfeldt
22bf1f28f9 Freetype: Fix wrong line spacing for Courier New
The regular variant of Monotype's "Courier New" font, the one
which is included by default on Windows, has an EBLC table, which
overrides the ascent and descent for certain sizes. The Freetype
engine doesn't automatically respect this, so there is a hack
in place to fetch the correct values for us.

But there were two issues with that code, which lead to us getting
the wrong line spacing for that particular font: The first was that
we did not update the height metric for the font. This is used,
together with the ascent and descent, to calculate the leading of
the font. So when we set the height of text lines in a layout, we
would get a leading based on the height for the scalable font
and the ascent/descent from the EBLC table, and this would not match
up.

Also, as reported elsewhere on the Internet, the descent value in
the EBLC table for Courier New is set to a positive value instead
of a negative one. This must be a bug in the font, so we special
case it and fix the value to avoid bogus line spacing later.

[ChangeLog][Qt Gui][Text] Fixed line spacing with some scalable fonts
containing bitmaps with the Freetype font engine.

Task-number: QTBUG-50090
Change-Id: I95165dde7b8ffac6d7f9ac43baadb3eb75d28abe
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-09-30 10:32:55 +00:00
Marc Mutz
c35eff2ace Add qtest_network.h
... and move toString() implementations there which were repeated in
network tests, or #ifdef'ed in qtest.h.

Since the functions moved from network tests are now in a public header,
had to massage them a bit to pass headersclean:

- replace Q_FOREACH with C++11 range-for
- avoid implicit conversion from QByteArray -> const char* (done by
  re-using toString(QByteArray) instead of calling strdup() manually)

Also made the functions overloads instead of specializations. This
allows to pass the enum by value instead of by const-&.

Like the existing QHostAddress, the newly-added toString() overloads are
marked as \internal. We can decide later whether to turn them into
public API.

Change-Id: I8c23db7a0a6575273567017d42d7b2a957acece8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-09-29 21:46:19 +00:00
Shawn Rutledge
157ee01a8d xcb: when using XI2 for mouse, change state only on press and release
If the mouse event is synthesized from a touchscreen, since we're
using XI2 we've already delivered the actual touch event by the time
an XI_Motion event occurs.  It's bogus to treat the XI_Motion event
as a mouse press merely because XIMaskIsSet pretends that the mouse
button is pressed.  If the QPA motion event says that the button
is pressed, then QGuiApplicationPrivate::processMouseEvent() will
synthesize an extra mouse button event for the press, and another
for the release.

Task-number: QTBUG-56156
Change-Id: I937edfd8cc9aab5b21370036c4b42dc0c0a74b50
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2016-09-29 16:26:37 +00: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
Sune Vuorela
d322ea4e7d Prefer pkg-config for finding libpq
pg_config is a thing of the past, and at least debian stable offers a
pkg-config file for libpq

Change-Id: I582c0a78a77f0ebb0c43e31f04b1ef315786b478
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-09-28 18:29:00 +00:00
BogDan Vatra
87583738f9 moc: support nested q_namespaces
Nested namespaces are quite common, therefore moc should support them.

Task-number: QTBUG-55415
Change-Id: I756cab36d498eb4342b402d255836d5d30f07b30
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-28 16:44:19 +00:00
Oswald Buddenhagen
5dbcced3bf use bindir instead of libdir when launching tools on windows, take 2
this makes build dirs consistent with install dirs, which fixes
launching tests, examples, and build tools in some configs.

unfortunately, this makes prefix builds slower and their build dirs
bigger due to the DLLDESTDIR implementation being stupid (QTBUG-11435),
but i'm not inclined to fix that now. it isn't actually worse than for
non-prefix builds, so whatever.

Task-number: QTBUG-54438
Change-Id: Idbd034620e95cb23f7699d243678c4e9fa6353ac
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-09-28 16:27:59 +00:00
Friedemann Kleint
a456739786 Add note about lifetime of the pointer returned by QClipboard::mimeData()
Explain that it might become invalidated when the clipboard changes.

Task-number: QTBUG-55737
Change-Id: Ic7366901f60647caab44930ab03915fd0c9aba1a
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-09-28 15:42:07 +00:00
Dmitry Shachnev
76746ddab6 QApplication: use desktopStyleKey if styleOverride was invalid
When the application is passed an invalid style option, we should fall
back to the style provided by the platform theme, not to the first
available style.

Change-Id: I59e25b00d4a32221dea7c960d0f4e0068247b2dd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-09-28 15:33:17 +00:00
Liang Qi
e918334045 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/widgets/dialogs/qcolordialog.cpp
	src/widgets/dialogs/qfiledialog.cpp
	tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp

Change-Id: I34bc8a990f8f526889a95a5c7099ef557b9681ad
2016-09-28 11:51:35 +02:00
Edward Welbourne
cf0119bb69 syncqt.pl: fix a few misguided regexes to match .h file names
To match correctly (only) .h files, a regex needs to end in \.h$
Some of them missed the \, one missed the $.
(The last also had a legitimate .* before its misunescaped .)
One pair matched _p.h and _pch.h, which could be combined.

Change-Id: I7539a28eb7017cd0f1b36c72e05108e03a68a952
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-09-28 04:56:56 +00:00
Marc Mutz
da2c73ad2b Plug memleaks in tst_QWidget
We need to delete the style returned from QStyleFactory::create()
ourselves, so put them into a QScopedPointer.

The alternative would have been to create this once, as a member
of tst_QWidget, but this is the minimal approach that ensures
behavior just as the old code, but without the leak.

Change-Id: I527f1031c57be6f05942f4acc057e7dae1af2571
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-28 04:56:48 +00:00
Marc Mutz
24314c73ae QTapAndHoldGestureRecognizer: Fix several UBs (invalid cast) in recognize()
As found by UBSan:

  qstandardgestures.cpp:511:67: runtime error: downcast of address 0x7ffc9beb1b90 which does not point to an object of type 'QTouchEvent'
  0x7ffc9beb1b90: note: object is of type 'QPlatformSurfaceEvent'
   fc 7f 00 00  08 93 b1 6f f5 2a 00 00  00 00 00 00 00 00 00 00  d9 00 ec 9b 00 00 00 00  49 01 c1 5e
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QPlatformSurfaceEvent'
    #0 0x2af55edfa66a in QTapAndHoldGestureRecognizer::recognize(QGesture*, QObject*, QEvent*) qstandardgestures.cpp:511
    #1 0x2af55ee3d9bb in QGestureManager::filterEventThroughContexts(QMultiMap<QObject*, Qt::GestureType> const&, QEvent*) qgesturemanager.cpp:276
    #2 0x2af55ee4565b in QGestureManager::filterEvent(QWidget*, QEvent*) qgesturemanager.cpp:512
    #3 0x2af55ee53945 in QGestureManager::filterEvent(QObject*, QEvent*) qgesturemanager.cpp:556
    #4 0x2af55ea1b83a in QApplication::notify(QObject*, QEvent*) qapplication.cpp:3053
    #5 0x2af573949d0f in QCoreApplication::notifyInternal2(QObject*, QEvent*) qcoreapplication.cpp:988
    #6 0x2af56982ff94 in QCoreApplication::sendEvent(QObject*, QEvent*) qcoreapplication.h:231
    #7 0x2af56982ff94 in QWindowPrivate::create(bool) qwindow.cpp:435
    #8 0x2af55ecd10fe in QWidgetPrivate::create_sys(unsigned long long, bool, bool) qwidget.cpp:1471
    #9 0x2af55ecc770e in QWidget::create(unsigned long long, bool, bool) qwidget.cpp:1333
    #10 0x2af55ed80618 in QWidget::setVisible(bool) qwidget.cpp:8156
    #11 0x4feec4 in tst_QWidget::touchEventsForGesturePendingWidgets() tst_qwidget.cpp:9824

  qstandardgestures.cpp:512:67: runtime error: downcast of address 0x7ffc9beb1b90 which does not point to an object of type 'QMouseEvent'
  0x7ffc9beb1b90: note: object is of type 'QPlatformSurfaceEvent'
   fc 7f 00 00  08 93 b1 6f f5 2a 00 00  00 00 00 00 00 00 00 00  d9 00 ec 9b 00 00 00 00  49 01 c1 5e
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QPlatformSurfaceEvent'
    #0 0x2af55edfaa19 in QTapAndHoldGestureRecognizer::recognize(QGesture*, QObject*, QEvent*) qstandardgestures.cpp:512
    [... skipping common lines ...]

  qstandardgestures.cpp:514:95: runtime error: downcast of address 0x
  0x7ffc9beb1b90: note: object is of type 'QPlatformSurfaceEvent'
   fc 7f 00 00  08 93 b1 6f f5 2a 00 00  00 00 00 00 00 00 00 00  d9 00 ec 9b 00 00 00 0
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QPlatformSurfaceEvent'
    #0 0x2af55edfa966 in QTapAndHoldGestureRecognizer::recognize(QGesture*, QObject*, QEvent*) qstandardgestures.cpp:514
    [... skipping common lines ...]

The problem is that the casts are done outside the switch that
determines the event's type, so for any given event object, at least
any two of the casts are invalid.

This could actually be a real problem, because it's trivial for a
compiler to prove that these three lines unconditionally invoke UB, so
it has all the right in the world to decide to drop the complete rest
of the function, using this line of reasoning:

1. The only way for these three casts not to be UB is if event ==
   nullptr.

2. If event == nullptr, then event->type() invokes UB, so event cannot
   be nullptr.

3. The only way both can be true is if this code path is never
   taken. I can thus assume that

      object == state && event->type() == QEvent::Timer

   is always true, drop the check and execute the if block
   unconditionally (I need to call QEvent::type(), to satisfy the
   as-if-rule, but I needn't check its return value).

Fix by moving the casts where they belong: into each case of the
switch, where the type of the event has been checked to match the
target type of the cast.

Change-Id: I3aee8e213dc19d2f51636bcc5221cc92b3142e58
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-28 04:56:44 +00:00
Marc Mutz
c65621b362 QWidget: Fix UB (invalid cast) in sendResizeEvents()
Found by UBSan:

  qwidget.cpp:5228:62: runtime error: downcast of address 0x61b00003d480 which does not point to an object of type 'QWidget'
  0x61b00003d480: note: object is of type 'QMainWindowLayout'
   bc 00 00 75  90 2e 2a 78 4f 2b 00 00  40 c1 02 00 f0 60 00 00  78 2f 2a 78 4f 2b 00 00  00 00 00 00
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QMainWindowLayout'
    #0 0x2b4f70efb1c2 in sendResizeEvents qwidget.cpp:5228
    #1 0x2b4f70f65f7f in QWidget::grab(QRect const&) qwidget.cpp:5252
    #2 0x6b1746 in tst_QWidget::render_task188133() tst_qwidget.cpp:6615

Fix by performing the cast only after the test for isWidgetType() has
succeeded.

Change-Id: I061a60ef35bcb5fbefb9bc7b84706c9dd5afd207
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-28 04:56:39 +00:00
Marc Mutz
5571d2bf62 tst_QApplication: Fix UBs (invalid cast) in focusMouseClick()
Found by UBSan:

  tst_qapplication.cpp:1754:48: runtime error: member access within address 0x7ffda11f2220 which does not point to an object of type 'SpontaneousEvent'
  0x7ffda11f2220: note: object is of type 'QMouseEvent'

The code attempted to model the layout of a QEvent with another class
that allows public access to the memory location that (hopefully)
corresponds to QEvent::spont, gaining access by casting a QEvent
object to that specifically-crafted class.

Fix by the using the existing QSpontaneKeyEvent::setSpontaneous()
call, which, despite its name, works for all QEvent subclasses, and
which has already been fixed to not invoke UB (in bc087db).

Change-Id: I7db8b8a8a823f7d61ab17375142d19dc3874fea5
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-28 04:56:34 +00:00
Palo Kisa
b9e4206726 QGraphicsAnchorLayout: Fix invalid use of Q_AUTOTEST_EXPORT
The Q_AUTOTEST_EXPORT is defined in all cases. So usage as #if
defined(Q_AUTOTEST_EXPORT) was wrong.

Change-Id: Ia1c1526ad08fdfa35ca773d7c62f8bbba39a6d38
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-09-27 21:40:21 +00:00
Tor Arne Vestbø
8a2557fbb7 Pick up changes to device-pixel-ratio in QRasterBackingStore
Regression from 2d2d9078, which assumed the code in QBackingStore::beginPaint
would apply to macOS as well, but QHighDpiScaling::isActive() is only active
when Qt does the high DPI scaling, so we never hit the resize() code-path.

Adds backingStore() accessor to go from QPlatformBackingStore to QBackingStore.

Change-Id: I5de2ade74e731df445ea22e0f49b2a121e678efe
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-09-27 20:59:14 +00:00
Tor Arne Vestbø
aaf16b2f43 UIKit: Document the history and implementation of QIOSBackingStore
Change-Id: Icca393afa84bc7dae7f28669a3e73268ffed68b7
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2016-09-27 20:59:09 +00:00
Allan Sandfeld Jensen
bf76405afc Extend tested formats in lancelot
Adds two formats that does not have optimized code-paths in qdrawhelper
to ensure the generic path has coverage.

This has already uncovered one bug fixed before this patch could go in.

Change-Id: I0e0a1a873555b27f6438f69a76982b8e06263dcf
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-09-27 17:26:03 +00:00
Andreas Wilhelm
cd78457c6d qdbusxmlparser: Enabled error output
Implements behavior for the --verbose switch already specified
but never implemented. Without this switch you would have to rebuild
qdbusxml2cpp to see error output. Using -V will now produce error output such as:

dbus.parser: unknown token "" "Characters"
dbus.parser: Invalid D-BUS interface name 'com.qt-project.dbus' found while parsing introspection
dbus.parser: unknown token "" "Characters"
dbus.parser: skipping unknown element "method"
dbus.parser: xml error "Opening and ending tag mismatch." doc "..."

Task-number: QTBUG-34126
Change-Id: Ie5b7ec78007ddc305b1e7ddbffb1436920721c9c
Reviewed-by: Rolf Eike Beer <eb@emlix.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-27 15:48:45 +00:00