0
votes

I'm creating application to analyze data from a device and displaying it on the screen. SDK to handling this device have function to display current frame of data in specific Window by setting window handler (HWND).

In my Qt Gui Application i'm trying display my own widget over video stream, which a DLL showing in my QGLWidget (it's set by winId function and HWND). MainWidget is a parent of QGLWidget where the data stream is displayed, and QWidget (or some graphic marker, for example Circle) should be displayed above data stream from QGLWidget.

Everything works almost perfect, but I'm getting blinking effect (twinkle effect?) - my circle widget is hidding and showing with frequency which human eye can get and i try to avoid it. The only option to eliminate that is create this circle as widget and set for its Qt::Popup flag, by it has big disadvantage - i don't have access to the rest of interface (I know, it's Popup flag fault). I've tried other options like:

  • set Qt::WindowStaysOnTopHint and few other flags,
  • create layout object which parent is QGLWidget, where i'm displaying data from device, and than set circle widget as item of layout, but here black background is shading displayed data (i've turned off even background, but i've realized that Qt can't know what is under my widget because it's handled by external library).

In documentation i found information that i can create my own directshow+COM object (or interface, am i right?) to handling video stream but i don't really know this technologies and i want avoid this option so much!

[Edit] I found that i can take current frame of data as IPictureDisp interface, but as I said earlier i don't really know COM technology. I've tried to find something about, how work with IPictureDisp but i don't have basic knowledge about COM technology. Does anybody has any good tutorial about it?

1
What isn't working? I couldn't quite figure out what the problem is. Are you trying to show a Qt widget on top of an external process? Or is a DLL showing a child HWND inside your process? Your question is a bit confusing right now, can you edit it and remove the irrelevant info, what does it matter if it's COM/DirectShow? Also, break your question into paragraphs, please.sashoalm
Thanks for advice. I've corrected my post. Now, I hope, it has information what exactly i want.Krzysztof Skrzynecki
I still don't understand what the problem is. What are you trying to achieve, and how does it fail? You don't know how to make a child QWidget or what? And don't add all the irrelevant info about what your project is, or why you need it. Just say "I want to make one QWidget the child of another"sashoalm
I try to turn off this blinking effect. It's something wrong with frequency of rendering or a DLL render this displayed data and Qt render widget separately.Krzysztof Skrzynecki

1 Answers

0
votes

Try this widget hierarchy:

MainWindget
|-QGLWidget
|-MarkerWidet

MarkerWidet should be a small square widget.

Make sure that MarkerWidet is above QGLWidget by calling MarkerWidet::raise(). But call MarkerWidet::lower() before calling MarkerWidet::raise(). Qt has an error with QWidget::raise(), this error is eliminated by calling lower(); raise();.

After starting your application check actual widget hierarchy, use Spy++ to do it. Spy++ can be found in the Visual Studio installation, or downloaded here.

Pseudocode:

MainWindget* mainWidget = new MainWindget;
QGLWidget* glWidget = new QGLWidget(mainWidget);
device->setHwnd(glWidget->winId());
mainWidget->show();
...
MarkerWidet* marker = new MarkerWidet(mainWidget);
marker->resize(30, 30);
marker->move(10, 10);
marker->lower();
marker->raise();