Hey Bo,

Just wanted to share with you some progress.

Actually Qt makes it really simple. I was amazed I could do it with a just 5 lines of code. (Qt ROCKS!)

Right now, I just have a problem. The plugin window opens and closes perfectly. But once open, if I delete the plug in from the host and the QApplication is deleted, it crashes. Still can't figure it why.

See below my simple solution for this case. I problably know it yourself. I'm sharing it anyway.

bool IVstWrapperEditor::open(void *ptr)
{
    AEffEditor::open(ptr);

    if (!window)
    {
        window = QWindow::fromWinId((WId)ptr);

        view = new QQuickView(window);
        view->setSource(QUrl(QStringLiteral("qrc:/main.qml")));
        view->rootContext()->setContextProperty("controller", _controller);
        view->show();

        return true;
    }

    return false;
}

void IVstWrapperEditor::close()
{
    if (window)
    {
        qDebug() << "destroying view";
        view->deleteLater();
        view=0;

        qDebug() << "destroying window";
        window->deleteLater();
        window=0;
    }

    AEffEditor::close();
}

Regards,

Nuno

On 03/06/2015 11:56, Nuno Santos wrote:
In my case I have a related app which opens the plugin.

The host provides a window handle to the plugin.

I was trying to make that handle into a QWidget with the following code:

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);
}

The problem is that two windows appear, the one the host provides and the one created by QWidget.

It seems that the create call is not working as intended.

MyWindow subclasses QWidget in order to call the create method since it’s protected.

Do you have any clue why this technic isn’t working?

Thanks,

Nuno Santos
Founder / CEO / CTO
www.imaginando.pt <http://www.imaginando.pt>
+351 91 621 69 62

On 03 Jun 2015, at 11:37, Bo Thorsen <b...@vikingsoft.eu <mailto:b...@vikingsoft.eu>> wrote:

Den 03-06-2015 kl. 12:35 skrev Nuno Santos:
Thanks for sharing your code.

I will try and give some feedback.

Any thoughts regarding the initial approach? Is there any reason for you
not having followed that path?

My application inserts an overlay over a complete unrelated application (the pokerstars or bet365 poker clients actually), so this is the only approach that can work.

Bo Thorsen,
Director, Viking Software.

--
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu



_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to