[Interest] replacing QWidget::create() in Qt5

René J.V. Bertin rjvbertin at gmail.com
Mon Mar 6 22:33:39 CET 2017


Hello,

I understand that it is no longer possible to use QWidget::create() with the same result under Qt5 but it's not clear to me how convert the following kind of code (not mine so I may not understand it perfectly):

class Foo : public QWidget;

Foo:Foo(WId id)
	: QWidget()
{
    if (id) {
        create( id, false, true );
    }
}

>From what I understand this allows to subclass QWidget and still create an instance of this new class from an arbitrary WId (an X11 Window in this case).

The Qt5 replacement 

QWidget::fromWindowContainer(QWindow::fromWinId(id))

creates a new QWidget which would then have to be converted to an instance of the child class, but how?

Thanks!

R.



More information about the Interest mailing list