[Lazarus] Embed other application window with qt5

zeljko zeljko at holobit.net
Tue Jun 9 09:36:00 CEST 2020


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.


zeljko


More information about the lazarus mailing list