An if with no side-effects in its test and an empty body is a no-op.
An else block with nothing but a no-op in it is a no-op.
A no-op without even pedagogic value is just a distraction.
Change-Id: I224831a325e6b770d0a99d726d96f73da4b8c11f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Three checks of the same #if managed to save repetition of (if I felt
charitable) three shared lines, compared to combining the three into
one, which leaves the code easier to read (and obviates the need for
one of the "shared" lines). Split a long line while moving it.
Change-Id: I762d10ae1df1224c749206b8eb490bafd7ea4900
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Having a variable in which to store a function's return in two
branches of a switch in order to return if either was true saved
little relative to just testing the function in each case and
returning in situ, which reads more clearly.
Change-Id: Ibd95a95721eaa6fc4861b10e723038b96caf269a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
access\qnetworkfile.cpp: In member function 'void QNetworkFile::open()':
access\qnetworkfile.cpp:69:93: error: invalid use of incomplete type 'class QDateTime'
headerRead(QNetworkRequest::LastModifiedHeader, QVariant::fromValue(fi.lastModified()));
Task-number: QTBUG-45925
Change-Id: I61ff67f9691fe7b6966353e29eeb03d37590d78d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
An empty read or a failed write on the underlying QIODevice of the text
stream would lead to an early return where we wouldn't correctly restore
the QIODevice::Text flag of the io device.
Change-Id: I5b632f45dea6ede3f408113556c3dad1b96574e2
Task-number: QTBUG-47176
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Define WINVER, _WIN32_WINNT as 0x501 (Windows XP) in qt_windows.h.
Remove definitions of the same/lower versions and unneeded
definitions in other places. Remove definition for Borland compiler.
Task-number: QTBUG-51673
Change-Id: I2a344a7f7cf78b2afbf45dcdf8bf2a19b93f0a07
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This change adds support for BackgroundRequestAttribute to local file request. It is useful
when opening files located in network drives where the file open operation could take several
seconds to complete. When this attribute is activated the QNetworkAccessManager::get call
returns the reply immediately and the user has to wait until QNetworkReply::finished signal
is emitted or QNetworkReply::isFinished function returns true.
Task-number: QTBUG-45925
Change-Id: Ie2019dd94fe04253d1ef6874811d7e749a5aad93
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Found by UBSan:
src/testlib/qtestspontaneevent.h:95:38: runtime error: member call on address 0x7ffc33019650 which does not point to an object of type 'QSpontaneKeyEvent' 0x7ffc33019650: note: object is of type 'QMouseEvent'
83 2b 00 00 98 e8 fa 8e 83 2b 00 00 00 00 00 00 00 00 00 00 02 00 04 00 00 00 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QMouseEvent'
src/testlib/qtestspontaneevent.h:95:38: runtime error: member call on address 0x7ffc330196e0 which does not point to an object of type 'QSpontaneKeyEvent' 0x7ffc330196e0: note: object is of type 'QKeyEvent'
00 00 00 00 f8 e8 fa 8e 83 2b 00 00 00 00 00 00 00 00 00 00 07 00 04 00 00 00 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QKeyEvent'
Fix by providing setSpontaneous() on QEvent as a private function and
befriending QSpontaneKeyEvent. Make setSpontaneous() always-inline to
avoid BiC between 5.6.0 and 5.6.1.
Change-Id: Ic60d82ed6a858f4f13f41fa3d2d1db6e808896b7
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This is now maintained in qtwebengine module.
Change-Id: Id468be297dfd0a28920fb92d4ba793ff3d3ceab2
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
With the introduction of QtInfoMsg in commit ef6279fd we also changed
the mapping of Qt to slog2 levels: QtInfoMsg now ends up as SLOG2_DEBUG1,
instead of SLOG2_INFO. Anyhow, we didn't change the default buffer
verbosity level accordingly.
Task-number: QTBUG-51378
Change-Id: Ia464f9e5a31e19413902e877d4f2be0ba6d340db
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Janne Koskinen <janne.p.koskinen@theqtcompany.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
all platform plugins are supposed to start with a q.
Change-Id: I4871cc553995aa68a09f8f045bdd378f5022cd87
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com>
this fixes static builds by ensuring that all dependencies are exported.
Task-number: QTBUG-51071
Change-Id: Icbce502dcbcb4d4b4d922c42679f44e2cc930bf3
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This reverts commit 40cbf1927b -
the qmake parser bug this worked around has been fixed.
As a side effect, the platform conditionals were simplified.
Change-Id: Ibfc1253e3c2252ab954c725a9effd6e719cb691c
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
this is necessary for:
- generating -rpath-link arguments when link_prl is not used. link_prl
is enabled by default, so this has no effect on most projects.
- deployment purposes, which is hypothetical as of now.
Change-Id: I9e629f3eef93c4edf12efc016ecc27dbe2186d61
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
The centralized one (in QFontDatabase) does the job.
Change-Id: I33def7a7bcddeaa62b904d8812321a7f4648a9d0
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
The glyph for the ellipsis could be absent in the main font, so we should
try to find it in a fallback font; otherwise fall back to "...".
Change-Id: Ic53060ed42f3c800aba055d2be2a1c7c3cfeec64
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
"ssl" should be defined when "openssl" is defined, and WinCE should
default to autodetection of OpenSSL.
(cherry picked from commit f2fbee5134)
Change-Id: I9110b245d66fac233eb2bfe89b26cb34cee3e291
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Some consumers of wheel events need to know if the
scrolling direction is inverted in order to provide
consistent behavior.
For example, the scrolling direction of a horizontal
slider should not change when the user toggles the
"natural scrolling" setting on OS X. In this case
the inverted bit will change state and the slider
can compensate.
This change adds a bit to QWheelEvent and sets it
on OS X.
Task-number: QTBUG-35972
Change-Id: I221435dea45d436d570b113bd0e24ee6f6832211
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Found by UBSan:
src/widgets/util/qcompleter_p.h:130:8: runtime error: load of value 249, which is not a valid value for type 'bool'
Change-Id: I0529e54e17a6f4d6add91786a2d5687f2d043531
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Found by UBSan:
src/printsupport/kernel/qplatformprintdevice.cpp:370:10: runtime error: load of value 196, which is not a valid value for type 'bool'
Change-Id: I184e5bf5e4917eeb492b54fe87950bcf03421887
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Before this patch, using setDefaultDropAction on QListView in icon mode
would not have any effect. Now the drag behaves properly.
The default action is set to CopyAction rather than IgnoreAction to
keep the current behavior and avoid breaking user code.
[ChangeLog][QtWidgets][QListWidget] Fixed a bug that caused
the default drop action to be ignored when using icon mode.
Task-number: QTBUG-15741
Change-Id: I49654cde382af344ffc4594699303c928e27e05d
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
A receiver of TouchUpdate and TouchEnd events is determined either
as a widget which has an implicit grab for the touch point or as a
visible widget if there are no implicit grabs. The events are sent
if the receiver has accepted TouchBegin event or if it is subscribed
to a gesture. Before sending the events to the widget they are
delivered to the gesture manager. Thus, in order to detect gestures
for the widget, it must own an implicit grab or be a visible widget.
It can happen that the parent widget is subscribed to a gesture, but
doesn't accept TouchBegin event, as in the case of QScrollArea. Then it
will not get an implicit grab and gesture detection will be impossible.
Activate an implicit grab for such widgets. Also don't send TouchUpdate
and TouchEnd to them, because it's against the documentation.
Task-number: QTBUG-43277
Change-Id: Id767583991def6d76c48ad15eb39af822cad115d
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
When connection or login fails, the ODBC SQL driver was leaking memory.
This bug has been present since Qt 4.8 and up.
Task-number: QTBUG-51334
Change-Id: Ie17f3d575a08d47e047a65d1b30af9ce0789b2d0
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
These have been wrong since being introduced in 5.3.
Change-Id: I5b4aa198c8d4c6726f1c5097abe8d43275722dab
Reviewed-by: Ljubomir Papuga <ljubomir.papuga@imgtec.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Reported by UBSan:
src/gui/text/qfontengine_ft.cpp:1079:54: runtime error: null pointer passed as argument 1, which is declared to never be null
The default-constructed QScopedArrayPointer is not
reset() in every code path. In fact, in the code
path leading to this memset, the only reset() call
is in the if block right above it, so move the
memset into the if block.
Change-Id: I1f793c313ca56f3315c6bdd55456cb025cafc089
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
The fix for QTBUG-50199 involves adding an undocumented enum value
which can be returned from QWheelEvent::phase(). This will be quite
unexpected for applications that use it, which work fine with 5.6.0
and then start receiving this new phase value in 5.6.1. So it should
not happen by default. Set the env variable
QT_ENABLE_MOUSE_WHEEL_TRACKING to enable this functionality.
In 5.7 it will be default behavior. But in 5.6 the default
behavior is as it was before: if you use a conventional mouse wheel,
the phase stays at ScrollUpdate continuously.
[ChangeLog][QtCore] QWheelEvent::phase() returns 0 rather than
Qt::ScrollUpdate when the wheel event comes from an actual
non-emulated mouse wheel and the environment variable
QT_ENABLE_MOUSE_WHEEL_TRACKING is set. In Qt 5.6, this is required
to enable the fix for QTBUG-50199.
Change-Id: Ieb2152ff767df24c42730d201235d1225aaec832
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
X screen corresponds to Qt virtual desktop, and RandR output
corresponds to QScreen. There can be more than one X screen,
so we need a way to get the number of X screen for QScreen,
in particular for the right implementation of some methods
in QX11Info.
Change-Id: Ib5e38703bf11ae08bb283f26a7b7b15f1a5e8671
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
GCC 6 is able to identify member functions that are unused.
Remove them.
Change-Id: Ic77548164b38a1cd3c957d2c57a5bccb979bc02e
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The new version broke the build again
-> fix it again.
(cherry picked from commit af2f3bde48)
Change-Id: Ifcc33fbd9f7d7e98901de5130a67501ba19d9895
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
There is no way to add fonts to the system font collection with
DirectWrite. Instead you have to write custom collections. But
that would mean keeping two instances of the same font data in
memory since we are already registering them for the GDI engine,
and we have no way of knowing which engine will be used. When
we at some point replace the GDI engine completely, we could
implement this in the proper way, but for now, instead of looking
up the equivalent to the LOGFONT in DirectWrite's system font
collection, we look it up using GDI and then convert the HFONT
to DirectWrite.
[ChangeLog][Windows][Text] Fixed disabling hinting for application
fonts, e.g. when automatic scaling by device pixel ratio is in
effect.
Task-number: QTBUG-18711
Change-Id: I5c1365ab956dfa23d4d687877d7440473ee03bb0
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
GetLastError() does not return the correct error code for the
DirectWrite functions, they are returned by the function itself.
Task-number: QTBUG-18711
Change-Id: I3931f58bb29a5f2dc4a5aa911ff16a873267d185
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
QUtf8::convertToUnicode() contains a SIMD-enabled
ASCII fast-path already which is likely faster
than what the compiler will emit for the old code
here.
Change-Id: I6afae9689424eb53a9f7c01359cc4f57ffcead26
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
iOS cannot do runtime feature detection, and querying the CPU is only
allowed in kernel mode (or beyond), so we have to decide the features
at compile time, in which case we might as well use the fallback code
path that uses the built in __ARM_* macros to point out which features
are supported, instead of hard-coding the features for iOS.
Change-Id: Ie507c0d8e962a7bdab16508c8b8122645276512e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
They seem to cause crashes on Windows 7 and 8.
Change-Id: I6e91a195077313610a79358d6787ed211357b56a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>