Revised some toFloat()s to be consistent with the matching
toDouble()s; previously, they would return infinity if toDouble() did
but return 0 if toDouble() got a finite value outside float's range.
That also applied to values that underflowed float's range, succeeding
and returning 0 as long as they were within double's range but failing
if toDouble() underflowed. Now float-underflow also fails. Amended
their documentation to reflect this more consistent reality.
Added some tests of out-of-range values, infinities and NaNs.
[ChangeLog][QtCore][toFloat] QString, QByteArray and QLocale returned
an infinity on double-overflow (since 5.7) but returned 0 on a finite
double outside float's range, while setting ok to false; this was at
odds with their documented behavior of returning 0 on any failure.
They also succeeded, returning zero, on underflow of float's range,
unless double underflowed, where they failed. Changed the handling of
values outside float's range to match that of values outside double's
range: fail, returning an infinity on overflow or zero on underflow.
The documentation now reflects the revised behavior, which matches
toDouble().
Change-Id: Ia168bcacf7def0df924840d45d8edc5f850449d6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
They actually return infinity if conversion overflows, while still
setting ok to false; they were documented to return 0 on failure, with
no mention of this special handling of overflow. Documented reality
rather than changing the behavior. Gave underflow as an example of
failure other than overflow (toDouble()s do indeed fail on it).
Added some tests of out-of-range values, infinities and NaNs.
[ChangeLog][QtCore][toDouble] QString, QByteArray and QLocale return
an infinity on overflow (since 5.7), while setting ok to false; this
was at odds with their documented behavior of returning 0 on failure.
The documentation now reflects the actual behavior.
Fixes: QTBUG-71256
Change-Id: I8d7e80ba1f06091cf0f1480c341553381103703b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
A couple of QLocale tests were using setlocale twice to provide a
transient locale tweak in tests; however, if the test in between
fails, that can leave the program running in the "transient" locale
after. So implement a proper class whose destructor ensures the
transient is tidied away. Also change the locale in use by one of
these transient changes: it purported to be checking things didn't
depend on locale, but was using the same local as most of the
test-cases for its test.
Change-Id: I0d954edcc96019a8c2eb12b7a7c568e8b87a41d5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The qCompare() implementation for double was handling infinities and
NaN the way tests need, but the one for float didn't; it has just the
same need, so apply the same fix. Extends 79493a3ee1.
Change-Id: I8425026acb61d535e449f579b77fdcd609157f7c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
PasteboardGetItemCount() can return -1 as result to unsigned variable,
so the further loop will iterate "forever". Return early to avoid hang.
Change-Id: Ie91dba1c193d04513f0496d20bd0b6b0b5b6c151
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
It was previously using 50ms steps, which was a bad choice for client
code whose total time-out was comparable to 50ms or less. Reduce the
time-step so that we loop several times within the timeout (but make
sure it's never zero, by adding 1ms).
Change-Id: I0428a7741c0741dfb312e40ae1eda900050195ab
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
We had a global static, a setter for it (that's nowhere used within Qt
code) and a getter for it whose only use was commented out. Neither
was declared in any header; the getter's commented-out client had a
local extern declaration at the point of (non-)use.
Found while reviewing a change to the next few lines of code after the
commented-out use of the getter.
Change-Id: I393d56219cb7dd7cf836ca80e1bdd605a2914003
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
The function's documentation needlessly repeated parts of its first
line. The BindFlag enum it takes as a parameter confused readers by
saying an option is ignored on Windows, failing to make clear that it
is so because that option is what Windows does by default.
Tidied some phrasing and typos in the process.
Fixes: QTBUG-52364
Change-Id: Ia6510caff7ec80216eefccf41fb009b1357e4b2e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
When calling setDocument (directly or through the constructor) a delayed
rehighlight is initiated. Previously, if any text was changed before
this rehighlight could run it would cancel the rehighlight, even if the
changed text only caused a new block of text to be highlighted.
Fixes: QTBUG-71307
Change-Id: Ib09b664d90906f5b4427105f0e45469806f3a779
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Also clean up QTextCodec usage in qmake build and some includes
of qtextcodec.h.
Change-Id: I0475b82690024054add4e85a8724c8ea3adcf62a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
[ChangeLog][Documentation] Fixed the icons for the "file save" action
that were inaccurate representations of a 3.5-inch floppy disk (the cut
edge was on the wrong side). Now all floppy representations are
physically accurate.
Change-Id: Ia3b27ae12a1a4fefa3b7fffd155bb86fee5271c3
Fixes: QTBUG-71012
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
AR and NM have different tools when LTCG is used,
override those also when cross compiling.
Fixes: QTBUG-71595
Change-Id: I5347bd1874688dd89395c50ff6dd08fb1c0ebab1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Opt out of switching between the normal and OpenGL based flush paths.
Once a QOpenGLWidget or QQuickWidget becomes visible in a window, the
window contents will be composed using OpenGL from that point on, even
if said widgets become invisible afterwards. Now that Qt Creator does
not rely on QQuickWidget the issue is less burning anyways.
Task-number: QTBUG-68329
Change-Id: I177e6e6094ee06ea26d8d0343bd3d84aadfa5913
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
If QT_QPA_EGLFS_HIDECURSOR was enabled, m_deviceListener was never
initialized, which caused segfault in the destructor.
Task-number: QTBUG-71507
Change-Id: Id8b17f5312073249cd12995317213fd746753521
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
When we try to gracefully destroy a QOpenGLVertexArrayObject it is not
possible to create an QOffscreenSurface from a thread that is not the
GUI thread. In this case we just need to bail out instead.
The side effect that was seen previously was that there would be a
warning and a deadlock on Windows when closing QQuickWindows that
contained a QQuickPaintedItem backed by a FrameBufferObject render
target (which would be using the OpenGL paint engine) when using the
threaded render loop.
Task-number: QTBUG-70148
Change-Id: I4a20d74d9af850bb90d243212ad9f65c3fc9e616
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
QPointer uses QWeakPointer / QSharedPointer internals in QObject and has
the code to make sure two threads won't stomp on each other if both try
to create a QPointer for the same QObject at the same time. The
threading code was fine, but had a mistake in the clean up code for the
loser thread: the QtSharedPointer::ExternalRefCountData destructor has a
Q_ASSERT for the state of the reference counts. So we need to set the
state correctly before calling the destructor.
But we don't want to do it in case the Q_ASSERT compiled to nothing. So
we use a hack that violates the Second Rule of Q_ASSERTs: don't do
something with side-effects. This way, we can insert code that will only
be compiled if Q_ASSERTs do something, without having to duplicate the
preprocessor conditions from qglobal.h.
Fixes: QTBUG-71412
Change-Id: I1bd327aeaf73421a8ec5fffd1560fdfc8b73b70c
Reviewed-by: Romain Pokrzywka <romain.pokrzywka@gmail.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
"xcb_randr_get_screen_info" can be slow and in some configurations can
cause short mouse cursor freezes (which will happen on Qt application
startup).
Initial screen rotation was used only to not handle possible redundant
screen change event.
Fixes: QTBUG-70760
Change-Id: I9f01325a045d2c82c4dd2fce91a18a34e54a4bcd
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
We want to inform the user when they have upgraded their Xcode version
and hence have a new SDK version, which requires a complete rebuild.
Explicit changes to the Xcode selection (be it via xcode-select or
$DEVELOPER_DIR) do not affect the existing build directory, so we must
record the Xcode selection inside the build to avoid false triggering.
Change-Id: I7d13da1232226712a4951e8a360cf4b634c6fa2f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
If a tooltip was shown on an application modal dialog then it would end
up blocking mouse events to the dialog while the tooltip was visible.
Since tooltips are special in this case, they should not cause mouse
events to be blocked.
Fixes: QTBUG-65599
Change-Id: Ibf1729ca4942f5854e4f9687c5586382e23c1c31
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The AMD FirePro dual gpus on the Mac Pro have a problem with offline
renderers in Chromium. Therefore, Chromium and thus Qt WebEngine
disable this option via the pixel format attributes.
The Qt Cocoa plugin on the other hand enables it in the recent versions,
causing context creation in Qt WebEngine to fail when run on a Mac Pro
with dual AMD FirePro gpus due to incompatible context options.
This patch uses the environment variable QT_MAC_PRO_WEBENGINE_WORKAROUND
which is set by Qt WebEngine upon application startup if the application
is running on a late 2013 Mac Pro. It should typically not be set from
anywhere else.
[ChangeLog] Offline renderers will be disabled when the application is
using Qt WebEngine and running on one of the late 2013 Mac Pro models.
Fixes: QTBUG-70062
Change-Id: I0b0831efb6f4073ebd37672040aaed6370853fc0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Some Linux distributions patch OpenSSL's soname, making builds
on such distributions not deployable elsewhere. The problem is that
the code loading OpenSSL symbols would attempt to use the soname
of the build machine, and therefore not finding the OpenSSL
libraries on the deploy system.
The binary builds of Qt for Linux are affected by this problem,
as they build under RHEL7.4 which changes to soname of OpenSSL to
a non-standard string. This makes the binary builds not pick up
OpenSSL 1.0 from the machine where the build gets installed on.
Given that in the pre-1.1 versions only the 1.0 series is supported,
bump the minimum requirement of Qt to that. The 1.0.x releases
(up to 1.0.2, at the time of this writing) have kept binary
compatibility, and advertise a soname of "1.0.0", which is used
by most distributions.
So, if loading of OpenSSL with the build-time soname fails,
try to load them with the "1.0.0" hardcoded soname.
[ChangeLog][QtNetwork][SSL] OpenSSL >= 1.0 is now required to build
Qt with OpenSSL support.
Task-number: QTBUG-68156
Change-Id: Ieff1561a3c1d278b511f09fef06580f034f188c6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The event dispatcher can be null already but we may have outstanding
QWinEventNotifier objects (like in a QProcess).
Patch-By: Tamas Karpati
Task-number: QTBUG-70214
Change-Id: I5e432e273def425ea334fffd154f34abfd6cb11a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
[ChangeLog][Third-Party Code] PCRE2 was updated to version 10.32.
Change-Id: Id3bf7df0003f626cd1135d0508a5a489ff02f1e5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
A file with the correct QPicture magic bytes, but shorter than a full
QPicture file header, could cause the header decoder to access memory
out of bounds. Add a size check to avoid.
As a driveby, generally harden the parsing against malformed files.
[ChangeLog][QtGui][QPicture] Fix crash reading malformed picture file
Task-number: QTBUG-71208
Change-Id: I86eb1f915ca9b3a4b91c7433036d76ed6061e2f0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Commit b7887f9b4f removed this explicit
disabling because it shouldn't be needed anymore. Turns out it was, as
new Android SDK do include modern Linux headers and those define the
structs and constants needed for statx().
Repeat of 8eb3944dac.
Task-number: QTBUG-64490
Fixes: QTBUG-71200
Change-Id: If7e743cf8476463880ccfffd155e6d5c2b5a3da9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Removing the extra space before -MT ensures that the vcxproj
generator gets valid input.
Change-Id: Iccf88c5fc4473db406d714b646185a4fb60a3418
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
The script taken here is a QChar::Script, not a
QFontDatabase::WritingSystem. This means it was passing QChar::Unknown.
Change-Id: I919ae7187ba277346a7719116a94776dce24dd84
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
The pdf engine uses a resource file, but Q_INIT_RESOURCE() was lacking.
Task-number: QTBUG-71070
Change-Id: I685961b3f2eea0ffe6b5313c72d504a8ad9a98e5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Those system calls are present in glibc 2.28. Instead of using
syscall(3) to place the system calls directly, let's use only the glibc
functions. That also means we no longer accept ENOSYS from either
function, if they were detected in glibc.
Change-Id: I44e7d800c68141bdaae0fffd1555b4b8fe63786b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
The remaining diff to clean 1.6.35 is archived in the qtpatches.diff file.
[ChangeLog][Third-Party Code] libpng was updated to version 1.6.35
Change-Id: I925b3d95f6da20e12fc3274b4713e3fea05094f7
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
According to the Khronos documentation, gbm_surface_create() will give
a BAD_MATCH error if the format does not match the EGL_NATIVE_VISUAL_ID.
Newer drivers have started to enforce this.
Change-Id: I61360b0f52965ad8057e7de8f824ffca64fea904
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
If you, directly after connecting, call "ignoreSslErrors()" followed by
"resume()" then you will most likely crash.
It is very contrived and there's no reason to do this.
Change-Id: I949a303238f5012296d0e84eb76173764eb9de2e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
It has had some changes and should be kept up to date.
Fixes: QTBUG-70386
Task-number: QTBUG-70852
Change-Id: I868a558811c34cf5a800c3087a0ca96e7fb49b1a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Modal sheets are supposed to appear below the toolbar if a toolbar
exists, or below the title bar if a toolbar doesn't exist.
In the unified title and toolbar mode, sheets should to appear
directly below the toolbar, if the toolbar is positioned at the
top of the window.
Code-wise we achieve that by calling setUnifiedTitleAndToolBarOnMac on
a QMainWindow, which results in adjusting the top content border of
the NSWindow via [NSWindow setContentBorderThickness:forEdge], which
Cocoa uses to position a modal sheet (the sheet top edge is aligned
with the top edge of the content view + the Y border thickness
value).
The issue is that because NSWindow.titlebarAppearsTransparent is set
to YES, for sheet presentation purposes, Cocoa considers the content
view to begin at the position of the top left corner of the
frame (where the title bar is), and thus sheets appear somewhere
in the middle of the unified toolbar.
To fix that we need to account for the title bar height in the
border thickness value.
Compute the title bar height from the window frame height - window
content view height, and add it to the top border thickness value.
Amends 8ac9addd94
Change-Id: Icf85c513035cc3710b438e60eb14dc04c5bbaced
Fixes: QTBUG-65451
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>