mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 00:40:18 +02:00
(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:
parent
7c7e12c77b
commit
f15ac6be4d
@ -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}
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user