Is there a way to disable AIS_ViewController?

Hi,

I use AIS_ViewController in a Qt-Widget with stacked layout (like GeomWidget), but all other pages are Qt only stuff.
On switching through all pages, when a Qt-page is activated the second time, event-handling for Qt is not working any more (see attached image). Looks like occ is "steeling" some events.
Tree- and Tablewidgets are not able to paint their content and pages get no focus on mouse click.

After getting these issues with stacked layout I tried to create my own widget, where I handle pages with GridLayout - but the same happens.

... and when I switch back to AIS_ViewController, I can't repaint the content. Update() and Repaint() don't work.

Attachments: 
Kirill Gavrilov's picture

I don't think that AIS_ViewController could possibly do anything with your problem - it is just a passive receiver of input events passed from application code, it doesn't know anything about platform-specific APIs nor setup/overrides any callbacks on it's own.

The problem I guess is due to the way how OpenGL viewer is integrated into your Qt application - using QGLWidget (obsolete and limited), QOpenGLWidget (more flexible, intended for better integration with other Qt Widgets) or directly QWidget (similar to QGLWidget, but taking responsibility for OpenGL setup).

DjangoReinhard's picture

Thank you for your attention!

I followed the Qt-Sample Application from occ (OcctOverview), but I stripped all 2D stuff and put the code from ApplicationCommon into Qt-mainwindow class. Apart from that, almoust everything is the same as in OcctOverview.

I thought about AIS_ViewController, as this class has the event-handling for mouse events.
The problem is, I'm new to Qt and new to occ - I know gui programming from java world, whatever it is worth ...
From Qt I read, that if an eventhandler issues event->accept() no other eventhandler receives the event.

It was my hope, that this could be the source of my problems. May be I'm wrong with suspecting AIS_ViewController, but the problem is definitively sourced by occ window classes - which means, if I remove occ-window from stack, rest of pages have no problems with painting or focus change.

Kirill Gavrilov's picture

I would guess that the issue is related to native window management by used widgets, so that setting Qt::WA_NativeWindow flag to 3D Viewer widget might help. Maybe users with deeper Qt Widgets experience would share more hints, but I guess sharing some reproducible code could be insightful.

DjangoReinhard's picture

That did the trick! Thank you VERY much for your help.
I'll check transparency issue too. May be that works this way too.

Kirill Gavrilov's picture

If you would show a code snippet and description on how you have modified your code to solve the problem, then it might be helpful to others. If it has no side effects, the fix might be also included into OCCT samples.

DjangoReinhard's picture

Ok, the constructor of View class (View.cxx) already contains two times

setAttribute(Qt::WA_PaintOnScreen);
setAttribute(Qt::WA_NoSystemBackground);

I added the new attribute to the first occurrence so its now:

setAttribute(Qt::WA_PaintOnScreen);
setAttribute(Qt::WA_NoSystemBackground);
setAttribute(Qt::WA_NativeWindow);