53 #if !defined(QT_NO_QWS_DECORATION_STYLED) || defined(QT_PLUGIN) 90 if (decorationRegion ==
None)
93 bool isActive = (widget ==
qApp->activeWindow());
116 bool handled =
false;
124 int titleHeight =
titleBarHeight(widget) + (noTitleBorder ? borderWidth : 0);
125 int titleExtra = noTitleBorder ? borderWidth : 0;
127 if ((paintAll || decorationRegion &
Borders) && state ==
Normal && hasBorder) {
131 QRect r(rect.left() - titleExtra, rect.top() - titleHeight,
132 rect.width() + 2 * titleExtra, titleHeight);
156 decorationRegion &= (~Borders);
167 | (decorationRegion &
Menu 169 | (decorationRegion &
Help 177 | (decorationRegion &
Close 187 widget->
rect().
width() + 2 * titleExtra, titleHeight);
194 if (!(decorationRegion &
Menu) && hasSysMenu)
195 newClip -=
region(widget, widgetRect, Menu);
196 if (!(decorationRegion &
Title) && hasTitle)
197 newClip -=
region(widget, widgetRect, Title);
198 if (!(decorationRegion &
Help) && hasContextHelp)
199 newClip -=
region(widget, widgetRect, Help);
200 if (!(decorationRegion &
Minimize) && hasMinimize)
201 newClip -=
region(widget, widgetRect, Minimize);
202 if (!(decorationRegion &
Maximize) && hasMaximize)
203 newClip -=
region(widget, widgetRect, Maximize);
204 if (!(decorationRegion & (Minimize | Maximize)) && (hasMaximize | hasMinimize))
206 if (!(decorationRegion &
Close))
207 newClip -=
region(widget, widgetRect, Close);
232 int titleHeight =
titleBarHeight(widget) + (noTitleBorder ? borderWidth : 0);
233 int titleExtra = noTitleBorder ? borderWidth : 0;
235 QRect inside =
QRect(rect.
x() - titleExtra, rect.
top() - titleHeight,
236 rect.
width() + 2 * titleExtra, titleHeight);
258 switch (decorationRegion) {
275 if (hasMaximize | hasMinimize)
301 opt.
rect =
QRect(rect.
x() - titleExtra, rect.
top() - titleHeight,
302 rect.
width() + 2 * titleExtra,
303 rect.
height() + titleHeight + titleExtra);
308 return (mask.region.isEmpty() ?
region : (region & mask.region));
311 #endif // QT_NO_QWS_DECORATION_STYLED
The QPainter class performs low-level painting on widgets and other paint devices.
static Qt::LayoutDirection layoutDirection()
SubControl
This enum describes the available sub controls.
#define QT_END_NAMESPACE
This macro expands to.
QPointer< QWidget > widget
QStyle::State state
the style flags that are used when drawing the control
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=0) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
QIcon icon
the icon for the title bar
virtual QRegion region(const QWidget *widget, const QRect &rect, int decorationRegion=All)
Returns the region specified by decorationRegion for the top-level widget.
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
void restore()
Restores the current painter state (pops a saved state off the stack).
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.
QString text
the text of the title bar
QRect boundingRect() const
Returns the bounding rectangle of this region.
static QStyle * style()
Returns the application's style object.
QStyle::SubControls activeSubControls
This variable holds a bitwise OR of the sub-controls that are active for the complex control...
int height() const
Returns the height of the rectangle.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
int titleBarHeight(const QWidget *widget)
Returns the title bar height in pixels for the given widget.
void save()
Saves the current painter state (pushes the state onto a stack).
virtual QRegion region(const QWidget *w, const QRect &rect, int decorationRegion=All)=0
Implement this function to return the region specified by decorationRegion for the given top level wi...
int lineWidth
the line width for drawing the frame
QRegion clipRegion() const
Returns the currently set clip region.
#define QT_BEGIN_NAMESPACE
This macro expands to.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
QRegion region(const QWidget *widget, const QRect &rect, int decorationRegion=All)
Returns the region specified by decorationRegion for the top-level widget.
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
The QStyleOptionFrame class is used to describe the parameters for drawing a frame.
QPaintEngine * paintEngine() const
Returns the paint engine that the painter is currently operating on if the painter is active; otherwi...
The QRegion class specifies a clip region for a painter.
virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget=0) const =0
Draws the given control using the provided painter with the style options specified by option...
QPalette palette
the palette that should be used when painting the control
The QStyleHintReturnMask class provides style hints that return a QRegion.
int top() const
Returns the y-coordinate of the rectangle's top edge.
QString windowTitleFor(const QWidget *widget) const
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
int x() const
Returns the x-coordinate of the rectangle's left edge.
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...
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
bool paint(QPainter *painter, const QWidget *widget, int decorationRegion=All, DecorationState state=Normal)
Paints the border and title decoration for the top-level widget using the painter provided and the de...
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
The QRect class defines a rectangle in the plane using integer precision.
DecorationState
This enum describes the various states of a decoration region.
virtual ~QDecorationStyled()
Qt::WindowFlags titleBarFlags
the widget flags for the title bar
The QDecorationDefault class is a base class providing default window decorations.
int titleBarState
the state of the title bar
const QBrush & window() const
Returns the window (general background) brush of the current color group.
QRect rect
the area that should be used for various calculations and painting
QStyle::SubControls subControls
This variable holds a bitwise OR of the sub-controls to be drawn for the complex control.
DecorationRegion
This enum describes the various regions of the window decoration.
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
bool hasFeature(PaintEngineFeatures feature) const
Returns true if the paint engine supports the specified feature; otherwise returns false...
The QPalette class contains color groups for each widget state.