... 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>
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>
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>
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>
You can now use the recursiveFiltering property to recurse into
children to find potential matching children to filter in.
Change-Id: I411a2fb29489fd56b9c881b3e6b8d1860cce630c
Reviewed-by: Stephen Kelly <steveire@gmail.com>
Does not make much sense now that we can connect to lambda functions
[ChangeLog][QtCore][QSignalMapper] QSignalMapper is now marked
as deprecated.
Change-Id: I89135f23fdf16b42142a125eb7c9a86084c90bfc
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Only 2 bits are needed to represent -1, 0, and 1 in a signed integer,
and !(n != -1) implies n == -1 so the second condition was redundant.
Change-Id: I200a17fe4e49ebc0eaa9a1988b4625267cef61a4
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Shortcuts are universally not shown on macOS or mobile platforms, making
applications look very obviously out of place.
Windows and GNOME desktop environments almost never use them.
Only KDE appears to do so commonly; default accordingly.
Task-number: QTBUG-49435
Change-Id: Ieac4cee57b15a02be5258f3d07749af6316af62b
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Its only uses were:
* Call it to just store it in QDragManager::QDragManager
* qnsview.mm calls it but since it knows it's a QCocoaDrag it can just call a function of that class directly
* qxcbdrag.cpp calls it but since it basically was calling itself can just use the class member directly
Change-Id: Ic7797c877d77f944a1212a7ea01173393bf903fe
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
... early spring-cleaning, leaving one block of virtual
root debug code that was inappropriately conditioned on
Q_XCB_DEBUG; it now gets its own define.
Removed Q_XCB_CALL:
1) I don't know anyone who actually uses it.
2) Enabling this feature (via Q_XCB_DEBUG) fails to build
(and has been like that for about 1 year).
3) There are better ways to debug X11 client message exchange
(see xtrace for example).
4) Using Q_XCB_CALL is a very fragile approach. Grep for
example for xcb_change_property and you will see that
half of the calls are not wrapped with the Q_XCB_CALL
macro.
This patch also removes the Q_XCB_NOOP macro. It's unclear
what its purpose was. There was a TODO comment in qxcbeglcontext.h
suggesting removal of this macro as well. Its evaluation of its
parameter, even without Q_XCB_DEBUG, had no side-effects, so its
removal should be harmless.
Change-Id: I9fa48af454061d8b38f69f308131647cd18f85f4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
QSysInfo has a customized deprecation directive that QDoc needs to
ignore to generate documentation for the deprecated functionality.
Change-Id: I1c378f14a2f842f1e9a55614d43fe509bb77fd89
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Commit fb376e0fcc removed an array that
facilitated returning the names of built-in types, to avoid the jump tables
from the switch statement. This commit brings it back but makes the array a
compile-time constant string offset table.
The array is created by way of a set of C++11 constexpr functions, so we
require that compiler feature. I've tested that MSVC 2015 does support
it as well as the ICC 17 when masquerading as MSVC 2015, so I've enabled
for that too. The only compiler left out is MSVC 2013.
If we didn't need to support MSVC 2015, this could have been written
more simply with C++14 relaxed constexpr.
This also adds unit tests to confirm that QMetaType::typeName() does
return null when we said it would. We're testing QMetaType::User-1
(which we'll likely never use) and QMetaType::LastWidgetsType-1 to
select something inside the range of the built-in types.
Task-number: QTBUG-58851
Change-Id: I4139d5f93dcb4b429ae9fffd14a33982891e2ac1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This removes some tight coupling between QMdiSubWindow and
QMacStyle in order to allow the latter to be moved into a plugin.
Change-Id: I090c2c5774279c0454486c3db2e77f00a646b145
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
[ChangeLog][moc] Added Support for C++17 nested namespaces
Change-Id: Ib83fc5bf48f66546fa97b49710582fbf9c984503
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
For consistency with ucstrcmp(), which does the same.
Before, the two overloads would sort null before empty strings. This
behavior was removed in Qt 3.0, IIRC-
This does not yet change anything, as all callers seem to work around
the problem by handling null strings before calling this function
(directly or indirectly). We would have seen a failure crop up if it
wasn't so.
As soon as we use these functions to compare QStringViews, however,
the functions need to deal correctly with a nullptr lhs and/or rhs, so
fix them.
Change-Id: Ie4e417aade993213169b96b5e7351850c52ae733
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
warning: Can't link to 'controlType()'
warning: Can't link to 'horizontalPolicy()'
warning: Can't link to 'verticalPolicy()'
Change-Id: I6b31acebf183defee7b4ab36976034ed4a3fc98a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Like in other functions, allocate arrays of quint64 instead of QRgba64
to avoid the cost of initializing large arrays on every small scanline.
Change-Id: Ie132b3157003a18a444ca5c4f94ae668d17327fd
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
As pointed out in the previous code-review:
Replace a bool ctor parameter with QFlags<enum> to conform to
Qt API Design Principles (Boolean Parameter Trap).
Since the bool with its many unwanted implicit conversions is
gone from the ctor parameter list now, drop the explicit
keyword again. It was requested because of the boolean parameter
in the first place.
Change-Id: Ibaf287a6a3e38c22f033fd5d9e024c54f30a1fd4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
QWindowsWindow::handleResized would call isFullScreen_sys which checks
if the window's screen geometry matches the one of the window. When
switching back from fullscreen, Windows will have set the geometry to
fill the next window, but we don't switch QScreen until later in that
function, inside handleGeometryChange. This would result in our window
to take the whole screen geometry, but the FullScreen state wouldn't
be transferred to the new screen.
Fix the issue by using screenForGeometry and check if we are fullscreen
on any screen.
Also make sure that we check the validity of m_savedFrameGeometry when
restoring after a screen remove, since we would previously restore to an
area not covered by any screen anymore.
Change-Id: I43bc02738007918e9a26c1d27a699c51d3365034
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This patch fixes the example that contained problems showing up
with mesa/nouveau drivers.
Change-Id: Ic90f6028e394138781f00bcc00c145c56134f441
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
The base implementation takes care of updating visibility and emitting
signals.
Task-number: QTBUG-59313
Change-Id: I270b37c894420902488d89dc0c79f4c12b8d9a29
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
... as a replacement for two QPairs and move some common
QFont/QPalette functionality into it.
Change-Id: Iaab92130dd54eaa7900ac2048014a80cbd04bfb6
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Call sites of NmakeMakefileGenerator::writeResponseFileFiles expect that
the output is terminated with '\n'. Do not bail out if files is empty.
Task-number: QTBUG-59305
Change-Id: Id3fef8dbc506dad1868e6b352119f5f27b50a368
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Lambda functions provide all the benefits of std::bind() plus more
Change-Id: Iec30b20bb35ac0fae560435b323f80af2f2e5fce
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This was added in 2006 (when Tiger was the latest version of macOS) in
order to work around an issue where the pasteboard would not be
available when running under a non-graphical session. The latest
supported version of macOS is currently 10.10 on which this is not
expected to be an issue, so this workaround and therefore the Carbon
dependency can be removed.
Change-Id: Id5ed0a7e531dda71ce461c8bbbaebd5d4cadbd0e
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Carbon is deprecated and we should not rely on it at runtime or compile
time. These headers were only included for a small collection of
keyboard key constants which have now been hardcoded instead.
Change-Id: Ia2eaa267584b63be8019be3bbf64cba897a985a8
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
These code paths are actually never exercised at all.
Change-Id: I95a5cfa0173e265573c30378ec2e03a2ddf954e4
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Change-Id: I10a1c4b742bb446f7baa219d4118a03d9f60495c
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Required for implementing upcoming QStringView's member functions such
as compare(), indexOf(), endsWith(), ...
Most implementations of the function body just add the length to the
begin pointer to obtain an end pointer and then either no longer use
the length, or decrease it in lock-step with increasing the begin
pointer.
The only exception is MIPS DSP's qt_ucstrncmp_mips_dsp_asm(), which
gets the length passed in as an uint, implicitly converted from the
int parameter, proving that calling the function with negative length
was always undefined behavior, and therefore using an unsigned type
does not introduce incompatibilites.
I don't stand a snowball's chance in hell to fix the assembler
routine, but since the code is only included for MIPS32, we don't need
to do anything except be paranoid, add a static_assert that uint is
the same size as size_t, and keep calling the old code.
Dropped Q_COMPILER_LAMBDA in some places. We require lambdas since 5.7.
Also hold lambdas by value, not by reference. This stuff is supposedly
completely inlined, anyway, so there's no reason to make the code more
complicated with magic lifetime extension of temporaries bound to
references.
Change-Id: I0c7bdc47648b873992b51b2e9d47d808390320ea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The extension of ucstrncmp to size_t will introduce the first user
of this loop unrolling construct with size_t indices.
Instead of choosing between int and size_t, make the index type a
new template argument to facilitate a step-by-step transition from
int to size_t users.
Change-Id: I9d8fa7aaefa572130403bd19e11f52c58dff0a4d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
These files are unused.
They still contains Qt3 code (QCString for example)
Task-number: QTBUG-59302
Change-Id: I661f08db4092311df1d6c7d54b9780d86adab8aa
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The data is 256 bytes, so might as well align it on a 16-byte boundary
to facilitate copying (if that happens). We should consider similar for
QByteArrayMatcher in 6.0.
Change-Id: I74966ed02f674a7295f8fffd14a8c64526d734bb
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
... as a replacement for QPair<enum, int>, and move some
repsonsibilities into it.
This avoids the repeated use of the magic number -1 to indicate
invalid locations and does away with the confusing .first and .second,
replacing them instead with proper names, .position and .index.
Change-Id: If904c5333cecf8ce3d5160ca4be9264a13a2b72a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>