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#ifndef QGRAPHICSLAYOUTSTYLEINFO_P_H
4#define QGRAPHICSLAYOUTSTYLEINFO_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include <QtWidgets/private/qtwidgetsglobal_p.h>
18#include <QtGui/private/qabstractlayoutstyleinfo_p.h>
19#include <QtWidgets/qstyleoption.h>
20
21#include <memory>
22
23QT_REQUIRE_CONFIG(graphicsview);
24
25QT_BEGIN_NAMESPACE
26
27class QStyle;
28class QWidget;
29class QGraphicsLayoutPrivate;
30
31class QGraphicsLayoutStyleInfo : public QAbstractLayoutStyleInfo
32{
33public:
34 QGraphicsLayoutStyleInfo(const QGraphicsLayoutPrivate *layout);
35 ~QGraphicsLayoutStyleInfo();
36
37 virtual qreal combinedLayoutSpacing(QLayoutPolicy::ControlTypes controls1,
38 QLayoutPolicy::ControlTypes controls2,
39 Qt::Orientation orientation) const override;
40
41 virtual qreal perItemSpacing(QLayoutPolicy::ControlType control1,
42 QLayoutPolicy::ControlType control2,
43 Qt::Orientation orientation) const override;
44
45 virtual qreal spacing(Qt::Orientation orientation) const override;
46
47 virtual qreal windowMargin(Qt::Orientation orientation) const override;
48
49 virtual void invalidate() override
50 {
51 m_style = nullptr;
52 QAbstractLayoutStyleInfo::invalidate();
53 }
54
55 QWidget *widget() const;
56 QStyle *style() const;
57
58private:
59 const QGraphicsLayoutPrivate *m_layout;
60 mutable QStyle *m_style;
61 QStyleOption m_styleOption;
62 std::unique_ptr<QWidget> m_widget;
63};
64
65QT_END_NAMESPACE
66
67#endif // QGRAPHICSLAYOUTSTYLEINFO_P_H
68

source code of qtbase/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h