(Qt): Revert QtObjectFromWidgetH onto previous position - cannot compile qt interface under linux (fpc-2.2.0, fpc-2.0.4, fpc-2.1.5)

git-svn-id: trunk@12126 -
This commit is contained in:
zeljko 2007-09-22 07:22:05 +00:00
parent 7c7e12c77b
commit f15ac6be4d
2 changed files with 39 additions and 40 deletions

View File

@ -191,6 +191,43 @@ begin
end;
function QtObjectFromWidgetH(const WidgetH: QWidgetH): TQtWidget;
var
V: QVariantH;
Ok: Boolean;
QtWg: TQtWidget;
begin
Result := nil;
V := QVariant_Create();
try
QObject_property(QObjectH(WidgetH), V, 'lclwidget');
if not QVariant_IsNull(v) and QVariant_isValid(V) then
begin
//Write('Got a valid variant .. ');
{$IFDEF CPU32}
QtWg := TQtWidget(QVariant_toUint(V, @Ok));
{$ENDIF}
{$IFDEF CPU64}
QtWg := TQtWidget(QVariant_toULongLong(V, @Ok));
{$ENDIF}
if OK then
begin
//Write('Converted successfully, Control=');
if QtWg<>nil then
begin
Result := QtWg;
//WriteLn(Result.LCLObject.Name);
end else
;//WriteLn('nil');
end else
;//WriteLn('Can''t convert to UINT');
end else
;//Writeln('GetFocus: Variant is NULL or INVALID');
finally
QVariant_Destroy(V);
end;
end;
{$I qtobject.inc}
{$I qtwinapi.inc}
{$I qtlclintf.inc}

View File

@ -23,7 +23,7 @@
* *
*****************************************************************************
}
unit QTProc;
unit qtproc;
{$mode objfpc}{$H+}
@ -35,51 +35,13 @@ uses
{$else}
qt4,
{$endif}
GraphType, QtWidgets;
GraphType;
procedure FillStandardDescription(var Desc: TRawImageDescription);
function GetUtf8String(S: String): WideString;
function QtObjectFromWidgetH(const WidgetH: QWidgetH): TQtWidget;
implementation
function QtObjectFromWidgetH(const WidgetH: QWidgetH): TQtWidget;
var
V: QVariantH;
Ok: Boolean;
QtWg: TQtWidget;
begin
Result := nil;
V := QVariant_Create();
try
QObject_property(QObjectH(WidgetH), V, 'lclwidget');
if not QVariant_IsNull(v) and QVariant_isValid(V) then
begin
//Write('Got a valid variant .. ');
{$IFDEF CPU32}
QtWg := TQtWidget(QVariant_toUint(V, @Ok));
{$ENDIF}
{$IFDEF CPU64}
QtWg := TQtWidget(QVariant_toULongLong(V, @Ok));
{$ENDIF}
if OK then
begin
//Write('Converted successfully, Control=');
if QtWg<>nil then
begin
Result := QtWg;
//WriteLn(Result.LCLObject.Name);
end else
;//WriteLn('nil');
end else
;//WriteLn('Can''t convert to UINT');
end else
;//Writeln('GetFocus: Variant is NULL or INVALID');
finally
QVariant_Destroy(V);
end;
end;
{------------------------------------------------------------------------------
Function: FillStandardDescription
Params: