From 15ea475b40f6ad28d46e5cbd65a1ccc8556a53df Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 16 Jan 2020 10:21:58 +0100 Subject: Make FontLoader.name read-only Being able to set the name of a FontLoader seems to have been made to allow for some alternative coding patterns, but it doesn't really provide any convenience over other ways of customizing font names, and it definitely adds confusion for users, as well as as a possible race condition if both the source and name of the same FontLoader is set at unpredictable times. [ChangeLog][QtQuick] FontLoader.name property has been made read-only to reduce confusion about its use and precedence over conflicting properties. Fixes: QTBUG-80031 Change-Id: I0dd0e76ff376402c0b458ed7e5c57ec017bbc92d Reviewed-by: Lars Knoll --- examples/quick/text/doc/src/text.qdoc | 3 --- examples/quick/text/fonts/fonts.qml | 7 ++----- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'examples') diff --git a/examples/quick/text/doc/src/text.qdoc b/examples/quick/text/doc/src/text.qdoc index d8bd8d349a..6378e3efe6 100644 --- a/examples/quick/text/doc/src/text.qdoc +++ b/examples/quick/text/doc/src/text.qdoc @@ -49,9 +49,6 @@ Simply by name, using the font.family property directly: \snippet text/fonts/fonts.qml name - or using a \l FontLoader type: - \snippet text/fonts/fonts.qml fontloader - or using a FontLoader and specifying a local font file: \snippet text/fonts/fonts.qml fontloaderlocal diff --git a/examples/quick/text/fonts/fonts.qml b/examples/quick/text/fonts/fonts.qml index d356e00417..f4e721b6c1 100644 --- a/examples/quick/text/fonts/fonts.qml +++ b/examples/quick/text/fonts/fonts.qml @@ -56,9 +56,6 @@ Rectangle { width: 320; height: 480 color: "steelblue" -//! [fontloader] - FontLoader { id: fixedFont; name: "Courier" } -//! [fontloader] //! [fontloaderlocal] FontLoader { id: localFont; source: "content/fonts/tarzeau_ocr_a.ttf" } //! [fontloaderlocal] @@ -94,14 +91,14 @@ Rectangle { width: parent.width horizontalAlignment: Text.AlignRight wrapMode: Text.WordWrap - font { family: fixedFont.name; pixelSize: 20; weight: Font.Bold; capitalization: Font.AllLowercase } + font { family: "Courier"; pixelSize: 20; weight: Font.Bold; capitalization: Font.AllLowercase } } Text { text: myText color: "lightsteelblue" width: parent.width wrapMode: Text.WordWrap - font { family: fixedFont.name; pixelSize: 20; italic: true; capitalization: Font.SmallCaps } + font { family: "Courier"; pixelSize: 20; italic: true; capitalization: Font.SmallCaps } } Text { text: myText -- cgit v1.2.3 From fd272b60c322be6df77f936880b59f7fd1f585f8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 13 Jan 2020 15:39:47 +0100 Subject: Upgrade qsb files to version 4 Change-Id: Ic1a1f5ff49c34d72495bc74083f37db118c935c1 Reviewed-by: Eirik Aavitsland --- .../shadereffects/content/shaders/+qsb/blur.frag | Bin 2247 -> 1811 bytes .../shadereffects/content/shaders/+qsb/colorize.frag | Bin 2106 -> 1701 bytes .../shadereffects/content/shaders/+qsb/genie.vert | Bin 2629 -> 2201 bytes .../shadereffects/content/shaders/+qsb/outline.frag | Bin 2538 -> 2117 bytes .../shadereffects/content/shaders/+qsb/shadow.frag | Bin 2151 -> 1745 bytes .../shadereffects/content/shaders/+qsb/wobble.frag | Bin 2049 -> 1625 bytes 6 files changed, 0 insertions(+), 0 deletions(-) (limited to 'examples') diff --git a/examples/quick/shadereffects/content/shaders/+qsb/blur.frag b/examples/quick/shadereffects/content/shaders/+qsb/blur.frag index 1c79359297..d29b2d4365 100644 Binary files a/examples/quick/shadereffects/content/shaders/+qsb/blur.frag and b/examples/quick/shadereffects/content/shaders/+qsb/blur.frag differ diff --git a/examples/quick/shadereffects/content/shaders/+qsb/colorize.frag b/examples/quick/shadereffects/content/shaders/+qsb/colorize.frag index 45c5301f31..58bb5aaa8e 100644 Binary files a/examples/quick/shadereffects/content/shaders/+qsb/colorize.frag and b/examples/quick/shadereffects/content/shaders/+qsb/colorize.frag differ diff --git a/examples/quick/shadereffects/content/shaders/+qsb/genie.vert b/examples/quick/shadereffects/content/shaders/+qsb/genie.vert index dd94129cf7..540cb6a85b 100644 Binary files a/examples/quick/shadereffects/content/shaders/+qsb/genie.vert and b/examples/quick/shadereffects/content/shaders/+qsb/genie.vert differ diff --git a/examples/quick/shadereffects/content/shaders/+qsb/outline.frag b/examples/quick/shadereffects/content/shaders/+qsb/outline.frag index 470e2bd6e6..633fe0f926 100644 Binary files a/examples/quick/shadereffects/content/shaders/+qsb/outline.frag and b/examples/quick/shadereffects/content/shaders/+qsb/outline.frag differ diff --git a/examples/quick/shadereffects/content/shaders/+qsb/shadow.frag b/examples/quick/shadereffects/content/shaders/+qsb/shadow.frag index 128af21daa..8059fab6ac 100644 Binary files a/examples/quick/shadereffects/content/shaders/+qsb/shadow.frag and b/examples/quick/shadereffects/content/shaders/+qsb/shadow.frag differ diff --git a/examples/quick/shadereffects/content/shaders/+qsb/wobble.frag b/examples/quick/shadereffects/content/shaders/+qsb/wobble.frag index 9b27ae87cb..85fb453659 100644 Binary files a/examples/quick/shadereffects/content/shaders/+qsb/wobble.frag and b/examples/quick/shadereffects/content/shaders/+qsb/wobble.frag differ -- cgit v1.2.3 From 1ee5fed75f07ac63fe6f0463fca72af672304ddb Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 15 Jan 2020 11:53:35 +0100 Subject: Introduce PathText path element For text rendering in Qt Quick, we currently have the limitation that when rendering text at such a large size that the distance fields start showing artifacts, the only option is to use NativeRendering, which will look nice, but which will use a lot of texture memory for the glyph cache, since it will actually cache the glyphs at the requested size. A suggested approach would be to fall back to using triangulated paths when the font gets large enough, but the work on this was never completed. It turns out that we can get this now, basically for free, since we already support rendering arbitrary QPainterPaths using Qt Quick Shapes. The only thing missing is the ability to add the path of a given text to the shape. This patch fills in that gap. Note that this is currently not supported by nvidia renderer. [ChangeLog][QtQuick] Added PathText path element which can be used together with Qt Quick Shapes to get text rendering that does not cache glyphs in a texture, but triangulates the outlines of the glyphs instead. Change-Id: I436e1476b129b324cf7a54f89a1b18e0579e8185 Reviewed-by: Laszlo Agocs --- examples/quick/shapes/content/item18.qml | 71 ++++++++++++++++++++++++++ examples/quick/shapes/content/shapegallery.qml | 4 ++ examples/quick/shapes/shapes.pro | 3 +- examples/quick/shapes/shapes.qrc | 1 + 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 examples/quick/shapes/content/item18.qml (limited to 'examples') diff --git a/examples/quick/shapes/content/item18.qml b/examples/quick/shapes/content/item18.qml new file mode 100644 index 0000000000..3774d19bc5 --- /dev/null +++ b/examples/quick/shapes/content/item18.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Shapes 1.0 + +Rectangle { + color: "lightGray" + + Shape { + anchors.centerIn: parent + width: 200 + height: 100 + + ShapePath { + id: capTest + strokeColor: "black" + strokeWidth: 1 + fillColor: "black" + + PathText { x: 0; y: 100; font.family: "Arial"; font.pixelSize: 150; text: "Qt!" } + } + } +} diff --git a/examples/quick/shapes/content/shapegallery.qml b/examples/quick/shapes/content/shapegallery.qml index 86445e25c2..e5a7c51483 100644 --- a/examples/quick/shapes/content/shapegallery.qml +++ b/examples/quick/shapes/content/shapegallery.qml @@ -130,6 +130,10 @@ Rectangle { name: "Tiger" shapeUrl: "item17.qml" } + ListElement { + name: "Text" + shapeUrl: "item18.qml" + } } property int gridSpacing: 10 diff --git a/examples/quick/shapes/shapes.pro b/examples/quick/shapes/shapes.pro index ff6fa422fb..f99d941804 100644 --- a/examples/quick/shapes/shapes.pro +++ b/examples/quick/shapes/shapes.pro @@ -24,7 +24,8 @@ OTHER_FILES += content/main.qml \ content/item13.qml \ content/item14.qml \ content/item15.qml \ - content/item17.qml + content/item17.qml \ + content/item18.qml target.path = $$[QT_INSTALL_EXAMPLES]/quick/shapes INSTALLS += target diff --git a/examples/quick/shapes/shapes.qrc b/examples/quick/shapes/shapes.qrc index e03c0e8a0a..6de463dd33 100644 --- a/examples/quick/shapes/shapes.qrc +++ b/examples/quick/shapes/shapes.qrc @@ -28,5 +28,6 @@ content/item14.qml content/item15.qml content/item17.qml + content/item18.qml -- cgit v1.2.3 From 87e7203532d69e0aaa0898a972d1d90fa589d519 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 19 Aug 2019 11:12:20 +0200 Subject: Use required properties to fix some more qmllint warnings Change-Id: I4489bd55e8777b7bf591c41a21e2b6dfdf9ea996 Reviewed-by: Simon Hausmann --- examples/quick/shared/LauncherList.qml | 1 + examples/quick/shared/SimpleLauncherDelegate.qml | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/quick/shared/LauncherList.qml b/examples/quick/shared/LauncherList.qml index 9859b5b635..f6001cc681 100644 --- a/examples/quick/shared/LauncherList.qml +++ b/examples/quick/shared/LauncherList.qml @@ -75,6 +75,7 @@ Rectangle { id: launcherList clip: true delegate: SimpleLauncherDelegate{ + required property url url onClicked: root.showExample(url) } model: ListModel {id:myModel} diff --git a/examples/quick/shared/SimpleLauncherDelegate.qml b/examples/quick/shared/SimpleLauncherDelegate.qml index 7f07dea52a..097954cb89 100644 --- a/examples/quick/shared/SimpleLauncherDelegate.qml +++ b/examples/quick/shared/SimpleLauncherDelegate.qml @@ -51,6 +51,9 @@ import QtQuick 2.12 Rectangle { id: container + required property string name + required property string description + property Item exampleItem width: ListView.view.width height: button.implicitHeight + 22 @@ -110,7 +113,7 @@ Rectangle { anchors.leftMargin: 10 anchors.right: parent.right anchors.rightMargin: 10 - text: name + text: container.name color: "black" font.pixelSize: 22 wrapMode: Text.WrapAtWordBoundaryOrAnywhere @@ -122,7 +125,7 @@ Rectangle { id: buttonLabel2 anchors.left: parent.left anchors.leftMargin: 10 - text: description + text: container.description wrapMode: Text.WrapAtWordBoundaryOrAnywhere color: "#666" font.pixelSize: 12 -- cgit v1.2.3 From 406f15ce0e2707452462ff73b2d660ece960623f Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 24 Jan 2020 14:11:53 +0100 Subject: Quick: Don't qualify OpenGL includes The headers are moving from QtGui to QtOpenGL. By avoiding the qualification we can keep them compiling either way. Also, add opengl-private to make the types available. Also removed the QGraphicsRotation hack to get access to the projected rotation function of QMatrix4x4. The function is public now. Task-number: QTBUG-74409 Change-Id: I216e8ca09f8e247f96627b081308e3a57c55c29c Reviewed-by: Ulf Hermann --- examples/quick/quickwidgets/quickwidget/fbitem.cpp | 6 +++--- examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp | 2 +- examples/quick/scenegraph/openglunderqml/squircle.cpp | 4 ++-- examples/quick/scenegraph/openglunderqml/squircle.h | 4 ++-- examples/quick/scenegraph/textureinthread/threadrenderer.cpp | 4 ++-- examples/quick/scenegraph/twotextureproviders/xorblender.cpp | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'examples') diff --git a/examples/quick/quickwidgets/quickwidget/fbitem.cpp b/examples/quick/quickwidgets/quickwidget/fbitem.cpp index 95ff2da2e0..3e98168dcf 100644 --- a/examples/quick/quickwidgets/quickwidget/fbitem.cpp +++ b/examples/quick/quickwidgets/quickwidget/fbitem.cpp @@ -49,9 +49,9 @@ ****************************************************************************/ #include "fbitem.h" -#include -#include -#include +#include +#include +#include #include #if QT_CONFIG(opengl) diff --git a/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp b/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp index 8ba5bddb2a..1c7be258be 100644 --- a/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp +++ b/examples/quick/scenegraph/fboitem/fboinsgrenderer.cpp @@ -51,7 +51,7 @@ #include "fboinsgrenderer.h" #include "logorenderer.h" -#include +#include #include #include diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp index 828857fe24..1c4563baa5 100644 --- a/examples/quick/scenegraph/openglunderqml/squircle.cpp +++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp @@ -51,8 +51,8 @@ #include "squircle.h" #include -#include -#include +#include +#include #include //! [7] diff --git a/examples/quick/scenegraph/openglunderqml/squircle.h b/examples/quick/scenegraph/openglunderqml/squircle.h index c24fdd50c2..ecd92161fc 100644 --- a/examples/quick/scenegraph/openglunderqml/squircle.h +++ b/examples/quick/scenegraph/openglunderqml/squircle.h @@ -52,8 +52,8 @@ #define SQUIRCLE_H #include -#include -#include +#include +#include diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp index c364d0b7dd..5fd8037193 100644 --- a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp +++ b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp @@ -54,8 +54,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp index d5881b9adc..667b0bf8c7 100644 --- a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp +++ b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp @@ -52,8 +52,8 @@ #include -#include -#include +#include +#include #include #include -- cgit v1.2.3