View Issue Details

IDProjectCategoryView StatusLast Update
0026607LazarusWidgetsetpublic2014-08-29 21:09
ReporterVojtech CihakAssigned ToZeljan Rikalo 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformamd64OSLinuxOS VersionChakra 64-bit
Product Version1.3 (SVN)Product Build46048 
Target VersionFixed in Version1.3 (SVN) 
Summary0026607: Color of Panel [Qt]
DescriptionThis is partially design-time issue. Color of TPanel cannot be changed in run-time (and panel is transparent) when panel is new and had never other color than clDefault. Color of TPanel cannot be changed in design-time too.
Steps To Reproduce1) Issue no. 1
Run demo. Panel is transparent and its color cannot be changed.

If it does not work (i.e. panel is not transparent and its color can be changed) then:
stop demo
delete panel
place new panel on its place
run demo again.

2) Issue no. 2
Design-time
Try to change color in OI. It does not work.
Run demo. Project now starts with correct color.
Additional InformationLazarus 1.3 r46048M FPC 2.7.1 x86_64-linux-qt
TagsNo tags attached.
Fixed in Revision46089
LazTarget1.2.6
WidgetsetQT
Attached Files
  • Panel_Color.zip (5,972 bytes)
  • qt_custompanel_color.diff (1,420 bytes)
    Index: lcl/interfaces/qt/qtobjects.pas
    ===================================================================
    --- lcl/interfaces/qt/qtobjects.pas	(revision 46078)
    +++ lcl/interfaces/qt/qtobjects.pas	(working copy)
    @@ -779,7 +779,7 @@
         destructor Destroy; override;
         procedure ReloadPaletteBegin; // used in QEventPaletteChange !
         procedure ReloadPaletteEnd; // used in QEventPaletteChange !
    -    procedure setColor(const AColor: PQColor); overload;
    +    procedure setColor(const AColor: PQColor);
         procedure setTextColor(const AColor: PQColor);
         property Handle: QPaletteH read FHandle;
         property CurrentColor: TQColor read FCurrentColor;
    Index: lcl/interfaces/qt/qtwinapi.inc
    ===================================================================
    --- lcl/interfaces/qt/qtwinapi.inc	(revision 46078)
    +++ lcl/interfaces/qt/qtwinapi.inc	(working copy)
    @@ -2412,7 +2412,14 @@
       begin
         AWidget := HwndFromWidgetH(QtDC.Parent);
         if (AWidget <> 0) and Assigned(TQtWidget(AWidget).LCLObject) then
    +    begin
           ATransparent := not (csOpaque in TQtWidget(AWidget).LCLObject.ControlStyle);
    +      // issue #26607
    +      if ATransparent and (TQtWidget(AWidget).LCLObject is TCustomPanel) and
    +        (TQtWidget(AWidget).LCLObject.Color <> clDefault) and
    +        not TCustomPanel(TQtWidget(AWidget).LCLObject).ParentColor then
    +          ATransparent := False;
    +    end;
       end;
     
       case Style of
    

Activities

Vojtech Cihak

2014-08-18 12:16

reporter  

Panel_Color.zip (5,972 bytes)

Zeljan Rikalo

2014-08-27 13:51

developer   ~0076744

Reproducable on 32bit too, but only when I delete panel and create new one.

Zeljan Rikalo

2014-08-27 20:23

developer   ~0076750

To get transparent panel in runtime: Panel1.ControlStyle := Panel1.ControlStyle - [csOpaque]; in attached example.

Zeljan Rikalo

2014-08-29 14:16

developer  

qt_custompanel_color.diff (1,420 bytes)
Index: lcl/interfaces/qt/qtobjects.pas
===================================================================
--- lcl/interfaces/qt/qtobjects.pas	(revision 46078)
+++ lcl/interfaces/qt/qtobjects.pas	(working copy)
@@ -779,7 +779,7 @@
     destructor Destroy; override;
     procedure ReloadPaletteBegin; // used in QEventPaletteChange !
     procedure ReloadPaletteEnd; // used in QEventPaletteChange !
-    procedure setColor(const AColor: PQColor); overload;
+    procedure setColor(const AColor: PQColor);
     procedure setTextColor(const AColor: PQColor);
     property Handle: QPaletteH read FHandle;
     property CurrentColor: TQColor read FCurrentColor;
Index: lcl/interfaces/qt/qtwinapi.inc
===================================================================
--- lcl/interfaces/qt/qtwinapi.inc	(revision 46078)
+++ lcl/interfaces/qt/qtwinapi.inc	(working copy)
@@ -2412,7 +2412,14 @@
   begin
     AWidget := HwndFromWidgetH(QtDC.Parent);
     if (AWidget <> 0) and Assigned(TQtWidget(AWidget).LCLObject) then
+    begin
       ATransparent := not (csOpaque in TQtWidget(AWidget).LCLObject.ControlStyle);
+      // issue #26607
+      if ATransparent and (TQtWidget(AWidget).LCLObject is TCustomPanel) and
+        (TQtWidget(AWidget).LCLObject.Color <> clDefault) and
+        not TCustomPanel(TQtWidget(AWidget).LCLObject).ParentColor then
+          ATransparent := False;
+    end;
   end;
 
   case Style of

Zeljan Rikalo

2014-08-29 14:16

developer   ~0076775

Please test with attached patch.

Vojtech Cihak

2014-08-29 16:09

reporter   ~0076779

I tested (64-bit). It looks good.

This: Panel1.ControlStyle := Panel1.ControlStyle - [csOpaque];
works only with clDefault, I guess it is correct.

Zeljan Rikalo

2014-08-29 20:34

developer   ~0076784

Please test and close if ok.

Vojtech Cihak

2014-08-29 21:09

reporter   ~0076786

I tested with r.46089. Thanks.

Issue History

Date Modified Username Field Change
2014-08-18 12:16 Vojtech Cihak New Issue
2014-08-18 12:16 Vojtech Cihak File Added: Panel_Color.zip
2014-08-27 13:45 Zeljan Rikalo Assigned To => Zeljan Rikalo
2014-08-27 13:45 Zeljan Rikalo Status new => assigned
2014-08-27 13:51 Zeljan Rikalo LazTarget => -
2014-08-27 13:51 Zeljan Rikalo Note Added: 0076744
2014-08-27 13:51 Zeljan Rikalo Status assigned => confirmed
2014-08-27 20:23 Zeljan Rikalo Note Added: 0076750
2014-08-29 14:16 Zeljan Rikalo File Added: qt_custompanel_color.diff
2014-08-29 14:16 Zeljan Rikalo Note Added: 0076775
2014-08-29 14:16 Zeljan Rikalo Status confirmed => feedback
2014-08-29 16:09 Vojtech Cihak Note Added: 0076779
2014-08-29 16:09 Vojtech Cihak Status feedback => assigned
2014-08-29 20:34 Zeljan Rikalo Fixed in Revision => 46089
2014-08-29 20:34 Zeljan Rikalo LazTarget - => 1.2.6
2014-08-29 20:34 Zeljan Rikalo Note Added: 0076784
2014-08-29 20:34 Zeljan Rikalo Status assigned => resolved
2014-08-29 20:34 Zeljan Rikalo Fixed in Version => 1.3 (SVN)
2014-08-29 20:34 Zeljan Rikalo Resolution open => fixed
2014-08-29 21:09 Vojtech Cihak Note Added: 0076786
2014-08-29 21:09 Vojtech Cihak Status resolved => closed