SALOME style class. More...
#include <Style_Salome.h>
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_Model * | model () |
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_Model * | myModel = 0 |
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_PrefDlg class can be then used to change style properties, select one of the predefined style themes or even create user themes:
|
private |
Use Style_Salome::apply() static function to set SALOME style to the application.
|
virtual |
|
static |
References isActive(), model(), Style_Salome(), update(), and Style_Model::update().
|
private |
p | painter |
r | rectangle |
bgCol | background 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().
|
private |
p | painter |
r | rectangle |
horiz | 'draw horizontal item' flag |
References Style_Model::color(), model(), Style_Model::TabBorderBottom, and Style_Model::TabBorderTop.
|
virtual |
cc | complex control type |
opt | style option |
p | painter |
w | widget |
References Style_Tools::All, Style_Model::antialiasing(), Style_Tools::arrowRect(), Style_Model::AutoRaiseEffect, Style_Model::BorderBottom, Style_Model::BorderTop, BUT_PERCENT_COL, Style_Model::ButtonRadius, checkDebugLevel(), OCCViewer::color(), Style_Model::color(), DELTA_SLIDER, drawControl(), Style_Tools::drawFocus(), drawHandle(), drawHoverRect(), drawPrimitive(), Style_Tools::drawSlider(), Style_Model::EditRadius, Style_Model::FieldDark, Style_Model::FieldLight, Style_Model::FrameRadius, Style_Tools::getMinDelta(), hasHover(), Style_Model::HighlightEffect, Horizontal, Style_Tools::Left, LINE_GR_MARGIN, model(), pixelMetric(), Style_Tools::Right, SHADOW, Style_Tools::shadowRect(), Style_Tools::SlDown, Style_Model::Slider, Style_Model::SliderRadius, Style_Tools::SlLeft, Style_Tools::SlNone, Style_Tools::SlRight, Style_Tools::SlUp, styleHint(), subControlRect(), subElementRect(), Style_Model::TabBorderBottom, Style_Model::TabBorderTop, Style_Model::widgetEffect(), Style_Model::widgetRounding(), and Window.
|
virtual |
ce | control element type |
opt | style option |
p | painter |
w | widget |
References Style_Tools::All, Style_Model::antialiasing(), Style_Model::AutoRaiseEffect, Style_Model::BorderBottom, Style_Model::BorderTop, Style_Tools::BottomLeft, Style_Tools::BottomRight, BUT_PERCENT_COL, BUT_PERCENT_ON, Style_Model::ButtonRadius, checkDebugLevel(), OCCViewer::color(), Style_Model::color(), DELTA_H_TAB, drawBackground(), drawBorder(), Style_Tools::drawFocus(), drawHandle(), drawHoverRect(), drawPrimitive(), Style_Model::EditRadius, Style_Model::FieldLight, Style_Model::FrameRadius, Style_Tools::getMaxRect(), hasHover(), Style_Model::Header, Style_Model::HighlightBorder, Style_Model::HighlightEffect, Style_Model::HighlightWidget, Horizontal, Style_Tools::Left, LINE_GR_MARGIN, model(), Style_Tools::None, pixelMetric(), Style_Model::ProgressBar, Style_Tools::Right, Style_Tools::roundRect(), s, SHADOW, Style_Tools::shadowRect(), Style_Model::Slider, Style_Model::splitHandleLength(), standardPixmap(), styleHint(), subControlRect(), subElementRect(), Style_Model::TabBorderBottom, Style_Model::TabBorderTop, Style_Tools::tabRect(), titleText(), Style_Tools::TopLeft, Style_Tools::TopRight, Vertical, Style_Model::widgetEffect(), Style_Model::widgetRounding(), and Window.
|
private |
p | painter |
r | rectangle |
horiz | if true draw horizontal handle, otherwise draw vertical handle |
isRect | if true surrounding rectangle is also drawn |
References Style_Model::handleDelta(), hole_xpm, Horizontal, model(), and Vertical.
|
private |
p | painter |
r | rectangle |
bgCol | background color |
rad | corners rounding radius |
type | shadow type |
border | if 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().
|
virtual |
pe | primitive type |
opt | style option |
p | painter |
w | widget (optional) |
References Style_Tools::All, Style_Model::antialiasing(), Style_Model::Base, Style_Model::BorderBottom, Style_Model::BorderTop, Style_Tools::BottomLeft, Style_Tools::BottomRight, BUT_PERCENT_COL, BUT_PERCENT_ON, Style_Model::ButtonRadius, checkDebugLevel(), Style_Model::Checked, OCCViewer::color(), Style_Model::color(), DELTA_H_TAB, Style_Tools::drawArrow(), drawBackground(), drawBorder(), drawHandle(), drawHoverRect(), Style_Tools::drawSign(), Style_Model::EditRadius, Style_Model::FieldDark, Style_Model::FieldLight, Style_Model::FrameRadius, hasHover(), Style_Model::HighlightEffect, LINE_GR_MARGIN, model(), Plot2d::NoPen, Style_Model::Pointer, PTSARRLEN, SHADOW, Style_Tools::shadowCheck(), Style_Tools::shadowRect(), Style_Model::splitHandleLength(), Style_Model::TabBorderBottom, Style_Model::TabBorderTop, Style_Tools::tabRect(), Style_Tools::TopLeft, Style_Tools::TopRight, Style_Model::widgetEffect(), Style_Model::widgetRounding(), and Window.
|
private |
true
if any widget effect is currently used References model(), Style_Model::NoEffect, and Style_Model::widgetEffect().
|
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.
resMgr | resources manager |
section | resources file section name |
References Style_Model::fromResources(), and model().
|
static |
true
if SALOME style is set to the applcation or false
otherwise
|
static |
References myModel.
|
virtual |
metric | metric type |
opt | style option |
w | widget |
References checkDebugLevel(), model(), and Style_Model::sliderSize().
|
virtual |
Performs late initialization of the given application object.
app | application object |
References checkDebugLevel(), model(), updateAllWidgets(), and updatePaletteColors().
|
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.
w | widget object |
References checkDebugLevel(), and hasHover().
|
static |
References isActive(), model(), and Style_Model::restore().
|
virtual |
ct | contents type |
opt | style option |
contentsSize | contents size |
w | widget (optional) |
References checkDebugLevel(), DELTA_H_TAB, Style_Model::EditRadius, Style_Tools::getMaxRect(), model(), Style_Model::sliderSize(), and Style_Model::widgetRounding().
|
protectedslot |
standardIcon | standard icon type |
opt | style option |
w | widget (optional) |
References checkDebugLevel().
|
virtual |
stPixmap | standard pixmap type |
opt | style option |
w | widget (optional) |
References checkDebugLevel(), cross_xpm, maximize_xpm, minimize_xpm, and normal_xpm.
|
virtual |
hint | hint type |
opt | style option |
w | widget (optional) |
returnData | (currently not used) |
References checkDebugLevel(), Style_Model::color(), Style_Model::GridLine, and model().
|
virtual |
cc | complex control type |
opt | style option |
sc | subcontrol type |
wid | widget (optional) |
References Style_Model::ButtonRadius, checkDebugLevel(), DELTA_SLIDER, Style_Model::EditRadius, Style_Tools::getMaxRect(), Horizontal, model(), SHADOW, and Style_Model::widgetRounding().
|
virtual |
se | subelement type |
opt | style option |
wid | widget (optional) |
References checkDebugLevel(), Style_Model::EditRadius, Style_Tools::getMaxRect(), hasHover(), model(), SHADOW, and Style_Model::widgetRounding().
|
private |
txt | original text |
W | possible width |
H | possible height |
f | used font |
|
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.
w | widget object |
References checkDebugLevel(), and hasHover().
|
static |
|
private |
app | application object |
References polish().
|
private |
References OCCViewer::color(), model(), Style_Model::NColorRoles, and Style_Model::WindowText.
|
staticprivate |