1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : Style_Model.cxx
23 // Author : Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com)
25 #include "Style_Model.h"
27 #include <QtxResourceMgr.h>
29 #include <QApplication>
35 \brief Mix two colors to get color with averaged red, green, blue and alpha-channel values
38 \param c2 second color
39 \return averaged color
41 static QColor mixColors( const QColor& c1, const QColor& c2 )
43 return QColor( (c1.red() + c2.red() ) / 2,
44 (c1.green() + c2.green() ) / 2,
45 (c1.blue() + c2.blue() ) / 2,
46 (c1.alpha() + c2.alpha() ) / 2 );
51 \brief SALOME style model
53 Style model class stores properties of the SALOME style, like palette colors,
54 widget roundings etc. It allows reading these properties from the resource file
55 and write them back to resource file.
57 SALOME_Style class provides an access to the global style model (which is applied
58 to the application). To get access to the global SALOME style model, use static
59 Style_Model::model() function.
61 \sa Style_Salome class
65 \brief Application style data
68 Style_Model::AppData* Style_Model::myAppData = 0;
73 Create new SALOME style model with default properties.
75 Style_Model::Style_Model()
78 initDefaults(); // init from default values
84 Style_Model::~Style_Model()
89 \brief Initialize model from the current application style
91 This function is useful when it is necessary to set/remove SALOME style
92 dynamically. Function fromApplication() saves current application properties
93 (style, palette, font) which can be later restored with the restore() function.
95 The simplest way it can be done is using static functions of Style_Salome class:
96 Style_Salome::apply(), Style_Salome::restore()
98 \param reset if \c true model is also initializes preoperties from the application
99 \sa restore(), fromResources()
100 \sa Style_Salome class
102 void Style_Model::fromApplication( bool reset )
106 if ( !QApplication::instance() ) // application object is not created yet
110 // if not yes initialized from the application,
111 // store current application's style, palette, etc
112 myAppData = new AppData;
113 myAppData->myStyle = QApplication::style();
114 myAppData->myPalette = QApplication::palette();
115 myAppData->myFont = QApplication::font();
118 // initialize style properties from the application
120 if ( !reset ) return;
123 myFont = myAppData->myFont;
125 for ( int i = (int)QPalette::Active; i <= (int)QPalette::Inactive; i++ ) {
126 for ( int j = (int)Style_Model::WindowText; j < (int)Style_Model::NColorRoles; j++ ) {
127 myColors[ (QPalette::ColorGroup)i ][ (Style_Model::ColorRole)j ] =
128 myAppData->myPalette.color( (QPalette::ColorGroup)i, (QPalette::ColorRole)j );
132 QColor dark = myAppData->myPalette.color( QPalette::Dark );
133 setColor( BorderTop, dark.lighter() );
134 setColor( BorderBottom, dark.darker() );
135 setColor( TabBorderTop, dark.lighter().lighter() );
136 setColor( TabBorderBottom, dark.darker().darker() );
137 setColor( FieldLight, myAppData->myPalette.color( QPalette::Light ) );
138 setColor( FieldDark, myAppData->myPalette.color( QPalette::Mid ).light( 125 ) );
139 setColor( ProgressBar, myAppData->myPalette.color( QPalette::Highlight ) );
140 setColor( Pointer, myAppData->myPalette.color( QPalette::WindowText ) );
141 setColor( Checked, myAppData->myPalette.color( QPalette::Base ) );
142 setColor( GridLine, myAppData->myPalette.color( QPalette::Mid ) );
143 setColor( Header, myAppData->myPalette.color( QPalette::Button ) );
144 setColor( Slider, myAppData->myPalette.color( QPalette::Button ) );
145 setColor( HighlightWidget, myAppData->myPalette.color( QPalette::Button ) );
146 setColor( HighlightBorder, myAppData->myPalette.color( QPalette::Button ) );
147 setColor( Lines, myAppData->myPalette.color( QPalette::Mid ) );
151 \brief Initialize model from the resources
153 This function can be used to retrieve SALOME style properties from the resource file(s).
154 Note, that paremeters \a resMgr and \a resSection are stored by the model to be used
155 later with save() method.
157 \param resMgr resources manager
158 \param resSection resources section name; if empty (default), "Theme" section is used instead
159 \sa fromApplication(), save(), update()
161 void Style_Model::fromResources( QtxResourceMgr* resMgr, const QString& resSection )
163 // init from application
164 fromApplication( false );
166 myResourceMgr = resMgr;
167 myResourceSection = resSection;
169 // init from resource manager
170 if ( !resourceMgr() )
173 QString section = resourceSection();
177 readColorValue( Button, "button" );
179 readColorValue( WindowText, "window-text" );
181 readColorValue( Light, "light" );
183 readColorValue( Dark, "dark" );
185 readColorValue( Mid, "mid" );
187 readColorValue( Text, "text" );
189 readColorValue( BrightText, "bright-text" );
191 readColorValue( ButtonText, "button-text" );
193 readColorValue( Base, "base" );
195 readColorValue( Window, "window" );
197 readColorValue( AlternateBase, "alternate-base" );
199 readColorValue( Midlight, "midlight" );
201 readColorValue( Shadow, "shadow" );
203 readColorValue( Highlight, "highlight" );
205 readColorValue( HighlightedText, "highlight-text" );
207 readColorValue( Link, "link" );
209 readColorValue( LinkVisited, "link-visited" );
211 readColorValue( ToolTipBase, "tooltip-base" );
213 readColorValue( ToolTipText, "tooltip-text" );
215 readColorValue( BorderTop, "border-top" );
217 readColorValue( BorderBottom, "border-bottom" );
219 readColorValue( TabBorderTop, "tab-border-top" );
221 readColorValue( TabBorderBottom, "tab-border-bottom" );
223 readColorValue( FieldLight, "field-light" );
225 readColorValue( FieldDark, "field-dark" );
227 readColorValue( ProgressBar, "progress-bar" );
229 readColorValue( Pointer, "pointer" );
231 readColorValue( Checked, "checked" );
233 readColorValue( GridLine, "grid-line" );
235 readColorValue( Header, "header" );
237 readColorValue( Slider, "slider" );
239 readColorValue( HighlightWidget, "highlight-widget" );
241 readColorValue( HighlightBorder, "highlight-border" );
243 readColorValue( Lines, "lines" );
244 // auto-palette flag (internal)
245 if ( resourceMgr()->hasValue( section, "auto-palette" ) ) {
246 setAutoPalette( resourceMgr()->booleanValue( section, "auto-palette" ) );
249 if ( resourceMgr()->hasValue( section, "lines-type" ) ) {
250 int ltype = resourceMgr()->integerValue( section, "lines-type" );
251 if ( ltype >= NoLines && ltype <= Inclined )
252 setLinesType( (LineType)ltype );
254 // lines transparency
255 if ( resourceMgr()->hasValue( section, "lines-transparency" ) ) {
256 int ltransp = resourceMgr()->integerValue( section, "lines-transparency" );
257 if ( ltransp >= 0 && ltransp <= 100 )
258 setLinesTransparency( ltransp );
261 if ( resourceMgr()->hasValue( section, "application-font" ) ) {
262 setApplicationFont( resourceMgr()->fontValue( section, "application-font" ) );
265 if ( resourceMgr()->hasValue( section, "button-rad" ) ) {
266 setWidgetRounding( ButtonRadius, resourceMgr()->doubleValue( section, "button-rad" ) );
268 if ( resourceMgr()->hasValue( section, "edit-rad" ) ) {
269 setWidgetRounding( EditRadius, resourceMgr()->doubleValue( section, "edit-rad" ) );
271 if ( resourceMgr()->hasValue( section, "frame-rad" ) ) {
272 setWidgetRounding( FrameRadius, resourceMgr()->doubleValue( section, "frame-rad" ) );
274 if ( resourceMgr()->hasValue( section, "slider-rad" ) ) {
275 setWidgetRounding( SliderRadius, resourceMgr()->doubleValue( section, "slider-rad" ) );
278 if ( resourceMgr()->hasValue( section, "widget-effect" ) ) {
279 int effect = resourceMgr()->integerValue( section, "widget-effect" );
280 if ( effect >= NoEffect && effect <= AutoRaiseEffect )
281 setWidgetEffect( (WidgetEffect)effect );
283 else if ( resourceMgr()->hasValue( section, "is-highlight-widget" ) ||
284 resourceMgr()->hasValue( section, "is-raising-widget" ) ) {
285 bool highlight = resourceMgr()->booleanValue( section, "is-highlight-widget", false );
286 bool autoraise = resourceMgr()->booleanValue( section, "is-highlight-widget", false );
288 setWidgetEffect( HighlightEffect );
289 else if ( autoraise )
290 setWidgetEffect( AutoRaiseEffect );
292 if ( resourceMgr()->hasValue( section, "all-antialized" ) ) {
293 setAntialiasing( resourceMgr()->booleanValue( section, "all-antialized" ) );
296 if ( resourceMgr()->hasValue( section, "hor-hadle-delta" ) ) {
297 setHandleDelta( Qt::Horizontal, resourceMgr()->integerValue( section, "hor-hadle-delta" ) );
299 if ( resourceMgr()->hasValue( section, "ver-hadle-delta" ) ) {
300 setHandleDelta( Qt::Vertical, resourceMgr()->integerValue( section, "vsr-hadle-delta" ) );
302 if ( resourceMgr()->hasValue( section, "slider-size" ) ) {
303 setSliderSize( resourceMgr()->integerValue( section, "slider-size" ) );
305 else if ( resourceMgr()->hasValue( section, "slider-increase" ) ) {
306 setSliderSize( resourceMgr()->integerValue( section, "slider-increase" ) );
308 if ( resourceMgr()->hasValue( section, "split-handle-len" ) ) {
309 setSplitHandleLength( resourceMgr()->integerValue( section, "split-handle-len" ) );
314 \brief Save SALOME stype properties to the resource file.
316 If paremeters \a resMgr and \a resSection are not specified, default ones
317 (those passed to the fromResources() function) are used instead.
319 \param resMgr resources manager
320 \param resSection resources section name
321 \sa fromResources(), update()
323 void Style_Model::save( QtxResourceMgr* resMgr, const QString& resSection )
326 resMgr = resourceMgr();
330 QString section = resSection.isEmpty() ? resourceSection() : resSection;
334 writeColorValue( Button, "button", resMgr, section );
336 writeColorValue( WindowText, "window-text", resMgr, section );
338 writeColorValue( Light, "light", resMgr, section );
340 writeColorValue( Dark, "dark", resMgr, section );
342 writeColorValue( Mid, "mid", resMgr, section );
344 writeColorValue( Text, "text", resMgr, section );
346 writeColorValue( BrightText, "bright-text", resMgr, section );
348 writeColorValue( ButtonText, "button-text", resMgr, section );
350 writeColorValue( Base, "base", resMgr, section );
352 writeColorValue( Window, "window", resMgr, section );
354 writeColorValue( AlternateBase, "alternate-base", resMgr, section );
356 writeColorValue( Midlight, "midlight", resMgr, section );
358 writeColorValue( Shadow, "shadow", resMgr, section );
360 writeColorValue( Highlight, "highlight", resMgr, section );
362 writeColorValue( HighlightedText, "highlight-text", resMgr, section );
364 writeColorValue( Link, "link", resMgr, section );
366 writeColorValue( LinkVisited, "link-visited", resMgr, section );
368 writeColorValue( ToolTipBase, "tooltip-base", resMgr, section );
370 writeColorValue( ToolTipText, "tooltip-text", resMgr, section );
372 writeColorValue( BorderTop, "border-top", resMgr, section );
374 writeColorValue( BorderBottom, "border-bottom", resMgr, section );
376 writeColorValue( TabBorderTop, "tab-border-top", resMgr, section );
378 writeColorValue( TabBorderBottom, "tab-border-bottom", resMgr, section );
380 writeColorValue( FieldLight, "field-light", resMgr, section );
382 writeColorValue( FieldDark, "field-dark", resMgr, section );
384 writeColorValue( ProgressBar, "progress-bar", resMgr, section );
386 writeColorValue( Pointer, "pointer", resMgr, section );
388 writeColorValue( Checked, "checked", resMgr, section );
390 writeColorValue( GridLine, "grid-line", resMgr, section );
392 writeColorValue( Header, "header", resMgr, section );
394 writeColorValue( Slider, "slider", resMgr, section );
396 writeColorValue( HighlightWidget, "highlight-widget", resMgr, section );
398 writeColorValue( HighlightBorder, "highlight-border", resMgr, section );
400 writeColorValue( Lines, "lines", resMgr, section );
401 // auto-palette flag (internal)
402 resMgr->setValue( section, "auto-palette", isAutoPalette() );
405 resMgr->setValue( section, "lines-type", (int)linesType() );
406 // lines transparency
407 resMgr->setValue( section, "lines-transparency", linesTransparency() );
409 resMgr->setValue( section, "application-font", applicationFont() );
411 resMgr->setValue( section, "button-rad", widgetRounding( ButtonRadius ) );
412 resMgr->setValue( section, "edit-rad", widgetRounding( EditRadius ) );
413 resMgr->setValue( section, "frame-rad", widgetRounding( FrameRadius ) );
414 resMgr->setValue( section, "slider-rad", widgetRounding( SliderRadius ) );
415 resMgr->setValue( section, "all-antialized", antialiasing() );
417 resMgr->setValue( section, "widget-effect", (int)widgetEffect() );
419 resMgr->setValue( section, "hor-hadle-delta", handleDelta( Qt::Horizontal ) );
420 resMgr->setValue( section, "vsr-hadle-delta", handleDelta( Qt::Vertical ) );
421 resMgr->setValue( section, "slider-size", sliderSize() );
422 resMgr->setValue( section, "split-handle-len", splitHandleLength() );
426 \brief Reload SALOME style properties from the resources file(s).
427 \sa fromResources(), save()
429 void Style_Model::update()
431 fromResources( resourceMgr(), resourceSection() );
435 \brief Restore original style, palette and font to the application
437 This function should be used in conjunction with fromApplication() method.
438 Sets initial style, color palette and font to the application.
439 If SALOME style model has not been initialized from the application,
440 this function does nothing.
442 \sa fromApplication()
444 void Style_Model::restore()
446 if ( !QApplication::instance() ) // application object is not created yet
448 if ( !myAppData ) // not initialized from the application yet
451 QApplication::setStyle( myAppData->myStyle );
452 QApplication::setPalette( myAppData->myPalette );
453 QApplication::setFont( myAppData->myFont );
457 \brief Get resource manager used by this SALOME style model.
459 \return pointer to the resource manager passed previously to the fromResources() method
460 \sa initFromResources(), resourceSection()
462 QtxResourceMgr* Style_Model::resourceMgr() const
464 return myResourceMgr;
468 \brief Get resources section name
470 If section name is empty, default "Theme" is returned
472 \return resource section name passed previously to the fromResources() method
473 \sa initFromResources(), resourceMgr()
475 QString Style_Model::resourceSection() const
477 return !myResourceSection.isEmpty() ? myResourceSection : "Theme";
481 \brief Get palette color value
482 \param role color role
483 \param cg color group
484 \return a color which should be used to draw the corresponding part of the application
487 QColor Style_Model::color( ColorRole role, QPalette::ColorGroup cg ) const
489 QColor c = myColors[ cg ][ role ];
490 if ( !c.isValid() ) c = myColors[ QPalette::Active ][ role ];
495 \brief Set palette color value
497 If \a inactive and/or \a disabled colors are not specified, they are automatically
498 calculated from \a active color.
500 \param role color role
501 \param active a color to be used with active color group (QPalette::Active)
502 \param inactive a color to be used with inactive color group (QPalette::Inactive)
503 \param disabled a color to be used with disabled color group (QPalette::Disabled)
506 void Style_Model::setColor( Style_Model::ColorRole role, const QColor& active,
507 const QColor& inactive, const QColor& disabled )
509 QColor ac = active, ic = inactive, dc = disabled;
511 if ( !ic.isValid() ) {
514 if ( !dc.isValid() ) {
518 dc = color( Button ).darker();
521 dc = color( Button );
524 dc = mixColors( color( Base, QPalette::Inactive ), color( Button, QPalette::Inactive ) );
527 dc = mixColors( color( Light, QPalette::Inactive ), color( Button, QPalette::Inactive ) );
535 setColor( role, QPalette::Active, ac );
536 setColor( role, QPalette::Inactive, ic );
537 setColor( role, QPalette::Disabled, dc );
541 \brief Set palette color value
543 If \a inactive and/or \a disabled colors are not specified, they are automatically
544 calculated from \a active color.
546 \param role color role
547 \param cg color group
548 \param c color which should be used to draw the corresponding part of the application
551 void Style_Model::setColor( Style_Model::ColorRole role, QPalette::ColorGroup cg, const QColor& c )
553 myColors[ cg ][ role ] = c;
557 \brief Returns 'auto-calculating color values' flag
558 \return 'auto-calculating color values' flag
562 bool Style_Model::isAutoPalette() const
564 return myAutoPalette;
568 \brief Set/clear 'auto-calculating color values' flag
569 \param on new value of 'auto-calculating color values' flag
573 void Style_Model::setAutoPalette( bool on )
579 \brief Get lines type
580 \return current lines type
581 \sa setLinesType(), linesTransparency()
583 Style_Model::LineType Style_Model::linesType() const
589 \brief Set lines type
590 \param lt new lines type
591 \sa linesType(), linesTransparency()
593 void Style_Model::setLinesType( LineType lt )
599 \brief Get lines transparency value
600 \return current lines transparency
601 \sa setLinesTransparency(), linesType()
603 int Style_Model::linesTransparency() const
605 return myLinesTransparency;
609 \brief Set lines transparency value
610 \param transparency new lines transparency
611 \sa linesTransparency(), linesType()
613 void Style_Model::setLinesTransparency( int transparency )
615 myLinesTransparency = transparency;
619 \brief Get application font
620 \return current application font
621 \sa setApplicationFont()
623 QFont Style_Model::applicationFont() const
629 \brief Set application font
630 \param font new application font
631 \sa applicationFont()
633 void Style_Model::setApplicationFont( const QFont& font )
639 \brief Get widget corners rounding radius value
640 \param wr widget type
641 \return current widget corners rounding
642 \sa setWidgetRounding(), antialiasing()
644 double Style_Model::widgetRounding( Style_Model::WidgetRounding wr ) const
646 return myWidgetRounding[ wr ];
650 \brief Set widget corners rounding radius value
651 \param wr widget type
652 \param value new widget corners rounding
653 \sa widgetRounding(), antialiasing()
655 void Style_Model::setWidgetRounding( WidgetRounding wr, double value )
657 myWidgetRounding[ wr ] = value;
661 \brief Get anti-aliasing flag value
662 \return \c true if widgets borders should be antialiased
663 \sa setAntialiasing(), widgetRounding()
665 bool Style_Model::antialiasing() const
667 return myAntiAliasing;
671 \brief Set anti-aliasing flag value
672 \param value if \c true, widgets borders should be antialiased
673 \sa antialiasing(), widgetRounding()
675 void Style_Model::setAntialiasing( bool value )
677 myAntiAliasing = value;
681 \brief Get widget effect
682 \return current widget effect
683 \sa setWidgetEffect()
685 Style_Model::WidgetEffect Style_Model::widgetEffect() const
687 return myWidgetEffect;
691 \brief Set widget effect
692 \param we new widget effect
695 void Style_Model::setWidgetEffect( WidgetEffect we )
701 \brief Get handle spacing value
702 \param o handle spacing direction
703 \return current handle spacing value
706 int Style_Model::handleDelta( Qt::Orientation o ) const
708 return myHandleDelta[ o ];
712 \brief Set handle spacing value
713 \param o handle spacing direction
714 \param value new handle spacing value
717 void Style_Model::setHandleDelta( Qt::Orientation o, int value )
719 myHandleDelta[ o ] = value;
723 \brief Get splitter handle length
724 \return current splitter handle length
725 \sa setSplitHandleLength()
727 int Style_Model::splitHandleLength() const
729 return mySplitHandleLength;
733 \brief Set splitted handle length
734 \param value new splitter handle length
735 \sa splitHandleLength()
737 void Style_Model::setSplitHandleLength( int value )
739 mySplitHandleLength = value;
743 \brief Get slider handle extra size
744 \return current slider handle extra size
747 int Style_Model::sliderSize() const
753 \brief Set slider handle extra size
754 \param value new slider handle extra size
757 void Style_Model::setSliderSize( int value )
759 mySliderSize = value;
763 \brief Initialize model with the default values
765 void Style_Model::initDefaults()
767 // default application font
768 myFont.fromString( "Sans Serif,9,-1,5,50,0,0,0,0,0" );
770 // default palette colors
771 myAutoPalette = false;
772 QColor btn = QColor( "#e6e7e6" );
773 QColor fg = QColor( "#000000" );
774 QColor bg = QColor( "#ffffff" );
775 setColor( Button, btn ); // = (230, 231, 230)
776 setColor( WindowText, fg ); // = ( 0, 0, 0)
777 setColor( Light, bg ); // = (255, 255, 255)
778 setColor( Dark, btn.darker() ); // = (115, 115, 115) // btn.darker( 130 ) = (177, 178, 177)
779 setColor( Mid, btn.darker( 150 ) ); // = (153, 154, 153)
780 setColor( Text, fg ); // = ( 0, 0, 0)
781 setColor( BrightText, bg ); // = (255, 255, 255) // fg = ( 0, 0, 0)
782 setColor( ButtonText, fg ); // = ( 0, 0, 0)
783 setColor( Base, bg ); // = (255, 255, 255)
784 setColor( Window, btn ); // = (230, 231, 230)
785 setColor( AlternateBase, mixColors( bg, btn ) ); // = (242, 243, 242)
786 setColor( Midlight, mixColors( bg, btn ) ); // = (242, 243, 242)
787 setColor( Shadow, fg ); // = ( 0, 0, 0)
788 setColor( Highlight, "#000080" ); // = ( 0, 0, 128) // ( 33, 68, 156 )
789 setColor( HighlightedText, bg ); // = (255, 255, 255)
790 setColor( Link, "#0000ff" ); // = ( 0, 0, 255)
791 setColor( LinkVisited, "#ff00ff" ); // = (255, 0, 255)
792 setColor( ToolTipBase, "#ffffdc" ); // = (255, 255, 220) // ( 230, 231, 230 )
793 setColor( ToolTipText, fg ); // = ( 0, 0, 0)
794 setColor( BorderTop, "#adadad" ); // = (173, 173, 173) // ( 255, 255, 255 )
795 setColor( BorderBottom, "#393939" ); // = ( 57, 57, 57) // ( 88, 89, 88 )
796 setColor( TabBorderTop, "#ffffff" ); // = (255, 255, 255)
797 setColor( TabBorderBottom, "#0e0e0e" ); // = ( 14, 14, 14) // ( 44, 44, 44 )
798 setColor( FieldLight, "#ffffff" ); // = (255, 255, 255)
799 setColor( FieldDark, "#c0c1c0" ); // = (192, 193, 192) // ( 240, 241, 240 )
800 setColor( ProgressBar, "#000080" ); // = ( 0, 0, 128) // ( 33, 68, 156 )
801 setColor( Pointer, "#000000" ); // = ( 0, 0, 0)
802 setColor( Checked, "#ffffff" ); // = (255, 255, 255)
803 setColor( GridLine, "#999a99" ); // = (153, 154, 153) // ( 192, 192, 192 )
804 setColor( Header, "#e6e7e6" ); // = (230, 231, 230)
805 setColor( Slider, "#e6e7e6" ); // = (230, 231, 230)
806 setColor( HighlightWidget, "#e6e7e6" ); // = (230, 231, 230)
807 setColor( HighlightBorder, "#e6e7e6" ); // = (230, 231, 230)
808 setColor( Lines, "#999a99" ); // = (153, 154, 153) // ( 192, 193, 192 )
811 myLinesType = NoLines;
812 myWidgetEffect = NoEffect;
813 myAntiAliasing = false;
814 myLinesTransparency = 0;
815 myWidgetRounding[ EditRadius ] = 0.0;
816 myWidgetRounding[ ButtonRadius ] = 0.0;
817 myWidgetRounding[ FrameRadius ] = 0.0;
818 myWidgetRounding[ SliderRadius ] = 0.0;
819 myHandleDelta[ Qt::Horizontal ] = 3;
820 myHandleDelta[ Qt::Vertical ] = 3;
821 mySplitHandleLength = 20;
826 \brief Read palette color values from resources manager
827 \param role color role
828 \param prefix palette color value resource name prefix
829 \sa writeColorValue()
831 void Style_Model::readColorValue( ColorRole role, const QString& prefix )
833 if ( !resourceMgr() ) return;
835 QString section = resourceSection();
836 QString active = QString( "%1-color" ).arg( prefix );
837 QString inactive = QString( "%1-color-inactive" ).arg( prefix );
838 QString disabled = QString( "%1-color-disabled" ).arg( prefix );
840 if ( resourceMgr()->hasValue( section, active ) )
841 setColor( role, resourceMgr()->colorValue( section, active ) );
842 if ( resourceMgr()->hasValue( section, inactive ) )
843 setColor( role, QPalette::Inactive, resourceMgr()->colorValue( section, inactive ) );
844 if ( resourceMgr()->hasValue( section, disabled ) )
845 setColor( role, QPalette::Disabled, resourceMgr()->colorValue( section, disabled ) );
849 \brief Write palette color values to resources manager
850 \param role color role
851 \param prefix palette color value resource name prefix
852 \param resMgr resource manager
853 \param resSection resource section name
856 void Style_Model::writeColorValue( ColorRole role, const QString& prefix,
857 QtxResourceMgr* resMgr, const QString& resSection ) const
859 QString active = QString( "%1-color" ).arg( prefix );
860 QString inactive = QString( "%1-color-inactive" ).arg( prefix );
861 QString disabled = QString( "%1-color-disabled" ).arg( prefix );
863 resMgr->setValue( resSection, active, color( role, QPalette::Active ) );
864 resMgr->setValue( resSection, inactive, color( role, QPalette::Inactive ) );
865 resMgr->setValue( resSection, disabled, color( role, QPalette::Disabled ) );