Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsgbasicglyphnode.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6#include <qsgmaterial.h> // just so that we can safely do delete m_material in the dtor
7
8QT_BEGIN_NAMESPACE
9
10QSGBasicGlyphNode::QSGBasicGlyphNode()
11 : m_style(QQuickText::Normal)
12 , m_material(nullptr)
13 , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 0)
14{
15 m_geometry.setDrawingMode(QSGGeometry::DrawTriangles);
16 setGeometry(&m_geometry);
17}
18
19QSGBasicGlyphNode::~QSGBasicGlyphNode()
20{
21 delete m_material;
22}
23
24void QSGBasicGlyphNode::setColor(const QColor &color)
25{
26 m_color = color;
27 if (m_material != nullptr) {
28 setMaterialColor(color);
29 markDirty(DirtyMaterial);
30 }
31}
32
33void QSGBasicGlyphNode::setGlyphs(const QPointF &position, const QGlyphRun &glyphs)
34{
35 if (m_material != nullptr)
36 delete m_material;
37
38 m_position = position;
39 m_glyphs = glyphs;
40
41#ifdef QSG_RUNTIME_DESCRIPTION
42 qsgnode_set_description(this, QLatin1String("glyphs"));
43#endif
44}
45
46void QSGBasicGlyphNode::setStyle(QQuickText::TextStyle style)
47{
48 if (m_style == style)
49 return;
50 m_style = style;
51}
52
53void QSGBasicGlyphNode::setStyleColor(const QColor &color)
54{
55 if (m_styleColor == color)
56 return;
57 m_styleColor = color;
58}
59
60QT_END_NAMESPACE