Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Style_Tools Class Reference

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. More...
 
static QPainterPath substractPath (const QPainterPath &, const QPainterPath &)
 Create painter path by subtracting painter path path from another painter path fromPath. More...
 
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. More...
 
static void roundRect (QPainter *, const QRect &, const double, const int, const QColor &, const QColor &, bool=true, bool=true)
 Draw rectangle with rounded corners. More...
 
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. More...
 
static void shadowCheck (QPainter *, const QRect &, const double, const int, const QColor &, const QColor &, const QColor &, const QColor &)
 Draw shadow of the check-mark. More...
 
static void arrowRect (QPainter *, const QRect &, const QColor &, const QColor &, const QColor &)
 Draw rectnagle arrow. More...
 
static void fillRect (QPainter *, const QRect &, const QColor &, const QColor &, const int=255)
 Fill rectangle with gradiented background. More...
 
static void drawArrow (QStyle::PrimitiveElement, QPainter *, const QRect &, const QColor &, const QColor &)
 Draw arrow (for example, for combo-box drop-down menu button) More...
 
static void drawSign (QStyle::PrimitiveElement, QPainter *, const QRect &, const QColor &, const QColor &)
 Draw indicator (for example, for spin box's increment/decrement buttons) More...
 
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. More...
 
static void drawFocus (QPainter *, const QRect &, const double, const int, const QColor &)
 Draw widget's focus. More...
 
static void drawFocus (QPainter *, const QPainterPath &, const QColor &, const bool=true)
 Draw widget's focus. More...
 
static void drawSlider (QPainter *, const QRect &, const double, SliderType, const QColor &, const QColor &, const QColor &, const QColor &)
 Draw slider. More...
 
static void highlightRect (QPainter *, const QRect &, const double, const int, const double, const QColor &, const QColor &, const QColor &)
 Draw highlighted rectangle. More...
 
static int getMinDelta (const QRect &, const QSize &, const int)
 Get minimal delta value (the minimum between rect and size dimensions) More...
 
static int getMaxRect (const QRect &, const int)
 Get halved size of the quadrangle covering specified rectangle. More...
 

Member Enumeration Documentation

Enumerator
None 

No rounding required.

All 

All corners.

Right 

Right corners.

Left 

Left corners.

TopLeft 

Top-left corner.

TopRight 

Top-right corner.

BottomLeft 

Bottom-left corner.

BottomRight 

Bottom-right corner.

Enumerator
WholePath 

Whole path.

BottomPath 

Bottom path.

TopPath 

Top path.

Enumerator
SlUp 

Up-to-down gradient.

SlDown 

Down-to-up gradient.

SlLeft 

Left-to-right gradient.

SlRight 

Right-to-left gradient.

SlNone 

No gradient.

Member Function Documentation

void Style_Tools::arrowRect ( QPainter *  p,
const QRect &  re,
const QColor &  frame,
const QColor &  gr1,
const QColor &  gr2 
)
static
Parameters
ppainter
redrawing rectangle
frameframe color
gr1background's first gradient color
gr2background's second gradient color
void Style_Tools::drawArrow ( QStyle::PrimitiveElement  type,
QPainter *  p,
const QRect &  r,
const QColor &  pen,
const QColor &  brush 
)
static
Parameters
typeprimitive type
ppainter
rdrawing rectangle
penforeground painter pen
brushbackground painter brush
void Style_Tools::drawFocus ( QPainter *  p,
const QRect &  aRect,
const double  rad,
const int  type,
const QColor &  border 
)
static
Parameters
ppainter
aRectdrawing rectangle
radrounding radius
typerounding operation type
borderfocus rectangle color

References roundRect().

void Style_Tools::drawFocus ( QPainter *  p,
const QPainterPath &  path,
const QColor &  border,
const bool  line = true 
)
static
Parameters
ppainter
pathdrawing painter path
borderfocus rectangle color
lineif true, focus is drawn as dotted line
void Style_Tools::drawSign ( QStyle::PrimitiveElement  type,
QPainter *  p,
const QRect &  r,
const QColor &  pen,
const QColor &  brush 
)
static
Parameters
typeprimitive type
ppainter
rdrawing rectangle
penforeground painter pen
brushbackground painter brush
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
Parameters
ppainter
rdrawing rectangle
radrounding radius
sliderslider type
lightbackground's first gradient color
darkbackground's second gradient color
border_toptop-left border's color
border_botbottom-right border's color

References All, getMaxRect(), roundRect(), SlDown, SlLeft, SlNone, SlRight, and SlUp.

void Style_Tools::fillRect ( QPainter *  p,
const QRect &  re,
const QColor &  c1,
const QColor &  c2,
const int  alpha = 255 
)
static
Parameters
ppainter
redrawing rectangle
c1background's first gradient color
c2background's second gradient color
int Style_Tools::getMaxRect ( const QRect &  rect,
const int  defRect 
)
static
Parameters
rectrectangle
defRectdefault quadranle size value
Returns
resulting value
int Style_Tools::getMinDelta ( const QRect &  rect,
const QSize &  size,
const int  defDelta 
)
static
Parameters
rectrectangle
sizesize
defDeltadefault minimum delta
Returns
resulting minimum value
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
Parameters
ppainter
rectdrawing rectangle
radrounding radius
typerounding operation type marg margin size
centerbackground's center gradient color
out_centerbackground's second color
borderborder color

References roundRect().

QPainterPath Style_Tools::painterPath ( const QRect &  r)
static
Parameters
rrectangle on which painter path is build
Returns
resulting painter path
QPainterPath Style_Tools::roundRect ( const QRect &  r,
const double  rad,
int  type = 0,
int  shType = 0 
)
static
Parameters
rinitial rectangle
radrounding radius
typerounding type operation (Style_Tools::RoundType)
shTypeshadow type (Style_Tools::ShadowType)
Returns
resulting painter path

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
Parameters
ppainter
rdrawing rectangle
radcorner rounding radius
typerounding type operation (Style_Tools::RoundType)
c1first gradient color
c2second gradient color
fillif true rectangle is filled with gradiented background according to c1 and c2
antialif true, rectangle corners are anti-aliased

References roundRect().

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
Parameters
ppainter
rdrawing rectangle
radcorner rounding radius
typerounding type operation (Style_Tools::RoundType)
lightbackground's first gradient color
darkbackground's second gradient color
border_toptop-left border's color
border_botbottom-right border's color

References BottomPath, roundRect(), and TopPath.

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
Parameters
ppainter
rdrawing rectangle
radcorner rounding radius
margdrawing margin
shadshadow size
typerounding type operation (Style_Tools::RoundType)
lightbackground's first gradient color
darkbackground's second gradient color
border_toptop-left border's color
border_botbottom-right border's color
antializeif true, rectangle corners are anti-aliased
isButtontrue if button is drawn
btnOntrue if button is drawn and it is pressed
fillif true rectangle is filled with gradiented background according to light and dark

References BottomPath, roundRect(), and TopPath.

QPainterPath Style_Tools::substractPath ( const QPainterPath &  fromPath,
const QPainterPath &  path 
)
static
Parameters
fromPathinitial painter path
pathpainter path being subtracted from fromPath
Returns
resulting painter path
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
Parameters
ppainter
rdrawing rectangle
positiontab position
radrounding radius
deltagap between tabs
lightbackground's first gradient color
darkbackground's second gradient color
border_toptop-left border's color
border_botbottom-right border's color
selectedtrue if tab is selected
isLasttrue if tab is last in the tabs list
isHovertrue if tab is hovered
focusRectfocus rectangle
drawif true, tab bar is drawn
Returns
tab bar's painter path

References drawFocus(), and getMaxRect().


The documentation for this class was generated from the following files: