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
qsgrhiinternaltextnode.cpp
Go to the documentation of this file.
1// Copyright (C) 2023 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
7#include <private/qquadpath_p.h>
8#include <private/qsgcurvefillnode_p.h>
9#include <private/qsgcurvestrokenode_p.h>
10#include <private/qsgcurveprocessor_p.h>
11
13
14QSGRhiInternalTextNode::QSGRhiInternalTextNode(QSGRenderContext *renderContext)
15 : QSGInternalTextNode(renderContext)
16{
17}
18
19void QSGRhiInternalTextNode::addDecorationNode(const QRectF &rect, const QColor &color)
20{
21 QSGCurveStrokeNode *node = new QSGCurveStrokeNode;
22 node->setColor(color);
23 node->setStrokeWidth(rect.height());
24
25 QQuadPath path;
26 QPointF c = rect.center();
27 path.moveTo(QVector2D(rect.left(), c.y()));
28 path.lineTo(QVector2D(rect.right(), c.y()));
29
30 QSGCurveProcessor::processStroke(path, 2, rect.height(), false, Qt::MiterJoin, Qt::FlatCap,
31 [&node](const std::array<QVector2D, 3> &s,
32 const std::array<QVector2D, 3> &p,
33 const std::array<QVector2D, 3> &n,
34 const std::array<float, 3> &ex,
35 QSGCurveStrokeNode::TriangleFlags f) {
36 Q_ASSERT(f.testFlag(QSGCurveStrokeNode::TriangleFlag::Line));
37 node->appendTriangle(s, std::array<QVector2D, 2>{p.at(0), p.at(2)}, n, ex);
38 });
39 node->cookGeometry();
40 appendChildNode(node);
41}
42
43QT_END_NAMESPACE
\inmodule QtQuick
Combined button and popup list for selecting options.