The returned data is in US-ASCII (or else Latin-1), and resides in
consecutive memory. We can therefore return it in a QLatin1String,
which, however, will in general not be NUL-terminated.
Many users use the return value as part of a QStringBuilder
expression, and those which are not are not pessimized further by
this change.
The caller in qtimezoneprivate_icu looks as if it could simply zero
-terminate the return value and use it as-is, as opposed to
converting to UTF-8, but I left the code equivalent to the original
just the same.
Change-Id: I0e628af8c1320fcff8d0aacf160e859681d2b85a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
By default SQLite opens DB in Serialized mode, allowing connections to be used
from several threads simultaneously: https://www.sqlite.org/threadsafe.html
According to Qt documentation, database can only be used from one thread.
This change opens sqlite dabases in "Multi-thread" mode, so that one does not
pay for useless mutex locking for each DB access
Change-Id: Ife61f1a648d74c91d3b27a2ce0059d052ccc62b2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QStringView is a simple container for (const QChar*, int) and (const
char16_t*, size_t). It acts as a replacement interface type for const
QString and const QStringRef, and enables passing all kinds of
string-like types to functions otherwise expecting const QString& -
without the need to convert to QString first.
The use of this new class is guarded by a macro that enables three
levels of QStringView support:
1. offer QStringView, overload some functions taking QString with
QStringView
2. like 1, but remove all overloads of functions taking QStringRef,
leaving only the function taking QStringView. Do this only where
QStringRef overloads tradionally existed.
3. like 2, but replace functions taking QString, too.
This is done in order to measure the impact of QStringView on code
size and execution speed, and to help guide the decision of which
level to choose for Qt 6.
This first patch adds QStringView with most of its planned
constructors, but not much more than iterators and isNull()/isEmpty().
Further patches will add support for QStringView to QStringBuilder,
add QStringView overloads of functions taking QString, and add the
complete API of const QString to QStringView.
[ChangeLog][QtCore][QStringView] New class, superseding const QString
and QStringRef as function parameters, accepting a wide variety of
UTF-16 string data sources, e.g. u"string", std::u16string{,_view},
and, on Windows, L"string", std::wstring{,_view} without converting to
QString first.
Change-Id: Iac273e46b2c61ec2c31b3dacebb29500599d6898
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
We can quickly check if the change affects sorting by checking whether
lessThan(N-1, N) and lessThan(N, N+1) are still true. If this is the case
for all changed rows, then we can skip the whole remove+insert+layoutChanged().
Task-number: QTBUG-1548
Change-Id: Ia778b3e8880cc9909eef1f8a016c84235870353d
Reviewed-by: Stephen Kelly <steveire@gmail.com>
The functions are documented but the class does not show up in the
docs without the \class.
Change-Id: I8a7e4c82ba11354855ca272e5c6be59cf1419f14
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
It's private API, the last in-tree user was removed in acbd7999, but
failed to remove the class. Do it now.
Change-Id: I26294b535d80b419a2f545a4783014b493a5dc93
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Merge with QDockAreaLayoutInfo::itemRect, so it can be re-used
fromp the QDockWidgetGroupWindow layout.
Change-Id: Ic072eceb786be394f96e378a3ade4462cd1043fd
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
the target of the injected forwarding header doesn't exist at qmake
time, as it is generated by an extra compiler, so the touch() calls in
qt_module_headers.prf would fail.
the error scenario described in ce942a226 is not applicable to
gui/vulkan, as no bootstrapped modules are involved. therefore, we can
just suppress the timestamping.
Change-Id: I1c9b6fcdf3717069fdbb654e3cb5d73b199192f4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Widget windows choose a visual via the GLX or EGL path. Vulkan windows
use the default, simple visual chooser. When having a parent, the
different visuals can cause a BadMatch. Avoid this by taking the parent's
visual.
This way the hellovulkanwidget example is now functional on xcb as well
(tested on Jetson TX1 with L4T 24.2).
While we are at it, stop forcing RGB888 in the format, unless nothing
was set.
Change-Id: I39ab87e3219c04d4f547325d13d4873d70564411
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Same license as the existing OpenGL stuff.
Change-Id: I6d0a77a7213f496971b5c3a8676dedb8e4377ceb
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
A convenience subclass of QWindow that provides a Vulkan-capable
window with a double-buffered FIFO swapchain.
While advanced use cases are better served by a custom QWindow
subclass, many applications can benefit from having a convenient
helper that makes getting started easier.
Add also three examples of increasing complexity, and a variant that
shows embeddeding into widgets via QWindowContainer.
[ChangeLog][QtGui] Added QVulkanWindow, a convenience subclass of
QWindow.
Task-number: QTBUG-55981
Change-Id: I6cdc9ff1390ac6258e278377233fd369a0bfeddc
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
If a system runs out of FDs, there is no sense in trying to autodetect
the format - as the real problem is the lack of FDs, not the
non-existent file.
Change-Id: I3302340859c3cc62995ac1b7b3c7b6e6326cb43e
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Remove HTML tags.
Fix notes that predate the introduction of deviceFunctions().
Add a note about the function wrappers being auto-generated.
Change-Id: If99022ce74313c6bb33c3bb7bd6840b6cf26b3be
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
[ChangeLog][QtCore][Logging] If you set QT_FATAL_WARNINGS to a number
greater than 1, Qt will stop the application at that nth warning,
instead of on the first one. For compatibility reasons with previous
versions, if the variable is set to any non-empty and non-numeric value
different from 0, Qt will understand as "stop on first warning".
Change-Id: I0031aa609e714ae983c3fffd14676f1826f34600
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Fix warning:
qwindowswindow.cpp: In member function 'void QWindowsWindow::setWindowState_sys(Qt::WindowStates)':
qwindowswindow.cpp:1965:74: error: suggest parentheses around arithmetic in operand of '^' [-Werror=parentheses]
if ((newState & Qt::WindowMinimized) && (oldState ^ newState & Qt::WindowMaximized))
This is actually a real bug. What was meant was to check if the Maximized flag
was changed. This code path is for the case in which the windows becomes
minimized, and the maximized state changed.
Amends change a02959bb5b.
Task-number: QTBUG-57882
Change-Id: I1cd32a7080240e4462d3cd4f129c6c1a08409996
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
The change does not change legally observable behavior as the result
of using QT_RESTRICTED_CAST_FROM_ASCII is only defined for (a part of)
the 7-bit range where Latin1 and UTF-8 are the same.
This change does not intend to lift the 7-bit restriction on string
literals for which the use of QT_RESTRICTED_CAST_FROM_ASCII is
well-defined even though in practice it works now for any UTF-8,
which is the presumed encoding outside that range nowadays.
Change-Id: If9a4199235396a43f8f26d7591907b21120823ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
qmake really lacks version comparing functions:
users either use ugly constructions to compare versions
by components, such as
greaterThan(QT_CLANG_MAJOR_VERSION, 3)|greaterThan(QT_CLANG_MINOR_VERSION, 4):
or even incorrectly compare versions as strings:
!lessThan(apple_clang_ver, "5.1")|!lessThan(reg_clang_ver, "3.4"):
Add test functions versionAtLeast and versionAtMost which use
QVersionNumber to compare version numbers by components.
Change-Id: I65e6b3c296d0301d544b7e38bf3d44f8d555c7fc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Our headers ought to be clean in all compiler versions.
Change-Id: I4a7dc1fe14154695b968fffd14aba9ff9995c618
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
qwindowsnativeinterface.cpp: In member function 'virtual void* QWindowsNativeInterface::nativeResourceForWindow(const QByteArray&, QWindow*)':
qwindowsnativeinterface.cpp:104:12: error: enumeration value 'VulkanSurface' not handled in switch [-Werror=switch]
Amends f1a23a5467.
Task-number: QTBUG-55981
Change-Id: Ie9bf396ab8ea1be505abfaffd5d603bb3856c089
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
... to reduce text size by replacing QStringLiteral with QL1S.
Change-Id: I8166282d915f081ba816989039451466ec29e208
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... to avoid the expensive conversion from QString to QL1S.
[ChangeLog][QtCore][QStringList] Added contains(QLatin1String) overload.
Change-Id: Ie75839ce9e46e03fe5155a02c7dcf00277b95c8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Replace it with QL1S in overloaded functions.
Saves some text size.
Change-Id: Ie1436a787fb3052157880234ca180fefce5a8412
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Split out basic fetching to share it between the two.
Change-Id: I6c27a7cea3a5c10b511232edc68bd32490514a27
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
An QApplication::mouseButtons() value could stay outdated after external
DnD operations, e.g. dragging an object outside Qt application or vice
versa. Also user can cancel DnD with Escape key.
Task-number: QTBUG-55885
Task-number: QTBUG-59539
Change-Id: Ia6deb4ae5ccfe77e6d6c2464de40cd06fc71f9b8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
When only minimumSize was set and it matched to the size NSView was
created with, viewDidChangeFrame() was not called for the window and
it's internal geometry value was still (0, 0) what led to unpleasant
side effects such as QML content was not displayed until something
caused an update.
Task-number: QTBUG-58963
Change-Id: Ib12d36d405969971e7ff62b79b50c3d78928a649
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Generally, this might avoid unnecessary work in a quite common case.
But if high dpi scaling is set, the dpi (in logical pixels) does
not change. However this event is sent before
QGuiApplicationPrivate::processWindowScreenChangedEvent has had
time to change the geometry, and might cause a problem in QMenu
Amends f3a4b4258f.
Task-number: QTBUG-59484
Change-Id: Ie4ceedcb0754613cf239ae86b225c4139b70d0cc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
It has started failing recently on the CI, too.
Task-number: QTBUG-58745
Change-Id: I4c8834917e6455d00c300549ed448b06da75d5bc
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
For Android, Windows and xcb. Verified on Win10 with NVIDIA, Win10
with AMD, Android with Tegra K1, Android aarch64 with Tegra X1, and
Linux aarch64 with Tegra X1 (Jetson TX1, L4T).
Introduce QPA-based Vulkan library loader, core function resolver, and
instance creation support. In addition to creating a new VkInstance,
adopting an existing one from an external engine is supported as well.
The WSI specifics are hidden in the platform plugins. Vulkan-capable
windows use the new surface type VulkanSurface and are associated with
a QVulkanInstance.
On Windows VULKAN_SDK is picked up automatically so finding vulkan.h
needs no additional manual steps once the LunarG SDK is installed.
[ChangeLog][QtGui] Added support for rendering to QWindow via the Vulkan
graphics API.
Task-number: QTBUG-55981
Change-Id: I50fa92d313fa440e0cc73939c6d7510ca317fbc9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
These used to be in QPixmapData in Qt4, allowing platforms to override
mask handling. Useful when native 32-bit ARGB might not be available.
Change-Id: I1fcb77222ee4bc4705a8b4c614c9d5c3938c47ba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Fixes the bug in QFile which allowed opening a file with reserved
characters in its name. If the name is a long file path, CreateFile
opens a file with a truncated name instead of failing, so we have
to catch reserved characters ourselves.
[ChangeLog][Windows] Fixed a bug that caused QFile to create
files with truncated names if the file name was invalid. Now,
QFile::open correctly fails to create such files.
Task-number: QTBUG-57023
Change-Id: I01d5a7132054cecdfa839d0b8de06460039248a3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
... for better std C++ integration.
[ChangeLog][QtCore][QChar] Added constructors from char16_t and, on
Windows, wchar_t.
Change-Id: I2d18ea3a37e869b8ea9f4036d7200d9d13c7d929
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Some users have reported crashes in -[QNSView mouseEnteredImpl:]
which we believe are due to null m_platformWindow. The stack
traces are like the one below or similar:
0 libqcocoa_dylib QNSView mouseEnteredImpl_ 0x1F
1 appkit NSTrackingArea _dispatchMouseEntered_ 0xA2
2 appkit NSApplication sendEvent_ 0xF4D
3 libqcocoa_dylib QNSApplication sendEvent_ 0x4E
4 libqcocoa_dylib QCocoaEventDispatcher processEvents 0x184
5 qtcore QEventLoop exec 0x19C
6 qtwidgets QDialog exec 0x20B
Moreover, since 2f505b79a4, that
member is a QPointer, so we should do more systematic checks.
Change-Id: Iced447515a4ae07a62734e587f5b08d46d313071
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Notify users when multithreaded OpenGL is disabled due to the
renderer or vendor blacklist.
Change-Id: I16a80568afe87b227575102ca839f18050613e90
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Register a notification only if the LISTEN call was successful. This
behaves now like the UNLISTEN case: the notification is only unregistered
if the call was successful.
Change-Id: I2b18ec3a619fea5bed0a319013ad9df4b9e15456
Reviewed-by: Matt Newell <newellm@blur.com>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
We need Q_ASSERT in (C++11) constexpr functions, and the only way to
inject them in C++11 is to use the comma operator. E.g. in
QLatin1String:
constexpr QLatin1Char at(int i) const
{ return assert(1 >= 0), assert(i < size()), m_data[i]; }
The main problem with our existing Q_ASSERT is that while it is a
ternary expression in active mode, it was a statement in passive
mode. This is easily fixed by dropping the do-while loop and leaving
just its parenthesized exit condition. Add a cast to void, too,
ensuring that Q_ASSERT has type void in both passive and active modes.
But even in C++14 constexpr functions, which accept several
statements, Q_ASSERT needs to have a path through its conditionals
that is constexpr, but neither qt_assert(_x) nor qt_noop() are
constexpr. Nor can they be in C++11 (no void returns in C++11
constexpr functions). I fixed this by replacing qt_noop() with
static_cast<void>(0). The void cast is required so both 2nd and 3rd
arguments to the ternary are void (mixing void and non-void branches
in the ternary is only allowed if the void leg is a
throw-expression[1]).
As a drive-by, adjust to style guide, remove overparenthesization and
reverse the conditional in the ternary.
Apply it to QLatin1String where we had the problem that constexpr
functions had a narrow constract.
[1] should probably be extended to any [[noreturn]] void function,
e.g. std::terminate().
[ChangeLog][QtCore][QtGlobal] Q_ASSERT() and Q_ASSERT_X() now always
expand to expressions of type void that are usable in constexpr
contexts. This makes them usable in both C++11 and C++14 constexpr
functions.
Change-Id: I09c396bc0034ac344cfaadc6f8cbeb1b7b0cbabc
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
No test were hitting the code path for tiled non-ARGB32PM bilinear
filtered scaling. In part because we were only using brushes in pixmap
mode which are always converted to RGB32 or ARGB32PM.
Change-Id: Ib466567f31ce6ee894acdf484d44b3af62dad6fc
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This reflects QWidget API, and restores some behavior from Qt4.
Some WM can have several state at the same time. On Plasma for example,
when a window is both maximized and minimized, the "maximized" checkbox
is checked from the taskbar entry.
The API of QPlatformWindow was changed to take a QFlag and the platform
plugins were adapted.
- On XCB: Always send the full state to the WM. And read the full state.
- On Windows: The code was originally written with '&' in Qt4, and was changed
to == when porting. Some adaptation had to be made so the states would be
preserved.
- On macOS: Only a single state can be set and is reported back for now,
with the possibly to expand this in the future.
- Other platforms: Just do as before with the effective state.
Task-number: QTBUG-57882
Task-number: QTBUG-52616
Task-number: QTBUG-52555
Change-Id: I7a1f7cac64236bbd4c591f796374315639233dad
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
Secure Transport supports more ciphers then we can convert into QSslCipher.
This results in our tests failing, since after the successful SSL handshake
sessionCipher is 'unknown'. This patch adds missing AES256-GCM-SHA384 and also,
to make new cipher addition easier in future, sorts cipher suites as it's done
in CipherSuite.h (ST framework's header) - grouped by RFC they were introduced
in + sorted within their group.
As a bonus (thanks to Eddy for spotting this problem) - some copy & paste (?)
typos were fixed (mismatched names).
Task-number: QTBUG-59480
Change-Id: I61e984da8b37f1c0787305a26fc289e2e7c2b4ad
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Instead of relying on a private symbol exported from QtCore.
Task-number: QTBUG-47566
Change-Id: I4a7dc1fe14154695b968fffd14abd2b21a18203b
Reviewed-by: David Faure <david.faure@kdab.com>
qsql_sqlite.cpp:643:5: warning: 'sqlite3_enable_shared_cache' is deprecated: first deprecated in macOS 10.7 [-Wdeprecated-declarations]
https://www.sqlite.org/c3ref/enable_shared_cache.html says to use the
flag to sqlite3_open_v2()
Change-Id: Ib499cebaa4c4489b90b9fffd149d3d5bf9434ae5
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Closing the dialog at the end of the test ends the modal session via
QCocoaEventDispatcherPrivate::endModalSession(), but the actual ending
of the session is deferred to cleanupModalSessions(), and that is never called.
The result is that QCocoaWindow::setVisible of the window in testKeyPressOnToplevel
and following tests ends up calling [m_nsWindow orderFront:nil]; instead of
[m_nsWindow makeKeyAndOrderFront:nil];, leaving the window inactive and the
tests failing.
Task-number: QTBUG-58474
Change-Id: If66b2e201f658b627c2ec50a562938f59a5037ed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>