[Interest] Showing QGuiApplication/QML application on a given HWND ref.
Nuno Santos
nunosantos at imaginando.pt
Wed Jun 3 11:03:56 CEST 2015
Hamish,
Thanks for you reply.
Create method exists but it's protected. From what I have been googling
around this is something new in Qt 5. Previous version seem to had this
method public. In order to access it, I have subclassed QWidget. In the
constructor of the window i'm passing the window ptr and casting it to
HWND. Then I use it within the create method, casted to WId.
The problem is that two windows are being created, thus, QWidget is not
taking over the give window pointer. Any ideas why this happen?
MyWindow::MyWindow(void* ptr) :
QWidget(0)
{
HWND w = (HWND) ptr;
setGeometry(QRect(0,0,640,480));
QPalette Pal(palette());
// set black background
Pal.setColor(QPalette::Background, Qt::black);
setAutoFillBackground(true);
setPalette(Pal);
create((WId)w, false, false);
}
Thanks,
Nuno
On 03/06/2015 08:00, Hamish Moffatt wrote:
> On 03/06/15 16:56, Nuno Santos wrote:
>> Hi,
>>
>> When we start a new QGuiApplication, it handles the Window creation on each platform.
>>
>> Now imagine that someone would give us a window ref and we wanted to put our Qt application running on it.
>>
>> Is this possible?
>>
>> I’m building a plugin for an host program that provides the window for the plugin to be shown, but Qt already opens an window.
>>
>> Apparently it is not possible to control if that window is provide or not. It seems to be always provided.
>>
>>
> I think QWidget::create() is for this purpose. It takes a WId (which is
> an HWND on Windows) where you can supply the window reference you've
> been given.
>
> I haven't tried it. Good luck.
>
> Hamish
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list