QT: Reveal a wrong typecast in QtObjectFromWidgetH.

git-svn-id: trunk@48618 -
This commit is contained in:
juha 2015-04-04 10:38:05 +00:00
parent 1228e86211
commit e72d7c9c44

View File

@ -368,6 +368,7 @@ function QtObjectFromWidgetH(const WidgetH: QWidgetH): TQtWidget;
var
V: QVariantH;
Ok: Boolean;
Obj: TObject;
QtWg: TQtWidget;
begin
Result := nil;
@ -382,13 +383,17 @@ begin
begin
//Write('Got a valid variant .. ');
{$IFDEF CPU32}
QtWg := TQtWidget(QVariant_toUint(V, @Ok));
Obj := TObject(QVariant_toUint(V, @Ok));
{$ENDIF}
{$IFDEF CPU64}
QtWg := TQtWidget(QVariant_toULongLong(V, @Ok));
Obj := TObject(QVariant_toULongLong(V, @Ok));
{$ENDIF}
if OK then
begin
if not (Obj is TQtWidget) then
raise Exception.Create('QtObjectFromWidgetH: QObject_property returned '
+ 'a variant which is not TQtWidget.');
QtWg := TQtWidget(Obj);
//Write('Converted successfully, Control=');
if QtWg<>nil then
begin