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)
42 % HexString<uint>(
option->direction)
43 % HexString<uint>(complexOption ?
uint(complexOption->activeSubControls) : 0u)
44 % HexString<quint64>(
option->palette.cacheKey())
45 % HexString<uint>(
size.width())
46 % HexString<uint>(
size.height())
47 % HexString<qreal>(
dpr);
50 if (
const QStyleOptionSpinBox *
spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(
option)) {
77 return option->fontMetrics.fontDpi();
103#if QT_CONFIG(accessibility)
104bool isInstanceOf(
QObject *
obj, QAccessible::Role role)
107 QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(
obj);
108 match = iface && iface->role() == role;
113bool hasAncestor(
QObject *
obj, QAccessible::Role role)
117 while (parent && !found) {
118 if (isInstanceOf(parent, role))
120 parent = parent->
parent();
131 int bigLineSize = radius / 6;
134 if (bigLineSize > radius / 2)
135 bigLineSize = radius / 2;
141 const int width = dial->rect.width();
142 const int height = dial->rect.height();
144 const int currentSliderPosition = dial->upsideDown ? dial->sliderPosition : (dial->maximum - dial->sliderPosition);
146 if (dial->maximum == dial->minimum)
148 else if (dial->dialWrapping)
149 a =
Q_PI * 3 / 2 - (currentSliderPosition - dial->minimum) * 2 *
Q_PI
150 / (dial->maximum - dial->minimum);
152 a = (
Q_PI * 8 - (currentSliderPosition - dial->minimum) * 10 *
Q_PI
153 / (dial->maximum - dial->minimum)) / 6;
156 qreal len =
r - QStyleHelper::calcBigLineSize(
r) - 3;
159 return pos + dial->rect.topLeft();
164 static const qreal rad_factor = 180 /
Q_PI;
167 if (
p1.x() ==
p2.x()) {
175 if (
p1.x() <=
p2.x()) {
184 _angle =
qAtan(
m) * rad_factor;
187 _angle = 180 - _angle;
197 int width = dial->rect.width();
198 int height = dial->rect.height();
204 const int ns = dial->tickInterval;
207 int notches = (dial->maximum +
ns - 1 - dial->minimum) /
ns;
210 if (dial->maximum < dial->minimum || dial->maximum - dial->minimum > 1000) {
211 int maximum = dial->minimum + 1000;
215 poly.resize(2 + 2 * notches);
216 int smallLineSize = bigLineSize / 2;
217 for (
int i = 0;
i <= notches; ++
i) {
219 : (
Q_PI * 8 -
i * 10 *
Q_PI / notches) / 6;
222 if (
i == 0 || (((
ns *
i) % (dial->pageStep ? dial->pageStep : 1)) == 0)) {
223 poly[2 *
i] =
QPointF(xc + (
r - bigLineSize) *
c,
224 yc - (
r - bigLineSize) *
s);
227 poly[2 *
i] =
QPointF(xc + (
r - 1 - smallLineSize) *
c,
228 yc - (
r - 1 - smallLineSize) *
s);
229 poly[2 *
i + 1] =
QPointF(xc + (
r - 1) *
c, yc -(
r - 1) *
s);
232 return poly.translated(dial->rect.topLeft());
247 const qreal penSize =
r/20.0;
264 buttonColor.
setHsv(buttonColor .hue(),
265 qMin(140, buttonColor .saturation()),
277 int(
r * 2 - 2 * d_ - 2),
278 int(
r * 2 - 2 * d_ - 2));
282 qreal shadowSize =
qMax(1.0, penSize/2.0);
283 QRectF shadowRect= br.adjusted(-2*shadowSize, -2*shadowSize,
284 2*shadowSize, 2*shadowSize);
286 shadowRect.center().y(), shadowRect.width()/2.0,
287 shadowRect.center().x(), shadowRect.center().y());
288 shadowGradient.setColorAt(
qreal(0.91),
QColor(0, 0, 0, 40));
290 p->setBrush(shadowGradient);
292 p->translate(shadowSize, shadowSize);
293 p->drawEllipse(shadowRect);
294 p->translate(-shadowSize, -shadowSize);
298 br.width()*1.3, br.center().x(),
299 br.center().y() - br.height()/2);
300 gradient.setColorAt(0, buttonColor.
lighter(110));
301 gradient.setColorAt(
qreal(0.5), buttonColor);
302 gradient.setColorAt(
qreal(0.501), buttonColor.
darker(102));
303 gradient.setColorAt(1, buttonColor.
darker(115));
304 p->setBrush(gradient);
312 p->setPen(buttonColor.
lighter(110));
313 p->drawEllipse(br.adjusted(1, 1, -1, -1));
321 p->setPen(
QPen(highlight, 2.0));
323 p->drawEllipse(br.adjusted(-1, -1, 1, 1));
329 buttonColor = buttonColor.
lighter(104);
332 QRectF dialRect(dp.x() - ds, dp.y() - ds, 2*ds, 2*ds);
333 QRadialGradient dialGradient(dialRect.center().x() + dialRect.width()/2,
334 dialRect.center().y() + dialRect.width(),
336 dialRect.center().x(), dialRect.center().y());
337 dialGradient.setColorAt(1, buttonColor.
darker(140));
338 dialGradient.setColorAt(
qreal(0.4), buttonColor.
darker(120));
339 dialGradient.setColorAt(0, buttonColor.
darker(110));
413#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.
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
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...
\variable QStyleOptionMenuItem::menuItemType
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)
QVector3D maximum(const QVector3D &v1, const QVector3D &v2) Q_DECL_NOTHROW
void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect, int left, int top, int right, int bottom)
static bool usePixmapCache(const QStyleOption *opt)
Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, qreal dpi)
Q_WIDGETS_EXPORT qreal dpi(const QStyleOption *option)
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size, qreal dpr)
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.
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
static QT_BEGIN_NAMESPACE qreal dpr(const QWindow *w)
#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)