coin3d / soqt

Old Coin GUI binding for Qt, replaced by Quarter
BSD 3-Clause "New" or "Revised" License
22 stars 17 forks source link

Qt6: SoQt has some serious issues when used in Qt6 application - use Quarter instead #79

Open githubuser0xFFFF opened 2 months ago

githubuser0xFFFF commented 2 months ago

We used an SoQt based viewer in our Qt5 application and now switched to Qt6. We noticed some strange issues with SoQt and switched to Quarter as our new viewer. With Quarter we do not see these problems in Qt6.

We use the SoQt viewer in an application that uses dock widgets, that means the SoQt viewer will get reparented when docking and undocking widgets. This causes application crashs and the following issue:

grafik

Normally the filesystem Auto-Hide widget (1) should be in front of the docked widgets below. While this works properly for the window decoration of the SoQt viewer widget (2), the SoQt widget scene content (2) will be painted in front of the filesystem widget. This does not happen with Qt5 version of SoQt. This does also not happen with the Quarter based viewer (3) with the yellow cone.

That means we see crashes when docking / undocking SoQt widgets and we see paint artefacts with SoQt but Quarter viewer works perfectl - therefore we switched to quarter.

If somenoe would like to see and to reproduce the issue, then do the following steps:

Now you can create multiple SoQt viewers (Create Coin3D Viewer), Quarter viewers (Create Quarter Viewer) to test this.

VolkerEnderlein commented 4 weeks ago

Thanks for reporting this issue.

I just checked with Qt6 and direct reparenting, as you tried in QtADS, does not work in the current SoQt version. But indirect reparenting via an additional QWidget and setting that as parent of the SoQtExaminerViewer works, see following snippet:

    auto w = new QWidget(this);
    auto Viewer = new SoQtExaminerViewer(w, nullptr, true, SoQtFullViewer::BUILD_ALL);
    Viewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_BLEND);
    Viewer->setAnimationEnabled(false);
    Viewer->setFeedbackVisibility(true);
    Viewer->setSampleBuffers(4);
    Viewer->setSceneGraph(Root);
    //d->Viewer->setBackgroundColor(toSbColor(QColor(38, 38, 38)));
    auto DockWidget = new ads::CDockWidget(QString("Coin3D Viewer %1").arg(Coin3DWidgetCount++));
    DockWidget->setIcon(svgIcon(":/adsdemo/images/category.svg"));
    DockWidget->setWidget(w, ads:: CDockWidget::ForceNoScrollArea);

I see that more a work around than a solution, and think we are not connecting to a signal, that is sent when the base widget is reparented. Maybe that handling changed in Qt6 or the QOpenGLWidget does behave different. Keep up the good work.

githubuser0xFFFF commented 4 weeks ago

Hi Volker, thank you for investigating this. The solution of inserting the SoQtExaminerViewer into another QWidget is a nice work around.