"............"
};
+///////////////////////////////////////////////////////////
+// FOR debug purposes only!!!
+//
+const int DEBUG_LEVEL = 0;
+
+static bool checkDebugLevel( int level )
+{
+ return DEBUG_LEVEL == level;
+}
+//
+///////////////////////////////////////////////////////////
Style_Salome::Style_Salome()
: QWindowsStyle()
void Style_Salome::polish ( QApplication* app )
{
+ if ( checkDebugLevel(1) ) {
+ QWindowsStyle::polish( app );
+ return;
+ }
+
QWindowsStyle::polish( app );
updateSettings( app );
}
void Style_Salome::polish ( QWidget* w )
{
+ if ( checkDebugLevel(2) ) {
+ QWindowsStyle::polish( w );
+ return;
+ }
+
if ( !w )
return;
if ( w && hasHover() ) {
void Style_Salome::unpolish( QWidget* w )
{
+ if ( checkDebugLevel(3) ) {
+ QWindowsStyle::unpolish( w );
+ return;
+ }
+
if ( w && hasHover() ) {
if ( qobject_cast<QPushButton*>(w) || qobject_cast<QToolButton*>(w)||
qobject_cast<QCheckBox*>(w) || qobject_cast<QRadioButton*>(w) ||
}
void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComplex* opt,
- QPainter* p, const QWidget* w ) const
+ QPainter* p, const QWidget* w ) const
{
+ if ( checkDebugLevel(4) ) {
+ QWindowsStyle::drawComplexControl( cc, opt, p, w );
+ return;
+ }
+
const QPalette& pal = w->palette();
switch( cc ) {
case CC_SpinBox:
void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt,
QPainter* p, const QWidget* w ) const
{
+ if ( checkDebugLevel(5) ) {
+ QWindowsStyle::drawControl( ce, opt, p, w );
+ return;
+ }
+
switch ( ce ) {
case CE_PushButton:
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt,
QPainter* p, const QWidget* w ) const
{
+ if ( checkDebugLevel(6) ) {
+ QWindowsStyle::drawPrimitive( pe, opt, p, w );
+ return;
+ }
+
const QPalette& pal = opt->palette;
bool doRestore = false;
switch ( pe ) {
int Style_Salome::pixelMetric( PixelMetric metric, const QStyleOption* opt,
const QWidget* w ) const
{
+ if ( checkDebugLevel(7) ) {
+ return QWindowsStyle::pixelMetric( metric, opt, w );
+ }
+
int aRes = QWindowsStyle::pixelMetric( metric, opt, w );
switch( metric ) {
case PM_SliderLength: {
QSize Style_Salome::sizeFromContents( ContentsType ct, const QStyleOption* opt,
const QSize& contentsSize, const QWidget* w ) const
{
+ if ( checkDebugLevel(8) ) {
+ return QWindowsStyle::sizeFromContents( ct, opt,contentsSize, w );
+ }
+
QSize sz = QWindowsStyle::sizeFromContents( ct, opt, contentsSize, w );
switch (ct) {
case CT_TabBarTab:
QPixmap Style_Salome::standardPixmap(StandardPixmap stPixmap, const QStyleOption *opt,
const QWidget *w) const
{
+ if ( checkDebugLevel(9) ) {
+ return QWindowsStyle::standardPixmap( stPixmap, opt, w );
+ }
+
switch ( stPixmap )
{
case SP_DockWidgetCloseButton:
const QStyleOption* opt,
const QWidget* widget ) const
{
+ if ( checkDebugLevel(10) ) {
+ return QWindowsStyle::standardIconImplementation( standardIcon, opt, widget );
+ }
+
switch ( standardIcon )
{
case SP_MessageBoxInformation:
int Style_Salome::styleHint( StyleHint hint, const QStyleOption* opt, const QWidget* widget,
QStyleHintReturn* returnData ) const
{
+ if ( checkDebugLevel(11) ) {
+ return QWindowsStyle::styleHint( hint, opt, widget, returnData );
+ }
+
int aRes = QWindowsStyle::styleHint( hint, opt, widget, returnData );
switch( hint ) {
case SH_Table_GridLineColor: {
}
QRect Style_Salome::subControlRect( ComplexControl cc, const QStyleOptionComplex* opt,
- SubControl sc, const QWidget* wid ) const
+ SubControl sc, const QWidget* wid ) const
{
+ if ( checkDebugLevel(12) ) {
+ return QWindowsStyle::subControlRect( cc, opt, sc, wid );
+ }
+
QRect res = QWindowsStyle::subControlRect( cc, opt, sc, wid );
switch ( cc ) {
case CC_SpinBox: {
QRect Style_Salome::subElementRect( SubElement se, const QStyleOption* opt,
const QWidget* wid ) const
{
+ if ( checkDebugLevel(13) ) {
+ return QWindowsStyle::subElementRect( se, opt, wid );
+ }
+
QRect res = QWindowsStyle::subElementRect( se, opt, wid );
int aHalfRect = (int)Style_Tools::getMaxRect( res, (int)getDblValue( Style_Model::edit_rad )/2 );
int w = res.width(), h = res.height();
void Style_Salome::updatePaletteColors()
{
QPalette aPal = QApplication::palette();
- aPal.setColor( QPalette::WindowText, getColor( Style_Model::pal_wtext_clr ) );
- aPal.setColor( QPalette::Button, getColor( Style_Model::button_clr ) );
- aPal.setColor( QPalette::Light, getColor( Style_Model::pal_light_clr ) );
- aPal.setColor( QPalette::Midlight, getColor( Style_Model::pal_light_clr ).light(115) );
- aPal.setColor( QPalette::Dark, getColor( Style_Model::pal_dark_clr ) );
- aPal.setColor( QPalette::Mid, aPal.button().color().dark(150) );
- aPal.setColor( QPalette::Text, getColor( Style_Model::pal_text_clr ) );
- //aPal.setColor( QPalette::BrightText, );
- aPal.setColor( QPalette::ButtonText, getColor( Style_Model::pal_btext_clr ) );
- aPal.setColor( QPalette::Base, getColor( Style_Model::pal_base_clr ) );
- aPal.setColor( QPalette::AlternateBase,getColor( Style_Model::pal_base_clr ).dark( 110 ) );
- aPal.setColor( QPalette::Window, getColor( Style_Model::bg_clr ) );
- //aPal.setColor( QPalette::Shadow, );
- aPal.setColor( QPalette::Highlight, getColor( Style_Model::pal_high_clr ) );
+ aPal.setColor( QPalette::WindowText, getColor( Style_Model::pal_wtext_clr ) );
+ aPal.setColor( QPalette::Button, getColor( Style_Model::button_clr ) );
+ aPal.setColor( QPalette::Light, getColor( Style_Model::pal_light_clr ) );
+ aPal.setColor( QPalette::Midlight, getColor( Style_Model::pal_light_clr ).light(115) );
+ aPal.setColor( QPalette::Dark, getColor( Style_Model::pal_dark_clr ) );
+ aPal.setColor( QPalette::Mid, aPal.color( QPalette::Active, QPalette::Button ).dark(150) );
+ aPal.setColor( QPalette::Text, getColor( Style_Model::pal_text_clr ) );
+ //aPal.setColor( QPalette::BrightText, ??? );
+ aPal.setColor( QPalette::ButtonText, getColor( Style_Model::pal_btext_clr ) );
+ aPal.setColor( QPalette::Base, getColor( Style_Model::pal_base_clr ) );
+ aPal.setColor( QPalette::AlternateBase, getColor( Style_Model::pal_base_clr ).dark( 110 ) );
+ aPal.setColor( QPalette::Window, getColor( Style_Model::bg_clr ) );
+ //aPal.setColor( QPalette::Shadow, ??? );
+ aPal.setColor( QPalette::Highlight, getColor( Style_Model::pal_high_clr ) );
aPal.setColor( QPalette::HighlightedText, getColor( Style_Model::pal_high_text_clr ) );
- //aPal.setColor( QPalette::Link, Qt::blue );
- //aPal.setColor( QPalette::LinkVisited, Qt::magenta );
-
- // dependence colors
- aPal.setColor(QPalette::Inactive, QPalette::Button, aPal.button().color());
- aPal.setColor(QPalette::Inactive, QPalette::Window, aPal.background().color());
- aPal.setColor(QPalette::Inactive, QPalette::Light, aPal.light().color());
- aPal.setColor(QPalette::Inactive, QPalette::Dark, aPal.dark().color());
+ //aPal.setColor( QPalette::Link, ??? );
+ //aPal.setColor( QPalette::LinkVisited, ??? );
+
+ // dependant colors
if (aPal.midlight() == aPal.button())
- aPal.setColor(QPalette::Midlight, aPal.button().color().light(110));
- if (aPal.background() != aPal.base()) {
- aPal.setColor(QPalette::Inactive, QPalette::Highlight, aPal.color(QPalette::Inactive, QPalette::Window));
+ aPal.setColor(QPalette::Inactive, QPalette::Midlight, aPal.color(QPalette::Active, QPalette::Button).light(110));
+ if (aPal.window() != aPal.base()) {
+ aPal.setColor(QPalette::Inactive, QPalette::Highlight, aPal.color(QPalette::Inactive, QPalette::Window));
aPal.setColor(QPalette::Inactive, QPalette::HighlightedText, aPal.color(QPalette::Inactive, QPalette::Text));
}
- const QColor bg = aPal.background().color();
- const QColor fg = aPal.foreground().color(), btn = aPal.button().color();
+ const QColor bg = aPal.window().color();
+ const QColor fg = aPal.windowText().color();
+ const QColor btn = aPal.button().color();
+
QColor disabled((fg.red()+btn.red())/2,(fg.green()+btn.green())/2,
(fg.blue()+btn.blue())/2);
- aPal.setColorGroup(QPalette::Disabled, aPal.foreground(), aPal.button(), aPal.light(),
- aPal.dark(), aPal.mid(), aPal.text(), aPal.brightText(), aPal.base(), aPal.background() );
- aPal.setColor(QPalette::Disabled, QPalette::WindowText, disabled);
- aPal.setColor(QPalette::Disabled, QPalette::Text, disabled);
- aPal.setColor(QPalette::Disabled, QPalette::ButtonText, disabled);
- aPal.setColor(QPalette::Disabled, QPalette::Highlight, aPal.highlight().color() );
- aPal.setColor(QPalette::Disabled, QPalette::HighlightedText, aPal.highlightedText().color() );
- aPal.setColor(QPalette::Disabled, QPalette::Base, bg);
+
+ aPal.setColor(QPalette::Disabled, QPalette::WindowText, disabled);
+ aPal.setColor(QPalette::Disabled, QPalette::Text, disabled);
+ aPal.setColor(QPalette::Disabled, QPalette::ButtonText, disabled);
+ aPal.setColor(QPalette::Disabled, QPalette::Base, bg);
+
QApplication::setPalette( aPal );
QColor aWndCol = myTTipWnd,
for (QWidgetList::ConstIterator it2 = all.constBegin(); it2 != all.constEnd(); ++it2) {
w = *it2;
if (w->windowType() != Qt::Desktop && w->testAttribute(Qt::WA_WState_Polished)
- && !w->testAttribute(Qt::WA_SetStyle)) {
+ && !w->testAttribute(Qt::WA_SetStyle)) {
QEvent e(QEvent::StyleChange);
QApplication::sendEvent(w, &e);
polish( w );