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
qquickfluentwinui3focusstroke.cpp
Go to the documentation of this file.
1
2// Copyright (C) 2024 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
5#include <QtGui/qpainter.h>
6#include <QtGui/qpainterpath.h>
7#include <QtQuick/private/qquickitem_p.h>
9QQuickFluentWinUI3FocusStroke::QQuickFluentWinUI3FocusStroke(QQuickItem *parent)
11{
12}
13void QQuickFluentWinUI3FocusStroke::paint(QPainter *painter)
14{
15 painter->setRenderHint(QPainter::Antialiasing);
16 QPainterPath path;
17 QRectF rect = boundingRect();
18 path.moveTo(rect.left(), rect.top() + m_radius);
19 path.lineTo(rect.left(), rect.bottom() - m_radius);
20 path.arcTo(QRectF(rect.left(), rect.bottom() - 2 * m_radius, 2 * m_radius, 2 * m_radius), 180, 90);
21 path.lineTo(rect.right() - m_radius, rect.bottom());
22 path.arcTo(QRectF(rect.right() - 2 * m_radius, rect.bottom() - 2 * m_radius, 2 * m_radius, 2 * m_radius), 270, 90);
23 path.lineTo(rect.right(), rect.top() + m_radius);
24 path.lineTo(rect.right(), rect.top() + m_radius);
25 path.lineTo(rect.right(), rect.top());
26 path.lineTo(rect.left(), rect.top());
27 painter->fillPath(path, m_color);
28}
29QColor QQuickFluentWinUI3FocusStroke::color() const
30{
31 return m_color;
32}
33void QQuickFluentWinUI3FocusStroke::setColor(const QColor &color)
34{
35 if (color == m_color)
36 return;
37 m_color = color;
38 update();
39}
40int QQuickFluentWinUI3FocusStroke::radius() const
41{
42 return m_radius;
43}
44void QQuickFluentWinUI3FocusStroke::setRadius(int radius)
45{
46 if (m_radius == radius)
47 return;
48 m_radius = radius;
49 update();
50}
51QT_END_NAMESPACE
52#include "moc_qquickfluentwinui3focusstroke_p.cpp"
QObject * parent
Definition qobject.h:73
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
Combined button and popup list for selecting options.