7#include <private/qhighdpiscaling_p.h>
8#include <private/qguiapplication_p.h>
9#include <private/qmath_p.h>
10#include <private/qstyle_p.h>
12#if QT_CONFIG(scrollbar)
39 if (
const QStyleOptionSpinBox *
spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(
option)) {
66 return option->fontMetrics.fontDpi();
92#if QT_CONFIG(accessibility)
93bool isInstanceOf(
QObject *
obj, QAccessible::Role role)
96 QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(
obj);
97 match = iface && iface->role() == role;
102bool hasAncestor(
QObject *
obj, QAccessible::Role role)
106 while (
parent && !found) {
107 if (isInstanceOf(
parent, role))
120 int bigLineSize = radius / 6;
123 if (bigLineSize > radius / 2)
124 bigLineSize = radius / 2;
130 const int width = dial->rect.width();
131 const int height = dial->rect.height();
133 const int currentSliderPosition = dial->upsideDown ? dial->sliderPosition : (dial->maximum - dial->sliderPosition);
135 if (dial->maximum == dial->minimum)
137 else if (dial->dialWrapping)
138 a =
Q_PI * 3 / 2 - (currentSliderPosition - dial->minimum) * 2 *
Q_PI
139 / (dial->maximum - dial->minimum);
141 a = (
Q_PI * 8 - (currentSliderPosition - dial->minimum) * 10 *
Q_PI
142 / (dial->maximum - dial->minimum)) / 6;
145 qreal len =
r - QStyleHelper::calcBigLineSize(
r) - 3;
148 return pos + dial->rect.topLeft();
153 static const qreal rad_factor = 180 /
Q_PI;
156 if (
p1.x() ==
p2.x()) {
164 if (
p1.x() <=
p2.x()) {
173 _angle =
qAtan(
m) * rad_factor;
176 _angle = 180 - _angle;
186 int width = dial->rect.width();
187 int height = dial->rect.height();
193 const int ns = dial->tickInterval;
196 int notches = (dial->maximum +
ns - 1 - dial->minimum) /
ns;
199 if (dial->maximum < dial->minimum || dial->maximum - dial->minimum > 1000) {
200 int maximum = dial->minimum + 1000;
204 poly.
resize(2 + 2 * notches);
205 int smallLineSize = bigLineSize / 2;
206 for (
int i = 0;
i <= notches; ++
i) {
208 : (
Q_PI * 8 -
i * 10 *
Q_PI / notches) / 6;
211 if (
i == 0 || (((
ns *
i) % (dial->pageStep ? dial->pageStep : 1)) == 0)) {
212 poly[2 *
i] =
QPointF(xc + (
r - bigLineSize) *
c,
213 yc - (
r - bigLineSize) *
s);
216 poly[2 *
i] =
QPointF(xc + (
r - 1 - smallLineSize) *
c,
217 yc - (
r - 1 - smallLineSize) *
s);
218 poly[2 *
i + 1] =
QPointF(xc + (
r - 1) *
c, yc -(
r - 1) *
s);
236 const qreal penSize =
r/20.0;
253 buttonColor.
setHsv(buttonColor .hue(),
254 qMin(140, buttonColor .saturation()),
266 int(
r * 2 - 2 * d_ - 2),
267 int(
r * 2 - 2 * d_ - 2));
271 qreal shadowSize =
qMax(1.0, penSize/2.0);
273 2*shadowSize, 2*shadowSize);
277 shadowGradient.setColorAt(
qreal(0.91),
QColor(0, 0, 0, 40));
279 p->setBrush(shadowGradient);
281 p->translate(shadowSize, shadowSize);
282 p->drawEllipse(shadowRect);
283 p->translate(-shadowSize, -shadowSize);
287 br.width()*1.3, br.center().x(),
288 br.center().y() - br.height()/2);
289 gradient.setColorAt(0, buttonColor.
lighter(110));
290 gradient.setColorAt(
qreal(0.5), buttonColor);
291 gradient.setColorAt(
qreal(0.501), buttonColor.
darker(102));
292 gradient.setColorAt(1, buttonColor.
darker(115));
293 p->setBrush(gradient);
301 p->setPen(buttonColor.
lighter(110));
302 p->drawEllipse(br.adjusted(1, 1, -1, -1));
310 p->setPen(
QPen(highlight, 2.0));
312 p->drawEllipse(br.adjusted(-1, -1, 1, 1));
318 buttonColor = buttonColor.
lighter(104);
321 QRectF dialRect(dp.x() - ds, dp.y() - ds, 2*ds, 2*ds);
322 QRadialGradient dialGradient(dialRect.center().x() + dialRect.width()/2,
323 dialRect.center().y() + dialRect.width(),
325 dialRect.center().x(), dialRect.center().y());
326 dialGradient.setColorAt(1, buttonColor.
darker(140));
327 dialGradient.setColorAt(
qreal(0.4), buttonColor.
darker(120));
328 dialGradient.setColorAt(0, buttonColor.
darker(110));
402#if QT_CONFIG(scrollarea)
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
int lightness() const noexcept
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 resize(qsizetype size)
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 QBrush & text() const
Returns the text foreground brush of the current color group.
const QBrush & dark() const
Returns the dark brush of the current color group.
const QBrush & light() const
Returns the light 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.
const QBrush & window() const
Returns the window (general background) brush of the current color group.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
The QPolygonF class provides a list of points using floating point precision.
QPolygonF translated(qreal dx, qreal dy) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
\inmodule QtCore\reentrant
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
constexpr QPointF center() const noexcept
Returns the center point of the rectangle.
\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...
\variable QStyleOptionMenuItem::menuItemType
QStyle::SubControls activeSubControls
The QStyleOption class stores the parameters used by QStyle functions.
int calcBigLineSize(int radius)
QPolygonF calcLines(const QStyleOptionSlider *dial)
void drawDial(const QStyleOptionSlider *option, QPainter *painter)
void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect, int left, int top, int right, int bottom)
Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, qreal dpi)
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
Q_WIDGETS_EXPORT qreal dpi(const QStyleOption *option)
WidgetSizePolicy widgetSizePolicy(const QWidget *widget, const QStyleOption *opt)
QColor backgroundColor(const QPalette &pal, const QWidget *widget)
static const qreal qstyleBaseDpi
Combined button and popup list for selecting options.
QVector3D maximum(const QVector3D &v1, const QVector3D &v2) Q_DECL_NOTHROW
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
Q_GUI_EXPORT int qt_defaultDpiX()
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
#define BEGIN_STYLE_PIXMAPCACHE(a)
#define END_STYLE_PIXMAPCACHE
QT_BEGIN_NAMESPACE Q_GUI_EXPORT int qt_defaultDpiX()
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent