8#include <QtCore/qmath.h>
9#include <QtGui/qpainter.h>
10#include <QtGui/qpixmapcache.h>
11#include <QtGui/qwindow.h>
12#include <QtGui/private/qhighdpiscaling_p.h>
13#include <QtGui/private/qguiapplication_p.h>
14#include <QtGui/private/qmath_p.h>
15#include <QtGui/private/qhexstring_p.h>
32 % HexString<uint>(
option->direction)
33 % HexString<uint>(complexOption ?
uint(complexOption->activeSubControls) : 0u)
34 % HexString<quint64>(
option->palette.cacheKey())
35 % HexString<uint>(
size.width())
36 % HexString<uint>(
size.height());
64 return option->fontMetrics.fontDpi();
84#if QT_CONFIG(accessibility)
85bool isInstanceOf(
QObject *
obj, QAccessible::Role role)
88 QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(
obj);
89 match = iface && iface->role() == role;
94bool hasAncestor(
QObject *
obj, QAccessible::Role role)
98 while (parent && !found) {
99 if (isInstanceOf(parent, role))
101 parent = parent->
parent();
109 int bigLineSize = radius / 6;
112 if (bigLineSize > radius / 2)
113 bigLineSize = radius / 2;
119 const int width = dial->rect.width();
120 const int height = dial->rect.height();
122 const int currentSliderPosition = dial->upsideDown ? dial->sliderPosition : (dial->maximum - dial->sliderPosition);
124 qreal startAngle = (90. - dial->startAngle) *
Q_PI / 180.;
125 qreal spanAngle = (dial->endAngle - dial->startAngle) *
Q_PI / 180.;
126 if (dial->maximum == dial->minimum)
129 a = (startAngle - (currentSliderPosition - dial->minimum) * spanAngle
130 / (dial->maximum - dial->minimum));
141 static const qreal rad_factor = 180 /
Q_PI;
144 if (
p1.x() ==
p2.x()) {
152 if (
p1.x() <=
p2.x()) {
161 _angle =
qAtan(
m) * rad_factor;
164 _angle = 180 - _angle;
174 int width = dial->rect.width();
175 int height = dial->rect.height();
181 const int ns = dial->tickInterval;
184 int notches = (dial->maximum +
ns - 1 - dial->minimum) /
ns;
187 if (dial->maximum < dial->minimum || dial->maximum - dial->minimum > 1000) {
188 int maximum = dial->minimum + 1000;
189 notches = (maximum +
ns - 1 - dial->minimum) /
ns;
192 poly.resize(2 + 2 * notches);
193 int smallLineSize = bigLineSize / 2;
194 for (
int i = 0;
i <= notches; ++
i) {
196 : (
Q_PI * 8 -
i * 10 *
Q_PI / notches) / 6;
199 if (
i == 0 || (((
ns *
i) % (dial->pageStep ? dial->pageStep : 1)) == 0)) {
200 poly[2 *
i] =
QPointF(xc + (
r - bigLineSize) *
c,
201 yc - (
r - bigLineSize) *
s);
204 poly[2 *
i] =
QPointF(xc + (
r - 1 - smallLineSize) *
c,
205 yc - (
r - 1 - smallLineSize) *
s);
206 poly[2 *
i + 1] =
QPointF(xc + (
r - 1) *
c, yc -(
r - 1) *
s);
223 const qreal penSize =
r/20.0;
237 buttonColor.
setHsv(buttonColor .hue(),
238 qMin(140, buttonColor .saturation()),
250 int(
r * 2 - 2 * d_ - 2),
251 int(
r * 2 - 2 * d_ - 2));
255 qreal shadowSize =
qMax(1.0, penSize/2.0);
256 QRectF shadowRect= br.adjusted(-2*shadowSize, -2*shadowSize,
257 2*shadowSize, 2*shadowSize);
259 shadowRect.center().y(), shadowRect.width()/2.0,
260 shadowRect.center().x(), shadowRect.center().y());
261 shadowGradient.setColorAt(
qreal(0.91),
QColor(0, 0, 0, 40));
263 p->setBrush(shadowGradient);
265 p->translate(shadowSize, shadowSize);
266 p->drawEllipse(shadowRect);
267 p->translate(-shadowSize, -shadowSize);
271 br.width()*1.3, br.center().x(),
272 br.center().y() - br.height()/2);
277 p->setBrush(gradient);
285 p->setPen(buttonColor.
lighter(110));
286 p->drawEllipse(br.adjusted(1, 1, -1, -1));
294 p->setPen(
QPen(highlight, 2.0));
296 p->drawEllipse(br.adjusted(-1, -1, 1, 1));
302 buttonColor = buttonColor.
lighter(104);
305 QRectF dialRect(dp.x() - ds, dp.y() - ds, 2*ds, 2*ds);
306 QRadialGradient dialGradient(dialRect.center().x() + dialRect.width()/2,
307 dialRect.center().y() + dialRect.width(),
309 dialRect.center().x(), dialRect.center().y());
310 dialGradient.setColorAt(1, buttonColor.
darker(140));
311 dialGradient.setColorAt(
qreal(0.4), buttonColor.
darker(120));
312 dialGradient.setColorAt(0, buttonColor.
darker(110));
IOBluetoothDevice * device
bool frame
whether the spin box draws itself with a frame
ButtonSymbols buttonSymbols
the current button symbol mode
virtual StepEnabled stepEnabled() const
Virtual function that determines whether stepping up and down is legal at any given time.
const QColor & color() const
Returns the brush color.
The QColor class provides colors based on RGB, HSV or CMYK values.
int saturation() const noexcept
Returns the HSV saturation color component of this color.
void setAlphaF(float alpha)
Sets the alpha of this color to alpha.
QColor darker(int f=200) const noexcept
QColor toHsv() const noexcept
Creates and returns an HSV QColor based on this color.
int hue() const noexcept
Returns the HSV hue color component of this color.
void setAlpha(int alpha)
Sets the alpha of this color to alpha.
void setHsv(int h, int s, int v, int a=255)
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha componen...
int value() const noexcept
Returns the value color component of this color.
QColor lighter(int f=150) const noexcept
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.
void setColorAt(qreal pos, const QColor &color)
Creates a stop point at the given position with the given color.
QObject * parent() const
Returns a pointer to the parent object.
The QPainter class performs low-level painting on widgets and other paint devices.
void setPen(const QColor &color)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void drawLine(const QLineF &line)
Draws a line defined by line.
void restore()
Restores the current painter state (pops a saved state off the stack).
void drawLines(const QLineF *lines, int lineCount)
Draws the first lineCount lines in the array lines using the current pen.
void save()
Saves the current painter state (pushes the state onto a stack).
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device.
void drawEllipse(const QRectF &r)
Draws the ellipse defined by the given rectangle.
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint.
The QPalette class contains color groups for each widget state.
const QBrush & highlight() const
Returns the highlight brush of the current color group.
const QBrush & button() const
Returns the button brush of the current color group.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
The QPolygonF class provides a list of points using floating point precision.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
int calcBigLineSize(int radius)
QPolygonF calcLines(const QStyleOptionSlider *dial)
static QPointF calcRadialPos(const QStyleOptionSlider *dial, qreal offset)
qreal dpi(const QStyleOption *option)
void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect, int left, int top, int right, int bottom)
WidgetSizePolicy widgetSizePolicy(const QStyleOption *opt)
QColor backgroundColor(const QPalette &pal)
static const qreal qstyleBaseDpi
qreal dpiScaled(qreal value, qreal dpi)
void drawDial(const QStyleOptionSlider *option, QPainter *painter)
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static QT_BEGIN_NAMESPACE const qreal Q_PI
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat x1
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLenum GLuint GLintptr offset
GLfixed GLfixed GLfixed y2
QT_BEGIN_NAMESPACE Q_GUI_EXPORT int qt_defaultDpiX()
#define BEGIN_STYLE_PIXMAPCACHE(a)
#define END_STYLE_PIXMAPCACHE
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
\inmodule QtCore \reentrant