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
qquickstyleitemframe.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 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
8
9StyleItemGeometry QQuickStyleItemFrame::calculateGeometry()
10{
11 QStyleOptionFrame styleOption;
12 initStyleOption(styleOption);
13 StyleItemGeometry geometry;
14
15 geometry.minimumSize = style()->sizeFromContents(QStyle::CT_Frame, &styleOption, QSize(0, 0));
16 geometry.implicitSize = contentSize();
17 styleOption.rect = QRect(QPoint(0, 0), geometry.implicitSize);
18 geometry.contentRect = style()->subElementRect(QStyle::SE_FrameContents, &styleOption);
19 geometry.ninePatchMargins = style()->ninePatchMargins(QStyle::CE_ShapedFrame, &styleOption, geometry.minimumSize);
20
21 return geometry;
22}
23
24void QQuickStyleItemFrame::paintEvent(QPainter *painter) const
25{
26 QStyleOptionFrame styleOption;
27 initStyleOption(styleOption);
28 style()->drawControl(QStyle::CE_ShapedFrame, &styleOption, painter);
29}
30
31void QQuickStyleItemFrame::initStyleOption(QStyleOptionFrame &styleOption) const
32{
33 initStyleOptionBase(styleOption);
34 styleOption.lineWidth = 1;
35 styleOption.frameShape = QStyleOptionFrame::StyledPanel;
36 styleOption.features = QStyleOptionFrame::Flat;
37}
38
39QT_END_NAMESPACE
40
41#include "moc_qquickstyleitemframe.cpp"