Qt: fix TQtAbstractItemView should use QPaletteBase; Convert colors using QColor_fromRGB() in qtobjects.ColorRefToQColor()

git-svn-id: trunk@16621 -
This commit is contained in:
zeljko 2008-09-17 13:29:26 +00:00
parent 230ec832ef
commit 36729ad9c3
2 changed files with 30 additions and 9 deletions

View File

@ -2236,15 +2236,7 @@ end;
procedure ColorRefToTQColor(const AColorRef: TColorRef; var AColor:TQColor);
begin
AColor.r:=(AColorRef and $ff);
AColor.r:=AColor.r+(AColor.r shl 8);
AColor.g:=(AColorRef and $ff00);
AColor.g:=AColor.g+(AColor.g shr 8);
AColor.b:=(AColorRef and $ff0000) shr 8;
AColor.b:=AColor.b+(AColor.b shr 8);
AColor.ColorSpec := Ord(QColorRGB);
AColor.Alpha := 65535;
AColor.Pad := 0;
QColor_fromRgb(@AColor, Red(AColorRef),Green(AColorRef),Blue(AColorRef));
end;
procedure DebugRegion(const msg: string; Rgn: QRegionH);

View File

@ -824,6 +824,9 @@ type
procedure signalViewportEntered; cdecl; virtual;
procedure AttachEvents; override;
procedure DetachEvents; override;
procedure SetColor(const Value: PQColor); override;
procedure setTextColor(const Value: PQColor); override;
function itemViewViewportEventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl; virtual;
public
procedure clearSelection;
@ -8795,6 +8798,32 @@ begin
inherited DetachEvents;
end;
procedure TQtAbstractItemView.SetColor(const Value: PQColor);
var
Palette: QPaletteH;
begin
Palette := QPalette_create(QWidget_palette(Widget));
try
QPalette_setColor(Palette, QPaletteBase, Value);
QWidget_setPalette(Widget, Palette);
finally
QPalette_destroy(Palette);
end;
end;
procedure TQtAbstractItemView.setTextColor(const Value: PQColor);
var
Palette: QPaletteH;
begin
Palette := QPalette_create(QWidget_palette(Widget));
try
QPalette_setColor(Palette, QPaletteText, Value);
QWidget_setPalette(Widget, Palette);
finally
QPalette_destroy(Palette);
end;
end;
function TQtAbstractItemView.itemViewViewportEventFilter(Sender: QObjectH;
Event: QEventH): Boolean; cdecl;
begin