... using the same qt_trimmed(), qTrimmed(), Q..::trimmed() split we've
been using for all other out-of-line string-view member functions to
avoid forcing string-view objects onto the stack for the passing of 'this'.
In the test, had to fix nullness not being propagated from a QByteArray
to the QLatin1String constructed from it. Probably worth fixing in
QLatin1String(QByteArray), too.
[ChangeLog][QtCore] Added qTrimmed() free functions.
[ChangeLog][QtCore][QLatin1String] Added trimmed() function.
Change-Id: I73c18ef87e203f30f7552c10dd5c84223bcfae0e
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is often more natural than (ptr, len), and I need it in the
implementation of QLatin1String::trimmed().
[ChangeLog][QtCore][QLatin1String] Added a constructor taking two
pointers, complementing the constructor that takes a pointer and a
length.
Change-Id: I0606fa0e3f820af1c3c1e261a340e5a941443e4f
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is often more natural than (ptr, len), and I need it in the
implementation of QStringView::trimmed().
Change-Id: I1d99b5ddaf76eee0582150b0233ef6ce9c37d25d
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Necessary to support C++17's [[nodiscard]] attribute, which needs to
be placed at the beginning of a function declaration.
Change-Id: I31494d13c7be558e86378782ab8684ef2956730b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... to {setButtonState,buttonState,m_buttonState}. This is more
consistent with the naming from XCB events:
xcb_button_press_event_t->state
xcb_button_release_event_t->state
xcb_motion_notify_event_t->state
Change-Id: I51ebb858defbdfee4a2009922178f0e58658e6b6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Emulation of non-logical coordinate mode gradients was implemented by
essentially 3 x 2 repetitions of the same manipulation of the QBrush
transform. Avoid the code duplication by extracting a common method.
Add lancelot test scripts that excersizes these code paths.
Change-Id: I7baa921923231ef9e83e443dba996b82b32ad1e7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
No need to have two enums for the exact same purpose.
qmacstyle auto-test updated as well.
Change-Id: Ia601648191e39c0cbbaa7477143441005ae063c2
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
We probably changed how rounding is done between CGRect
and QRect coordinates, but we expect more things to change
in the near future.
Change-Id: If961849c46edc5fcfee9aef2acda57f386b2928b
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
The platform window is cleared in detachFromPlatformWindow, just like the
delegate, but the platform window may be cleared due to other reasons as
well, so use that as a guard before calling functions on the pw.
Change-Id: Ie0773182073d4932b2bca8bc0fc8af24b8895a9d
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Add a comment, to describe the relation of
QObjectPrivate::currentChildBeingDeleted and
QObjectData::isDeletingChildren, given that this field is defined
in an entirely other file on a base-class, making it severely
non-obvious to the reader.
Task-number: QTBUG-57714
Change-Id: I7b8b24693c4ccc6192e9f9f34f951202b7fdddb0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Link to ApplicationServices since that's where this function
is located. Whether this framework may be removed with Carbon
is unknown at the moment. It does remove an obscure dependency
nonetheless.
Change-Id: If6514f70ca434298f1c88457adac51d38a1afa22
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
We use the NSColor system/developer palette instead of
HITheme brushes.
Change-Id: I11b34c7049ca98057eaeca5a0d0b8f64dbe3e5ab
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
QWidget has its own setVisible() code that needs to
be run in order to correctly transition widget visibility.
It is desirable to be able to show and hide (native)
widgets also from the QWindow side, for example from
the platform plugin, or from generic QWindow handling
code in QtGui.
Add a new virtual QWindowPrivate::setVisible() and
move the QWindow visibility implementation there.
Subclasses can now override this function to add custom
code.
Make QWidgetPrivate::show/hide_sys() call the QWindowPrivate
setVisible implementation instead of the QWindow setVisible
public API.
Change-Id: I082f174b100659e1221d5898b490f8a9f498abdf
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit fixes two bugs:
1) Two ranges should not be merged if they are of different columns.
The old code would have merged (0,0) with (1, 1). Tranforming a selection
of just two indexes in a rectangle of four indexes.
2) The QItemSelectionRange appended had wrong column and worked only for
indexes of the first column. For example if 'tl' was (0, 1) than br was (0, 1)
so the QItemSelectionRange would have be ((0,1), (0, 1-1)) so ((0,1), (0,0)).
This QItemSelectionRange is invalid because topLeft columns is greater than
bottomRight column. The fix take in consideration the bottomRight column.
Task-number: QTBUG-58871
Change-Id: I591ef0bcc63926f24a7b1ced002af9b7737a4b6e
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
With the right guards for isContentView() we can use m_view.window
directly. The only instances left of m_nsWindow are during window
creation, which will be removed in a followup.
Message send syntax for reading or writing Objective-C properties
has been replaced with dot syntax where appropriate.
Change-Id: I86925753612516625c93ea5bbedc98a3ddd8fec4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
And unify all of them to use regular pointer check syntax, to stay
consistent with other uses of non-smart pointers.
Change-Id: Ic55d7a16f2010120aaa8eac5b2df8189490671a2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Some AMD cards have been reported to not update otherwise.
Task-number: QTBUG-60527
Change-Id: I84d57a57eb2b76fb31255ae42b79b96ab7b257c9
Reviewed-by: Kimmo Leppälä <kimmo.leppala@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The m_nsWindow member both indicates whether or not the QCocoaWindow
represents the content view of a NSWindow, and provides access to that
NSWindow. The former is better expressed through isContentView(), which
allows us to then replace m_nsWindow entirely in a followup with access
though m_view.window, removing the need to cache the NSWindow.
Change-Id: I6e7de4b6d64b29fc9023222be045254f18be28cd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Any objects directly or indirectly autoreleased in main(), before we start
the event loop, will never be released, as there are no pools present yet.
This includes all resources allocated during application and window setup,
unless those function have local pools. Ideally that setup code would be
called from within the runloop callstack, where there is a pool present,
but that requires a new main/startup-API for Qt.
To aid in debugging object ownership and hierarchies within Qt, we set up
our own root level pool tied to QApplication, which ensures that most objects
autoreleased in main() will eventually be released and have their dealloc
methods called.
The feature can be disabled by setting an environment variable:
QT_DISABLE_ROOT_LEVEL_AUTORELEASE_POOL=1
Combined with OBJC_DEBUG_MISSING_POOLS=YES, this allows breaking on the
function objc_autoreleaseNoPool to weed out codepaths in Qt that should
have local pools.
Change-Id: Id02e1edaaaeaa04c53862d7228e519214c99ab51
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
ProtocolInvalidOperationError are meant for actual replies from the
server indicating that the operation is not valid (HTTP 400 Bad
Request).
Change-Id: I9ad33fff8b634979bdbafffd14bbc57e4b21d6bf
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The QMimeType class can be quite useful to graphical QML applications,
especially on the desktop.
[ChangeLog][QtCore][QMimeType] Add Q_GADGET, so that QML applications
can make use of QMimeType's properties and methods.
Change-Id: I03e6e82062558a72f5b97e65bbddfc4b7470e735
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Jeremy Katz <jeremy@panix.com>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
They're deprecated since C++11 and removed in C++17.
Change-Id: Ia2acd9312707bfee96838743645a04ae1780e5dd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Clients don't (or shouldn't) care if a selection clipboard is supported
for instance. They should just try to use it. There's nothing they can
usefully do if the platform doesn't offer a selection clipboard (like
Mac).
Change-Id: I0adb79766807806a4754353b48e33ed8acf9100a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
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>
QLocaleData::unsLongLongToString uses qulltoa, which will allocate a
zero-length QArrayData. Then with padding a single 0 was put in a
QString, which gets prepended to the result. By taking care of this
special case, we can now also fast-path the common case where base=10
and no flags nor precision was provided.
Change-Id: Ia893b0ea4c77634c24e7cef5aafb06d0ef44c507
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The existing QHash::operator== does not work when the same
keys appear in different order between the two hashes being compared.
However, relying on iteration order on a QHash is (as usual) a bad
idea and one should never do it.
Task-number: QTBUG-60395
Change-Id: Ifb39a6779230e26bbd6fdba82ccc0247b9cdc6ed
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Compilation and link times in CPU seconds with GCC 7, using precompiled
headers (not including moc, rcc, uic, etc. steps or headersclean):
Before After
Debug -O0 198,1 180,3
Debug -Og 240,7 229,2
Release -O3 267,1 249,2
Release LTO 239,4 229,8
QtCore required a little manual adjusting because some files are
bootstrapped into moc itself and into qmake.
Change-Id: I84e363d735b443cb9beefffd14b8b57c10e7da36
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
There's no need to derive. This fixes the build with MSVC 2017 under
/permissive-. I don't know what was wrong (ICC, Clang and GCC don't
complain), but it must be related to "Lookup members in dependent base"
in [1].
[1] https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance
Change-Id: I9ad33fff8b634979bdbafffd14bb8016f5dc98b3
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>