51 #include "private/qpushbutton_p.h" 142 tmp.
setRed((tmp.
red() * value) / 255 + (b.
red() * (255 - value)) / 255);
144 tmp.
setBlue((tmp.
blue() * value) / 255 + (b.
blue() * (255 - value)) / 255);
151 QFont font = q->font();
171 QFont font = q->font();
190 r.
setTop(r.
top() +
qMax(0, (q->icon().actualSize(q->iconSize()).height()
207 return q->icon().actualSize(q->iconSize()).width() +
leftMargin() + 6;
221 return q->style()->inherits(
"QWindowsVistaStyle")
233 q->setSizePolicy(policy);
235 q->setIconSize(
QSize(20, 20));
237 q->initStyleOption(&opt);
247 qreal descriptionheight = 0;
258 descriptionheight += line.
height();
262 return qCeil(descriptionheight);
272 int minimumHeight =
qMax(
d->descriptionOffset() +
d->bottomMargin(),
330 int textWidth =
qMax(fm.width(
text()), 135);
331 int buttonWidth = textWidth +
d->textOffset() +
d->rightMargin();
332 int heightWithoutDescription =
d->descriptionOffset() +
d->bottomMargin();
336 heightWithoutDescription +
d->descriptionHeight(buttonWidth)));
344 int heightWithoutDescription =
d->descriptionOffset() +
d->bottomMargin();
346 return qMax(heightWithoutDescription +
d->descriptionHeight(width),
373 p.
drawPixmap(
d->leftMargin() + hOffset,
d->topMargin() + vOffset,
380 textColor =
QColor(21, 28, 85);
382 textColor =
QColor(7, 64, 229);
384 d->currentColor =
d->mergedColors(textColor,
d->currentColor, 60);
399 p.
drawItemText(
d->descriptionRect().translated(hOffset, vOffset), textflags,
415 return d->description;
void setRed(int red)
Sets the red color component of this color to red.
The QColor class provides colors based on RGB, HSV or CMYK values.
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 ...
The QFontMetrics class provides font metrics information.
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
void setPosition(const QPointF &pos)
Moves the line to position pos.
void drawControl(QStyle::ControlElement ce, const QStyleOption &opt)
Use the widget's style to draw a control element ce specified by QStyleOption option.
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
The QPointF class defines a point in the plane using floating point precision.
void setFont(const QFont &f)
Sets the layout's font to the given font.
The QTextLine class represents a line of text inside a QTextLayout.
void setGreen(int green)
Sets the green color component of this color to green.
void restore()
Restores the current painter state (pops a saved state off the stack).
long ASN1_INTEGER_get ASN1_INTEGER * a
void setLineWidth(qreal width)
Lays out the line with the given width.
ushort red
Returns the red color component of this color.
The QString class provides a Unicode character string.
void setHeight(int h)
Sets the height to the given height.
bool isValid() const
Returns true if this text line is valid; otherwise returns false.
void save()
Saves the current painter state (pushes the state onto a stack).
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void setWidth(int w)
Sets the width to the given width.
void setHeightForWidth(bool b)
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
int width() const
Returns the width.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setBold(bool)
If enable is true sets the font's weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
const char * styleHint(const QFontDef &request)
void drawItemText(const QRect &r, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole)
void setBlue(int blue)
Sets the blue color component of this color to blue.
QPalette palette
the palette that should be used when painting the control
int top() const
Returns the y-coordinate of the rectangle's top edge.
The QTextLayout class is used to lay out and render text.
#define Q_DECLARE_PUBLIC(Class)
ushort blue
Returns the blue color component of this color.
The QFont class specifies a font used for drawing text.
QTextLine createLine()
Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise ret...
QSize actualSize(const QSize &size, Mode mode=Normal, State state=Off) const
Returns the actual size of the icon for the requested size, mode, and state.
QObject * parent() const
Returns a pointer to the parent object.
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
void detach()
Detaches the font object from common font data.
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
void setPointSizeF(qreal)
Sets the point size to pointSize.
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
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...
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget...
The QSize class defines the size of a two-dimensional object using integer point precision.
void setFont(const QFont &f)
Sets the painter's font to the given font.
const QBrush & buttonText() const
Returns the button text foreground brush of the current color group.
void endLayout()
Ends the layout process.
int height() const
Returns the height of the font.
The QPaintEvent class contains event parameters for paint events.
The QEvent class is the base class of all event classes.
ushort green
Returns the green color component of this color.
qreal height() const
Returns the line's height.
void beginLayout()
Begins the layout process.
static bool isNull(const QVariant::Private *d)
The QIcon class provides scalable icons in different modes and states.