diff --git a/lcl/interfaces/qt/qtint.pp b/lcl/interfaces/qt/qtint.pp index 569392bb3f..f6a26eaba3 100644 --- a/lcl/interfaces/qt/qtint.pp +++ b/lcl/interfaces/qt/qtint.pp @@ -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} diff --git a/lcl/interfaces/qt/qtproc.pp b/lcl/interfaces/qt/qtproc.pp index 904d06bb45..3ac0a3187c 100644 --- a/lcl/interfaces/qt/qtproc.pp +++ b/lcl/interfaces/qt/qtproc.pp @@ -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: