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
qstylehelper_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#include <QtWidgets/private/qtwidgetsglobal_p.h>
6#include <QtCore/qpoint.h>
7#include <QtCore/qstring.h>
8#include <QtGui/qpaintdevice.h>
9#include <QtGui/qpolygon.h>
10#include <QtCore/qstringbuilder.h>
11#include <QtGui/qaccessible.h>
12#include <QtGui/qpainter.h>
13#include <QtGui/qguiapplication.h>
14#include <QtWidgets/qwidget.h>
15
16#ifndef QSTYLEHELPER_P_H
17#define QSTYLEHELPER_P_H
18
19//
20// W A R N I N G
21// -------------
22//
23// This file is not part of the Qt API. It exists purely as an
24// implementation detail. This header file may change from version to
25// version without notice, or even be removed.
26//
27// We mean it.
28//
29
30#include <private/qhexstring_p.h>
31
33
34class QColor;
35class QObject;
36class QPalette;
37class QPixmap;
38class QStyleOptionSlider;
39class QStyleOption;
40class QWindow;
41
42namespace QStyleHelper
43{
44 Q_WIDGETS_EXPORT QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size, qreal dpr);
45
46 Q_WIDGETS_EXPORT qreal dpi(const QStyleOption *option);
47
48 Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, qreal dpi);
49 Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, const QPaintDevice *device);
50 Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, const QStyleOption *option);
51
52#if QT_CONFIG(dial)
53 qreal angle(const QPointF &p1, const QPointF &p2);
55 int calcBigLineSize(int radius);
57#endif //QT_CONFIG(dial)
58 Q_WIDGETS_EXPORT void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect,
59 int left = 0, int top = 0, int right = 0,
60 int bottom = 0);
61#if QT_CONFIG(accessibility)
64#endif
65 Q_WIDGETS_EXPORT QColor backgroundColor(const QPalette &pal, const QWidget* widget = nullptr);
66
68
69 Q_WIDGETS_EXPORT WidgetSizePolicy widgetSizePolicy(const QWidget *w, const QStyleOption *opt = nullptr);
70
71 // returns the device pixel ratio of the widget or the global one
72 // if widget is a nullptr
73 static inline qreal getDpr(const QWidget *widget)
74 {
75 return widget ? widget->devicePixelRatio()
76 : qApp->devicePixelRatio();
77 }
78
79 // returns the device pixel ratio of the painters underlying paint device
80 static inline qreal getDpr(const QPainter *painter)
81 {
82 Q_ASSERT(painter && painter->device());
83 return painter->device()->devicePixelRatio();
84 }
85}
86
87
88QT_END_NAMESPACE
89
90#endif // QSTYLEHELPER_P_H
friend class QPainter
\inmodule QtCore\reentrant
Definition qpoint.h:29
static qreal getDpr(const QPainter *painter)
static qreal getDpr(const QWidget *widget)
Q_WIDGETS_EXPORT void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect, int left=0, int top=0, int right=0, int bottom=0)
static void qDrawWinShades(QPainter *p, int x, int y, int w, int h, const QColor &c1, const QColor &c2, const QColor &c3, const QColor &c4, const QBrush *fill)
QVarLengthArray< QPainter::PixmapFragment, 16 > QPixmapFragmentsArray
Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, int lineWidth=1, int midLineWidth=0, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, const QRect &r, const QPalette &pal, bool sunken=false, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, const QRect &r, const QPalette &pal, bool sunken=false, int lineWidth=1, int midLineWidth=0, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, const QRect &r, const QPalette &pal, bool sunken=false, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2, const QPalette &pal, bool sunken=true, int lineWidth=1, int midLineWidth=0)
Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, const QRect &r, const QPalette &pal, bool sunken=false, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2, const QPalette &pal, bool sunken=true, int lineWidth=1, int midLineWidth=0)
Definition qdrawutil.cpp:60
Q_WIDGETS_EXPORT void qDrawPlainRoundedRect(QPainter *p, int x, int y, int w, int h, qreal rx, qreal ry, const QColor &, int lineWidth=1, const QBrush *fill=nullptr)
Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=nullptr)
The QTileRules class provides the rules used to draw a pixmap or image split into nine segments.
Definition qdrawutil.h:89