A set of utility functions used by SALOME style to draw widgets.
#include <Style_Tools.h>
Public Types | |
| enum | RoundType { None = 0x00000000, All = 0x00000001, Right = 0x00000002, Left = 0x00000004, TopLeft = 0x00000008, TopRight = 0x00000010, BottomLeft = 0x00000020, BottomRight = 0x00000040 } |
Rounding operation type. More... | |
| enum | ShadowType { WholePath, BottomPath, TopPath } |
Shadow type. More... | |
| enum | SliderType { SlUp, SlDown, SlLeft, SlRight, SlNone } |
Slider type. More... | |
Static Public Member Functions | |
| static QPainterPath | painterPath (const QRect &) |
| Create painter path for specified rectangle. | |
| static QPainterPath | substractPath (const QPainterPath &, const QPainterPath &) |
| Create painter path by subtracting painter path path from another painter path fromPath. | |
| static QPainterPath | roundRect (const QRect &, const double, int=0, int=0) |
| Create painter path basing on specified rectangle r with rounded corners specified by radius r, operation type and shadow type shType. | |
| static void | roundRect (QPainter *, const QRect &, const double, const int, const QColor &, const QColor &, bool=true, bool=true) |
| Draw rectangle with rounded corners. | |
| static void | shadowRect (QPainter *, const QRect &, const double, const double, const int, int, const QColor &, const QColor &, const QColor &, const QColor &, const bool, const bool, const bool=false, const bool=true) |
| Draw rectangle with rounded corners and shadow. | |
| static void | shadowCheck (QPainter *, const QRect &, const double, const int, const QColor &, const QColor &, const QColor &, const QColor &) |
| Draw shadow of the check-mark. | |
| static void | arrowRect (QPainter *, const QRect &, const QColor &, const QColor &, const QColor &) |
| Draw rectnagle arrow. | |
| static void | fillRect (QPainter *, const QRect &, const QColor &, const QColor &, const int=255) |
| Fill rectangle with gradiented background. | |
| static void | drawArrow (QStyle::PrimitiveElement, QPainter *, const QRect &, const QColor &, const QColor &) |
| Draw arrow (for example, for combo-box drop-down menu button) | |
| static void | drawSign (QStyle::PrimitiveElement, QPainter *, const QRect &, const QColor &, const QColor &) |
| Draw indicator (for example, for spin box's increment/decrement buttons) | |
| static QPainterPath | tabRect (QPainter *, const QRect &, const int, const double, const double, const QColor &, const QColor &, const QColor &, const QColor &, const bool, const bool, const bool, const bool=false, const bool=true) |
| Create painter path for tab bar and optionally draw it. | |
| static void | drawFocus (QPainter *, const QRect &, const double, const int, const QColor &) |
| Draw widget's focus. | |
| static void | drawFocus (QPainter *, const QPainterPath &, const QColor &, const bool=true) |
| Draw widget's focus. | |
| static void | drawSlider (QPainter *, const QRect &, const double, SliderType, const QColor &, const QColor &, const QColor &, const QColor &) |
| Draw slider. | |
| static void | highlightRect (QPainter *, const QRect &, const double, const int, const double, const QColor &, const QColor &, const QColor &) |
| Draw highlighted rectangle. | |
| static int | getMinDelta (const QRect &, const QSize &, const int) |
| Get minimal delta value (the minimum between rect and size dimensions) | |
| static int | getMaxRect (const QRect &, const int) |
| Get halved size of the quadrangle covering specified rectangle. | |
| QPainterPath Style_Tools::painterPath | ( | const QRect & | r | ) | [static] |
| r | rectangle on which painter path is build |
| QPainterPath Style_Tools::substractPath | ( | const QPainterPath & | fromPath, |
| const QPainterPath & | path | ||
| ) | [static] |
| fromPath | initial painter path |
| path | painter path being subtracted from fromPath |
| QPainterPath Style_Tools::roundRect | ( | const QRect & | r, |
| const double | rad, | ||
| int | type = 0, |
||
| int | shType = 0 |
||
| ) | [static] |
| r | initial rectangle |
| rad | rounding radius |
| type | rounding type operation (Style_Tools.RoundType) |
| shType | shadow type (Style_Tools.ShadowType) |
References All, BottomLeft, BottomPath, BottomRight, getMaxRect(), Left, None, painterPath(), Right, TopLeft, TopPath, TopRight, and WholePath.
| void Style_Tools::roundRect | ( | QPainter * | p, |
| const QRect & | r, | ||
| const double | rad, | ||
| const int | type, | ||
| const QColor & | c1, | ||
| const QColor & | c2, | ||
| bool | fill = true, |
||
| bool | antial = true |
||
| ) | [static] |
| p | painter |
| r | drawing rectangle |
| rad | corner rounding radius |
| type | rounding type operation (Style_Tools.RoundType) |
| c1 | first gradient color |
| c2 | second gradient color |
| fill | if true rectangle is filled with gradiented background according to c1 and c2 |
| antial | if true, rectangle corners are anti-aliased |
References roundRect().
| void Style_Tools::shadowRect | ( | QPainter * | p, |
| const QRect & | r, | ||
| const double | rad, | ||
| const double | marg, | ||
| const int | shad, | ||
| int | type, | ||
| const QColor & | light, | ||
| const QColor & | dark, | ||
| const QColor & | border_top, | ||
| const QColor & | border_bot, | ||
| const bool | antialize, | ||
| const bool | isButton, | ||
| const bool | btnOn = false, |
||
| const bool | fill = true |
||
| ) | [static] |
| p | painter |
| r | drawing rectangle |
| rad | corner rounding radius |
| marg | drawing margin |
| shad | shadow size |
| type | rounding type operation (Style_Tools.RoundType) |
| light | background's first gradient color |
| dark | background's second gradient color |
| border_top | top-left border's color |
| border_bot | bottom-right border's color |
| antialize | if true, rectangle corners are anti-aliased |
| isButton | true if button is drawn |
| btnOn | true if button is drawn and it is pressed |
| fill | if true rectangle is filled with gradiented background according to light and dark |
References BottomPath, roundRect(), and TopPath.
| void Style_Tools::shadowCheck | ( | QPainter * | p, |
| const QRect & | r, | ||
| const double | rad, | ||
| const int | type, | ||
| const QColor & | light, | ||
| const QColor & | dark, | ||
| const QColor & | border_top, | ||
| const QColor & | border_bot | ||
| ) | [static] |
| p | painter |
| r | drawing rectangle |
| rad | corner rounding radius |
| type | rounding type operation (Style_Tools.RoundType) |
| light | background's first gradient color |
| dark | background's second gradient color |
| border_top | top-left border's color |
| border_bot | bottom-right border's color |
References BottomPath, roundRect(), and TopPath.
| void Style_Tools::arrowRect | ( | QPainter * | p, |
| const QRect & | re, | ||
| const QColor & | frame, | ||
| const QColor & | gr1, | ||
| const QColor & | gr2 | ||
| ) | [static] |
| p | painter |
| re | drawing rectangle |
| frame | frame color |
| gr1 | background's first gradient color |
| gr2 | background's second gradient color |
| void Style_Tools::fillRect | ( | QPainter * | p, |
| const QRect & | re, | ||
| const QColor & | c1, | ||
| const QColor & | c2, | ||
| const int | alpha = 255 |
||
| ) | [static] |
| p | painter |
| re | drawing rectangle |
| c1 | background's first gradient color |
| c2 | background's second gradient color |
| void Style_Tools::drawArrow | ( | QStyle::PrimitiveElement | type, |
| QPainter * | p, | ||
| const QRect & | r, | ||
| const QColor & | pen, | ||
| const QColor & | brush | ||
| ) | [static] |
| type | primitive type |
| p | painter |
| r | drawing rectangle |
| pen | foreground painter pen |
| brush | background painter brush |
| void Style_Tools::drawSign | ( | QStyle::PrimitiveElement | type, |
| QPainter * | p, | ||
| const QRect & | r, | ||
| const QColor & | pen, | ||
| const QColor & | brush | ||
| ) | [static] |
| type | primitive type |
| p | painter |
| r | drawing rectangle |
| pen | foreground painter pen |
| brush | background painter brush |
| QPainterPath Style_Tools::tabRect | ( | QPainter * | p, |
| const QRect & | r, | ||
| const int | position, | ||
| const double | rad, | ||
| const double | delta, | ||
| const QColor & | light, | ||
| const QColor & | dark, | ||
| const QColor & | border_top, | ||
| const QColor & | border_bot, | ||
| const bool | selected, | ||
| const bool | isLast, | ||
| const bool | isHover, | ||
| const bool | focusRect = false, |
||
| const bool | draw = true |
||
| ) | [static] |
| p | painter |
| r | drawing rectangle |
| position | tab position |
| rad | rounding radius |
| delta | gap between tabs |
| light | background's first gradient color |
| dark | background's second gradient color |
| border_top | top-left border's color |
| border_bot | bottom-right border's color |
| selected | true if tab is selected |
| isLast | true if tab is last in the tabs list |
| isHover | true if tab is hovered |
| focusRect | focus rectangle |
| draw | if true, tab bar is drawn |
References drawFocus(), and getMaxRect().
| void Style_Tools::drawFocus | ( | QPainter * | p, |
| const QRect & | aRect, | ||
| const double | rad, | ||
| const int | type, | ||
| const QColor & | border | ||
| ) | [static] |
| p | painter |
| aRect | drawing rectangle |
| rad | rounding radius |
| type | rounding operation type |
| border | focus rectangle color |
References roundRect().
| void Style_Tools::drawFocus | ( | QPainter * | p, |
| const QPainterPath & | path, | ||
| const QColor & | border, | ||
| const bool | line = true |
||
| ) | [static] |
| p | painter |
| path | drawing painter path |
| border | focus rectangle color |
| line | if true, focus is drawn as dotted line |
| void Style_Tools::drawSlider | ( | QPainter * | p, |
| const QRect & | r, | ||
| const double | rad, | ||
| SliderType | type, | ||
| const QColor & | light, | ||
| const QColor & | dark, | ||
| const QColor & | border_top, | ||
| const QColor & | border_bot | ||
| ) | [static] |
| p | painter |
| r | drawing rectangle |
| rad | rounding radius |
| slider | slider type |
| light | background's first gradient color |
| dark | background's second gradient color |
| border_top | top-left border's color |
| border_bot | bottom-right border's color |
References All, getMaxRect(), roundRect(), SlDown, SlLeft, SlNone, SlRight, and SlUp.
| void Style_Tools::highlightRect | ( | QPainter * | p, |
| const QRect & | rect, | ||
| const double | rad, | ||
| const int | type, | ||
| const double | marg, | ||
| const QColor & | center, | ||
| const QColor & | out_center, | ||
| const QColor & | border | ||
| ) | [static] |
| p | painter |
| rect | drawing rectangle |
| rad | rounding radius |
| type | rounding operation type marg margin size |
| center | background's center gradient color |
| out_center | background's second color |
| border | border color |
References roundRect().
| int Style_Tools::getMinDelta | ( | const QRect & | rect, |
| const QSize & | size, | ||
| const int | defDelta | ||
| ) | [static] |
| rect | rectangle |
| size | size |
| defDelta | default minimum delta |
| int Style_Tools::getMaxRect | ( | const QRect & | rect, |
| const int | defRect | ||
| ) | [static] |
| rect | rectangle |
| defRect | default quadranle size value |