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

SALOME style class. More...

#include <Style_Salome.h>

Inheritance diagram for Style_Salome:
Inheritance graph

Public Member Functions

virtual ~Style_Salome ()
 Destructor. More...
 
virtual void polish (QApplication *)
 Initialize the appearance of the application. More...
 
virtual void polish (QWidget *)
 Initializes the appearance of the given widget. More...
 
virtual void unpolish (QWidget *)
 Uninitialize the given widget's appearance. More...
 
virtual void drawComplexControl (ComplexControl, const QStyleOptionComplex *, QPainter *, const QWidget *=0) const
 Draws the given control using the provided painter with the style options specified by opt. More...
 
virtual void drawControl (ControlElement, const QStyleOption *, QPainter *, const QWidget *) const
 Draws the given element with the provided painter with the style options specified by opt. More...
 
virtual void drawPrimitive (PrimitiveElement, const QStyleOption *, QPainter *, const QWidget *=0) const
 Draws the given primitive element with the provided painter using the style options specified by opt. More...
 
virtual int pixelMetric (PixelMetric, const QStyleOption *=0, const QWidget *=0) const
 Returns the value of the given pixel metric. More...
 
virtual QSize sizeFromContents (ContentsType, const QStyleOption *, const QSize &, const QWidget *=0) const
 Returns the size of the element described by the specified option opt and type ct, based on the provided contentsSize. More...
 
virtual QPixmap standardPixmap (StandardPixmap, const QStyleOption *, const QWidget *=0) const
 Returns a pixmap for the given standardPixmap. More...
 
virtual int styleHint (StyleHint, const QStyleOption *=0, const QWidget *=0, QStyleHintReturn *=0) const
 Returns an integer representing the specified style hint for the given widget w described by the provided style option opt. More...
 
virtual QRect subControlRect (ComplexControl, const QStyleOptionComplex *, SubControl, const QWidget *=0) const
 Get the rectangle containing the specified subcontrol sc of the given complex control cc (with the style specified by option opt). The rectangle is defined in screen coordinates. More...
 
virtual QRect subElementRect (SubElement, const QStyleOption *, const QWidget *=0) const
 Returns the sub-area for the given element se as described in the provided style option opt. The returned rectangle is defined in screen coordinates. More...
 

Static Public Member Functions

static void initialize (QtxResourceMgr *=0, const QString &=QString())
 Initialize SALOME style. More...
 
static void apply ()
 Set SALOME style to the application. More...
 
static void restore ()
 Restore original style to the application. More...
 
static bool isActive ()
 Check if the SALOME style is currently set to application. More...
 
static Style_Modelmodel ()
 Get style model. More...
 
static void update ()
 Update style from resources. More...
 

Protected Slots

QIcon standardIconImplementation (StandardPixmap, const QStyleOption *=0, const QWidget *=0) const
 Returns an icon for the given standardIcon. More...
 

Private Member Functions

 Style_Salome ()
 Constructor. More...
 
void updatePaletteColors ()
 Update palette colors from style model. More...
 
void updateAllWidgets (QApplication *)
 Update all widgets with the current style properties. More...
 
bool hasHover () const
 Check if any widget effect is currently used. More...
 
void drawHoverRect (QPainter *, const QRect &, const QColor &, const double, const int, const bool) const
 Draw rectangle for the hovered widget. More...
 
void drawHandle (QPainter *, const QRect &, bool, bool=true) const
 Draw widget handle. More...
 
void drawBackground (QPainter *, const QRect &, const QColor &, const bool, const bool=false, const bool=true) const
 Draw background. More...
 
void drawBorder (QPainter *, const QRect &, bool) const
 Draw border. More...
 
QString titleText (const QString &, const int, const int, QFont &) const
 Get corrected title text. More...
 

Static Private Attributes

static Style_ModelmyModel = 0
 

Detailed Description

To set SALOME style to the application, use static function Style_Salome::apply(). Static function restore() can be used then to restore initial application style.

The usual way to use SALOME style is as following:

Style_Salome::initialize( resourceMgr() ); // initialize SALOME style from resources
if ( needSalomeStyle ) Style_Salome::apply(); // set SALOME style to the application

Style_PrefDlg class can be then used to change style properties, select one of the predefined style themes or even create user themes:

Style_PrefDlg dlg( desktop() );
dlg.exec();

Constructor & Destructor Documentation

Style_Salome::Style_Salome ( )
private

Use Style_Salome::apply() static function to set SALOME style to the application.

Style_Salome::~Style_Salome ( )
virtual

Member Function Documentation

void Style_Salome::apply ( )
static
void Style_Salome::drawBackground ( QPainter *  p,
const QRect &  r,
const QColor &  bgCol,
const bool  fill,
const bool  grad = false,
const bool  horiz = true 
) const
private
Parameters
ppainter
rrectangle
bgColbackground color
fill'fill rectangle' flag
grad'draw gradient' flag
horix'draw horizontal item' flag (usefull for gradient background)

References BUT_PERCENT_ON, Style_Model::color(), Style_Model::Horizontal, Style_Model::Inclined, Style_Model::Lines, and model().

void Style_Salome::drawBorder ( QPainter *  p,
const QRect &  r,
bool  horiz 
) const
private
Parameters
ppainter
rrectangle
horiz'draw horizontal item' flag

References Style_Model::color(), model(), Style_Model::TabBorderBottom, and Style_Model::TabBorderTop.

void Style_Salome::drawHandle ( QPainter *  p,
const QRect &  r,
bool  horiz,
bool  isRect = true 
) const
private
Parameters
ppainter
rrectangle
horizif true draw horizontal handle, otherwise draw vertical handle
isRectif true surrounding rectangle is also drawn

References Style_Model::handleDelta(), hole_xpm, Horizontal, model(), and Vertical.

void Style_Salome::drawHoverRect ( QPainter *  p,
const QRect &  r,
const QColor &  bgCol,
const double  rad,
const int  type,
const bool  border 
) const
private
Parameters
ppainter
rrectangle
bgColbackground color
radcorners rounding radius
typeshadow type
borderif true border is colored with specific color

References Style_Model::AutoRaiseEffect, Style_Model::BorderTop, BUT_PERCENT_ON, Style_Model::color(), hasHover(), HIGH_WDG_MARGIN, Style_Model::HighlightBorder, Style_Model::HighlightEffect, Style_Tools::highlightRect(), Style_Model::HighlightWidget, model(), and Style_Model::widgetEffect().

bool Style_Salome::hasHover ( ) const
private
Returns
true if any widget effect is currently used

References model(), Style_Model::NoEffect, and Style_Model::widgetEffect().

void Style_Salome::initialize ( QtxResourceMgr resMgr = 0,
const QString &  section = QString() 
)
static

This method should be called at the very beginning of the application which uses SALOME style. The method initializes style properties from the current settings.

If the parameter resMgr is not 0, the style is initialized from the resources manager.

The parameter section allows customizing of the resources file section used to store style's properties. By default "Theme" section name is used.

Parameters
resMgrresources manager
sectionresources file section name
See Also
apply(), restore()

References Style_Model::fromResources(), and model().

bool Style_Salome::isActive ( )
static
Returns
true if SALOME style is set to the applcation or false otherwise
Style_Model * Style_Salome::model ( )
static
Returns
style model

References myModel.

int Style_Salome::pixelMetric ( PixelMetric  metric,
const QStyleOption *  opt = 0,
const QWidget w = 0 
) const
virtual
Parameters
metricmetric type
optstyle option
wwidget
Returns
metric value

References checkDebugLevel(), model(), and Style_Model::sliderSize().

void Style_Salome::polish ( QApplication app)
virtual

Performs late initialization of the given application object.

Parameters
appapplication object

References checkDebugLevel(), model(), updateAllWidgets(), and updatePaletteColors().

void Style_Salome::polish ( QWidget w)
virtual

This function is called for every widget at some point after it has been fully created but just before it is shown for the very first time.

Parameters
wwidget object

References checkDebugLevel(), and hasHover().

void Style_Salome::restore ( )
static
QSize Style_Salome::sizeFromContents ( ContentsType  ct,
const QStyleOption *  opt,
const QSize &  contentsSize,
const QWidget w = 0 
) const
virtual
Parameters
ctcontents type
optstyle option
contentsSizecontents size
wwidget (optional)
Returns
size of the element

References checkDebugLevel(), DELTA_H_TAB, Style_Model::EditRadius, Style_Tools::getMaxRect(), model(), Style_Model::sliderSize(), and Style_Model::widgetRounding().

QIcon Style_Salome::standardIconImplementation ( StandardPixmap  standardIcon,
const QStyleOption *  opt = 0,
const QWidget w = 0 
) const
protectedslot
Parameters
standardIconstandard icon type
optstyle option
wwidget (optional)
Returns
standard icon

References checkDebugLevel().

QPixmap Style_Salome::standardPixmap ( StandardPixmap  stPixmap,
const QStyleOption *  opt,
const QWidget w = 0 
) const
virtual
Parameters
stPixmapstandard pixmap type
optstyle option
wwidget (optional)
Returns
standard pixmap

References checkDebugLevel(), cross_xpm, maximize_xpm, minimize_xpm, and normal_xpm.

int Style_Salome::styleHint ( StyleHint  hint,
const QStyleOption *  opt = 0,
const QWidget w = 0,
QStyleHintReturn *  returnData = 0 
) const
virtual
Parameters
hinthint type
optstyle option
wwidget (optional)
returnData(currently not used)
Returns
style hint value

References checkDebugLevel(), Style_Model::color(), Style_Model::GridLine, and model().

QRect Style_Salome::subControlRect ( ComplexControl  cc,
const QStyleOptionComplex *  opt,
SubControl  sc,
const QWidget wid = 0 
) const
virtual
Parameters
cccomplex control type
optstyle option
scsubcontrol type
widwidget (optional)
Returns
subcontrol rectangle

References Style_Model::ButtonRadius, checkDebugLevel(), DELTA_SLIDER, Style_Model::EditRadius, Style_Tools::getMaxRect(), Horizontal, model(), SHADOW, and Style_Model::widgetRounding().

QRect Style_Salome::subElementRect ( SubElement  se,
const QStyleOption *  opt,
const QWidget wid = 0 
) const
virtual
Parameters
sesubelement type
optstyle option
widwidget (optional)
Returns
subelement rectangle

References checkDebugLevel(), Style_Model::EditRadius, Style_Tools::getMaxRect(), hasHover(), model(), SHADOW, and Style_Model::widgetRounding().

QString Style_Salome::titleText ( const QString &  txt,
const int  W,
const int  H,
QFont &  f 
) const
private
Parameters
txtoriginal text
Wpossible width
Hpossible height
fused font
Returns
corrected title text
void Style_Salome::unpolish ( QWidget w)
virtual

This function is the counterpart to polish(). It is called for every polished widget whenever the style is dynamically changed; the former style has to unpolish its settings before the new style can polish them again.

Parameters
wwidget object

References checkDebugLevel(), and hasHover().

void Style_Salome::update ( )
static
void Style_Salome::updateAllWidgets ( QApplication app)
private
Parameters
appapplication object

References polish().

void Style_Salome::updatePaletteColors ( )
private

Member Data Documentation

Style_Model * Style_Salome::myModel = 0
staticprivate

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