The definitions of size_t and ptrdiff_t ([support.types.layout] p2 and
p3 respectively) do not specify that they need to be as big as a
pointer. They just need to be big enough to hold the size of the largest
object and the biggest array subscript, respectively, the platform
supports (e.g., 16-bit DOS would have them as 16-bit in all memory
models, except huge).
But we depend on them actually being the size of a pointer in many
places, such as in QArrayData::offset, that stores the linear distance
from the end of the structure to the beginning of the data, wherever it
is in memory.
It's also a good idea to verify that qptrdiff and qssize_t are the same
type.
Change-Id: I9ad33fff8b634979bdbafffd14bbd1223afc58e8
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
QRingBuffer::read() implements the same loop.
Change-Id: I480fe07e2400dfaee560f22bdbf07d6cdd013eb2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This patch implements an iterator that returns a pair containing both the
key and the value of an entry in QHash/QMap.
[ChangeLog][QtCore][Containers] Added an stl-like iterator to go through
QHash/QMap returning both the key and the value of the element pointed to.
That lets QHash/QMap interoperate better with stl's algorithms like
std::set_union.
Change-Id: Idbf8a8581510b3493648c34ab04c556de9fa4aa7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This variable was introducing during Qt 5.0 Q{Gui}Application
refactoring days (2011 or even before) and since then has been
used interchangeably with QGuiApplicationPrivate::mouse_buttons.
This patch removes the duplicate member variable as it is
redundant and could be a source of potential errors.
Initially I was thinking that ::buttons might be used for
the purpose of QTestLib, but it is not. QTestLib delivers
mouse events directly via qApp->notify() (mouse button state
is update via QGuiApplicationPrivate::mouse_buttons from notify()),
or via window system interface QWindowSystemInterface::handleMouseEvent
(which goes through QGuiApplication::processMouseEvent).
Looking at QGuiApplication, it is clear that ::buttons
and ::mouse_buttons always have the same value, as there
is only one assignment to these members in QGuiApplication:
mouse_buttons = buttons = e->buttons;
And there are no other places that would assign to
QGuiApplicationPrivate::buttons.
Change-Id: Ib60d366bf056a98b15bb4538a569693e7bd022e2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Replace the "hard-coded" fusion_arrow.png with qt_fusion_draw_arrow()
that scales appropriately on high DPI screens.
Task-number: QTBUG-40277
Change-Id: I2c4a134de757a39d7744977bd41accff69810521
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The sub-menu arrow indicator is still tiny. The Fusion style uses
a pre-made pixmap (fusion_arrow.png) for drawing the various arrow
indicators for sub-menus, spinboxes, combo boxes, scrollbars etc.
This will be addressed in a separate patch.
Task-number: QTBUG-40277
Change-Id: Id82c564340854e922b3b5f5bcf038ec535ed6cf4
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Retrieve and parse EDID blob.
Return screen product information from EDID.
[ChangeLog][Platform Specific Changes][Linux/XCB] Add screen product
information from EDID.
Change-Id: Ic54429cdc90c41342c37511bcaebce95c175f517
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
When calculating what to trim in trimmed_helper_positions(), first
trim the end, then the front.
This way, a string that consists of just whitespace will remain
anchored at its front, and we do not run into the memmove case in
trimmed_helper_inplace, which, even though there's zero elements to
move, still calls a potentially-out-of-line function (memmove()).
Change-Id: I7024ffa1f7ae2effb9c5166ec8f30a42b8d51079
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
All good (now).
Change-Id: I666773856a239826e646398a943e7df30bd81671
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
For transformations, regardless of whether they're currently
overloaded on rvalue-this or not, check the results of calls to const
lvalues as well as mutable rvalues.
Use the new mixed-type QCOMPARE more.
Change-Id: Ibaa436cd88b40e5c0823c3bbe5b04a9964e7e987
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
qtbase/src/gui/vulkan/qvulkanwindow.cpp:1882:42: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
VkClearColorValue clearColor = { 0.0f, 0.0f, 0.0f, 1.0f };
^~~~~~~~~~~~~~~~~~~~~~
{ }
1 error generated.
VkClearColorValue is a union, so it wants to be clear that we are
initializing only one of the union's members, apparently.
(Even though initing more than one wouldn't make sense.)
Change-Id: Id4afa3ddc1b4ce7e24e681fb93c0ee9083c41e08
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
It was added to support qAsConst(). When <type_traits> became mandatory,
porting qAsConst() to std::add_const was forgotten.
Change-Id: Ifb9b54d12554ce19dca4664642a8644f49aeb6af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Retrieve and parse EDID blob.
Return screen product information from EDID.
[ChangeLog][QPA][eglfs][kms] Add screen product information from EDID.
Change-Id: I766999afd9298e82f6147fdeba5d14757bfb4b03
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Add a support library to parse EDID that will be used by platform
plugins.
In order to tell the screen manufacturer from the identifier, the
parsers reads /usr/share/hwdata/pnp.ids or, if it's missing, uses
a lookup table previously generated from that file with a Python script.
Change-Id: Ie021eb68be91f06dc0da54445f88e3533f78d23e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Tablet events compression has been missing since commit
60cd1c6775 in 5.6.1, and there's
no way to bring the old behavior back. Since tablet events are
not taken into account by AA_CompressHighFrequencyEvents on
purpose, we introduce this new flag.
This new flag is conditional to AA_CompressHighFrequencyEvents
being set in order for it to be effective.
[ChangeLog][QtCore][Tablet support] If the application attribute
AA_CompressTabletEvents is set in addition to AA_CompressHighFrequencyEvents,
even the QTabletEvents will be compressed (only on the X11 platform so far).
AA_CompressHighFrequencyEvents does not enable compression of tablet events
by itself, because paint applications typically need to process
all possible tablet events in order to draw the smoothest curves.
Change-Id: Ie7434ab4f9a4c64f2626c75e661cfd0d6cd22896
Task-number: QTBUG-44964
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Reviewed-by: Wayne Arnold <wayne.arnold@autodesk.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Better than going half way and not quite finishing, and nicer results.
Change-Id: If6bf005182534f6fbfc13544d4190d3e54a272e9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This allows the use of move-only function objects
Task-number: QTBUG-60339
Change-Id: If3595fca338cf7f3039eb566cc02e4e73cd04c86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Prioritize DRM/KMS for eglfs. There are now binary drivers for Mali
that enable DRM, GBM and Wayland.
Change-Id: I9ac97f5006f88706854e9160bdafb82f9f8aac5c
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Following the established pattern of implementing non-mutating string
algorithms as free functions over views with a public qFoo() and a
static qt_foo() split, add qStartsWith() and qEndsWith(), calling the
existing qt_{starts,ends}_with_impl() templates.
[ChangeLog][QtCore][QStringAlgorithms] Added qStartsWith(),
qEndsWith().
Change-Id: Ic95c2a9c13883a99f1a96319083fb249f20de5f1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Also mark as shared-come-qt6 and add member-swap.
[ChangeLog][QtSql][QSqlError] Added swap().
Coverity-Id: 168223
Change-Id: Iaad4dee383900b9d11856e860b0647780a81a505
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The QString API symmetry test strikes again, showing that this is
inconsistent with both QString and QByteArray, which both return empty
for empty inputs.
The fix actually makes the implementation simpler.
Extend the QStringRef test to cover null inputs, too. I can't merge
the trimmed() test in the API symmetry test until everything is
actually consistent.
[ChangeLog][QtCore][QStringRef] trimmed() now returns an empty
string-ref for an empty input. Before, it would return a null one.
Change-Id: I6b35c5f498053c4e15a4a9dd465bc696258e7393
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
CID 178811 (#1 of 1): Resource leak (RESOURCE_LEAK)
25. leaked_storage: Variable dptr going out of scope leaks the storage it points to.
Change-Id: I3354fe46cfb08701f387f65aaaa5c4f235079501
Coverity-Id: 178811
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The reference images in tst_qframe had to be updated to match the palette.
[ChangeLog][QtWidgets][QFusionStyle] The default palette used by the
platform agnostic Fusion style has been desaturated. Previously the window
background color, and other colors derived from it, were brown shades. Now
these colors are neutral gray that fit better on any desktop.
Change-Id: Id6a05e05563b8cbc8f378ee415a64b8f99012b60
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
EGLNativeDisplayType is void* on NVIDIA systems but the backend may get compiled
on others where it is something else. The function definition does not match
the proto on these so it is time to correct this.
Change-Id: I569d9f8f3fcba7b2a4672d83606dfdc7bb18a1f0
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Just fixing the typo -> misplaced #ifndef guard.
Change-Id: Ib3b0ceb615f45291cb64a0ed6c7f3a370dc506bf
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The system tray icon implementation relied on QMenu. After
the introduction of QPlatformSystemTrayIcon::contextMenuRequested(),
the code can be moved into the plugin, making use of native menus
when enabled or falling back to QMenu.
This enables the SystemTrayIcon QML Type to work.
[ChangeLog][QtGui][Windows] A native system tray icon is now
available for SystemTrayIcon.
Change-Id: I0fdbfb5cbb815c1ea6fb19305a9bceb9c5bcc034
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Add simple Win32-API based menus (not owner-drawn).
Native menus are implemented using Win32 API and are simpler than
QMenu-based menus in for example that they do allow for placing widgets on
them or changing properties like fonts and do not provide hover signals.
They are mainly intended for Qt Quick. By default, they will be used if the
application is not an instance of QApplication or for Qt Quick Controls
2 applications.
In addition, the command line option -platform windows:menus=native
will unconditionally activate them and -platform windows:menus=no
turns them off.
[ChangeLog][QtGui][Windows] Native menus have been implemented.
Task-number: QTBUG-55967
Change-Id: I439a7d949745debea3eb0e5789cf42288a0d526f
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Add a signal passing the global position of the context menu.
For platforms that do not provide native menus, QSystemTrayIcon
will show a QMenu based menu.
Change-Id: I799e4a84ca38e00ea33f3c842ea4ca43ecb8c83f
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
... from bytearrayToDouble() and bytearrayToLongLong()
(bytearrayToUnsLongLong() didn't have one).
The only user, QIntValidator, always checked them in conjunction with
'ok'. Since 'overflow' was true only if 'ok' was false, too, there's
no point in carrying both.
We can bring this code back with QParsedNumber, when it will not cost
anything anymore. I actually was hoping that the overflow argument
would inform the design of QParsedNumber, but it turned out to be
unused, leading to this commit instead.
Change-Id: I841d0d1cc36c13c5425ac0338323721d90b3b24c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In matchHint() and lookupCache(), instead of checking for the
existence of 'parent' in 'cache', a new entry was created, if
needed.
However, the remainders of the functions could only fail in
that case, so don't allocate an empty map node here at all.
Wherever something sensible is added to the cache, there will
have to be an insertion of the same node anyway, so there's
no point doing that work here.
Allows to mark these functions const.
Also passed the QString argument by const-reference instead
of by value.
Done-with: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Change-Id: Ia873f246869a68eecaef83ce4a6b6369187456be
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Less code duplication, since truncate() is the action version of
left().
This is done in preparation of adding more actions for the string
transformations we have.
Change-Id: I55027b5143ad3349d46091ac1cc3d24a9707caee
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
It's really unfortunate that even a plain 'http' request results in
(Open)SSL initialization; this is apparently done by QSslConfiguration's
default constructor and we have several classes including QSslConfiguration
as a data-member.
There are different problems reported because of this, from crashes
(a broken OpenSSL on Windows) to long initialization times, which is
not acceptable if no 'https' request was actually executed.
This patch-set is replacing data-members of type QSslConfiguration
with smart-pointers and delays (Open)SSL initialization.
Task-number: QTBUG-59750
Change-Id: Id1d375e689dbd2d134abbb0572a9e804d595110e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
That's the only value for which we will guarantee a stable result across
Qt versions and across invocations of the same application on different
architectures is zero. For any other value, we reserve the right to
change the algorithm. We'll now print a warning when we detect that.
Task-number: QTBUG-47566
Change-Id: I27b55fdf514247549455fffd14b1135e10d24ab4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
... and add a version taking a QChar needle.
Back the implementation with a template function.
Mark the slightly surprising behavior that
null.startsWith(empty) == false
but
null.startsWith(null) == true
even though empty == null, for review come Qt 6.
Saves 0.5KiB in text size on optimized GCC 7.0 Linux AMD64 builds.
Change-Id: I2576472d22ccf22ec89911eaed25188f9f7b654f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
All good.
Can't check QByteArray::startsWith(), as it is lacking the
Qt::CaseSensitivity parameter.
Change-Id: I7f2379e520617c14514fc66d8fb3413cfb7c9147
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
... and adapt qCompareString(QLatin1String, QStringView) to call it
instead of performing the negation itself.
This function will be needed for QLatin1String::startsWith(QStringView).
Change-Id: I8f19dfe0c5274a80c88b43d05f9efda8a91eac46
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
qstrcmp sorts null strings before empty ones, while the Qt string
classes consider them equal.
The qt_compare_strings() overload for QLatin1String was using
qstrcmp(), but is supposed to implement the semantics that Qt string
classes use, so we need to add an extra check.
Was uncovered by tests for QLatin1String::startsWith(), but added a
new test for qCompareStrings() now, which is a bit more complicated
than desired, due to the lack of QUtf8String.
Change-Id: I0493c4491df928a68861a1bc7f0962f1c870a416
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Align ourselves to the Standard Library and call std::terminate if an
exception leaves the thread entry point (that is, run()).
On platforms using pthreads, thread cancellation needs to be taken in
special consideration, since it looks like it was supported before.
On Glibc, and when using C++, pthread_cancel and pthread_exit are
implemented by throwing a special kind of exception that can be caught,
but must always be rethrown. That exception is then used to activate the
cancellation clean-up handlers. (This is non-Standard C++ behavior.)
So: mimic what libstdc++'s std::thread does to support Glibc's pthread
cancellation.
At this time, it looks like libc++ has no support for this, and when
used in combination with Glibc a thread cancellation results in a crash
(also because it does not seem to terminate() when exceptions leave the
thread).
[ChangeLog][QtCore][QThread] An exception escaping from QThread::run()
will now result in immediate and abnormal program termination. The same
applies if an exception leaves a slot connected directly to the
QThread::started() or QThread::finished() signals.
Change-Id: I73cc93cf06c57018e149a578cc9d4cd0d6fc00ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's starting to hinder QStringView development
(QString::append(QStringView), e.g.).
- qbytearray.h includes qstring.h, but is included by qstring.h
-> remove qstring.h include from qbytearray.h
- the QStringLiteral definition is used from both qstring.h and
qstringview.h
-> extract into its own header, move QStringViewLiteral definition
there, too
- the qCompareStrings(), qConvertTo*() functions are used by QString
and QStringView
-> also extract into own header, included from qstring.h and
qstringview.h
- QStringView::toString() depends on QString, which depends on
QStringView
-> move QStringView::toString() definition to qstring.h, after the
definition of QString
-> move qstringview.h up to all the other includes in qstring.h
This is starting to look like a DAG again, and allows to remove the
unholy
#ifndef QSTRING_H
# include <qstring.h>
#endif
hack from qstringview.h.
[ChangeLog][Potentially Source-Incompatible Changes][QByteArray]
qbytearray.h no longer includes qstring.h. In particular, this means
that in order to use QStringBuilder with QByteArray, you need to
include both qbytearray.h and qstring.h now (or <QByteArray> and
<QString>, resp.).
Change-Id: I7f8acf9c11bc1731266cd25c6eda9fb36723f364
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
GCC's -Wshadow complained about the re-use of 'args' as the parameter
for the lambda.
Fix by renaming it to largs (lambda-args) instead.
Change-Id: Ia9e65b82b98ee56181d754868354988399496eef
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>