From 44957ef52dbee2d886358aaea7b0a814c1f739ac Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Fri, 15 Apr 2011 08:55:52 +0000 Subject: [PATCH] 2011-04-15 01:52 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbxbp/xbpwindow.prg ! Depricated: setting fore/background colors of a part via style sheet which was raising some issues. It needs further rationalization as well for some type of components. --- harbour/ChangeLog | 6 +++ harbour/contrib/hbxbp/xbpwindow.prg | 59 +++++------------------------ 2 files changed, 16 insertions(+), 49 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c8e153e727..a0094ac752 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,12 @@ The license applies to all entries newer than 2009-04-28. */ +2011-04-15 01:52 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbxbp/xbpwindow.prg + ! Depricated: setting fore/background colors of a part via + style sheet which was raising some issues. It needs further + rationalization as well for some type of components. + 2011-04-15 10:21 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * include/harbour.hbx + added HB_MUTEXEVAL diff --git a/harbour/contrib/hbxbp/xbpwindow.prg b/harbour/contrib/hbxbp/xbpwindow.prg index 8ad563d19c..8dcfaa1dcd 100644 --- a/harbour/contrib/hbxbp/xbpwindow.prg +++ b/harbour/contrib/hbxbp/xbpwindow.prg @@ -894,66 +894,27 @@ STATIC FUNCTION Xbp_RgbToName( nRgb ) /*----------------------------------------------------------------------*/ METHOD XbpWindow:setColorBG( nRGB ) - LOCAL oldRGB, cName, cQTName + LOCAL oldRGB := hbxbp_SetPresParam( ::aPresParams, XBP_PP_BGCLR, nRGB ) + LOCAL oPalette - cName := Xbp_RgbToName( nRGB ) - - IF hb_isNumeric( nRGB ) - oldRGB := hbxbp_SetPresParam( ::aPresParams, XBP_PP_BGCLR, nRGB ) - cQTName := Xbp_XbpToQTName( __ObjGetClsName( self ) ) - - IF empty( cQTName ) - ::setStyleSheet( "background-color: "+ cName +";" ) - ELSE - ::setStyleSheet( "background-color: "+ cName +";" ) - ENDIF - ELSE - oldRGB := hbxbp_SetPresParam( ::aPresParams, XBP_PP_BGCLR ) - ENDIF + oPalette := ::oWidget:palette() + oPalette:setColor( QPalette_Window, QColor( nRGB ) ) + ::oWidget:setPalette( oPalette ) RETURN oldRGB /*----------------------------------------------------------------------*/ METHOD XbpWindow:setColorFG( nRGB ) - LOCAL oldRGB, cName + LOCAL oldRGB := hbxbp_SetPresParam( ::aPresParams, XBP_PP_FGCLR, nRGB ) + LOCAL oPalette - cName := Xbp_RgbToName( nRGB ) - - IF hb_isNumeric( nRGB ) - oldRGB := hbxbp_SetPresParam( ::aPresParams, XBP_PP_FGCLR, nRGB ) - ::setStyleSheet( "color: "+ cName +";" ) - ELSE - oldRGB := hbxbp_SetPresParam( ::aPresParams, XBP_PP_FGCLR ) - ENDIF + oPalette := ::oWidget:palette() + oPalette:setColor( QPalette_WindowText, QColor( nRGB ) ) + ::oWidget:setPalette( oPalette ) RETURN oldRGB - #if 0 - LOCAL cClass := __ObjGetClsName( self ) - - IF hb_isNumeric( nRGB ) - IF empty( ::oPalette ) - ::oPalette := ::oWidget:palette() - ENDIF - - DO CASE - CASE cClass $ 'XBPPUSHBUTTON,XBPMENUBAR,XBPMENU,XBPTOOLBAR,XBPTABPAGE' - ::oPalette:setColor( QPalette_ButtonText, QColor( nRGB ) ) - OTHERWISE - ::oPalette:setColor( QPalette_Foreground, QColor( nRGB ) ) - ::oPalette:setColor( QPalette_Text , QColor( nRGB ) ) - ENDCASE - - ::oWidget:setPalette( ::oPalette ) - ENDIF - - LOCAL oColor := QColor( nRGB ) - hbxbp_SetPresParam( ::aPresParams, XBP_PP_FGCLR, nRGB ) - ::setStyleSheet( "color: "+ oColor:name +";" ) - RETURN Self - #endif - /*----------------------------------------------------------------------*/ METHOD XbpWindow:setFont( oFont )