Qt 5. paintEngine() paintEvent() with OCC 6.6.0

Hi again.

I tried to migrate from Qt 4.x to 5.1.1 (project uses OCC).

Seems that there is some issue with migrating:

The first stage.
If I implement virtual paintEngine() function in my derived QWidget class like this.
QPaintEngine *OCCWidget::paintEngine() const
return NULL;

We shall see an access violation in TKV3d.dll while any use of the viewer OCC object.
It happens because of "common" init() function call like in Qt samples in this OCC distrib does not occur.
The last happens because of paintEvent() handler call does not occur in this stage.

The second stage.
If we do not override paintEngine() function in our widget class everething work fine.

But often the widget content is invalid (it shows background widget color instead of proper OCC content).
This stage is exact like implement it in Qt 4.x.

It is a pity that the stage No.1 does not work like with Qt 4.x :(.

I try to solve it.

Any ideas?

Dmitry Kidyaev's picture

I have solved it.

I looked through QGLWidget source.
We need to specify QWidget(parent, Qt::MSWindowsOwnDC) QWidget constructor.

It works fine :).

Daniel Park's picture

Hi Dmitry,
Have you had problems with selection (faces, edges ect) ?

Dmitry Kidyaev's picture

Not yet. Faces and edges select properly.
What kind of problem do you have with it?

The obviously problem: missing ExactHLR mode in 6.6.0.
I suppose that the only way to show/hide edges now is to remove/add it from/to context dynamically :(.