Java-style iterators are going to be deprecated.
Change-Id: Ia55070608d3826bd84ed5d56a593c1c4918a6063
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
The original is much more subtle, so don't try to be a 100%
replacement. Most users will be able to use std::make_unique these
days. This is just a minimal implementation to enable using the
functionality in the implementation of Qt libraries. In particular,
it does not attempt to deal with arrays.
It is therefore not proposed as public API. It is placed in a new
private header, since the only header in QtCore that already
includes <memory> is sharedpointer_impl.h, and that did not seem
to be a good place to add it. It is probably too much of a
compilation-time drain to add <memory> to qglobal.h...
Change-Id: Ie206ef7ae9beb36c63aef4ec46dbde6c73e0d9f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The whole reason of QCharRef/QByteRef existence is to have a magic
operator=. This operator= delays the actual detach up to
the moment something is written into the Ref, thus avoiding
spurious detaches to the underlying string/byte array.
operator= has also an extra feature, it allows this code to
succeed:
QString s("abc");
s[10] = 'z';
assert(s == "abc z");
This last behavior is *extremely* surprising.
The problem with all of this is that this extra convenience is
outweighted by the massive pessimization in the codegen for
operator[]; by the maintenance burden (QChar APIs need to be
mirrored in QCharRef, etc.), and, for the automatic resize, by the
fact that it's an super-niche use case.
Cherry on top, std::basic_string does not do that, and no Qt or std
container does that. In other words: any other container-like class
exhibits UB for out of bounds access.
We can't just go and change behavior, though. This is something
coming all the way back from Qt 2 (maybe even Qt 1), which means we
can't deprecate it at short notice.
This patch simply adds a warning in debug builds in case the special
resizing behavior is triggered. While at it, removes some code
duplication in QByteRef.
[ChangeLog][QtCore][QString] The behavior of operator[] to allow
implicit resizing of the string has been deprecated, and will be
removed in a future version of Qt.
[ChangeLog][QtCore][QByteArray] The behavior of operator[] to allow
implicit detaching and resizing of the byte array has been
deprecated, and will be removed in a future version of Qt.
Change-Id: I3b5c5191167f12a606bcf6e513e6f304b220d675
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Honor the RO3, doing copies of the members where it belongs
(and not in its subclass), and properly handling the refcounting
by disabling the copy assignment
* Clean up construction of QPainterPathData by using ctor-init-lists,
getting rid of a warning because the base class copy constructor
wasn't being called by the subclass' copy constructor.
* Mark everything for cleanup in Qt 6.
Change-Id: I143a322dc816e2e12b454a9e5ffe63f1a86009a5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
__warn_unused_result__ and [[nodiscard]] both are masked by
Q_REQUIRED_RESULT but there are some minor differences between them.
In general [[nodiscard]] is more flexible while
__warn_unused_result__ can cause warnings in some contexts, for
example:
error #2621: attribute "__warn_unused_result__" does not apply here
error #3058: GNU attributes on a template redeclaration have no effect
That is a fix for regression caused by
b91e6f6f40.
Change-Id: Icf11b832f31e714a88536828051f4b7f348cdb36
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Why roll your own if you can use the original. The clone was even
designed to be API-compatible with std::set, so porting is trivial,
except for the unholy int/size_t mismatch, which requires a few
casts.
Change-Id: Ieb99cbc019ef387c6901d7518d1e79585169b638
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
The code contained a sizeable chunk of string parsing along with
qDebug()s in the normal path of execution. That code, however, was
only used for Qt's own autotests.
The idea of this patch is, then, to not only move the autotest case
into the cold text section (using Q_UNLIKELY), but also to completely
exclude it, when QT_BUILD_INTERNAL is not set.
Unfortunately, the structure of the function did not really lend
itself to #ifdefing that part of the code out (production code was in
the middle of non-production code), so I transformed the engine
selection code into a lambda, replacing assignment with returns, and
swapping the branches of the central if around to yield a single block
of code that can be excluded from compilation with just one #ifdef.
As a consequence, the runtime code is almost unaffected, and the
function is much easier to read now.
Since the test-specific code is only compiled into Qt now in developer
builds, guard the tests that rely on this behavior with the same macro.
Change-Id: I9fd1c57020a13cef4cd1b1674ed2d3ab9424d7cd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
They're meant to be subclassed, so we need to avoid slicing.
Change-Id: I384b65478f728c69aaf1edbc985b3fb4150191fe
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Use qExchange() in the move ctor and pass the function object by
rvalue ref.
This saves one move construction and doesn't produce unexpected
results. The qScopeGuard free function should take the function object
by value, because it decays and because we can't create an rvalure
reference in a deduced context. But once we're inside qScopeGuard, the
extra object isn't needed anymore, so optimize it away.
Change-Id: I94cbc45f9bf6ca086e100efd922a0b4643a81671
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
They will be deprecated, so qmake wouldn't compile anymore.
Change-Id: I42212fdf213df696d736ed34458f7e79bd902dd5
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
They are going to be deprecated.
Change-Id: Ib021aad108dc021df76ae21d1db6c8a1a734893d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The accessibilityAttributeValue method was deprecated and all needed
replacements are in macOS 10.12.
The new API is nicer, since it adds a lot of individual functions instead of
forcing one big switch statement on us. This makes it easier to implement
further protocols. When implementing e.g. the Button protocol, the old attribute
functions do not get called any more, so this is needed before implementing more
features.
Change-Id: I5a705edfa3f6bb0d25436df8cf5dd7f59e7e764e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
We had an implementation of this based on the old attribute
based API, which also works. This cleans it up and adds
the setter.
Change-Id: I886fc9c89ee08b9f4f9aabec00ac1a5b9a800c6f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Setting the childMode property to ParallelStates will result in an
invalid state machine. This is never checked (worse, we explicitly
allow it and have a constructor to set it), but it results in
findLCCA failing, which then results in a failing assert or crash.
This fix in this patch is to handle this case separately. The proper
fix would be to remove completely the ability to set the childMode
on a QStateMachine, but that will have to wait until Qt6.
Fixes: QTBUG-49975
Change-Id: I43692309c4d438ee1a9bc55fa4f65f8bce8e0a59
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Setting transparency (WS_EX_LAYERED) causes a WM_PAINT to be sent to
the invisible windows, which causes a resize to the default size
(640x480) to be sent from QGuiApplicationPrivate::processExposeEvent().
Suppress these messages.
Fixes: QTBUG-75455
Change-Id: Idc540aa7f9bf0047e78ec7c27db260940483f7c4
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Fixes: QTBUG-75612
Change-Id: I0e90a84697c1eb055c4150f2519829977fce7244
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
window.contentView can be of any NSView subclass.
Get to the QCocoaWindow via QCocoaNSWindow instead.
Change-Id: I8c761fd22e6078b075d8dd035ad767b9e4cb6da2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QWidgetTextControl and consequently QTextEdit did not emit
cursorPositionChanged() signal when cursor position was changed by a
QInputMethodEvent with a QInputMethodEvent::Selection attribute.
This is especially important on Android because QAndroidInputContext
uses such events extensively to move the cursor and also relies on
cursorPositionChanged() signal being emitted by the focus object. If the
signal is not emitted, QAndroidInputContext does not notify the virtual
keyboard about cursor position change which results in various glitches.
Change-Id: I7edd141258c483e6f103adcd6e40049b49c13387
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Change-Id: Id95c096700a8bfa733d8620064c2a37eb19cc3db
Fixes: QTBUG-72741
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Note that the test is still disabled, but this is needed in any case.
Change-Id: Ib7523ba800b94c32690c1bd09b23fc2078c71d4e
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
We have been rather sloppy in how read-only versus editable is handled.
According to the definition, editable signifies that in principle a
widget allows the user to change its text. Read-only means that this
ability is (currently) disabled.
Task-number: QTBUG-75002
Change-Id: I5d71843abcdaac52f4a60a1abcac2604341f6c96
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
OpenGLES specification does not support GL_TEXTURE_SWIZZLE_RGBA,
it supports only per-channel calls. And since Qt supports QpenGLES,
it should use the latter approach only.
The regression was introduced in Qt 5.12 by commit
ede3791df8
Task-number: QTBUG-74968
Change-Id: I9c531b248715992fb30df6af95dfa605e2ee2a25
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
When both mouse and tablet events are handled by QWindowsPointerHandler,
m_currentWindow variable is shared among the two event streams, therefore
each stream should ensure it does equivalent operations, when changing it.
Here we should subscribe to the Leave events, when we emit Enter event
from the inside of the tablet events flow. Without whis subscription,
the cursor may stuck in "resize" state when crossing the window's
frame multiple times.
Change-Id: I88df4a42ae86243e10ecd4a4cedf87639c96d169
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
The formatting of times in Norwegian has reverted to using dots in
place of colons, as it did before v31 (commit 82deb0ad1), so reverted
the tests to their state before that.
Change-Id: I8a09ce253731bb0f0f3caca117f06ad568940a81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
It was up to date with v34 (and seems to cope with v35.1) but only
clained support for v29.
Change-Id: I686cae1977824a4deec4633f19604b91061fe78a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Our conversion from CLDR's format to our own was missing some things
it could support sensibly, and some it could do better than ignore or
treat as literal, while mis-handling the 'E'-based formats for day
names. At least in CLDR v34 this doesn't actually make any difference
(on regenerating our locale data, the only change is the date of
generation).
Task-number: QTBUG-70516
Change-Id: I9d27b9bf24afd168c2f8a5258143d3d695bca0ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Information about header files is cached by qmake. The key is the
filename of the #include directive. For system includes (<stdio.h>) this
is unique, according to the search order in INCLUDE_PATH.
For local includes, given as "foo.h", there may be name collisions. Usually a
compiler first searches in the directory of the current file (stored in the
sourceDir variable), and only in case of a miss the INCLUDE_PATH is
considered.
The dependency generation now distinguishes local header files by their full
relative path. This is implemented by forcing the use of the full relative
path as key into the SourceFiles data structure if the flag try_local is set.
Change-Id: Ifd75325b53496824054595f7fc98d71bbd9d8aa6
Fixes: QTBUG-72383
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The high part was not copied to output.
Fixes: QTBUG-75559
Change-Id: I9350e52d256510f52b3fcc0015bf879d2c609532
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Also de-duplicate the "monospace" string in qgenericunixthemes.cpp,
and add tst_QFontDatabase::systemFixedFont() to verify that
QFontDatabase::systemFont(QFontDatabase::FixedFont) really returns
a monospace font across platforms. Replace commented-out qDebug()s
with qt.text.font.match and qt.text.font.db logging categories to
troubleshoot when the test fails (among other uses). Add qt.qpa.fonts
logging category to unix themes to show default system and fixed fonts
(font engines on other platforms are already using this category).
Fixes: QTBUG-54623
Change-Id: I2aa62b8c783d9ddb591a5e06e8df85c4af5bcb0c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Add documentation on how to use a module from CMake, alongside
the existing documentation about qmake. Separate generic info
from module-specific examples, to make it possible to use one
include file in all modules.
While at it, also remove the mentioning of the central include;
it is not something we should actively advocate anymore. Instead,
the documentation of every class gives the correct include to use.
Task-number: QTBUG-73058
Change-Id: I6b3c0e5ea218dd9c06a491c8fb799a7fcf42dd92
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Also define our default font so as to return something we actually have
Task-number: QTBUG-75587
Change-Id: I26e3c62921d369c3017af9796c0a20f7ac06d07c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Adding xcb_flush after xcb_bell makes it work, no need to move the
mouse.
Fixes: QTBUG-75617
Change-Id: Ieeb47468bf31cfa6fcf2d48da56d54b9e6eac6fe
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Mips archs were removed from Android NDK long time ago.
Change-Id: Icf64a1e2cfbe3fe7307c7898b14fd199d9eeaad3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
x86_64 libs are located in ANDROID_PLATFORM_ROOT_PATH/usr/lib64
not in ANDROID_PLATFORM_ROOT_PATH/usr/lib .
Fixes: QTBUG-47672
Change-Id: Ia1f74f7c2a30b276b95fd0e7dcf8370d739e3c41
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Qt starts drag-and-drop on a mouse button press event. Cococa in
this case won't send the matching release event, so we have to
synthesize it here.
Task-number: QTBUG-72417
Change-Id: I645b6a2733c1ea11ac4545cf3405f826af45fa47
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Do not store this variable locally, because
a) it might change if the SDK location changes
b) does not play well with Qt installer packages which would provide the
include path of the build machine.
To achieve this we introduce the (usual) magic value - for
QMAKE_EXPORT_INCDIR_VULKAN to denote "do not export this value".
Fixes: QTBUG-73796
Change-Id: Ied26ee12cbcdf7f5f6e1caef5d29dadf6309c5d6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
I was using a cheap usb-stick from ALDI supermarket with fat32,
and my application crashed because filesystem was empty.
Unrealistic scenario, but still just returning here false is better
than a crash
Change-Id: I8979d5a4e19ce57770ab03983e847b272ebf7019
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We get a call to storeFont for each supported script-type of
a font, but we use the font signature to register all the supported
types at once, and can thus save ~3/4 calls to addFontToDatabase.
Change-Id: I9d06252fb7f805e7babac58d82fa412ec4e0e36a
Fixes: QTBUG-59360
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Don't call or implement functions which are not available when compiling
with QT_DISABLE_DEPRECATED_BEFORE=0x050d00
Change-Id: I949b12bba880c516391f312f58c8748303a1790d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In Windows there are package-based systems like MSYS2 that provide
pkg-config for packages lookup.
This change skips autodetection only for MSVC which doesn't
provide the aforementioned feature.
Task-number: QTBUG-57436
Change-Id: Iaed517e93031adbd2fd9dbf350764f76569b94ea
Reviewed-by: Kai Koehne <kai.koehne@qt.io>