[Interest] how exactly do you replace Qt4's QWidget::create(WId, ...) ?
Sze Howe Koh
szehowe.koh at gmail.com
Mon Aug 10 00:51:15 CEST 2020
On Mon, 10 Aug 2020 at 00:53, René J.V. Bertin <rjvbertin at gmail.com> wrote:
>
> Hi,
>
> According to the documentation, where in Qt4/X11 one could create a "foreign" QWidget with QWidget::create(WId id, ...), in Qt5 one has to do something like
>
> externalWindow = QWindow::fromWinId(id);
> if (externalWindow) {
> externalParent = externalWindow->parent();
> theWidget = QWidget::createWindowContainer(externalWindow);
> }
>
> (with externalParent required to reparent externalWindow before destroying the container).
>
> Except that when I do this, I get 2 windows (neither of which will show my content), and the original window gets resized even when I take care not to ask for that (not directly at least).
>
> I also see a series of
>
> QWidget::paintEngine: Should no longer be called
> QPainter::begin: Paint device returned engine == 0, type: 1
>
> on the terminal which I don't see if I just create a new QWidget .
>
> I guess I must be missing something?
I haven't seen the symptoms that you've described, but I've seen other
weirdness with QWidget::createWindowContainer() on foreign windows:
https://bugreports.qt.io/browse/QTBUG-40320
I don't think they've ever been resolved in Qt 5.
> Thanks,
> R.
>
> PS: goal here is to convert an old KDE4 screensaver to Qt5 - a cute project for a steamy sunday afternoon ;)
Regards,
Sze-Howe
More information about the Interest
mailing list