aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick
Commit message (Collapse)AuthorAgeFilesLines
* Fix additional warnings from usage of deprecated APIsVolker Hilsheimer2020-09-161-1/+0
| | | | | | | | Replace QLibaryInfo::location with QLibraryInfo::path, and remove usage of Qt::AA_EnableHighDpiScaling, which doesn't have any effect anymore. Change-Id: I347e8a83e0f4c2b4405f2512e569ad3234f05a98 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* shadereffect example: remove unused legacy shader codeLaszlo Agocs2020-09-1328-239/+137
| | | | | | | | No point in exercising the file selector magic when there is only one possible path in Qt 6. Change-Id: I3b49b19d57a89855063e983ab0add13335840fb9 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* examples: include QQuickWindow in squircle headersUlf Hermann2020-09-134-0/+4
| | | | | | | This is required because QQuickWindow is passed as a signal parameter. Change-Id: Ied10beded7253558d080af4806d1b95880bf2d98 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make twotextureproviders example functional againLaszlo Agocs2020-09-074-0/+42
| | | | | Change-Id: I6a317fc8628b902e535a31daf4a3886fc87d08bc Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Regenerate graph example shadersLaszlo Agocs2020-09-074-0/+0
| | | | | Change-Id: Id4fe4d0e177180fadd10f34b9ebad17c71e40314 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add CMake project file for custommaterial exampleLaszlo Agocs2020-09-074-6/+126
| | | | | | | | | The name conflicts with a Quick3D example so try to use the same approach as it was done for customgeometry. Task-number: QTBUG-86205 Change-Id: Ie01cd6c0118d512b2f45d4c6e782ec6639e052c6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove old GLSL code from fboitem exampleLaszlo Agocs2020-09-077-34/+18
| | | | | | | There is no OpenGL path anymore in Qt 6, no point using file selectors. Change-Id: I4b7afbbb193dfe1a6e912a909babab0aeb8dcdda Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Remove use of deprecated High-DPI application attributesTor Arne Vestbø2020-09-023-3/+0
| | | | | Change-Id: Ibfb50fdcbb51ba93d6e5d11f9e8ce0e7b3bfde79 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Doc: Capitalize "GUI" correctlySze Howe Koh2020-08-301-1/+1
| | | | | | Pick-to: 5.15 Change-Id: I2230e2dcb7bc2497b5dbe71a22c21d84176b5e57 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* CMake: Rename example conflicting with qtquick3dAlexandru Croitor2020-08-252-7/+63
| | | | | | Fixes: QTBUG-86205 Change-Id: I38992501abb86a4328527283ad8924ec886ea8c8 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Switch to MTLTexture protocol in QSGTexture native accessLaszlo Agocs2020-08-041-1/+1
| | | | | | | Now only available from ObjC code. Change-Id: I88df6c8839fc660ffd2b8e88a789ca73a9d4accd Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add type safe native texture accessorsLaszlo Agocs2020-08-032-8/+6
| | | | | | | | Following the pattern from QtGui. Task-number: QTBUG-85239 Change-Id: I07b4456028d0f45223ad10e55ce65f423bab6a9b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace Qt's MidButton with MiddleButtonEdward Welbourne2020-07-221-1/+1
| | | | | | | | | | The latter has been the preferred name since Qt 4.7.0. Added a comment on where the old name is exposed to QML that it's only for backwards compatibility. Pick-to: 5.15 Change-Id: I2c5088d597dd7327cc5899d06afb180d0ec2893e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* shadereffect example: change to relative file refsLaszlo Agocs2020-06-301-7/+7
| | | | | | | | Like with Image, this should work with ShaderEffect as well, and is the better default approach to promote to users. Change-Id: I9b8427297687db189045886fbaf17d2b4a517aba Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Follow QQuickGraphicsDevice changes in QQuickRenderTargetLaszlo Agocs2020-06-262-4/+4
| | | | | | | | | They are not strictly related of course, but the API pattern should be kept. We can also move away from the QSGTexture dependency which is good since that was never directly related. Change-Id: I9aedff5918443bda3d6e3ee1ea389071222d1ad7 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Use QList instead of QVectorJarek Kobus2020-06-252-5/+5
| | | | | | Task-number: QTBUG-84469 Change-Id: I4c3353c00a566023503fbc178ba8454391dc334c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* New custom material examplePaul Olav Tvete2020-06-2413-3/+749
| | | | | | Fixes: QTBUG-78577 Change-Id: I280ffeda4bba1a9c170feb1ffa4b6c95eb0e6d28 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Rename setSceneGraphBackend to setGraphicsApiLaszlo Agocs2020-06-2212-12/+12
| | | | | | | | | | | | | | | | ...and fix up the docs. The string-based setSceneGraphBackend() stays of course (the docs have been enhanced, however). The GraphicsApi enum-based overload is now renamed to setGraphicsApi(). Using the same name for both functions is a historical artifact, reflecting the evolution (5.0 - 5.8 - 5.14). In 6.0 we can give it a more appropriate name, since it does not have much to do with "backends" from the user's perspective. Change-Id: Id75dbf81f50a148797e5b5de9be4000153737473 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix GL_ constant usage in examplesLaszlo Agocs2020-06-174-6/+6
| | | | | Change-Id: Iecfa47845edb78928b388d150a3229f8c7a93d5d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Remove QtQuick.Window pluginUlf Hermann2020-06-154-8/+4
| | | | | | | | | | | | | | | | | We move all the types into QtQuick itself and retain QtQuick.Window only as alias to QtQuick. This requires support for qmldirs that consist of only an import statement. [ChangeLog][QtQuick][Important Behavior Changes] The contents of the QtQuick.Window QML module have been moved into the QtQuick module. QtQuick.Window is merely and alias for QtQuick now. An explicit import of QtQuick will override this alias. Therefore, if you import QtQuick with a different version than QtQuick.Window, you will get the QtQuick.Window types of the version given in the QtQuick import now. Task-number: QTBUG-84639 Change-Id: Ia82afab0ac2faba70cfdaf53dc8dfe4261e1113f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Anisotropic antialiasing for distance field textEskil Abrahamsen Blomfeldt2020-06-153-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For perspective transforms, we need to find the sample range in the glyph cache per pixel. We can do this by getting the gradient of the distance field at the specific pixel. This will ensure proper antialiasing with any projection, but has the limitation that when glyph contours become thinner than a pixel, they may disappear or become too emphasized, because the hardware-gradient - based on neighbouring fragments - is not reliable at that scale. So we should only default to this when we detect that the text is child of a 3D scene. To make this smooth, we need to know the mode of the renderer when creating the shader. So QSGMaterial::createShader() now takes a render mode that we can use to customize behavior based on whether it is rendering into a 2D or 3D scene. [ChangeLog][QtQuick] The QSGMaterial::createShader() virtual function has been extended to take a render mode argument, which can be used for any customizations needed in the case where the shader will be used in combination with 3D perspective transformations. Fixes: QTBUG-84695 Change-Id: I5a18a4edbdfa07e8f9d506c42bb20e8eb580927d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Move resetOpenGLState() to QQuickFboLaszlo Agocs2020-06-121-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | QQuickWindow should not have OpenGL specifics in its API in Qt 6. However, resetOpenGLState() is used by applications commonly in combination with QQuickFramebufferObject (not the least because the documentation recommends it!). This is no problem in practice because QQuickFramebufferObject remains an OpenGL-only feature. So to minimize the breaks, move the function into QQuickFramebufferObject::Renderer so any application that calls the function can continue to do so by just calling it on 'this' instead. The rendercontrol_opengl example used to call this function as well, but unnecessarily, it will still function the same way without it. Note that there is a chance that there are applications that call resetOpenGLState() in other contexts, for example in slots connected to before or afterRendering(). For these it will need to be determined if the call is necessary at all, and if it is, should be replaced by (re)setting the appropriate OpenGL state manually instead. Task-number: QTBUG-84523 Change-Id: I335599f77e8a84e347a44427eb1a1bf917796ee8 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* fboitem example: Request OpenGL explicitlyLaszlo Agocs2020-06-121-0/+2
| | | | | | | It wouldn't render otherwise. Change-Id: I185459f2eccdffac4f7d7968e48aab4141e0908c Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Replace calls to deprecated QEvent accessor functionsShawn Rutledge2020-06-112-5/+5
| | | | | | | | | | | | | | | | | | | | Several event accessors were deprecated in qtbase/24e52c10deedbaef833c0e2c3ee7bee03eacc4f5. Replacements were generated by clazy using the new qevent-accessors check: $ export CLAZY_CHECKS=qevent-accessors $ export CLAZY_EXPORT_FIXES=1 $ ../qt6/configure -platform linux-clang -developer-build -debug -no-optimize-debug -opensource -confirm-license -no-pch QMAKE_CXX=clazy $ make $ cd ../../qt6/qtdeclarative $ find . -name "*.clazy.yaml" $ clang-apply-replacements . Task-number: QTBUG-20885 Task-number: QTBUG-84775 Change-Id: I1be5819506fd5039e86b4494223acbe193e6b0c9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* openglunderqml example: remove unnecessary resetOpenGLState callLaszlo Agocs2020-06-112-4/+2
| | | | | | | | | | | | | | | Also request the OpenGL RHI backend explicitly, like all the other similar examples (d3d11underqml, and so on) do. Calling resetOpenGLState() in this example is pointless because it happens before returning from the custom rendering function, and the endExternalCommands() call achieves the same internally, i.e. the rhi will know that cached state cannot be used anymore. There are other valid uses cases for resetOpenGLState() but this example does not have those. Change-Id: Ifa7861b80c29c174d02cfe37fe8ef8eed7344195 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Remove rendernode and opengltextureinthread examplesJonas Karlsson2020-06-1030-2526/+0
| | | | | | Task-Id: QTBUG-84623 Change-Id: I786a7a8ee256d8c395dd0e828213c5d137ba20dc Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Enable Metal-based scenegraph examplesLaszlo Agocs2020-06-101-3/+3
| | | | | Change-Id: Ib2734fb10feaac106bb6483a8a361c7b35af3348 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove winrtOliver Wolff2020-06-041-4/+0
| | | | | | | | | Task-number: QTBUG-84434 Change-Id: If8f57f00726868a3540c877d07fca761618e4f08 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix some bugs in the example that was introduced by moving over to QQC2Jan Arve Sæther2020-06-041-2/+12
| | | | | | | | | Most of the bugs was due to moving over to Qt Quick Controls 2, except from the binding we had to explicitly break now. That should probably have been done when we used Qt Quick Controls too. Change-Id: Ic558679802ea35e727eadc570cf299f9da4a3604 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Make QSGMaterialRhiShader become QSGMaterialShaderLaszlo Agocs2020-06-023-9/+3
| | | | | | | | | | | | | | | | After a symbiotic relationship in Qt 5.14 and 5.15, it is time for QSGMaterialRhiShader to devour its older sibling and take its place. This makes the direct OpenGL rendering path disfunctional. All QSGMaterial Qt 6 TODOs are solved, the API is clean and straightforward again: a QSGMaterial creates a QSGMaterialShader, no special flags and options needed. (it's just that QSGMaterialShader now has a slightly different API) Task-number: QTBUG-79268 Task-number: QTBUG-82997 Change-Id: I545ca8d796c5535e81957c706e7832133be15b7d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Remove CustomParticleEirik Aavitsland2020-06-0214-883/+0
| | | | | | | | | The implementation is intertwined with the direct GL path and not really portable to RHI. Fixes: QTBUG-78574 Change-Id: I6ac8707544c19a24661f07e0e6d2fc405e49cbff Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Enable rendercontrol_d3d11 example in CMake buildsLaszlo Agocs2020-05-292-2/+2
| | | | | Change-Id: Ifd1526da4a792e783e47fc7bb952bdb188a6e5c1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Don't install .qmltypes for Qt tests, examples and toolsAlexandru Croitor2020-05-2919-19/+0
| | | | | | | | | | | that don't have an explicit QT_QML_MODULE_INSTALL_DIR path specified. We don't want to pollute the Qt qml import path with these files. Task-number: QTBUG-84403 Change-Id: I768267e0e79daa8090d882c301648cce14e1a809 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate qtdeclarative/examplesAlexandru Croitor2020-05-2954-53/+267
| | | | | | | | | Includes - new example installation paths - one case of QT_QMLTYPES_FILENAME addition Change-Id: I24423da9b04b6ecc8445017fa35f148dd43b1829 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Update to Qt Quick Controls 2Jan Arve Sæther2020-05-291-2/+2
| | | | | | | | Qt Quick Controls will be deprecated in Qt 6 Change-Id: Ifca94d028b3fd71797816a22af4d896fb9ae2be3 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Avoid truncating in QSGMaterial::compare() implementationsLaszlo Agocs2020-05-272-10/+7
| | | | | | | | | | | | The Qt 5.0 pattern of subtracting pointers and returning them is not suitable (on 64-bit archs) since the return type is an int. There is also QSGTexture::comparisonKey() now which is a qint64. Just return -1 and 1 as appropriate. Change-Id: Iaf3377b484a8c4b19b0960f1e8def05e4fa68ce7 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Skip d3d rendercontrol example on MinGWLaszlo Agocs2020-05-272-1/+4
| | | | | | | | | | We will not invest into adding workarounds in the example code as the boilerplate to keep such unofficial environments working is not worth the effort and compromises readability in example code. Just skip building on MinGW. Change-Id: If33bd0382f8cab4713ad45fcaa126830e9760af3 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Adjust QSGTexture comparisonKey typeLaszlo Agocs2020-05-272-3/+3
| | | | | | | | | | | | | | | | | | | | | The original choice was int, simply following textureId(). This was later deemed insufficient: instead of a GLuint, the value is now often a 64-bit value (on 64 bit systems), based on a pointer, since the identity of a texture in the RHI world is the QRhiTexture* itself. In a custom texture implementation it is likely that the value here is the value of a native object handle, either a pointer or some 32 or 64 bit integer. Inspired by the recent QSGTexture::NativeTexture struct change (void* -> quint64), switch to a qint64 which is big enough to hold all these without truncation. We choose a signed value here, in order to allow for the following pattern that is widespread in material compare() implementations: if (qint64 diff = m_texture->comparisonKey() - other->texture()->comparisonKey()) return diff; Fixes: QTBUG-83769 Change-Id: I8bdae8cd835282358ded53b3703142b8f26e4400 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Fix namespaced builds in rendercontrol exampleLaszlo Agocs2020-05-271-0/+2
| | | | | Change-Id: Ic91d4c57e1d559d3ab2438e99c0c34ba2d1d9200 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Enable QQuickWidget with OpenGL over RHILaszlo Agocs2020-05-273-1/+7
| | | | | | | | | | | | | | | | | Also adapts to new NativeTexture format, where the actual handle is passed around instead of a pointer to it. [ChangeLog][QQuickWidget][Important Behavioral Changes] In earlier versions, the returned value from QQuickWidget::quickWindow() would persist for the life time of the widget. This is no longer the case, so if you are connecting to its signals, make sure you also connect to its destroyed() signal and update the connections when it is destroyed. Fixes: QTBUG-78638 Change-Id: I33cee8543ef1ff5d31555ed3ac18ba78c9c45102 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Adapt to changes in NativeTexture in qtbaseEskil Abrahamsen Blomfeldt2020-05-255-9/+7
| | | | | | | | | | To make the API less error prone, we have changed the void pointer to the texture handle to a 64-bit in instead, since all handles are maximum 64-bit. Task-number: QTBUG-78638 Change-Id: I9d995d6a883b3377f57d7c5b19d4bc4e15aa347b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add missing CMake project for vulkantextureimportLaszlo Agocs2020-05-252-1/+63
| | | | | | | | ...and enable vulkanunderqml and vulkantextureimport in the CMakeLists one level up. Change-Id: I91d659e028b0e7f53b5860bbfbdbb98c18e333c7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Clean up registration of QEasingCurveUlf Hermann2020-05-191-2/+2
| | | | | | | | | | | | | | | | We don't need to register the Type enum for both QtQml and QtQuick. QtQml is enough. Removing this makes the whole manual value type registration obsolete. Furthermore, we want QEasingCurve as QML_FOREIGN as we have several classes with properties of that type. To keep it nice and tidy, we make the uppercase-named enum holder class a separate type. Unfortunately, the Type enums differ in one entry: QEasingCurve::BezierSpline is called Easing.Bezier in QML. Therefore, we need to keep the custom enum around. We can change all users in qtdeclarative to use the name from QEasingCurve, though. Change-Id: Ibbc78d8bbf8938e2a8722f8c09833a0c73394c3d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix up the scenegraph/textureinthread exampleLaszlo Agocs2020-05-1813-48/+28
| | | | | | | | | | | | | Force OpenGL, remove the ShaderEffect (it serves no purpose in this example) and remove deprecated API usage. Finally, rename the example to opengltextureinthread. Note that the example's performance is sub-par, but the same is true with direct OpenGL. Change-Id: I7eaa2349ffdb3d27bd9e8815d674e918bc709c03 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Modernize the rendercontrol_opengl exampleLaszlo Agocs2020-05-187-710/+68
| | | | | | | | | | | | | | | Make it work when using QRhi-on-OpenGL. Some features like demonstrating a dedicated render thread, or targeting the window with the Quick content ('onscreen' argument, not clear why that was added in the first place), are now removed. Some of these could be reintroduced in future examples, not necessarily in combination with OpenGL. For now they are removed since the cost of porting and maintaining all that is not reasonable at this point. Task-number: QTBUG-84040 Change-Id: I67e5c7cc835c5cf5653cf827004ce66a4d300b36 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Remove Screen.orientationUpdateMaskShawn Rutledge2020-05-081-4/+0
| | | | | | | | Now Screen.orientation works by default rather than filtering by default. Task-number: QTBUG-83055 Change-Id: I0f49499ec25ceeebf19bc8ef1adc259023f1bc75 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Remove textureprovider exampleLaszlo Agocs2020-05-0612-614/+0
| | | | | | Task-number: QTBUG-83978 Change-Id: I8f26ae18dd09209cc1d6bee6e5f0b2f609ec667c Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Remove leftover legacy shader files in scenegraph exampleLaszlo Agocs2020-04-2913-102/+54
| | | | | | Task-number: QTBUG-82997 Change-Id: Icc328394154d7b352c9f47184c2f906d5afa4d44 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Resume AnimatedSprite playback when visibility changesLaszlo Agocs2020-04-241-6/+18
| | | | | | | | | | | | | | | | | | | | | Amends f5e2783 that was made in 5.6 to avoid updating the AnimatedSprite when not visible. The problem is, if the sprite was running, the expectation is that becoming visible again resumes the playback. It can be argued what the correct behavior is: do we expect the playback to resume from the point when the sprite went invisible, or should it take the time spent as invisible into account? This patch only corrects the immediate problem and provides the former, i.e. playback will resume from the point it had when becoming invisible. The AnimatedSprite scene in the imageelements example is improved to be able to test this. It can also exercise all the start/pause/resume/advance functions now. Fixes: QTBUG-63942 Pick-to: 5.15 Change-Id: Ieb6d046168a2132659848a36ee0b694c580159b1 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QQuickItem: rename geometryChanged to geometryChangeMitch Curtis2020-04-236-9/+9
| | | | | | | | | | | | | | | | | | This brings it in line with the existing convention in this and other modules, where virtual handlers are named "nounChange"; e.g. itemChange. Signals are named "nounChanged". This also allows adding a geometryChanged signal, which would enable users to listen to one signal for all changes to x/y/width/height. [ChangeLog][QQuickItem] Renamed geometryChanged to geometryChange in order to follow existing naming conventions and have consistency with existing API, such as itemChange. Task-number: QTBUG-82994 Change-Id: I0547358c796a0047982ccfbf2c38bab952e7a634 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>