[Lazarus] Embed other application window with qt5

Luca Olivetti luca at wetron.es
Tue Jun 9 10:10:15 CEST 2020


El 9/6/20 a les 9:36, zeljko ha escrit:
> On 6/9/20 9:08 AM, Luca Olivetti via lazarus wrote:
> 
>>> procedure TForm1.Button1Click(Sender: TObject);
>>> var kk:QWindowH;
>>>    cc: QWidgetH;
>>> begin
>>>    kk:=QWindow_fromWinID(StrToInt64(Edit1.text));
>>>    QWindow_setFlags(kk,QtFramelessWindowHint);
>>>    cc:=QWidget_createWindowContainer(kk);
>>>    QWidget_setParent(cc,TQtWidget(Self.Handle).Widget);
>>> end;
>>
>>
>> I also tried
>>
>>     QWidget.setParent(cc, TQTMainWindow(handle).GetContainerWidget)
>>
>> and
>>
>>     QWidget.setParent(cc, TQTMainWindow(handle).Widget)
>>
>> as well as TQTWidget(panel1.handle).widget
> 
> This works fine here (TPanel on main form, embedded google chrome ):
> 
>    AWindow := QWindow_fromWinID(PtrUInt($8600001)); // found id by xwininfo
>    AWidget := QWidget_createWindowContainer(AWindow, nil, QtWidget or 
> QtForeignWindow);
>    QWidget_setParent(AWidget, TQtWidget(Panel1.Handle).Widget);
>    QWidget_show(AWidget);
> 
> You're missing QtForeignWindow flag and QWidget_show() for container 
> widget.

Thank you!
I was also missing the QWidget_show call.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007


More information about the lazarus mailing list