qt: correctly handle HICON = 0

git-svn-id: trunk@15502 -
This commit is contained in:
paul 2008-06-21 13:24:37 +00:00
parent 453ea8d582
commit f4e7288ff8
2 changed files with 16 additions and 5 deletions

View File

@ -219,13 +219,17 @@ end;
procedure TQtWidgetSet.AppSetIcon(const AIcon: HICON);
var
Icon: TQtIcon;
DoDestroyIcon: Boolean;
Icon: QIconH;
begin
Icon := TQtIcon(AIcon);
if Icon <> nil then
QApplication_setWindowIcon(Icon.Handle)
DoDestroyIcon := AIcon = 0;
if DoDestroyIcon then
Icon := QIcon_create()
else
QApplication_setWindowIcon(nil);
Icon := TQtIcon(AIcon).Handle;
QApplication_setWindowIcon(Icon);
if DoDestroyIcon then
QIcon_destroy(Icon);
end;

View File

@ -2751,8 +2751,15 @@ begin
end;
procedure TQtWidget.setWindowIcon(AIcon: QIconH);
var
DestroyIcon: Boolean;
begin
DestroyIcon := AIcon = nil;
if DestroyIcon then
AIcon := QIcon_create();
QWidget_setWindowIcon(Widget, AIcon);
if DestroyIcon then
QIcon_destroy(AIcon);
end;
function TQtWidget.windowFlags: QtWindowFlags;