It is neither documented nor very useful, and it has
platform-specific issues as reported over the years.
Remove it now as part of the example revamp initiative.
Task-number: QTBUG-50278
Task-number: QTBUG-110093
Task-number: QTBUG-76054
Task-number: QTBUG-43209
Pick-to: 6.5
Change-Id: I6dadaf4162b4c19411c544b9f204c19e37aa740d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
We (almost) only build apps, for which PRIVATE linkage makes more sense.
Change-Id: I09a509c3fb33a00cdfdede687b3f95d638f42091
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Need to add the plumbing necessary to support two textures in
QOpenGLWidget and use these in the backing store. The changes
required on the RHI level is already done in an earlier patch.
Then paintGL() needs to be called twice, once for each buffer.
Also add overloads for the other functions of QOopenGLWidget
where it makes sense to query for left or right buffer.
Then finally create an example.
[ChangeLog][Widgets][QOpenGLWidget] Added support for
stereoscopic rendering.
Fixes: QTBUG-64587
Change-Id: I5a5c53506dcf8a56442097290dceb7eb730d50ce
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This is what we promote also in the documentation.
Change-Id: If91aebafe861b0c934acbb2c69afd182abc3345d
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace, with manual
unstaging of the actual definition and documentation in dist/,
src/corelib/doc/ and src/corelib/global/.
Task-number: QTBUG-99313
Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.
Existing copyright statements remain intact
Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Found by codespell
Pick-to: 6.4
Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.
Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
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>
This makes the code clearer and decouples it from the
GLWidget.
As a drive-by, add a global shortcut to close.
Pick-to: 6.3 6.2
Change-Id: I3469d29bc367acc17c5f8acf9d46219259b8315b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
CMAKE_INCLUDE_CURRENT_DIR is not necessary anymore for moc since
CMake 3.8: https://cmake.org/cmake/help/latest/release/3.8.html#other-changes
CMAKE_AUTORCC should not be used anymore. Instead, we now use
qt_add_resources() or similar
Enable CMAKE_AUTOUIC only if .ui files are present.
Pick-to: 6.3
Task-number: QTBUG-87643
Change-Id: I835e2994cd5dba9918136999499b9077961b616c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Also consolidate several find_package(Qt6 ...) calls in one call.
Task-number: QTBUG-98867
Change-Id: Idfd5e71f46d4489fac7411cbfadb84437a0658f3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
These are left-overs from the initial qmake2cmake conversion.
Pick-to: 6.2
Change-Id: Ie15c9ff022ea4566d10c1ba74599de9af83d29a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Examples are intended to show how to build against an installed Qt.
Building them as part of the main build means the way the Qt targets
are defined and created are not representative of an end user's build.
By building them as separate projects using ExternalProject, we can
more closely replicate the intended audience's environment. This
should allow us to catch more problems earlier.
Having examples built as part of the main build also creates problems
with some static builds where a tool built by the main build is needed
during configure time. This happens with other repos like qtdeclarative
but not (currently) with qtbase. Converting the examples in qtbase to
be built using ExternalProject is intended as a demonstrator for how
other repos can do similar. Until other repos are converted, they will
continue to work as they did before, with examples as part of the main
build for non-static builds only.
The new build-externally behavior is only supported for non-prefix
builds with this change. Prefix builds will continue to use the old
non-external method. Support for building examples externally in
prefix builds will be a separate change.
Task-number: QTBUG-90820
Fixes: QTBUG-91068
Change-Id: I2304329940568dbdb7da18d54d5595ea7d8668bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
As well as the MACOSX_BUNDLE properties as necessary.
Task-number: QTBUG-87664
Task-number: QTBUG-86827
Change-Id: I7677449a26d51fa853bd67bab6b3b61afbd2b12f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Use QScreen APIs instead.
Change-Id: Ie99af94fe4292223dbb165b3f5c1b74e8fe0498b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
We were already using the 'native' nomenclature when referring to these
kinds of APIs, e.g. when talking about native handles, or the existing
QPlatformNativeInterface on a QPA level. Using 'native' for the user
facing APIs also distinguishes them from the 'platform' backend layer
in QPA and elsewhere.
Change-Id: I0f3273265904f0f19c0b6d62471f8820d3c3232e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The qdoc-file that contains the example documentation was
left behind when the OpenGL code moved from QtGui
to QtOpenGL. This causes all the snippet commands to fail.
Task-number: QTBUG-74409
Change-Id: I86a753d4fc832965e76a085062882e6c720becd2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
The API is available by including qopenglcontext.h as usual,
but scoped in the QPlatformInterface namespace. The namespace
exposes platform specific type-safe interfaces that provide:
a) Factory functions for adopting native contexts, e.g.
QCocoaGLContext::fromNative(nsContext, shareContext);
b) Access to underlying native handles, e.g.
openGLContext->platformInterface<QCocoaGLContext>->nativeContext()
c) Platform specific functionality, e.g.
static QWGLContext::openGLModuleHandle()
openGLContext->platformInterface<QEGLContext>->doSomething();
The platform interfaces live close to the classes they extend,
removing the need for complex indirection and plumbing, and
avoids kitchen-sink modules and APIs such as the extras modules,
QPlatformFunctions, or QPlatformNativeInterface.
In the case of QOpenGLContext these platform APIs are backed
by the platform plugin, so dynamic_cast is used to ensure the
platform plugin supports the requested interface, but this is
and implementation detail. The interface APIs are agnostic
to where the implementation lives, while still being available
to the user as part of the APIs they extend/augment.
The documentation will be restored when the dust settles.
Task-number: QTBUG-80233
Change-Id: Iac612403383991c4b24064332542a6e4bcbb3293
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Remove QDestopWidget public header, simplify the implementation that
maintains a Qt::Desktop type QWidget for each QScreen, and turn
QWidget's initial target screen into a QScreen pointer.
QApplication::desktop() now takes an optional QScreen pointer, and
returns a QWidget pointer, so that applications and widgets can get
access to the root widget for a specific screen without having to
resort to private APIs.
QDesktopWidgetPrivate implementations to look up a screen for an index,
widget, or point are now all inline functions that thinly wrap
QGuiApplication::screens/screenAt calls. We should consider adding those
as convenience APIs to QScreen instead.
Note that QWidget::screen is assumed to return a valid pointer; there is
code that handles the case that it returns nullptr (but also code that
trusts that it never is nullptr), so this needs to be defined, verified
with tests, and asserted. We can then simplify the code further.
Change-Id: Ifc89be65a0dce265b6729feaf54121c35137cb94
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Many of these were generated by clazy using the new qevent-accessors check.
Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
It seems this example never worked as expected.
It has a 'multiple' option which should show extra
windows with rendering taking place in different
thread, however although render is moved to other thread
render() function was never called in that thread.
Fix following things:
* make rendering in other thread
* stop requestUpdate if nothing is exposed
* add timer so animation works at the same speed despite
of number of windows (renderer B renders two windows)
* wait for render to finish before triggering requestUdpate
* remove mutex where not needed
Pick-to: 5.15
Change-Id: I420436bd28d0357534332dd55b088d634d906c14
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Conflicts:
examples/opengl/doc/src/cube.qdoc
src/corelib/global/qlibraryinfo.cpp
src/corelib/text/qbytearray_p.h
src/corelib/text/qlocale_data_p.h
src/corelib/time/qhijricalendar_data_p.h
src/corelib/time/qjalalicalendar_data_p.h
src/corelib/time/qromancalendar_data_p.h
src/network/ssl/qsslcertificate.h
src/widgets/doc/src/graphicsview.qdoc
src/widgets/widgets/qcombobox.cpp
src/widgets/widgets/qcombobox.h
tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
tests/manual/diaglib/debugproxystyle.cpp
tests/manual/diaglib/qwidgetdump.cpp
tests/manual/diaglib/qwindowdump.cpp
tests/manual/diaglib/textdump.cpp
util/locale_database/cldr2qlocalexml.py
util/locale_database/qlocalexml.py
util/locale_database/qlocalexml2cpp.py
Resolution of util/locale_database/ are based on:
https://codereview.qt-project.org/c/qt/qtbase/+/294250
and src/corelib/{text,time}/*_data_p.h were then regenerated by
running those scripts.
Updated CMakeLists.txt in each of
tests/auto/corelib/serialization/qcborstreamreader/
tests/auto/corelib/serialization/qcborvalue/
tests/auto/gui/kernel/
and generated new ones in each of
tests/auto/gui/kernel/qaddpostroutine/
tests/auto/gui/kernel/qhighdpiscaling/
tests/libfuzzer/corelib/text/qregularexpression/optimize/
tests/libfuzzer/gui/painting/qcolorspace/fromiccprofile/
tests/libfuzzer/gui/text/qtextdocument/sethtml/
tests/libfuzzer/gui/text/qtextdocument/setmarkdown/
tests/libfuzzer/gui/text/qtextlayout/beginlayout/
by running util/cmake/pro2cmake.py on their changed .pro files.
Changed target name in
tests/auto/gui/kernel/qaction/qaction.pro
tests/auto/gui/kernel/qaction/qactiongroup.pro
tests/auto/gui/kernel/qshortcut/qshortcut.pro
to ensure unique target names for CMake
Changed tst_QComboBox::currentIndex to not test the
currentIndexChanged(QString), as that one does not exist in Qt 6
anymore.
Change-Id: I9a85705484855ae1dc874a81f49d27a50b0dcff7
Remove references to the deprecated QGLWidget and replace it with
QOpenGLWidget.
Change-Id: Ia31df42ab61c25e9ce46f4491267d2c64910f55c
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
They all used QGL (which has been removed).
Task-number: QTBUG-74408
Change-Id: Ied003625f14228b4951002a604fce91eaccec102
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The QGL* classes have been removed and the examples ported to QOpenGL, update
the documentation to reflect that.
Task-number: QTBUG-74408
Change-Id: Ibb4787cdeedc05a807d673943b61838f19092234
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Same pattern as QtQuickWidgets. Gets rid of QtOpenGL's dependency on QtWidgets.
Task-number: QTBUG-74409
Change-Id: I4f9b55c23e25a1e0519734037b768a16e870c7d2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>