Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
5
7
9{
10 QStyleOptionFrame styleOption;
11 initStyleOption(styleOption);
12 StyleItemGeometry geometry;
13
14 geometry.minimumSize = style()->sizeFromContents(QStyle::CT_Frame, &styleOption, QSize(0, 0));
15 geometry.implicitSize = contentSize();
16 styleOption.rect = QRect(QPoint(0, 0), geometry.implicitSize);
17 geometry.contentRect = style()->subElementRect(QStyle::SE_FrameContents, &styleOption);
18 geometry.ninePatchMargins = style()->ninePatchMargins(QStyle::CE_ShapedFrame, &styleOption, geometry.minimumSize);
19
20 return geometry;
21}
22
24{
25 QStyleOptionFrame styleOption;
26 initStyleOption(styleOption);
27 style()->drawControl(QStyle::CE_ShapedFrame, &styleOption, painter);
28}
29
30void QQuickStyleItemFrame::initStyleOption(QStyleOptionFrame &styleOption) const
31{
32 initStyleOptionBase(styleOption);
33 styleOption.lineWidth = 1;
34 styleOption.frameShape = QStyleOptionFrame::StyledPanel;
36}
37
39
40#include "moc_qquickstyleitemframe.cpp"
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
\inmodule QtCore\reentrant
Definition qpoint.h:25
void paintEvent(QPainter *painter) const override
StyleItemGeometry calculateGeometry() override
QSize contentSize() const
void initStyleOptionBase(QStyleOption &styleOption) const
static QStyle * style()
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qsize.h:25
\variable QStyleOptionFocusRect::backgroundColor
QFrame::Shape frameShape
FrameFeatures features
@ CE_ShapedFrame
Definition qstyle.h:232
@ SE_FrameContents
Definition qstyle.h:282
Combined button and popup list for selecting options.
QPainter painter(this)
[7]