Commit Graph

91 Commits

Author SHA1 Message Date
Leander Beernaert 9e633bbda7 Regenerate Examples
Change-Id: I2fbfb44bbb6d667e022bffb480feaf74ff0d0a5e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-14 09:09:55 +00:00
Ulf Hermann cc1a604c70 Specify parameters of type registration in class declarations
Using this technique we can automatically register all necessary
revisions and minor versions of a type, using the metaobject system.
This greatly reduces the potential for mistakes and resulting
incompatibilities between versions of imports.

We assume that for each type we need to register all revisions of its
super types and its attached type, and that the revisions match. That
is, if you import version X of type A, you will also get version X of
its attached type and of any super types. As we previously didn't take
these dependencies into account when manually registering the types, a
number of extra revisions are now registered for some types.

Potentially, we can now generate the qmltypes files at compile time,
using moc.

Change-Id: I7abb8a5c39f5e63ad1a0cb41a783f2c91909491b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-26 12:32:17 +02:00
Leander Beernaert bf58a1cc04 Update Examples with lowercase qt6_add_resources()
Re-run pro2cmake on all exampls.

Change-Id: Iafd1092beff023b407a8f29c2a5b651f2e534b75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-20 08:38:06 +00:00
Leander Beernaert b938edcfb3 Convert Examples
This patch converts all examples in qtdeclarative except for a few
exceptions which require a public facing qml plugin api.

Change-Id: I2cd2b1bb455be8b48796893a8235dea7f8b35aa2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-23 13:51:06 +00:00
Shawn Rutledge e17c89f4ce use the override keyword consistently and correctly (clang-tidy)
Change-Id: If9e28d143f8cba3df3c757476b4f2265e2eb8b2a
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2018-02-27 08:27:38 +00:00
Shawn Rutledge 06e962f263 init variables where they are declared when possible (clang-tidy)
clang-tidy -p compile_commands.json $file -checks='-*,modernize-use-default-member-init,readability-redundant-member-init'
 -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' -header-filter='qtdeclarative' -fix

Change-Id: I705f3235ff129ba68b0d8dad54a083e29fcead5f
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2018-02-26 13:08:30 +00:00
Shawn Rutledge 499ec43937 use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where
we are assigning or testing a pointer rather than a numeric zero.

Also, replaced cases where 0 was passed as Qt::KeyboardModifiers
with Qt::NoModifier (clang-tidy replaced them with nullptr, which
waas wrong, so it was just as well to make the tests more readable
rather than to revert those lines).

Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-02-26 07:13:18 +00:00
Liang Qi 692ff26085 Merge remote-tracking branch 'origin/5.10' into dev
Change-Id: I1ed923d72566af663555898c3ec708191eef8ae9
2017-11-06 18:05:07 +01:00
Liang Qi 15dd1b7883 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/qml/qml/qqmlimport.cpp
	src/qml/qml/qqmlimport_p.h
	src/qml/qml/qqmltypenamecache.cpp

Done-with: Ulf Hermann<ulf.hermann@qt.io>
Change-Id: I41ba7a592b2659ddf53da6952ea3b456a7bba319
2017-10-24 11:13:09 +02:00
Friedemann Kleint f82c4de515 Qt Quick examples: Introduce QCommandLineParser
Task-number: QTBUG-60630
Change-Id: Iaf24e09fdec92f8af495a1288685f266c39be4a7
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-10-18 09:45:59 +00:00
Kai Koehne 341a04377b Fix outdated FDL license header
Change-Id: I76dccf547de40b5e72fd7abaa062fa96cb2c118a
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2017-10-17 11:18:21 +00:00
Kai Koehne ea6cd0de3c Fix outdated BSD license header
Change-Id: Icc08925454445fc9497fb3bfd2c26efe90605983
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2017-10-17 11:18:11 +00:00
Kevin Funk 681f93c74d Replace Q_DECL_OVERRIDE with override
Change-Id: I176f91a8c51e81a2df3fe91733118261491223ee
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-09-25 08:27:35 +00:00
Liang Qi 0e80d28aa5 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
	src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp
	src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp
	src/qml/qml/qqmlimport.cpp
	src/quick/items/context2d/qquickcontext2dtexture_p.h
	tools/qmleasing/splineeditor.h

Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
2016-12-14 19:01:23 +01:00
Lars Knoll e579076bb3 Get rid of most QT_NO_FOO usages
Instead use QT_CONFIG(foo). This change actually detected a few
mis-spelled macros and invalid usages.

Change-Id: I06ac327098dd1a458e6bc379d637b8e2dac52f85
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-11-29 10:10:27 +00:00
Laszlo Agocs e8801e7c09 Enable shader disk cache in Qt Quick
Change-Id: I14ee97ee75664c5dfcd229a5be2be6294c936b2c
Task-number: QTBUG-55496
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2016-11-27 22:10:41 +00:00
Liang Qi f04c2c40fd Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	src/qml/jsruntime/qv4variantobject.cpp
	src/qml/types/qquickworkerscript.cpp
	src/quick/scenegraph/util/qsgdefaultpainternode_p.h
	tools/qmljs/qmljs.cpp

Change-Id: I876242714ec8c046238d8fd673a5ace2455b2b59
2016-10-18 08:33:26 +02:00
Liang Qi 102fa9b6db Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	examples/quick/quickwidgets/quickwidget/main.cpp
	src/qml/jsruntime/qv4jsonobject.cpp
	src/qml/jsruntime/qv4qobjectwrapper.cpp
	src/qml/jsruntime/qv4qobjectwrapper_p.h
	src/qml/qml/qqmlengine.cpp
	src/qml/qml/qqmlpropertycache.cpp
	src/qml/qml/qqmlpropertycache_p.h
	src/quick/items/qquickanimatedsprite.cpp
	src/quick/items/qquickitem.cpp
	src/quick/items/qquickitem.h
	src/quick/items/qquickitem_p.h
	src/quick/items/qquickview_p.h
	src/quick/scenegraph/qsgcontext.cpp
	src/quick/scenegraph/qsgdefaultrendercontext.cpp

Change-Id: I172c6fbff97208f21ed4c8b6db3d1747a889f22b
2016-10-10 16:01:48 +02:00
Laszlo Agocs e1a303dd01 Enhance quickwidget example with all grabbing cases
Add a demo of QQuickItem::grabToImage(), in addition to grabFramebuffer()
and render(). This way all possible approaches are demonstrated and tested.

Task-number: QTBUG-55879
Change-Id: I13c427730c416f0d87f83092627e2cb46aba2cc4
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2016-09-22 08:04:05 +00:00
Anton Kudryavtsev 2f9db0a631 examples: replace 'foreach' with 'range for'
While touching the code, replace QStringLiteral
with QL1S in QStringBuilder expression.

Change-Id: I2519b254d82453e1c9bd5b834c0bd78e5c026f83
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-09-03 16:50:01 +00:00
Liang Qi 42f485231c Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	src/quick/items/context2d/qquickcanvasitem.cpp
	src/quickwidgets/qquickwidget.cpp
	tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp

Change-Id: Idf279cb88e0df2a383489af5b6afdf04d04ae611
2016-06-30 13:28:35 +02:00
Laszlo Agocs 5511ed66e6 Add potentially missing include to qquickviewcomparison example
Task-number: QTBUG-54244
Change-Id: I38c3fff07ed2a5ff3ffddef1d523f110f0863ac0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2016-06-21 12:53:00 +00:00
Laszlo Agocs b30d970691 Add a tab widget to QQuickWidget example
...and include a tab with custom OpenGL rendering. Tab widgets are
interesting because they are commonly used in applications in combination
with widgets like QOpenGLWidget and QQuickWidget, and because they typically
trigger rapid show-hide sequences which QQuickWidget does not always handle
as well as it could.

Thus this serves both as a helpful example and a useful testing tool.

Plus it exposes at least two bugs already, namely that the continuous
animation in the QQuickFBO does not start when switching to the tab
containing the QQuickWidget in question, and that it is impossible
to integrate third-party rendering code in a robust manner due to
QQuickWidget destroying everything whenever hiding the widget. This
is not what happens with a QQuickView and the normal render loops.

Task-number: QTBUG-54133
Change-Id: Ie7d92cd0f685e4a26f4bb351cc023eb697a36bf4
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2016-06-20 15:50:32 +00:00
Liang Qi afc84775ef Merge remote-tracking branch 'origin/5.6.1' into 5.6
Change-Id: Ib7f8c60143c1efab279476dba390a3d9837ccc37
2016-05-19 06:34:04 +02:00
Oswald Buddenhagen e6581ed818 fix example installs
Change-Id: Ie6a219392a48fd6b1a32037cc215dc20d408e819
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-13 04:35:24 +00:00
Oswald Buddenhagen cd82f9d09e purge unused image
it's a duplicate from doc/images, so was presumably added by accident.

Change-Id: Icfe75d4cb2682b42a2993e64f445295b10daca70
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-05-12 14:20:28 +00:00
Edward Welbourne fcbe8ba3fa Purge sRGB chunks from PNG in documentation.
Subjects each *.png file that matched grep -law "sRGB" to:
pngcrush -ow -brute -rem allb -reduce -force

Various tools grumble about sRGB tables in PNG images; and our
handling of them doesn't pay attention to these, so purging them
makes the images smaller with no loss to the images.

Change-Id: I23d7a43ba6c6ce6cafa11c1950a118a73f4d07cd
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-03-24 19:40:25 +00:00
Edward Welbourne ca0765d283 Purge sRGB chunks from PNGs in examples.
Subjects each *.png file that matched grep -law "sRGB" to:
pngcrush -ow -brute -rem allb -reduce

Various tools grumble about sRGB tables in PNG images; and our
handling of them doesn't pay attention to these, so purging them
makes the images smaller with no loss to the images.

Change-Id: If3baf60fb7c0045446ddfddecef96374845e739e
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-03-24 19:40:15 +00:00
Laszlo Agocs 6fa50ffc31 Fix up flawed TranslucentBackground usage in docs and examples
Following the qtbase fixes, start doing things correctly in the
QQuickWidget examples too. Remove the checkbox and use a --transparent
command line argument (like in hellogl2).

In addition --transparent --no_render_alpha can be used to verify the
most problematic case: when alpha is present and the backingstore contains
semi-transparent pixels in places where the underlying QOpenGLWidget is
opaque. Here the result must still be an opaque pixel. This was previously
ensured by a glColorMask call, now replaced by glBlendFuncSeparate in
QPlatformBackingStore.

Task-number: QTBUG-47276
Change-Id: Ia040f899405f73e95e957becee5df43683af9c39
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2015-09-28 07:41:36 +00:00
Friedemann Kleint 1e2e356f0f Port examples to new connection syntax.
Change-Id: I121c59ac0ad56acb4cd54b99ecd37567368385ce
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2015-07-22 22:16:19 +00:00
Jani Heikkinen 20c207815a Fixed license headers
Change-Id: I4d5640ff95e1361ec7e65fb3e87d7726d8185ff5
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
2015-02-17 13:33:18 +00:00
Jani Heikkinen c5796292ad Update copyright headers
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.

Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9
Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
2015-02-12 10:28:11 +00:00
Laszlo Agocs d22769c728 Beautify the qquickviewcomparison example
Remove the red rectangle.
Change the background color to a gradient. (taken from rendercontrol)
Disable the transparency checkbox everywhere but Linux since it
usually will not work. (too much hassle with platform specifics like
frameless windows, etc.)

Change-Id: I21488386cddc5841a2bdc8104e7abb197b075b0d
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
2014-09-10 20:20:10 +02:00
Laszlo Agocs 04f0d937fe Fix up vao usage in qquickviewcomparison example
The binder calls create() if needed, so drop that call.
In the render function however, drop the binder.
Trying to create() again and again on every frame is a
waste of time.

Change-Id: I1e9cd8e2c97030b96e604256661e65ce75446e9d
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-08-26 12:11:44 +02:00
Laszlo Agocs 2b3de73def Add QQuickWidget::setClearColor()
And make qquickviewcomparison able to demonstrate how to create a
partially transparent QQuickWidget.

Avoid also recreating the QQuickView/QQuickWidget multiple times
when switching between the radio buttons.

[ChangeLog] Added QQuickWidget::setClearColor() in order to support
semi-transparent QQuickWidgets.

Change-Id: I319ad4afbe909530274d09f2a7fcff23730d6ebd
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-08-13 14:34:50 +02:00
Laszlo Agocs 549f76b521 Finish render() support for QQuickWidget
The enablers are already in. Now we just need to use the virtual in
QQuickWidgetPrivate and test it.

Task-number: QTBUG-39562
Change-Id: I1faf5a0a244ba4169fb8f9b0dae657304038b60e
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-08-11 13:19:47 +02:00
Laszlo Agocs e1fbfc0156 Change default to QQuickWidget in the comparison example
This way the example will run on embedded devices (eglfs)out of the
box and will only abort when switching to QQuickView.

Change-Id: I07855ac1a9d112f868adf6fcab8db888ba0888ec
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-07-09 12:41:51 +02:00
Laszlo Agocs 2bc44ba16b Add a QQuickWidget - QQuickView comparison example
Besides serving as a side-by-side test tool for QQuickView and
QQuickWidget (including multisampling), it also demonstrates some
useful practices for rendering 3D content via QQuickFramebufferObject.

Done-with: Paul Olav Tvete <paul.tvete@digia.com>
Change-Id: Ie73e998ee91e32ef1535dd6f0f65c8a69addcc5e
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
2014-06-19 20:55:57 +02:00
Laszlo Agocs 2e4a40a6cc Add support for multisampling in QQuickWidget
Use a multisampled fbo when the requested format has samples > 0.
Resolving happens after each rendering of the scene.

The blit to the temporary non-multisampled fbo could be avoided,
in theory, by sending the fbo instead of the texture id down the
stack and performing a blit directly to fbo #0. This however
involves a number of potential issues, for example due to the
non-sharability of FBOs between contexts. Hence it is left as a
future exercise.

Task-number: QTBUG-39187
Change-Id: Iae98b969bcbc3bb57e6d73288496f5428913c826
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-06-06 12:25:43 +02:00
Laszlo Agocs 337524714c Add surface format to QQuickWidget.
Change-Id: Id72a042588e37832a0d3757bad935c531ef8275a
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-03-18 20:59:55 +01:00
Topi Reinio 5b0935a105 Move Qt Quick Widgets example and document it
Because QtQuickWidgets is part of Qt Quick module documentation,
its examples need to also be moved under the examples/quick
directory structure.

This change moves the example, creates minimal documentation
for it, and adds a link to it from the QQuickWidget class
reference.

Task-number: QTBUG-37272
Change-Id: Iffb67849f150b9aaf0edaef5852364e93f7752b8
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-03-14 09:25:31 +01:00