From: vsr Date: Thu, 24 Apr 2008 16:06:59 +0000 (+0000) Subject: IPAL19388: Viewer title is not shown X-Git-Tag: V5_0_0~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8db4c0d02cde6ca271c1a8f72384808c6e5e3658;p=modules%2Fgui.git IPAL19388: Viewer title is not shown --- diff --git a/src/Qtx/QtxWorkstack.cxx b/src/Qtx/QtxWorkstack.cxx index db2e4ef52..27e8cdd0a 100644 --- a/src/Qtx/QtxWorkstack.cxx +++ b/src/Qtx/QtxWorkstack.cxx @@ -713,6 +713,7 @@ void QtxWorkstackArea::customEvent( QEvent* e ) switch ( we->type() ) { case ActivateWidget: + myBar->updateActiveState(); emit activated( activeWidget() ); break; case FocusWidget: @@ -725,10 +726,12 @@ void QtxWorkstackArea::customEvent( QEvent* e ) if ( activeWidget()->focusWidget()->hasFocus() ) { QFocusEvent in( QEvent::FocusIn ); - QApplication::sendEvent( this, &in ); - } - else + QApplication::sendEvent( this, &in ); + } + else { activeWidget()->focusWidget()->setFocus(); + myBar->updateActiveState(); + } } } break; @@ -748,6 +751,8 @@ void QtxWorkstackArea::focusInEvent( QFocusEvent* e ) { QFrame::focusInEvent( e ); + myBar->updateActiveState(); + emit activated( activeWidget() ); } @@ -1423,6 +1428,15 @@ void QtxWorkstackTabBar::contextMenuEvent( QContextMenuEvent* e ) emit contextMenuRequested( e->globalPos() ); } +/*! + \brief Process widget change state events (style, palette, enable state changing, etc). + \param e change event (not used) +*/ +void QtxWorkstackTabBar::changeEvent( QEvent* /*e*/ ) +{ + updateActiveState(); +} + /* void QtxWorkstackTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const { diff --git a/src/Qtx/QtxWorkstack.h b/src/Qtx/QtxWorkstack.h index 367713bf9..22425c869 100644 --- a/src/Qtx/QtxWorkstack.h +++ b/src/Qtx/QtxWorkstack.h @@ -326,6 +326,7 @@ protected: virtual void mousePressEvent( QMouseEvent* ); virtual void mouseReleaseEvent( QMouseEvent* ); virtual void contextMenuEvent( QContextMenuEvent* ); + virtual void changeEvent( QEvent* ); // virtual void paintLabel( QPainter*, const QRect&, QTab*, bool ) const; diff --git a/src/Style/Style_Salome.cxx b/src/Style/Style_Salome.cxx index ceb378a71..b4ca90b5e 100644 --- a/src/Style/Style_Salome.cxx +++ b/src/Style/Style_Salome.cxx @@ -159,6 +159,17 @@ static const char* const minimize_xpm[] = { "............" }; +/////////////////////////////////////////////////////////// +// FOR debug purposes only!!! +// +const int DEBUG_LEVEL = 0; + +static bool checkDebugLevel( int level ) +{ + return DEBUG_LEVEL == level; +} +// +/////////////////////////////////////////////////////////// Style_Salome::Style_Salome() : QWindowsStyle() @@ -192,12 +203,22 @@ void Style_Salome::updateSettings( QApplication* app ) 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() ) { @@ -214,6 +235,11 @@ void Style_Salome::polish ( QWidget* w ) void Style_Salome::unpolish( QWidget* w ) { + if ( checkDebugLevel(3) ) { + QWindowsStyle::unpolish( w ); + return; + } + if ( w && hasHover() ) { if ( qobject_cast(w) || qobject_cast(w)|| qobject_cast(w) || qobject_cast(w) || @@ -227,8 +253,13 @@ void Style_Salome::unpolish( QWidget* 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: @@ -591,6 +622,11 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp 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(opt)) { @@ -1302,6 +1338,11 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* 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 ) { @@ -1758,6 +1799,10 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, 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: { @@ -1785,6 +1830,10 @@ int Style_Salome::pixelMetric( PixelMetric metric, const QStyleOption* opt, 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: @@ -1830,6 +1879,10 @@ QSize Style_Salome::sizeFromContents( ContentsType ct, const QStyleOption* opt, 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: @@ -1850,6 +1903,10 @@ QIcon Style_Salome::standardIconImplementation( StandardPixmap standardIcon, const QStyleOption* opt, const QWidget* widget ) const { + if ( checkDebugLevel(10) ) { + return QWindowsStyle::standardIconImplementation( standardIcon, opt, widget ); + } + switch ( standardIcon ) { case SP_MessageBoxInformation: @@ -1869,6 +1926,10 @@ QIcon Style_Salome::standardIconImplementation( StandardPixmap standardIcon, 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: { @@ -1885,8 +1946,12 @@ int Style_Salome::styleHint( StyleHint hint, const QStyleOption* opt, const QWid } 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: { @@ -1972,6 +2037,10 @@ QRect Style_Salome::subControlRect( ComplexControl cc, const QStyleOptionComplex 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(); @@ -2005,48 +2074,44 @@ QRect Style_Salome::subElementRect( SubElement se, const QStyleOption* opt, 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, @@ -2090,7 +2155,7 @@ void Style_Salome::updateAllWidgets( QApplication* app ) 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 );