CopperSpice API  1.9.1
Drawing Utility Functions

Header file which includes low level drawing functions. More...

Functions

void qDrawBorderPixmap (QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap)
 
void qDrawPlainRect (QPainter *painter, const QRect &rect, const QColor &color, int lineWidth=1, const QBrush *fill=nullptr)
 
void qDrawPlainRect (QPainter *painter, int x, int y, int width, int height, const QColor &color, int lineWidth=1, const QBrush *fill=nullptr)
 
void qDrawShadeLine (QPainter *painter, const QPoint &p1, const QPoint &p2, const QPalette &palette, bool sunken=true, int lineWidth=1, int midLineWidth=0)
 
void qDrawShadeLine (QPainter *painter, int x1, int y1, int x2, int y2, const QPalette &palette, bool sunken=true, int lineWidth=1, int midLineWidth=0)
 
void qDrawShadePanel (QPainter *painter, const QRect &rect, const QPalette &palette, bool sunken=false, int lineWidth=1, const QBrush *fill=nullptr)
 
void qDrawShadePanel (QPainter *painter, int x, int y, int width, int height, const QPalette &palette, bool sunken=false, int lineWidth=1, const QBrush *fill=nullptr)
 
void qDrawShadeRect (QPainter *painter, const QRect &rect, const QPalette &palette, bool sunken=false, int lineWidth=1, int midLineWidth=0, const QBrush *fill=nullptr)
 
void qDrawShadeRect (QPainter *painter, int x, int y, int width, int height, const QPalette &palette, bool sunken=false, int lineWidth=1, int midLineWidth=0, const QBrush *fill=nullptr)
 
void qDrawWinButton (QPainter *painter, const QRect &rect, const QPalette &palette, bool sunken=false, const QBrush *fill=nullptr)
 
void qDrawWinButton (QPainter *painter, int x, int y, int width, int height, const QPalette &palette, bool sunken=false, const QBrush *fill=nullptr)
 
void qDrawWinPanel (QPainter *painter, int x, int y, int width, int height, const QPalette &palette, bool sunken=false, const QBrush *fill=nullptr)
 

Detailed Description

In order to use these functions include the CsGui <qdrawutil.h> header file. For additional information refer to the QPainter class.

Function Documentation

void qDrawBorderPixmap ( QPainter painter,
const QRect target,
const QMargins margins,
const QPixmap pixmap 
)
inline

This function is used for drawing a pixmap into the margins of a rectangle. Draws the given pixmap into the given target rectangle, using the given painter. The pixmap will be split into nine segments and drawn according to the margins structure.

void qDrawPlainRect ( QPainter painter,
const QRect rect,
const QColor color,
int  lineWidth = 1,
const QBrush fill = nullptr 
)

Draws the plain rectangle specified by rect using the given painter, color and lineWidth. The rectangle's interior is filled with the fill brush unless this value is a nullptr.

This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style. Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle() method to display a plain rectangle.

QFrame frame;
frame.setFrameStyle(QFrame::Box | QFrame::Plain);
See also
qDrawShadeRect(), QStyle
void qDrawPlainRect ( QPainter painter,
int  x,
int  y,
int  width,
int  height,
const QColor color,
int  lineWidth = 1,
const QBrush fill = nullptr 
)

Draws the plain rectangle beginning at (x, y) with the given width and height, using the specified painter, color and lineWidth. The rectangle's interior is filled with the fill brush unless this value is a nullptr.

This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style. Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle() method to display a plain rectangle.

QFrame frame;
frame.setFrameStyle(QFrame::Box | QFrame::Plain);
See also
qDrawShadeRect(), QStyle
void qDrawShadeLine ( QPainter painter,
const QPoint p1,
const QPoint p2,
const QPalette palette,
bool  sunken = true,
int  lineWidth = 1,
int  midLineWidth = 0 
)

Draws a horizontal or vertical shaded line between p1 and p2 using the given painter. Nothing is drawn if the line between the points would be neither horizontal nor vertical. The provided palette specifies the shading colors (light, dark and middle colors). The given lineWidth specifies the line width for each of the lines. It is not the total line width. The given midLineWidth specifies the width of a middle line drawn in the QPalette::mid() color. The line appears sunken if sunken is true, otherwise raised.

This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style. Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle() method to display a shaded line.

QFrame frame;
frame.setFrameStyle(QFrame::HLine | QFrame::Sunken);
See also
qDrawShadeRect(), qDrawShadePanel(), QStyle
void qDrawShadeLine ( QPainter painter,
int  x1,
int  y1,
int  x2,
int  y2,
const QPalette palette,
bool  sunken = true,
int  lineWidth = 1,
int  midLineWidth = 0 
)

Draws a horizontal (y1 == y2) or vertical (x1 == x2) shaded line using the given painter. Nothing is drawn if y1 != y2 and x1 != x2, which would mean the line is neither horizontal nor vertical.

The provided palette specifies the shading colors (light, dark and middle colors). The given lineWidth specifies the line width for each of the lines; it is not the total line width. The given midLineWidth specifies the width of a middle line drawn in the QPalette::mid() color. The line appears sunken if sunken is true, otherwise raised.

This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style. Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle() method to display a shaded line.

QFrame frame;
frame.setFrameStyle(QFrame::HLine | QFrame::Sunken);
See also
qDrawShadeRect(), qDrawShadePanel(), QStyle
void qDrawShadePanel ( QPainter painter,
const QRect rect,
const QPalette palette,
bool  sunken = false,
int  lineWidth = 1,
const QBrush fill = nullptr 
)

Draws the shaded panel at the rectangle specified by rect using the given painter and the given lineWidth. The given palette specifies the shading colors (light, dark and middle colors). The panel's interior is filled with the fill brush unless this value is a nullptr. The panel appears sunken if sunken is true, otherwise raised.

This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style. Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle() method to display a shaded panel.

QFrame frame;
frame.setFrameStyle( QFrame::Panel | QFrame::Sunken);
See also
qDrawWinPanel(), qDrawShadeLine(), qDrawShadeRect(), QStyle
void qDrawShadePanel ( QPainter painter,
int  x,
int  y,
int  width,
int  height,
const QPalette palette,
bool  sunken = false,
int  lineWidth = 1,
const QBrush fill = nullptr 
)

Draws the shaded panel beginning at (x, y) with the given width and height using the provided painter and the given lineWidth. The given palette specifies the shading colors (light, dark and middle colors). The panel's interior is filled with the fill brush unless this value is a nullptr. The panel appears sunken if sunken is true, otherwise raised.

This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style. Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle() method to display a shaded panel.

QFrame frame;
frame.setFrameStyle( QFrame::Panel | QFrame::Sunken);
See also
qDrawWinPanel(), qDrawShadeLine(), qDrawShadeRect(), QStyle
void qDrawShadeRect ( QPainter painter,
const QRect rect,
const QPalette palette,
bool  sunken = false,
int  lineWidth = 1,
int  midLineWidth = 0,
const QBrush fill = nullptr 
)

Draws the shaded rectangle specified by rect using the given painter.

The provide palette specifies the shading colors (light, dark and middle colors. The given lineWidth specifies the line width for each of the lines; it is not the total line width. The midLineWidth specifies the width of a middle line drawn in the QPalette::mid() color. The rectangle's interior is filled with the fill brush unless unless this value is a nullptr. The rectangle appears sunken if sunken is true, otherwise raised.

This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style. Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle() method to display a shaded rectangle.

QFrame frame;
frame.setFrameStyle(QFrame::Box | QFrame::Raised);
See also
qDrawShadeLine(), qDrawShadePanel(), qDrawPlainRect(), QStyle
void qDrawShadeRect ( QPainter painter,
int  x,
int  y,
int  width,
int  height,
const QPalette palette,
bool  sunken = false,
int  lineWidth = 1,
int  midLineWidth = 0,
const QBrush fill = nullptr 
)

Draws the shaded rectangle beginning at (x, y) with the given width and height using the provided painter.

The provided palette specifies the shading colors (light, dark and middle colors. The given lineWidth specifies the line width for each of the lines; it is not the total line width. The midLineWidth specifies the width of a middle line drawn in the QPalette::mid() color. The rectangle's interior is filled with the fill brush unless this value is a nullptr. The rectangle appears sunken if sunken is true, otherwise raised.

This method does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style. Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle() method to display a shaded rectangle.

QFrame frame;
frame.setFrameStyle(QFrame::Box | QFrame::Raised);
See also
qDrawShadeLine(), qDrawShadePanel(), qDrawPlainRect(), QStyle
void qDrawWinButton ( QPainter painter,
const QRect rect,
const QPalette palette,
bool  sunken = false,
const QBrush fill = nullptr 
)

Draws the Windows-style button at the rectangle specified by rect using the given painter with a line width of 2 pixels. The button's interior is filled with the fill brush unless this value is a nullptr. The given palette specifies the shading colors (light, dark and middle colors). The button appears sunken if sunken is true, otherwise raised.

This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets which follow the current GUI style.

See also
qDrawWinPanel(), QStyle
void qDrawWinButton ( QPainter painter,
int  x,
int  y,
int  width,
int  height,
const QPalette palette,
bool  sunken = false,
const QBrush fill = nullptr 
)

Draws the Windows-style button specified by the given point (x, y), width and height using the provided painter with a line width of 2 pixels. The button's interior is filled with the fill brush unless this value is a nullptr. The given palette specifies the shading colors (light, dark and middle colors). The button appears sunken if sunken is true, otherwise raised.

This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets which follow the current GUI style.

See also
qDrawWinPanel(), QStyle
void qDrawWinPanel ( QPainter painter,
int  x,
int  y,
int  width,
int  height,
const QPalette palette,
bool  sunken = false,
const QBrush fill = nullptr 
)

Draws the Windows-style panel specified by the given point(x, y), width and height using the provided painter with a line width of 2 pixels. The button's interior is filled with the fill brush unless this value is a nullptr. The given palette specifies the shading colors. The panel appears sunken if sunken is true, otherwise raised.

This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style. Alternatively you can use a QFrame widget and apply the QFrame::setFrameStyle() method to display a shaded panel.

QFrame frame;
frame.setFrameStyle(QFrame::WinPanel | QFrame::Raised);
See also
qDrawShadePanel(), qDrawWinButton(), QStyle