49 #include "private/qstyle_p.h" 70 if ((controls & (controls - 1)) == 0) {
76 for (
int i = 0; i <
MaxBits; ++i) {
77 if (
uint bit = (controls & (0x1 << i)))
341 d->proxyStyle =
this;
356 d->proxyStyle =
this;
477 result = metrics.
boundingRect(x, y, w, h, alignment, text);
483 result =
QRect(x, y, w, h);
503 y += h/2 - pixmap.
height()/2;
507 x += w - pixmap.
width();
509 x += w/2 - pixmap.
width()/2;
511 x += w - pixmap.
width();
539 savedPen = painter->
pen();
545 painter->
drawText(rect, alignment, text, &br);
555 painter->
drawText(rect, alignment, text);
557 painter->
setPen(savedPen);
576 painter->
drawPixmap(inter.x(), inter.y(), pixmap, inter.x() - aligned.
x(), inter.y() - aligned.
y(), inter.width(), inter.height());
2091 QRect rect = logicalRect;
2093 logicalRect.
width() - boundingRect.
width(), 0);
2113 return QPoint(boundingRect.
right() - logicalPos.
x(), logicalPos.
y());
2123 int x = rectangle.
x();
2124 int y = rectangle.
y();
2125 int w = size.
width();
2135 return QRect(x, y, w, h);
2178 if (span <= 0 || logicalValue < min || max <= min)
2180 if (logicalValue > max)
2181 return upsideDown ? span : min;
2183 uint range = max - min;
2184 uint p = upsideDown ? max - logicalValue : logicalValue - min;
2187 double dpos = (double(p))/(
double(range)/span);
2189 }
else if (range > (
uint)span) {
2190 return (2 * p * span + range) / (2*range);
2192 uint div = span / range;
2193 uint mod = span % range;
2194 return p * div + (2 * p * mod + range) / (2 * range);
2224 if (span <= 0 || pos <= 0)
2225 return upsideDown ? max : min;
2227 return upsideDown ? min : max;
2229 uint range = max - min;
2231 if ((
uint)span > range) {
2232 int tmp = (2 * pos * range + span) / (2 * span);
2233 return upsideDown ? max - tmp : tmp + min;
2235 uint div = range / span;
2236 uint mod = range % span;
2237 int tmp = pos * div + (2 * pos * mod + span) / (2 * span);
2238 return upsideDown ? max - tmp : tmp + min;
2288 background =
QColor(0xd4, 0xd0, 0xc8);
2290 background =
QColor(192, 192, 192);
2292 QColor background(0xd4, 0xd0, 0xc8);
2400 if (
d->layoutSpacingIndex == -1) {
2402 "layoutSpacingImplementation(QSizePolicy::ControlType,QSizePolicy::ControlType," 2403 "Qt::Orientation,const QStyleOption*,const QWidget*)" 2406 if (
d->layoutSpacingIndex < 0)
2409 void *param[] = {&result, &control1, &control2, &orientation, &option, &widget};
2412 d->layoutSpacingIndex, param);
2448 for (
int i = 0; i < count1; ++i) {
2449 for (
int j = 0; j < count2; ++j) {
2450 int spacing =
layoutSpacing(array1[i], array2[j], orientation, option, widget);
2451 result =
qMax(spacing, result);
2494 #if !defined(QT_NO_DEBUG_STREAM) 2497 #if !defined(QT_NO_DEBUG) 2498 debug <<
"QStyle::State(";
2549 return d->proxyStyle;
2560 d->proxyStyle = style;
The QPainter class performs low-level painting on widgets and other paint devices.
The QDebug class provides an output stream for debugging information.
The QColor class provides colors based on RGB, HSV or CMYK values.
static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rectangle)
Returns a new rectangle of the specified size that is aligned to the given rectangle according to the...
virtual void unpolish(QWidget *)
Uninitialize the given {widget}'s appearance.
static Qt::LayoutDirection layoutDirection()
The QApplication class manages the GUI application's control flow and main settings.
static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::ControlType *array)
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
void setHeight(int h)
Sets the height of the rectangle to the given height.
The QFontMetrics class provides font metrics information.
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
int width() const
Returns the width of the pixmap.
QPointer< QWidget > widget
QSize size() const
Returns the size of the pixmap.
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect, const QPoint &logicalPos)
Returns the given logicalPosition converted to screen coordinates based on the specified direction...
const QBrush & background() const
Returns the current background brush.
The QFlag class is a helper data type for QFlags.
static int appDepth(int screen=-1)
Returns the color depth (bits per pixel) used by the application on the given screen.
virtual QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const
Returns the area within the given rectangle in which to draw the specified pixmap according to the de...
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
int width() const
Returns the width of the rectangle.
#define Q_ARG(type, data)
#define QT_END_INCLUDE_NAMESPACE
This macro is equivalent to QT_BEGIN_NAMESPACE.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
virtual void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
Draws the given text in the specified rectangle using the provided painter and palette.
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
int height() const
Returns the height of the rectangle.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
static int sliderPositionFromValue(int min, int max, int val, int space, bool upsideDown=false)
Converts the given logicalValue to a pixel position.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
StandardPixmap
This enum describes the available standard pixmaps.
int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option=0, const QWidget *widget=0) const
Returns the spacing that should be used between control1 and control2 in a layout.
virtual ~QStyle()
Destroys the style object.
QRect boundingRect(QChar) const
Returns the rectangle that is covered by ink if character ch were to be drawn at the origin of the co...
static const QRectF boundingRect(const QPointF *points, int pointCount)
QColor darker(int f=200) const
Returns a darker (or lighter) color, but does not change this object.
int width() const
Returns the width.
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position...
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const
Returns an icon for the given standardIcon.
const QPen & pen() const
Returns the painter's current pen.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette...
virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const
Returns the area within the given rectangle in which to draw the provided text according to the speci...
const QBrush & light() const
Returns the light brush of the current color group.
virtual QPalette standardPalette() const
Returns the style's standard palette.
The QStyleOption class stores the parameters used by QStyle functions.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QSize size() const
Returns the size of the rectangle.
The QStringList class provides a list of strings.
#define Q_RETURN_ARG(type, data)
void qSort(RandomAccessIterator start, RandomAccessIterator end)
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
The QBrush class defines the fill pattern of shapes drawn by QPainter.
QString join(const QString &sep) const
Joins all the string list's strings into a single string with each element separated by the given sep...
virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
Draws the given pixmap in the specified rectangle, according to the specified alignment, using the provided painter.
static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
Transforms an alignment of Qt::AlignLeft or Qt::AlignRight without Qt::AlignAbsolute into Qt::AlignLe...
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction...
int right() const
Returns the x-coordinate of the rectangle's right edge.
QStyle()
Constructs a style object.
int y() const
Returns the y-coordinate of the rectangle's top edge.
int x() const
Returns the x-coordinate of the rectangle's left edge.
The QPoint class defines a point in the plane using integer precision.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
void setWidth(int w)
Sets the width of the rectangle to the given width.
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
int height() const
Returns the height.
qreal widthF() const
Returns the pen width with floating point precision.
The QRect class defines a rectangle in the plane using integer precision.
void getRect(int *x, int *y, int *w, int *h) const
Extracts the position of the rectangle's top-left corner to *x and *y, and its dimensions to *width a...
int y() const
Returns the y coordinate of this point.
const QStyle * proxy() const
The QPixmap class is an off-screen image representation that can be used as a paint device...
#define QT_BEGIN_INCLUDE_NAMESPACE
This macro is equivalent to QT_END_NAMESPACE.
virtual void polish(QWidget *)
Initializes the appearance of the given widget.
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...
int height() const
Returns the height of the pixmap.
The QSize class defines the size of a two-dimensional object using integer point precision.
int x() const
Returns the x coordinate of this point.
QColor lighter(int f=150) const
Returns a lighter (or darker) color, but does not change this object.
void setProxy(QStyle *style)
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
static bool isRightToLeft()
Returns true if the application's layout direction is Qt::RightToLeft; otherwise returns false...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static int sliderValueFromPosition(int min, int max, int pos, int space, bool upsideDown=false)
Converts the given pixel position to a logical value.
virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt=0, const QWidget *widget=0) const =0
int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1, QSizePolicy::ControlTypes controls2, Qt::Orientation orientation, QStyleOption *option=0, QWidget *widget=0) const
Returns the spacing that should be used between controls1 and controls2 in a layout.
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt=0, const QWidget *widget=0) const
Returns an icon for the given standardIcon.
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
int layoutSpacingImplementation(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option=0, const QWidget *widget=0) const
This slot is called by layoutSpacing() to determine the spacing that should be used between control1 ...
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
QDebug operator<<(QDebug debug, QStyle::State state)
Qt::LayoutDirection direction
The QPalette class contains color groups for each widget state.
The QIcon class provides scalable icons in different modes and states.