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
4#include <QtWidgets/private/qtwidgetsglobal_p.h>
5#include <QtCore/qpoint.h>
6#include <QtCore/qstring.h>
7#include <QtGui/qpaintdevice.h>
8#include <QtGui/qpolygon.h>
9#include <QtCore/qstringbuilder.h>
10#include <QtGui/qaccessible.h>
11
12#ifndef QSTYLEHELPER_P_H
13#define QSTYLEHELPER_P_H
14
15//
16// W A R N I N G
17// -------------
18//
19// This file is not part of the Qt API. It exists purely as an
20// implementation detail. This header file may change from version to
21// version without notice, or even be removed.
22//
23// We mean it.
24//
25
26#include <private/qhexstring_p.h>
27
28QT_BEGIN_NAMESPACE
29
30class QColor;
31class QObject;
32class QPainter;
33class QPalette;
34class QPixmap;
35class QStyleOptionSlider;
36class QStyleOption;
37class QWidget;
38class QWindow;
39
40namespace QStyleHelper
41{
42 QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size);
43
44 Q_WIDGETS_EXPORT qreal dpi(const QStyleOption *option);
45
46 Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, qreal dpi);
47 Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, const QPaintDevice *device);
48 Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, const QStyleOption *option);
49
50#if QT_CONFIG(dial)
51 qreal angle(const QPointF &p1, const QPointF &p2);
52 QPolygonF calcLines(const QStyleOptionSlider *dial);
53 int calcBigLineSize(int radius);
54 Q_WIDGETS_EXPORT void drawDial(const QStyleOptionSlider *dial, QPainter *painter);
55#endif //QT_CONFIG(dial)
56 Q_WIDGETS_EXPORT void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect,
57 int left = 0, int top = 0, int right = 0,
58 int bottom = 0);
59#if QT_CONFIG(accessibility)
60 Q_WIDGETS_EXPORT bool isInstanceOf(QObject *obj, QAccessible::Role role);
61 Q_WIDGETS_EXPORT bool hasAncestor(QObject *obj, QAccessible::Role role);
62#endif
63 Q_WIDGETS_EXPORT QColor backgroundColor(const QPalette &pal, const QWidget* widget = nullptr);
64
65 enum WidgetSizePolicy { SizeLarge = 0, SizeSmall = 1, SizeMini = 2, SizeDefault = -1 };
66
67 Q_WIDGETS_EXPORT WidgetSizePolicy widgetSizePolicy(const QWidget *w, const QStyleOption *opt = nullptr);
68}
69
70
71QT_END_NAMESPACE
72
73#endif // QSTYLEHELPER_P_H
74

source code of qtbase/src/widgets/styles/qstylehelper_p.h