Commit Graph

47783 Commits

Author SHA1 Message Date
Laszlo Agocs
8641d5d729 rhi: gl: Correctly report WideLines for OpenGL
In core profile contexts a line width other than 1 may not work
as expected since it is deprecated in the core profile.

Change-Id: I3fc33cf90c65156aa87d04f08518c9ddcfb62625
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-08-30 17:45:02 +02:00
Laszlo Agocs
9390edb119 rhi: Work around qsizetype fallout in manual tests
Change-Id: I9f0e210caacc6eefe5ed1ee6fa97574ad5e9edcc
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-08-30 17:45:01 +02:00
Laszlo Agocs
67faf0641d rhi: vulkan: Enable features on the device
The silly fine-grained enabling of features on the VkDevice
seems to be ignored in practice by the implementations, but
wideLines becomes relevant because the validation layers warns
if a line width is set on the pipeline without enabling the feature
on the device. So to play nice, enable the features we care about.

Change-Id: I0c64a0d10a8279fe43d899118b0d6f0e4f875d41
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-08-30 17:44:59 +02:00
Laszlo Agocs
fb4760bb21 rhi: gl: Also try GLSL 140 and 130
Change-Id: I21e3ca92d62f20f3ec608bef54c68f9bd09a207f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-08-30 16:17:16 +02:00
Marcel Krems
49efc168e1 QSqlError: Remove unused members, kept for binary compatibility
Also optimize the construction of QSqlErrorPrivate.

Change-Id: I791ebe0b66fab43e74093186a798ef9656f97dbd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-30 03:22:31 +02:00
Eskil Abrahamsen Blomfeldt
cba147d359 Fix text issues when using typographic names
By default, only the legacy family names are populated on Windows,
since we are using GDI to do the population.

The actual typographic names are added later as aliases when
the font is loaded.

This can cause us to fail matching a font against its typographic
name before it has been loaded and e.g .in Qt Quick we will cache
the glyph indexes for a fallback font instead. If the font is later
loaded and aliases are populated, we will use the cached glyph
indexes and get seemingly random glyphs displayed.

We reuse the mechanism invented for CoreText to do lazy population
of aliases. The population will now happen when the first non-match
occurs, and a second attempt will be made after we populate aliases.

[ChangeLog][Windows] Fixes an issue where fonts would sometimes not
fail to work when selected using typographic names.

Fixes: QTBUG-84786
Pick-to: 5.15
Change-Id: Ic7b65cde26ddcbf1a257f1673b9af37154660c2f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-30 01:57:37 +02:00
Morten Johan Sørvig
707b64bece Display combobox popup on the correct screen
Display QCompoBox popups on the correct screen, also
when the parent window spans multiple screens. In this
case, QWidget::screen() will return the main screen for the
window, which will not necessarily be the screen at
the combobox popup position.

Change-Id: Ib8a8163a757f7b849883b833fbde27a1e01af49a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-30 01:56:05 +02:00
Samuel Gaist
a646bcf2be QAbstractItemView: make clipboard copy less constrained
Currently when copying from an item view, only QString value types are
considered. This severely limits the usefulness of the feature as it
does not even allow to copy number nor dates that can be translated to
text.

This merge request changes that by checking if the content being copied
can be converted to a string rather that just being a string. This will
also allow for custom types to be handled.

Fixes: QTBUG-86166
Pick-to: 5.15
Change-Id: If57c986ef5831d59eeb59f9c4b900fa126ec31ea
Reviewed-by: David Faure <david.faure@kdab.com>
2020-08-29 23:26:58 +02:00
Volker Hilsheimer
add8262f72 Remove QStyleOptionProgressBar::orientation member
Address ### Qt 6 comment; the information is already stored in the
state variable, using the QStyle::State_Horizontal bit.

Change-Id: I61d143ba057776f9d622793a0592b5dd4726f25d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-29 22:05:09 +02:00
Lars Knoll
62c0844109 Move the data for QTimer into the d-pointer
We shouldn't expose it inline in the header file.

Change-Id: I400d805fd0769f788f257bbf78311fe1fb56df79
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-29 21:01:10 +02:00
Lars Knoll
f098aee532 Fix comparison of QVariants that contain pointers to QObjects
Allow comparing variants of different types, if both types
are pointers to related objects.

Amends change 4a69cd7f72

Change-Id: Ib52b17781b0b7f60cfd5da42fce733faacfa0ae8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-29 21:01:02 +02:00
Lars Knoll
4a1567ab12 Inline some methods that only forward to another overload
Change-Id: Iba74962d20c00de8996834f0a003f38c2d2cc3e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-29 21:00:51 +02:00
Edward Welbourne
78cf89c07d Use checked string iteration in case conversions
The Unicode table code can only be safely called on valid code-points.
So code that calls it must only pass it valid Unicode data. The string
iterator's Unchecked Unchecked methods only provide this guarantee
when the string being iterated is guaranteed to be valid UTF-16; while
client code should only use QString, QStringView and friends on valid
UTF-16 data, we have no way to be sure they have respected that.

So take the few extra cycles to actually check validity in the course
of iterating strings, when the resulting code-points are to be passed
to the Unicode table look-ups. Add tests that case mapping doesn't
access Unicode tables out of range (it'll trigger the new assertion).
Added some comments to qchar.h that helped me understand surrogates.

Change-Id: Iec2c3106bf1a875bdaa1d622f6cf94d7007e281e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-29 18:15:27 +02:00
Marcel Krems
ab5e444c8f Remove remaining traces of deprecated QtMsgHandler
Change-Id: I28aecb444eb9bc9e26e6ff8998904dbf28419f25
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-29 16:24:21 +02:00
Marcel Krems
2a896becdf qarraydataops: Fix compiler warnings under MSVC 2019.7
qarraydataops.h(444): warning C4127: conditional expression is constant
qarraydataops.h(444): note: consider using 'if constexpr' statement instead
...
qabstractitemmodel.h(261): note: see reference to class template instantiation 'QList<int>' being compiled

qarraydataops.h(1209) : warning C4702: unreachable code

qarraydataops.h(1104): warning C4913: user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used
src/corelib/kernel/qobjectdefs_impl.h(96): note: could be 'void QtPrivate::operator ,<std::reverse_iterator<QTypedArrayData<T>::iterator>>(std::reverse_iterator<QTypedArrayData<T>::iterator>,const QtPrivate::ApplyReturnValue<void> &)'
        with
        [
            T=QTextEdit::ExtraSelection
        ]
qarraydataops.h(1104): note: while trying to match the argument list '(std::reverse_iterator<QTypedArrayData<T>::iterator>, std::reverse_iterator<QTypedArrayData<T>::iterator>)'
        with
        [
            T=QTextEdit::ExtraSelection
        ]
...
codeedit.cpp(84): note: see reference to class template instantiation 'QList<QTextEdit::ExtraSelection>' being compiled

Change-Id: I3c5007e40f709c28bc8b3b3bec5ea98ea5f34e5a
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-29 15:07:54 +02:00
Marcel Krems
7e1432898e Remove MSVC workaround for QPolygon
Change-Id: I62f7c6da7629dcdfda653a136d3bcd483359c86c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-29 14:49:15 +02:00
Marcel Krems
fd92abb093 QLocalSocket: Print value OperationError on debug output
Pick-to: 5.15
Change-Id: Ib3e38e8c0a46b2070eca1e65f081b2d6d2774020
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-29 12:37:00 +00:00
Paul Wicking
e1b1dd7917 Doc: Remove obsolete snippet code
Obsolete code that is unused/not referenced from
documentation - get rid of it.

Task-number: QTBUG-81486
Change-Id: I82ee65b6e827666f88fa8ecf6d87ae736c893cc3
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-08-29 14:23:04 +02:00
Nico Vertriest
80cc233c59 Doc: Make Qt Gui snippets compilable - draganddrop
Task-number: QTBUG-81486
Change-Id: I0a10e4d353f864e295833ff7d4f47950c5199a21
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-29 14:22:49 +02:00
Paul Wicking
5596344100 Doc: Make Qt Gui snippets compilable - brush
Remove unused code in snippet files not referenced from anywhere.

Task-number: QTBUG-81486
Change-Id: I80b46c013bde99e1aea86311d3579ccc922b8fd7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-29 14:22:42 +02:00
Paul Wicking
5bf7ceb4d4 Doc: rename snippet project file
The project file name is wrong, so the project won't become
part of the parent subdirs project. Rename the project file
to correct this.

Task-number: QTBUG-81486
Change-Id: I069004caa5e7bdeecc0550fafe78f8977fbf7a87
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-29 14:22:36 +02:00
Andrei Golubev
a2b1b0292d Prepend optimize QString
Added prepend optimization to QString

Task-number: QTBUG-84320
Change-Id: Iaa8df790a10c56ecceb06f7143718fb94874ce76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-29 14:20:06 +02:00
Andrei Golubev
4b9ec00534 Support GrowsBackwards in QByteArray
Updated main QByteArray operations to support prepend-optimization path

There are still many things to consider especially algorithms that use
QByteArray::data() or do raw memory operations (e.g. memcpy) regardless
of the underlying memory layout, which was somewhat valid before but
will likely break now given free space > 0 at the beginning of the byte
array memory. Looked at existing cases in the scope of QByteArray, they
seem to be OK. Hopefully, CI would find missed violations if any

Task-number: QTBUG-84320
Change-Id: I7990cda165b8e77a397e41df4e145468e7a86be0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-29 14:20:06 +02:00
Andrei Golubev
7f3c0d8a05 Reserve extra space for '\0' in QArrayData::allocate
Added implicit space reservation for '\0' in allocation functions used by
containers. In current setting, this means sizeof(char16_t) bytes extra
memory is allocated each time and implicitly exists. The extra memory is
uninitialized by default

Task-number: QTBUG-84320
Change-Id: Ia3cc268183c00ea24ea9d326db3f392f71868d52
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-29 14:20:05 +02:00
Morten Johan Sørvig
5911335756 Port QtBase to the new QIcon::pixmap() API
The target devicePixelRatio can now be passed to the
pixmap() function, instead of a QWindow pointer.

This allows us to remove some usage of the QWidget pointer
in the styles, since the DPR is accessible from the passed
in painter. The QWidget pointer is still used in places where
we don't have a painter.

Task-number: QTBUG-85885
Change-Id: Ifecc669f5bad655e289a936d71bafe02605f21a4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-29 12:42:32 +02:00
Morten Johan Sørvig
1719be99a7 Deprecate QIcon API which take a QWindow pointer
- pixmap(QWindow * ...)
    Use pixmap(size, dpr) instead
- actualSize(QWindow *, ...)
    Use actualSize(size) instead

Task-number: QTBUG-85885
Change-Id: Ia2d73eec9f040cd659f39c854463e3cd3ba72b93
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-29 10:32:54 +00:00
Morten Johan Sørvig
4a0140832d QPixmapIconEngine: port to new virtual functions
Add availableSizes() override function and move the
implementation out of virtual_hook().

Task-number: QTBUG-85885
Change-Id: Ida3575b25e9bca6167b5be97d6a8f0f624559602
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-29 10:03:23 +02:00
Morten Johan Sørvig
6486102595 QIconLoader: port to use new virtual functions
Add override functions and move the implementation
out of virtual_hook().

Task-number: QTBUG-85885
Change-Id: I35ed81a3483dd85d49474b78572d5302b0e5b608
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-29 10:03:10 +02:00
Morten Johan Sørvig
319462559f Port tst_qiconhighdpi to the new QIcon::pixmap() API
Port the high-dpi icon test to use the new pixmap()
API which takes the target devicePixelRatio as an argument.

This means we can run the fromTheme test at dpr = {1,2,3},
instead of at the current global devicePixelRatio only.

Task-number: QTBUG-85885
Change-Id: Iec7b21e04ed760e48964307d2048eaec1976ffe2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-29 10:02:47 +02:00
Lars Knoll
4294e82fe9 Add const to some methods
Change-Id: I60e93e0c9b57468ef4188bdb60a32fb9ac9046e1
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-08-28 22:31:28 +02:00
Tor Arne Vestbø
9d2b43de19 Use build-system to declare tests that are low-DPI
Change-Id: I6da7204683b3c46232cfc542ed5e28131a82e87d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-08-28 22:16:53 +02:00
Edward Welbourne
1aa412987f Remove QUnicodeTools::DefaultOptionsCompat
Used in only one place, declared in a private header with a comment
saying to remove it. All callers of the one function that had it as
default parameter value are passing a value for the parameter.

Task-number: QTBUG-85700
Change-Id: Ic72e4df730740a4023b0a43be6bf7acf33a3166b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-28 21:29:45 +02:00
Edward Welbourne
429985b53a Convert QStringView::toWCharArray() to return qsizetype
As requested in a ### Qt6 comment.

Task-number: QTBUG-85700
Change-Id: I28a02bf49f4a6455a21a6032179318ce2915b8ca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-28 21:29:29 +02:00
Edward Welbourne
34a095848d Inline QString's conversions to integral types, except long long ones
As requested by a ### Qt6 comment.

Task-number: QTBUG-85700
Change-Id: I7c2813c0d8fbc38bcd2f7229de3a9d8e1b8b1f03
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-28 21:29:18 +02:00
Edward Welbourne
0d11a92af9 QLatin1String: finish up the qsizetype conversion
Correct one QString::lastIndexOf() whose return and parameter had been
changed, but body and comment hadn't.

Task-number: QTBUG-85700
Change-Id: Icbcd049f72346f0e696e6b22fe0893f6de5a2646
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-28 21:29:06 +02:00
Edward Welbourne
69014b6cd6 Use qsizetype for the size of QByteArray's raw data methods
A ### comment said to use int in setRawData(), which took a uint; but
the underlying QArrayDataPointer::fromRawData() takes a qsizetype, so
propagate that all the way.

Change-Id: Iba1f8d020c509b33f5c202c22c6a9bf85b3bab7f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-28 21:28:47 +02:00
Edward Welbourne
1fb35832df Simplify initialization of UnicodeData and PropertyFlags structs
Initialize values where they're declared, where possible.

Change-Id: Ib6bf33b27b19c76f406f78bc8a1bd9729bd8f2cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-28 21:27:51 +02:00
Edward Welbourne
e7db401b48 Use char32_t for QLocaleData::zeroUcs() and friends
Also catch some stray ushort that should be char16_t by now, use
unicode character values for some constants and rename a UCS2 variable
to not claim it's UCS4.

Change-Id: I374b791947f5c965eaa22ad5b16060b475081c9d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-28 21:27:40 +02:00
Edward Welbourne
2d6705575c Don't second-guess strcoll()
It's defective on Android, but no worse so than the fall-back we were
using; and we can't remember why we had that fall-back anyway.

Task-number: QTBUG-63518
Change-Id: I28e9b5c7cc64963c9e3941eb1bad85aced280a9b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-28 21:27:24 +02:00
Edward Welbourne
2d5dcd1b9f Include qhash.h in header instantiating QHash
Include what you use. In this case, the include needs to happen before
qpa/qplatformmenu.h, since that seems to pull in
src/gui/kernel/qwindowdefs.h, which confuses matters (somehow) with a
forward declaration.

Change-Id: Ic09ecb014563e8ebee86f338c7e98e470f82185b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-28 21:27:06 +02:00
Edward Welbourne
86ebe46f59 Make QTranslator::load() insist that its return value be checked
Add Q_REQUIRED_RESULT to force callers to check the return; the
QTranslator object is unusable if load() fails.
Check the result in QTranslator's own test.

Task-number: QTBUG-85700
Change-Id: I07509c76470cc87626190670665cd3162bfb17e7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-28 21:26:21 +02:00
Edward Welbourne
a144820ae7 QLine: swap IntersectType and IntersectionType
Make IntersectionType the enum and the obsolete IntersectType an
alias, with at least a comment to say it's deprecated.
Adjust the docs to match.

Task-number: QTBUG-85700
Change-Id: I0de9166b0d936f5b9a15fdd4f90cf7b01198e8d7
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-28 21:23:20 +02:00
Edward Welbourne
26547c296b Purge qalgorithm.h of deprecated API
A large slice of it has been deprecated since 5.2.

Reflowed a doc paragraph pointed out, in the deprecation commit, as
having been left ragged by its edits.

Note: qSwap() is documented as \deprecated but not marked, where it's
defined, as deprecated.

Change-Id: Iaff10ac0c4c38e5b85f10eca4eedeab861f09959
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-28 21:22:32 +02:00
Edward Welbourne
17ba201a3f QAnimationDriver: remove deprecated startTime(), setStartTime()
Deprecated since 5.13

Change-Id: Ie833647e4bd87698a882352f89b4727790ffeeaa
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-28 21:22:10 +02:00
Edward Welbourne
ae9a16b5cd Remove deprecated QDataStream::unsetDevice()
Deprecated since 5.13.

Change-Id: I9f8f58fb92bc12d32eab5b0ae8611611fe2481e5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-28 21:21:40 +02:00
Edward Welbourne
3f0c2ed9ac Qt namespace: purge deprecated enum members and a typedef
Since 5.0 - WFlags
Since 5.6 - ItemIsTristate
Since 5.14 - WA_NoBackground, WA_MacNoClickThrough,
WA_MacBrushedMetal, WA_MacMetalStyle, WA_MSWindowsUseDirect3D
WA_MacFrameworkScaled, ImMicroFocus
Since 5.15 - MatchRegExp, MidButton (really since 5.7.0),
WA_ContentsPropagated (really since 4.5.1, as are the following),
WA_WState_DND, WA_ForceAcceptDrops.

Change-Id: Ib1db3d85bf28823c704b5f3857546764b158e1ed
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2020-08-28 21:21:25 +02:00
Edward Welbourne
072fb7de51 Remove QTimeLine's curveShape
Deprecated in 5.15.1, removed in Qt 6. It is entirely redundant with
easingCurve, which has been there since 4.6.

Task-number: QTBUG-85520
Change-Id: Ib1daa322a17da390dd264ed8d48ac572138a5d84
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-08-28 21:21:09 +02:00
Cristian Adam
039c2f7a4b CMake: Support add_executable for Android
With the ANDROID_GUI target property set on add_executable targets,
CMake will generate a lib<target>.so file, which is what Qt requires
from a target.

By setting CMAKE_RUNTIME_OUTPUT_DIRECTORY with the same value as
CMAKE_LIBRARY_OUTPUT_DIRECTORY the ANDROID_GUI case will work as
expected in Android multi-abi case.

Instead of the following CMake code:

if (ANDROID)
    add_library(test-android SHARED
      main.cpp
      qml.qrc
    )
else()
    add_executable(test-android
      main.cpp
      qml.qrc
    )
endif()

you can have:

set(CMAKE_ANDROID_GUI ON)
add_executable(test-android
    main.cpp
    qml.qrc
)

Change-Id: I3995d6ff731d0525ca86f7260fe61d9ecb7b01ac
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2020-08-28 20:37:25 +02:00
Mike Achtelik
6e7b750791 Use ApplicationInfo to get metaData
Since the load*Libraries functions might also be invoked when using an android service,
where no activity is present, we can't rely on the activity to get the metaData.

Pick-to: 5.15
Change-Id: I493c68591dbcfbe3063971cfd9ab384df71d03d7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2020-08-28 20:37:22 +02:00
Joerg Bornemann
8dbb70f44d Remove fxc configure test
This was used for ANGLE, which was removed in 752497910b.

Change-Id: I29bad031b296fddc425145cd206a372baf650267
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-08-28 20:09:31 +02:00