Commit Graph

46555 Commits

Author SHA1 Message Date
Tor Arne Vestbø
e255146183 Replace use of deprecated Q_OS_MACX in favor of Q_OS_MACOS
Change-Id: I1059d56f67be28a4cc1a66b744e81df6d0b5d00d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-08 01:09:38 +02:00
Volker Hilsheimer
4f952aaea1 Move method only used in keypad navigation to a better place
QDesktopWidget in particular doesn't use that code anymore.

Change-Id: I8eed752175c5478663b25872c7ffe78c814245d7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-07 23:09:38 +00:00
Lars Knoll
a2cef41a31 Extend QSharedMemory to work with qsizetype for sizes
This allows larger than 2G memory segments to be allocated.

Fixes: QTBUG-76995
Change-Id: I95309eeea511fadb28724c7592298c2fcc6f1d1a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-07 20:38:57 +00:00
Tor Arne Vestbø
9ad1c6d835 Rewrite AA_MacDontSwapCtrlAndMeta documentation
Change-Id: Ifc41d0d341aed029e89baa3fc20f9535c1fb01d9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-07 22:01:58 +02:00
Volker Hilsheimer
359616066e Refactor QTabBarPrivate::Tab and much of its usage in QTabBar
The type was broken in that it pretends to be a value, but didn't
implement the necessary operators for save copy, move, or comparison.
Tabs are supposed to be managed by Tab instance, as the crazy
implementation of operator== demonstrated.

Refactor the code to use it as a pointer consistently, even though this
means additional allocations for each tab. This is however acceptable
since there are not millions of tabs, and there is only a single place
where tabs are removed from the list.

Also use ranged for where possible, and never access the tabList using
operator[] to avoid detaches.

Use a std::unique_ptr for the animation in the tab, which implicitly
protects against attempts to copy a Tab, and allows us to use the
compiler generated default destructor. Add Q_DISABLE_COPY_MOVE for good
measure, the compiler-generated move semantics would not work either
due to the back-pointer from animation to the tab.

Change-Id: I8e8c071472f8f1f401b0f4f1dde074d800842934
Fixes: QTBUG-85394
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-07 21:40:50 +02:00
Lars Knoll
652459afde Improve performance of property binding evaluation
Improves performance of binding evaluation by ~20% for
simple C++ bindings by simplifying and inlining the code
that clears the array of property observers.

Change-Id: I829ac1895f1673367d737944d950360015a5b435
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-07-07 21:20:04 +02:00
Tor Arne Vestbø
086ca457b5 Fix no-EGL build
Fixes: QTBUG-85464
Change-Id: If3a3acfb514c9b787bc3e9350da378d2f5d1bfa5
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2020-07-07 21:07:58 +02:00
Tor Arne Vestbø
357966a72c Make QGuiApp::platform(Function|NativeInterface) internal
Task-number: QTBUG-83252
Change-Id: I3d53114f6cf43aa482d0c30938dabc86bb05ea67
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-07 21:07:52 +02:00
Giuseppe D'Angelo
1e8d623340 QThread::create: remove the pre-C++17 codepaths
As we require C++17 now. The configure-time test checking for
future/async is left in for the moment being.

Change-Id: Ifde39d420673f70a2277f5a645bfaad30935a381
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-07-07 20:54:12 +02:00
Jarek Kobus
471e4fcb22 Use QList instead of QVector in gui implementation
Task-number: QTBUG-84469
Change-Id: I366e845249203d80d640355a7780ac2f91a762f1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-07 20:35:05 +02:00
Daniel Kahn Gillmor
7f400522c3 Clarify warning message about PIC/PIE
As noted in discussion at https://dev.gnupg.org/T4982#135524, when
there is a mismatch between position-independence of the Qt library
and other compilations, the warning produced by Qt is confusing.

It should say explicitly that -fPIE should not be passed.

Change-Id: I66394f86230a6598ac383bfd7bb14ab8cbbf6245
Pick-to: 5.15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-07 21:35:04 +03:00
Jarek Kobus
a7f9d5a7fa Use QList instead of QVector in util
Task-number: QTBUG-84469
Change-Id: I077fb5c32456d438a457c1f73852313ea2ea9ae5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-07 20:34:48 +02:00
Shawn Rutledge
c7c28b3406 Separate QPD::tabletDevice into priv tabletDevice and queryTabletDevice
There doesn't seem to be any reason users will need to query tablet
devices by their IDs, because every event comes with a complete
instance already, and we have QInputDevice::devices() to list them all.

QPointingDevicePrivate::tabletDevice() can create a new instance if a
matching one is not found (and complains about that); it's intended
for use in QtGui, as a way to find the device if it was not part of the
QWSI event. Now it sets the parent of those auto-created instances
to QCoreApplication to avoid a memory leak.

On the other hand, queryTabletDevice() is intended for use in platform plugins
that need to check whether an instance exists; but they will take care
of creating new instances themselves, and thus have more control over the
parent and the details being stored. Now that the systemId can also be given,
the search is more likely to have a unique result, on window systems
that provide device IDs.

Rename id() to systemId() to clarify that it's a system-specific unique
device ID of some sort, not the same as the uniqueId that a stylus has.
However it seems that in practice, this will often be 0; so clarify that
if it's not unique, QInputDevicePrivate::fromId() and queryTabletDevice()
may not always find the right instance.

Clarify the function usage via comments.

Change-Id: I82bb8d1c26eeaf06f07c290828aa17ec4a31646b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-07 16:14:58 +00:00
Pengfei Zhang
8936918a65 Fix rendering error in some glyphs
Caused by a spelling mistake in the calculation.

Pick-to: 5.15
Pick-to: 5.12
Change-Id: I69445fcd8a45b60c34d51aa09d778d4fee447065
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-07-07 13:35:05 +00:00
Lars Schmertmann
6ce2f3f26b Add ; to Q_UNUSED
This is required to remove the ; from the macro with Qt 6.

Task-number: QTBUG-82978
Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-07 11:51:48 +02:00
Jani Hautakangas
d9cc149995 Fix floating point clip rectangle rounding in raster and opengl paint engine
Fixes: QTBUG-83229
Pick-to: 5.15
Change-Id: If94028f27c9085e391acb9c423cde1b7c12bca36
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-07-07 11:50:09 +02:00
Volker Hilsheimer
7e2fded55e Remove usage of QDesktopWidget(Private) from most places in QtWidgets
Call QGuiApplication and QScreen APIs directly to get geometries, and
make use of QScreen::grabWindow grabbing the screen it's called on when
called with WId == 0.

This assumes that QGuiApplication::screen and QWidget::screen never
return nullptr, which is already assumed in other places.

In QSplashScreen, simplify the code to operate on the screen of the
QSplashScreen itself. Remove the case that handles a QDesktopWidget
parent - QSplashScreen doesn't have a constructor that takes a
QWidget* parent anymore.

In the QEffect implementation, we can rely on the widget pointer
not being nullptr (it's tested in the free functions client code
uses).

Includes a few drive-by changes to coding style and logic in
qtooltip.cpp, where the tip label placement now prefers the screen
of the widget the label is created for, and uses the position only
as a fallback.

What remains is the special handling of QDesktopWidget and the
Qt::Desktop type in QWidget and QApplication.

Change-Id: I30b67bab8ae82ddfcc7bbbec3c10f6e935b74f06
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-07-07 11:49:32 +02:00
Tor Arne Vestbø
bcbc4d4de2 macOS: Get rid of QCocoaWindowFunctions
The functionality is now directly available in the QCocoaWindow platform
interface, instead of going through the indirection of the platform headers
and native interface.

Task-number: QTBUG-84220
Change-Id: Ifc48263c83806705b44364f7727d317847737ab4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-07 11:49:31 +02:00
Tor Arne Vestbø
d7fc2fb5c6 macOS: Remove QMenu indirection via QPlatformNativeInterface
Task-number: QTBUG-83252
Change-Id: I0c750d2b1912ced343d96ea0ca081c3319be2889
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-07 11:49:27 +02:00
Alexandru Croitor
7ad5c5346f CMake: pro2cmake: Remove dead code regarding resource retaining
qtdeclarative as of 41864db3b61d9e81a9fe4906918d2cd3d6d32a0c always
retains the resources, so there's no manual facility for retaining
left. Remove the code.

Change-Id: If79b66683897b5f430844e13c0230e41a2cf061d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-07 11:48:46 +02:00
Alexandru Croitor
19b04f6928 CMake: pro2cmake: Fix handling of QT_SKIP_QUICKCOMPILER
If a file was part of a resource that has a non-empty base directory,
the script generated set_source_files_properties calls to the file
path without including the base dir, which means the command did
nothing.

The script should set the QT_SKIP_QUICKCOMPILER on the full file path
if a base dir is present, similar to how the alias handled.

Refactor the alias property writing code to write all properties
into the command that uses the full correct path.

Change-Id: Ic75d51ecf60eef3ada9bd6ca26882de3447896e9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-07 11:48:45 +02:00
Volker Hilsheimer
82cb1ecca2 Fix another printf format warning with qsizetype
As done in 939f5112a1 elsewhere, use %zd
and cast explicitly to size_t.

Change-Id: I2fc7607725829f80cc125568246503af341749f1
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-07 11:48:45 +02:00
Jarek Kobus
77bb50de8f Use QList instead of QVector in qtbase
Fixes all other QVector occurrences

Task-number: QTBUG-84469
Change-Id: I5f9311298d341a9a3061a6a640539583d1618939
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-07 11:48:45 +02:00
Jarek Kobus
989fca660c Use QList instead of QVector in corelib tests
Task-number: QTBUG-84469
Change-Id: Ic80fde5517aed363f17d0da55cadcc958c3c8895
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-07 11:48:45 +02:00
Jarek Kobus
d33655a953 Use QList instead of QVector in other qtbase tests
Task-number: QTBUG-84469
Change-Id: Ie0455c890c048c52eacad1badd6d21df999badf9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-07 11:48:45 +02:00
Joerg Bornemann
a02d2d3f22 CMake: Write EXTRA_RPATHS to qmodule.pri if QT_EXTRA_RPATHS is set
Change-Id: Icd13cc047a9ca33f2ec9b6c2ce8216cbc4ae378b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-07 07:16:38 +02:00
Volker Hilsheimer
d2e3f00367 Clean up data members and initialization in QAbstractSpinBox
Group the bit flags together and generally order roughly by size to
give the compiler better packing options.

Change-Id: I9468d5aaef96e115ad363c59222e626d792a0edc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-07 06:29:07 +02:00
Volker Hilsheimer
bb5171fb54 Remove unused virtual method QWindowPrivate::allowClickThrough
Always returned true, also in the QWidgetWindowPrivate override.

Change-Id: I01d11ae6f85882b52ce397125f994eea663ffcb5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-07 01:09:30 +02:00
Friedemann Kleint
23282ac23d SPI Accessibility: Remove global variable
Change it into a member variable of QSpiAccessibleBridge.

Task-number: QTBUG-83255
Change-Id: Ia781a7c86723e343680bf804be6393640f83a516
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-06 22:23:49 +02:00
Lars Knoll
563fbe79e5 Try to workaround bogus compiler warning in gcc 9 for ARMv7
../../src/corelib/io/qurlidna.cpp: In function ‘QString qt_ACE_do(QStringView, AceOperation, AceLeadingDot)’:
../../src/corelib/io/qurlidna.cpp:2543:23: error: ‘int __builtin_memcmp_eq(const void*, const void*, unsigned int)’
     reading 8 bytes from a region of size 2 [-Werror=stringop-overflow=]
              if (memcmp(result.constData() + prevLen, acePrefixUtf16, sizeof acePrefixUtf16) == 0)
                  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

In function ‘bool operator==(const QByteArray&, const QByteArray&)’,
     inlined from ‘virtual void (* QLinuxFbIntegration::platformFunction(const QByteArray&) const)()’
          at ../../src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp:185:18:
 include/QtCore/../../../../src/corelib/text/qbytearray.h:571:45: error:
     ‘int __builtin_memcmp_eq(const void*, const void*, unsigned int)’ reading 17 bytes from
          a region of size 1 [-Werror=stringop-overflow=]

The warnings/errors are bogus. Fix them by using QStringView::sliced() and de-inlining the
comparison operator for QByteArray.

Change-Id: I24956fe74a7989e75cd03d717570b8fca493ab23
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:31:40 +02:00
Lars Knoll
9117e3850b Rename from() to sliced()
After API discussions, agreement was that from(n) is a bad name
for the method. Let's go with sliced(n) instead.

Change-Id: I0338cc150148a5008c3ee72bd8fda96fb93e9c35
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:31:35 +02:00
Lars Knoll
e5fbe10647 Small fixes to the QList documentation
Change-Id: Ic839f7859912eb48bb192755d6f10536a0a73f8e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-07-06 21:31:30 +02:00
Lars Knoll
792cb3989a Add support for first(n), last(n) and sliced() to QList
This keeps the API symmetric with what we have in our string
classes.

Change-Id: I94c5b39b718ca2472f9ca645e7a42e4314636f67
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:31:25 +02:00
Lars Knoll
9a9a1a2a2e Port QString to qsizetype
Change-Id: Id9477ccfabadd578546bb265a9483f128efb6736
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:31:20 +02:00
Lars Knoll
df853fed66 Use qsizetype in QList
The change creates a slight source incompatibility. The main
things to take care of are

* code using printf statements on list.size(). Using qsizetype in
printf statements will always require a cast to work on both 32
and 64 bit.
* A few places where overloads now get ambiguous. One example is
QRandomGenerator::bounded() that has overloads for int, uint and
double, but not int64.
* Streaming list.size() to a QDataStream will change the format
depending on the architecture.

[ChangeLog][QtCore][QList] QList now uses qsizetype to index into
elements.

Change-Id: Iaff562a4d072b97f458417b670f95971bd47cbc6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:31:14 +02:00
Lars Knoll
3711bf85ae Help qtestlib with int -> qsizetype changes
Make sure we can handle qsizetype as an integer when appending
test data. This is required for backwards compatibility with Qt 5,
so people don't have to rewrite all their test cases.

QCOMPARE can handle mixed types, tthe only method that requires manual
changes now is QTEST(list.size(), "testrow_expecting_int").

Change-Id: I40723b239e0160cefc05745aa35a75de8599ac08
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-07-06 21:31:09 +02:00
Lars Knoll
215ca73534 Allow allocating more than 2G items in a vector
Also adjust qCalculateBlockSize() to be able to handle large
allocations.

QVector::length() is currently still limited to 2G items, that will
get changed in a later commit.

Change-Id: I3a92fbfd7f281d30844c5fafa3b9a474bc347c19
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:31:01 +02:00
Lars Knoll
ded37aedc9 Implement a proper iterator for QTypedArrayData
This avoids ambiguities in our API when someone e.g. writes
vector.insert(0, ...).

It requires a slight workaround in qlalr, where std::search()
for libc++ doesn't like that our difference_type is qsizetype.

Change-Id: I40aa1040781ffbdd12d04410078207969b3bde53
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:30:54 +02:00
Lars Knoll
0341bf2e97 Make QArrayDataPointer::size a qsizetype
This is a next step towards making QList, QString
and QByteArray able to deal with large sizes.

Change-Id: Icad49b33f503401ac4912678b2f88584c6f91a63
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:30:47 +02:00
Lars Knoll
c129362b4d Add a couple of noexcept
Change-Id: I993da2094482092540388ee72be3262bac94fad7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:30:40 +02:00
Lars Knoll
fbce2e58e6 Get rid of QArrayData::sharedNull()
Remove the last places where those got used and avoid
allocations when we resize to 0.

Change-Id: Ib553f4e7ce7cc24c31da15a55a86d18bdf1cc5c3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:30:33 +02:00
Lars Knoll
c01804bd1e Get rid of QArrayData::isMutable()
Change-Id: Ifb6368b83cd12ec3897c6b6b846d71bffa1f74b9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:30:27 +02:00
Lars Knoll
f8a53388a7 Get rid of unused flags in QArrayData
Change-Id: I3ea754b44fb33e33baba0781d9ae15b7f3b3d8eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:30:19 +02:00
Lars Knoll
a8d5f38537 Avoid allocating a d-pointer for empty strings
Those can simply be handled as compile time constant strings
pointing to the empty (Q)Char.

Change-Id: I1f6f6ab923a30c68a720003ca68c34c572aa29da
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:30:12 +02:00
Lars Knoll
a46caf087c Simplify Q_ARRAY_LITERAL
And clean up some unused pieces of code.

Change-Id: I285b6862dc67b7130af66d3e08f652b1a56b990e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-06 21:30:06 +02:00
Lars Knoll
76004502ba Get rid of shared null for QByteArray, QString and QVector
As a side effect, data() can now return a nullptr. This
has the potential to cause crashes in existig code. To work
around this, return an empty string from QString::data()
and QByteArray::data() for now.

For Qt 6 (and once all our internal issues are fixed), data()
will by default return a nullptr for a null QString, but we'll
offer a #define to enable backwards compatible behavior.

Change-Id: I4f66d97ff1dce3eb99a239f1eab9106fa9b1741a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-06 21:29:58 +02:00
Giuseppe D'Angelo
2e51686746 QList: improve the range constructors
In case of forward iterators, call std::distance just once and not
twice. In case of non-forward iterators, don't call
reserveIfForwardIterator -- as the name says, it doesn't make sense
on non-forward iterators.

Change-Id: I7e6a603205286c05f7bc7c47fd1f1e0d92705b20
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-06 17:59:07 +02:00
Giuseppe D'Angelo
95326a2977 QList: go for the rule of zero
The hand-written special member functions did exactly what the
compiler generated ones would do anyhow.

Change-Id: I66439178460d30957135aac44680dd3109ada62a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-06 17:59:00 +02:00
Giuseppe D'Angelo
bb02b9696e Q*Iterable::const_iterator: pass by const reference
The iterators are quite heavy objects (>100bytes), don't pass them
by value.

Change-Id: I4c9d1f64d14419a35bd067884d7e8bca2589f9b9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-06 17:58:55 +02:00
Joerg Bornemann
26fbf8082c CMake: Support configure -force_debug_info
Task-number: QTBUG-85373
Change-Id: Ia798fc2cf715aed9157e1d9e2f64187c16e38bcf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-06 17:44:01 +02:00