Hello,

While debugging the QNX platform plugin, I found out that when QWidget::winId()
is called on a non-toplevel widget, it will still use its parents
QBackingStore for rendering. Is this really the intended behavior?

This behavior is caused because ultimately, because
QWidgetPrivate::maybeBackingStore() will call QWidget::window(), which returns
the window of the toplevel widget, even if the caller widget has its own
native window, despite being a child widget, as illustrated below:

QWidget *QWidget::window() const
{
    QWidget *w = (QWidget *)this;
    QWidget *p = w->parentWidget();
    while (!w->isWindow() && p) {
        w = p;
        p = p->parentWidget();
    }
    return w;
}

If this is not the intended behavior, but rather a bug, checking for
Qt::WA_NativeWindow on the while condition should fix the problem, although I
do not have enough knowledge to be sure this wouldn't break other platforms.

Context: On QNX, every window needs to have its own buffer, even child windows. 
In this
context, I would expect the widget on which windId() has been called to be
able to draw to its own backing store, instead of its parent's.


Any thoughts?

Regards,
Rafael

-- 
Rafael Roquetto | [email protected] | Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to