Commit Graph

835 Commits

Author SHA1 Message Date
Eirik Aavitsland
f46db29d8c Painting: fix overriding and combining different clip types
In a recent improvement (6de36918c0) the
last set clip region or path was stored in separate variables, in
order to be set again if the aliasing mode changed. That solution was
too simplistic, as it would break down as soon as more than one clip
area was set, with the latter either replacing or intersecting the
first. It was also unnecessary to introduce new storing of clip areas
and transforms, as those are already recorded in the clipInfo stack in
the painter state. This patch hence reverts much of that implementation.

However the basic idea of setting the clip area again after AA change
is good, so that part is kept, implementated instead by calling a
pre-existing function to replay the clipInfo stack.

One of the baseline test cases is extended to excercise the
combination of clip areas. As a driveby, support for setClipRectF is
added to the painting baseline test scripts, and the build of the
manual lance tool is fixed.

Fixes: QTBUG-101474
Pick-to: 6.3 6.2
Change-Id: Ide8b70d8cbf138deb06cbb84f69e62f7405886e6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-15 12:45:46 +01:00
Laszlo Agocs
68a4c5da9a Compose render-to-texture widgets through QRhi
QPlatformTextureList holds a QRhiTexture instead of GLuint. A
QPlatformBackingStore now optionally can own a QRhi and a
QRhiSwapChain for the associated window.  Non-GL rendering must use
this QRhi everywhere, whereas GL (QOpenGLWidget) can choose to still
rely on resource sharing between contexts. A widget tells that it
wants QRhi and the desired configuration in a new virtual function in
QWidgetPrivate returning a QPlatformBackingStoreRhiConfig. This is
evaluated (among a top-level's all children) upon create() before
creating the repaint manager and the QWidgetWindow.

In QOpenGLWidget what do request is obvious: it will request an
OpenGL-based QRhi. QQuickWidget (or a potential future QRhiWidget)
will be more interesting: it needs to honor the standard Qt Quick
env.vars. and QQuickWindow APIs (or, in whatever way the user
configured the QRhiWidget), and so will set up the config struct
accordingly.

In addition, the rhiconfig and surface type is (re)evaluated when
(re)parenting a widget to a new tlw. If needed, this will now trigger
a destroy - create on the tlw. This should be be safe to do in
setParent. When multiple child widgets report an enabled rhiconfig,
the first one (the first child encountered) wins. So e.g. attempting
to have a QOpenGLWidget and a Vulkan-based QQuickWidget in the same
top-level window will fail one of the widgets (it likely won't
render).

RasterGLSurface is no longer used by widgets. Rather, the appropriate
surface type is chosen.

The rhi support in the backingstore is usable without widgets as well.
To make rhiFlush() functional, one needs to call setRhiConfig() after
creating the QBackingStore. (like QWidget does to top-level windows)

Most of the QT_NO_OPENGL ifdefs are eliminated all over the place.
Everything with QRhi is unconditional code at compile time, except the
actual initialization.

Having to plumb the widget tlw's shareContext (or, now, the QRhi)
through QWindowPrivate is no longer needed.  The old approach does not
scale: to implement composeAndFlush (now rhiFlush) we need more than
just a QRhi object, and this way we no longer pollute everything
starting from the widget level (QWidget's topextra -> QWidgetWindow ->
QWindowPrivate) just to send data around.

The BackingStoreOpenGLSupport interface and the QtGui - QtOpenGL split
is all gone. Instead, there is a QBackingStoreDefaultCompositor in
QtGui which is what the default implementations of composeAndFlush and
toTexture call. (overriding composeAndFlush and co. f.ex. in eglfs
should continue working mostly as-is, apart from adapting to the
texture list changes and getting the native OpenGL texture id out of
the QRhiTexture)

As QQuickWidget is way too complicated to just port as-is, an rhi
manual test (rhiwidget) is introduced as a first step, in ordewr to
exercise a simple, custom render-to-texture widget that does something
using a (not necessarily OpenGL-backed) QRhi and acts as fully
functional QWidget (modeled after QOpenGLWidget). This can also form
the foundation of a potential future QRhiWidget.

It is also possible to force the QRhi-based flushing always,
regardless of the presence of render-to-texture widgets. To exercise
this, set the env.var. QT_WIDGETS_RHI=1. This picks a
platform-specific default, and can be overridden with
QT_WIDGETS_RHI_BACKEND. (in sync with Qt Quick) This can eventually be
extended to query the platform plugin as well to check if the platform
plugin prefers to always do flushes with a 3D API.

QOpenGLWidget should work like before from the user's perspective, while
internally it has to do some things differently to play nice and prevent
regressions with the new rendering architecture. To exercise this
better, the qopenglwidget example gets a new tab-based view (that could
perhaps replace the example's main window later on?). The openglwidget
manual test is made compatible with Qt 6, and gets a counterpart in form
of the dockedopenglwidget manual test, which is a modified version of
the cube example that features dock widgets. This is relevant in
particular because render-to-texture widgets within a QDockWidget has
its own specific quirks, with logic taking this into account, hence
testing is essential.

For existing applications there are two important consequences with
this patch in place:

- Once the rhi-based composition is enabled, it stays active for the
lifetime of the top-level window.

- Dynamically creating and parenting the first render-to-texture
widget to an already created tlw will destroy and recreate the tlw
(and the underlying window). The visible effects of this depend on the
platform.  (e.g. the window may disappear and reappear on some,
whereas with other windowing systems it is not noticeable at all -
this is not really different from similar situtions with reparenting
or when moving windows between screens, so should be acceptable in
practice)

- On iOS raster windows are flushed with Metal (and rhi) from now on
(previously this was through OpenGL by making flush() call
composeAndFlush().

Change-Id: Id05bd0f7a26fa845f8b7ad8eedda3b0e78ab7a4e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-11 21:25:00 +01:00
Alexey Edelev
2201934efa Use 'copy' but not 'copy_if_different' on Windows platforms
Use custom script to copy big Android artifacts on Windows platforms.
The script uses 'copy' but not 'copy_if_different' when source file
size is bigger than 2GB. 'cmake -E copy_if_different' only compares
first 2GB of files because of cmake issue, so this step only
workaround the problem.

Pick-to: 6.2 6.3
Task-number: QTBUG-99491
Change-Id: Id076734700e334dfc3330da412462c2b53829b33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-10 02:31:05 +01:00
Mårten Nordheim
9ec94f31b0 QNetworkInformation: Rename parameter-less load() to loadDefaultBackend
To clarify its purpose and separate it from the others

Pick-to: 6.3
Change-Id: Id9efcf474ac0cd8777393380bb85c83780454005
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-02-09 15:17:54 +01:00
Ben Fletcher
9ef702a37b rhi: Add the basic infrastructure for geometry shader support
.. but this will only be supported on Vulkan, OpenGL 3.2+, and Open GL
ES 3.2+ for the time being.

The situation is:

- Vulkan is working.  qsb accepts .geom files already, and QShader has
  existing geometry shader support.

- OpenGL 3.2 and OpenGL ES 3.2 are working.

- D3D11 is not working.  D3D11 supports geometry shaders, but SPIRV-
  Cross does not support translating geometry shaders to HLSL.

- Metal is not working.  Metal does not directly support geometry
  shaders.

Change-Id: Ieb7c44c58b8be5f2e2197bf5133cf6847e6c132d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-01-31 08:53:37 -08:00
Ben Fletcher
1c3ae79ad3 rhi: Add support for polygon fill mode
Support for Polygon Mode (Triangle Fill Mode in Metal, Fill Mode in D3D)
in the RHI graphics pipeline.

Options are Fill and Line

Status:
    OpenGL - ok
    Vulkan - ok
    Metal - ok
    D3D11 - ok
    OpenGL ES - does not support glPolygonMode.

Change-Id: I20b7ef416624700c3dc8d1cbe6474f4ca3889db8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-01-31 08:52:05 -08:00
Volker Hilsheimer
c7539876f6 Baseline: Move the paintcommands code into the shared directory
It's used by the lancebench and the lance tool, and it will probably be
useful for writing some high-dpi related unit and baseline test cases,
so move it to the shared folder.

Change-Id: I969bab51c9504be13b4c192b4f29f69cd9102868
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-01-20 22:56:11 +01:00
Laszlo Agocs
a325016aa9 rhi: Add the basic infrastructure for tessellation support
...but this will only be supported with Vulkan and OpenGL 4.0+ and
OpenGL ES 3.2+ for the time being.

Taking the Vulkan model as our standard, the situation is the
following:

- Vulkan is ok, qsb secretly accepts .tesc and .tese files as input
  already (plus QShader already has the necessary plumbing when it
  comes to enums and such) To switch the tessellation domain origin to
  bottom left we require Vulkan 1.1 (don't bother with
  VK_KHR_maintenance2 on top of 1.0 at this point since 1.1 or 1.2
  implementations should be common by now). The change is essential to
  allow the same evaluation shader to work with both OpenGL and
  Vulkan: this way we can use the same shader source, declaring the
  tessellation winding order as CCW, with both APIs.

- OpenGL 4.0 and OpenGL ES 3.2 (or ES 3.1 with the Android extension
  pack, but we won't bother with checking that for now) can be made
  working without much complications, though we need to be careful
  when it comes to gathering and setting uniforms so that we do not
  leave the new tessellation stages out. We will stick to the Vulkan
  model in the sense that the inner and outer tessellation levels must
  be specified from the control shader, and cannot be specified from
  the host side, even though OpenGL would allow this. (basically the
  same story as with point size in vertex shaders)

- D3D11 would be no problem API-wise, and we could likely implement
  the support for hull and domain shader stages in the backend, but
  SPIRV-Cross does not support translating tessellation shaders to
  HLSL.  Attempting to feed in a .tesc or .tese file to qsb with
  --hlsl specified will always fail. One issue here is how hull
  shaders are structured, with the patchconstantfunc attribute
  specifying a separate function computing the patch constant
  data. With GLSL there is a single entry point in the tessellation
  control shader, which then performs both the calculations on the
  control points as well as the constant data (such as, the inner and
  outer tessellation factors).  One option here is to inject
  handwritten HLSL shaders in the .qsb files using qsb's replace (-r)
  mode, but this is not exactly a viable universal solution.

- Metal uses a different tessellation pipeline involving compute
  shaders. This needs more investigation but probably not something we
  can prioritize in practice. SPIRV-Cross does support this,
  generating a compute shader for control and a (post-)vertex shader
  for evaluation, presumably in order to enable MoltenVK to function
  when it comes to tessellation, but it is not clear yet how usable
  this is for us.

Change-Id: Ic953c63850bda5bc912c7ac354425041b43157ef
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-13 13:44:29 +01:00
Laszlo Agocs
bfc713530a rhi: Add queries for vertex input/output limits
Mainly because we do have legacy code in the Qt 5 graphical effects that
tries to dynamically determine the max number of varyings. Make it
easier to port such code.

Change-Id: I846cab2c2fe7b4cd473b5ced0146ca36f1c8169b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2022-01-12 20:37:20 +01:00
Zhang Hao
38a66aa53a xcb: Correctly update primary screen status with RandR 1.5
This amends d8f37d94e5 .

Fixes: QTBUG-99605
Pick-to: 6.3
Done-with: Liang Qi <liang.qi@qt.io>
Change-Id: Ia4cf67d6ebeed36596c0342302aa0b4af01769bc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-12 03:17:47 +01:00
Morten Johan Sørvig
9b096e8cb8 wasm: add secondary thread exec manual test
Pick-to: 6.3
Change-Id: Id16cddd703682d325d77ad597996960a8f521d1c
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-01-05 21:25:42 +01:00
Laszlo Agocs
23f8d6c57f rhi: Drop the profiler for now
The system we inherited from the original Qt 5.14 introduction of QRhi
is a text stream based solution where resource creation and frame
timings are sent in a comma-separated format to a QIODevice.

This, while useful to get insights about the number of resources at a
given time, is not actively helpful. The frameworks built on top (Qt
Quick, Qt Quick 3D) are expected to provide solutions for logging
timings in a different way (e.g. via the QML Profiler). Similarly,
tracking active resources and generating statistics from that is
better handled on a higher level.

The unique bits, such as the Vulkan memory allocator statistics and
the GPU frame timestamps, are converted into APIs in QRhi. This way a
user of QRhi can query it at any time and do whatever it sees fit with
the data.

When it comes to the GPU timestamps, that has a somewhat limited value
due to the heavy asynchronousness, hence the callback based
API. Nonetheless, this is still useful since it is the only means of
reporting some frame timing data (an approx. elapsed milliseconds for
a frame) from the GPU side.

Change-Id: I67cd58b81aaa7e343c11731f9aa5b4804c2a1823
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-01-04 13:00:40 +01:00
Morten Johan Sørvig
292bdac4cf wasm: add rasterwindow manual test
Simplest possible graphical app, with event logging.

Change-Id: I6b1eb88c270a190becb23cc63d6d755ffbafcf52
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-15 18:06:11 +02:00
Kai Köhne
9ca7429dff Tests: Use REQUIRED COMPONENTS in find_package(Qt6...)
Make sure configure fails early if a component cannot be found.

Task-number: QTBUG-98867
Pick-to: 6.2 6.3
Change-Id: I4baa35a84342df58ce8932601fb602be92ed5ab9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-13 14:16:26 +00:00
Lorn Potter
f0be152896 wasm: improve clipboard support
Add support for Clipboard API
Add clipboard manual test

Also includes these fixes:

- improve clipboard use for chrome browser
- make QClipboard::setText work
- html copy and paste
- image copy/paste

Chrome browser supports text, html and png

To use the Clipboard API, apps need to be served from
a secure context (https). There is a fallback in the
case of non secure context (http)

- Firefox requires dom.events.asyncClipboard.read,
dom.events.asyncClipboard.clipboardItem and
dom.events.asyncClipboard.dataTransfer to be
set from about:config, in order to support the
Clipboard API.

Change-Id: Ie4cb1bbb1dfc77e9655090a30967632780d15dd9
Fixes: QTBUG-74504
Fixes: QTBUG-93619
Fixes: QTBUG-79365
Fixes: QTBUG-86169
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-12-08 13:39:58 +10:00
Eirik Aavitsland
e8f93e38de Rename and restructure the baseline (lancelot) testing code
In preparation for addition of new baseline tests, establish a new
test category, "baseline". This is similar to the category
"benchmarks" in that it contains tests that use the QTest framework,
but conceptually are not unit tests, in contrast to those under auto/.

Move the existing QPainter baseline test, tst_lancelot, into this new
category, and rename it accordingly.

Baseline tests use the QBaselineTest extension to QTest. Move that
extension too into the tests/baseline directory, allowing the clean
out of the baselineserver directory.

Pick-to: 6.2
Change-Id: I1b527f5867c953b1d22be73798fcf7d1494712ea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-16 14:01:50 +01:00
Laszlo Agocs
a8be40bd64 rhi: Expose the maximum uniform buffer range limit
Pick-to: 6.2
Task-number: QTBUG-97715
Change-Id: I7f0a52c410b9b77f735fb3b7fd33141674bb0cda
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-11-10 13:31:05 +01:00
Mårten Nordheim
58b37f5908 QNI manual test: Remove unnecessary capturing and wrapping
No need to capture anything by reference, it's a leftover from when
the MainWindow was changed from inside the lambda.

And no need to wrap the argument to QLatin1String.arg() with QStringView
explicitly. This change is made just for brevity and consistency.

Change-Id: Ib8c163bcf5932d35a9d43dd8ce124588c539d5a4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-11-04 12:02:34 +01:00
Mårten Nordheim
bd52c1bba6 QNI: Add API to check if connection is metered
This may be a useful factor in deciding whether or not you should
perform communications over the network which are not purely essential.
For example, if you have a logging mechanism you can delay uploading
them until you are no longer on a metered network.

Task-number: QTBUG-91024
Change-Id: I19d32f031a3893512dc440914133678004987fb1
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-04 12:02:25 +01:00
Morten Johan Sørvig
873edc0f15 wasm: add asyncify manual test
Add simple QtCore-based test case which spins
a nested event loop.

Change-Id: Ia3a4ef76d561d0554faffcac8d36ae5dda2c6c53
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-11-04 09:23:15 +02:00
Laszlo Agocs
e7a1fbfc47 rhi: Add texture array support
Arrays of textures have always been supported, but we will encounter
cases when we need to work with texture array objects as well.

Note that currently it is not possible to expose only a slice of the
array to the shader, because there is no dedicated API in the SRB,
and thus the same SRV/UAV (or equivalent) is used always, capturing
all elements in the array. Therefore in the shader the last component
of P in texture() is in range 0..array_size-1.

Change-Id: I5a032ed016aeefbbcd743d5bfb9fbc49ba00a1fa
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-10-29 15:57:13 +02:00
Mårten Nordheim
bfe579613a QNI: Add a convenience method for loading the default plugin
We have some official plugins, we may as well treat them as default
and give a convenient function which loads those.

Change-Id: I6251c77ac042b795bcf24b86e510e960ee4bab54
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-22 09:40:49 +02:00
Mårten Nordheim
5f8e9c194e QNI: Add supportedFeatures getter
Which just returns all the supported features

Change-Id: I8c3996b00a6ebb114bdbc9db3085a0e27fc8fa79
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-22 09:40:45 +02:00
Mårten Nordheim
e4a09b0194 QNI: Update the manual test 'transportMedium' naming
I staged the manual test a little too soon, forgetting it's not compiled
in CI

Change-Id: Iaae8b8caaf8433c45e66ff662bb9bb7b25a3b8bd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-10-07 19:08:51 +02:00
Paul Olav Tvete
b869d9b768 Add manual test for window activation
This is a manual test of QWindow::requestActivate() and how it
interacts with implicit activation from the window system. Written in
order to test QtWayland, but hopefully also useful for testing on other
platforms.

Task-number: QTBUG-91542
Change-Id: Id18dc6d146d213a7c730cff343d9fc25f6c42514
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-09-30 20:51:52 +02:00
Mårten Nordheim
ce988284c4 Add transport info to the QNetworkInformation manual test
Task-number: QTBUG-91023
Change-Id: I0015bc18b0f5c7faf5826a46ee880add09a7b244
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-29 20:42:35 +02:00
Mårten Nordheim
11d2524bc4 Refactor QNetworkInformation manual test
To make it a little cleaner

Task-number: QTBUG-91023
Change-Id: Ib99cc722b47835d13707beeeea35573729e4b032
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-29 20:42:35 +02:00
Edward Welbourne
298e41b830 Remove fatuously true or false QT_VERSION checks
QT_VERSION is now at least QT_VERSION_CHECK(6, 3, 0), so remove all
checks against Qt 6.0.0 or earlier. They are superfluous. Tidied up in
some places in the process, particularly #include order.

Change-Id: I2636b2fd13be5b976f5b043ef2f8cddc038a72a4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-23 16:57:03 +02:00
Alexandru Croitor
0da123d67b CMake: Bump almost all cmake_minimum_required calls to 3.16
Needed for subsequent change that will check and error out if the
version is lower than 3.16. We do that to ensure all policies
introduced by CMake up to version 3.16 have their behavior set to
NEW.

Pick-to: 6.2
Task-number: QTBUG-95018
Change-Id: Ieaf82c10987dd797d86a3fd4a986a67e72de486a
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-09-22 19:36:49 +02:00
Liang Qi
0d3b395c16 tests/xcb: add a test for screen off and on
Task-number: QTBUG-96247
Change-Id: I1fd6f21ad914480b7e8d07227ee80184e305276a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-09-18 16:29:39 +02:00
Liang Qi
b6bcf01b81 tests/xcb: move xrandr process call to a function
Change-Id: I4dab0a878a93fa2c3d0af80883b8e2198c72633c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-09-18 16:29:39 +02:00
Tor Arne Vestbø
5c880e30c7 Don't let windowstates manual test eat log messages
Having logging in the test's log widget is nice, but we don't want
to silence the normal logging, as that might confuse someone who
expects to see normal log messages, not knowing there's a dedicated
log widget in the test.

Pick-to: 6.2
Change-Id: I7828f740cfb8cc2eae8da98b9b8facd4a57fa37b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-09-15 17:06:10 +02:00
Liang Qi
5c779f207f xcb: add manual test for xrandr scale
This amends 9a4c98e556.

Change-Id: Ief86d141efa8f87d624c6ba935cb4d9c0b2ead0f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-09-02 21:57:02 +02:00
Liang Qi
9a4c98e556 xcb: support xrandr(1.5) monitor setup
More information about monitor in xrandr 1.5, see
https://keithp.com/blogs/MST-monitors/

Since this change, screen is logical instead of physical.

If xrandr 1.5 and later is installed, Qt screen info will get
from xrandr monitor object instead of xrandr output if only have
1.2 to 1.4.

Users can manipulate monitor as they want, for example, a
combination for two physical screens, half of one screen and etc.

Didn't have chance to access MST monitors, but it should work
if xrandr monitor object was created automatically.

[ChangeLog][xcb] Qt screen info will get from xrandr monitor
object if 1.5 is installed.

Fixes: QTBUG-65457
Change-Id: Iad339cc0d4293b2403b4ef6bf6eb770feb3e685f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-09-01 20:32:04 +02:00
Morten Johan Sørvig
82f14a95b5 wasm: add manual tests for main() and exec()
Add minimal examples which demonstrates how exec() works
on Qt for WebAssembly and how to implement main() without
calling QApplication::exec().

Change-Id: I44f1d16af19c538380cc56faf3f0f4cc9d66cf11
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-27 15:45:24 +02:00
Tor Arne Vestbø
7d45f2d0b9 macOS: Add debug keyboard layout for manual testing
Pick-to: 6.2
Change-Id: Ie35f7a57c6d54c1cc0a7b79d8fd25d0b056bf5e6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-08-23 17:30:18 +02:00
Morten Johan Sørvig
60ca8ca5bc wasm: add cmake build for manual tests
The tests can now be built with qt-cmake-standalone-test.

Change-Id: I098340a9f755806061de281fbc25cb00c61f33f0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-19 18:41:53 +02:00
Mårten Nordheim
1edb51a315 QNetworkInformation: Give the manual test a GUI
For mobile platforms. Makes it quite a bit easier to follow on the
updates when I'm not tethered to my PC with ADB.

Change-Id: Icba03470e6082b6e47e31c9ead6df074407d3172
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-07-13 16:37:19 +02:00
Liang Qi
01ff216c82 tests: update startsystemmove manual test with latest api
Change-Id: Ib9a070f7878fa67b7db1e26c8ebbbb54873cb645
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-16 15:53:22 +02:00
Mårten Nordheim
14b74af060 QNetworkInformation: Adjustments to captive portal API
Make it return bool since the TriState was really only used signify that
the property was unsupported but there is already a separate way to
check if it's supported. More importantly there is no different set of
actions available to a user if they're in the Unknown or False state.

Because of the change to bool, we also rename the property to have an
'is'-prefix.

Change-Id: Iaaaad5ac31e663c36e00223bf5b0e719f412fc69
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-06-08 14:54:16 +02:00
Mårten Nordheim
da955aadf5 QNetworkInformation: Behind captive portal
This patch adds the API, with no supporting backends

Task-number: QTBUG-93848
Change-Id: I50454717f928819e1b990df91872675e842f9987
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-05-31 17:25:22 +02:00
Laszlo Agocs
51c22a1f51 rhi: Add support for 3D textures
Supported on OpenGL (and ES) 3.0+ and everywhere else.

Can also be a render target, targeting a single slice at a time.

Can be mipmapped, cannot be multisample.

Reading back a given slice from a 3D texture is left as a future
exercise, for now it is documented to be not supported.

Upload is going to be limited to one slice in one upload entry,
just like we specify one face or one miplevel for cubemap and
mipmapped textures.

This also involves some welcome hardening of how texture subresources
are described internally: as we no longer can count on a layer index
between 0..5 (as is the case with cubemaps), simply arrays with
MAX_LAYER==6 are no longer sufficient. Switch to sufficiently dynamic
data structures where applicable.

On Vulkan rendering to a slice needs Vulkan 1.1 (and 1.1 enabled on the
VkInstance).

Task-number: QTBUG-89703
Change-Id: Ide6c20124ec9201d94ffc339dd479cd1ece777b0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-05-31 17:16:57 +02:00
Laszlo Agocs
bbc6b5c3a7 vulkan: Update legacy tests and examples to the modern validation layer
Fixes: QTBUG-88388
Change-Id: Ib072f203ada5d692dea8d35da2b24db0deac0297
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-05-31 17:16:49 +02:00
Laszlo Agocs
0199640d44 rhi: manual tests: Switch to VK_LAYER_KHRONOS_validation
Task-number: QTBUG-88388
Change-Id: Ia6d7caf0357b017625d3245a72d21a3023d81035
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-05-31 17:16:45 +02:00
Joerg Bornemann
92185d417d Fix BASE argument of qt_add_resources
The BASE argument of qt_add_resources now denotes the root point of the
alias of the file.  Before, BASE was merely prepended to every file that
got passed to qt_add_resources.

Old behavior:
    qt_add_resources(app "images"
        PREFIX "/"
        BASE "../shared"
        FILES "images/button.png")

Alias is "../shared/images/button.png", and pro2cmake generated
QT_RESOURCE_ALIAS assignments to fix this.

New behavior:
    qt_add_resources(app "images"
        PREFIX "/"
        BASE "../shared"
        FILES "../shared/images/button.png")

The alias is "images/button.png".  No extra QT_RESOURCE_ALIAS assignment
is needed.

The new behavior is in effect for user projects and for Qt repositories
that define QT_USE_FIXED_QT_ADD_RESOURCE_BASE.  Qt repositories will be
ported one by one to this new behavior.  Then the old code path can be
removed.

Pick-to: 6.1
Task-number: QTBUG-86726
Change-Id: Ib895edd4df8e97b54badadd9a1c34408beff131f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-18 16:02:52 +02:00
Tor Arne Vestbø
7feeb7c34b Rejig native interface plumbing
The initial approach for providing public access to native
interfaces via T::nativeInteface<I>() was based on the template
not being defined, and then having explicit instantiations of
the supported types in a source file, so that the accessors
were exported and available to the user.

This worked fine for "simple" types such as QOpenGLContext
and QOffscreenSurface, but presented a problem in the context
of classes with subclasses, such as Q{Core,Gui}Application.

To ensure that a native interface for QCoreApplication was
accessible both from QCoreApplication and its subclasses,
while at the same time preventing a native interface for
QGuiApplication to be accessible for QCoreApplication, the
nativeInterface() template function had to be declared in
each subclass. Which in turn meant specializing each native
interface once for each subclass it was available in.

This quickly became tedious to manage, and the requirements
for exposing a new native interface wasn't very clear with
all these template specializations and explicit instantiations
spread around.

To improve on this situation, while also squashing a few
other birds at the same time, we change the approach to
use type erasure. The definition of T::nativeInteface<I>()
is now inline, passing on the requested interface to a per
type (T, not I) helper function, with the interface type
flattened to a std::type_info.

The type_info requested by the user is then compared to the
available types in a single per-type (T) "switch statement",
which is a lot easier to follow for someone trying to trace
the logic of how a native interface is resolved.

We can safely rely on type_info being stable between the user
application and the Qt library as a result of exporting the
type info for each native interface, by explicitly ensuring
they have a key function. This is the same mechanism that
ensures we can safely dynamic_cast these interfaces, even
across library boundaries.

The use of a free standing templated helper function instead
of a member function in the type T, is to avoid shadowing issues,
and to not pollute the class namespace of T with the helper
function.

Since we are already changing the plumbing for how a user
resolves a native interface for a type T, we take the opportunity
to add a few extra safeguards to the machinery.

First, we add a static assert in the T::nativeInteface<I>()
definition, that ensures that only compatible interfaces,
as declared by the interface themselves, are allowed.
This ensures a compile time error when an incompatible
interface is requested, which improves on the link time
errors we had prior to this patch, and also offsets the
one downside of type erasure, namely that errors are only
caught at runtime.

Secondly, each interface meant for public consumption through
T::nativeInteface<I>() is declared with a revision, which
is checked when requesting the interface. This allows us
to bump the revision when we make breaking changes to the
interface that would have otherwise been binary incompatible.
Since the user will never see this interface due to the
revision check, they will not end up calling methods that
have been removed or renamed.

One advantage of moving to a type-erased approach for the
plumbing is that we're not longer exposing the native
interface types as part of the T::nativeInteface symbols.
This means that if we ever want to rename a native interface,
the only exported symbol that the user code relies on is
the type info. Renaming is then possible by just exporting
the type info for the old interface, but leaving it empty.
Since no class in Qt implements the old native interface,
the user will just get a nullptr back, similarly to bumping
the revision of an interface.

Change-Id: Ie50d8fb536aafe2836370caacb22afbcfaf1712a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-05-12 22:02:05 +02:00
Martin Storsjö
236ae73ed8 Lowercase system includes and lib names for Windows, fix cross compiling
When cross compiling from a case sensitive file system, casing
matters, and mingw headers and import libraries consistently
use lowercase.

This was uncovered by d385158d5213ef568b7629e2aa4a818016bbffac;
prior to that, the schannel TLS plugin didn't end up built (at
least when cross compiling).

Fix other similar cases that can be found by grepping the repo.

Change-Id: Ia696e17b7aaa979d7b7f5b0801383f338a8b585b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-04-23 14:31:04 +03:00
Morten Johan Sørvig
fea54241aa Add ScreenGadget utility
ScreenGadget visualizes virtual desktop screen layout,
in device independent and native pixels.

This can be used to debug the (sometimes surprising)
device independent screen geometry resulting from Qt
applying a scale factor.

Change-Id: I5b18e0fc9a54ba3e14d648794429b2eeadd25748
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-04-19 18:45:39 +02:00
Morten Johan Sørvig
74cae2580f Update DprGadadget
Display active environment variables. Reorder the
labels with device independent values to the left
and native values to the right. Display the Qt scale
factor.

Change-Id: If95c252b06eff5abd91a25847777246effe94be2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-04-19 18:45:39 +02:00
JiDe Zhang
50a7eb8cf7 Add the "Territory" enumerated type for QLocale
The use of "Country" is misleading as some entries in the enumeration
are not countries (eg, HongKong), for all that most are. The Unicode
Consortium's Common Locale Data Repository (CLDR, from which QLocale's
data is taken) calls these territories, so introduce territory-based
names and prepare to deprecate the country-based ones in due course.

[ChangeLog][QtCore][QLocale] QLocale now has Territory as an alias for
its Country enumeration, and associated territory-based names to match
its country-named methods, to better match the usage in relevant
standards. The country-based names shall in due course be deprecated
in favor of the territory-based names.

Fixes: QTBUG-91686
Change-Id: Ia1ae1ad7323867016186fb775c9600cd5113aa42
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-15 20:17:49 +08:00