Support #3797
closedEmbedding a canvas from an external c++ Libraries
0%
Description
Hi
I am new in Wt and would like to ask the developper how can
one embedd a canvas from an c external Library. In Qt i was
using QtEmbeddedCanvas class but is there something similar in Wt?
Thanks in advance
Updated by Koen Deforche about 9 years ago
- Status changed from New to Feedback
Hey,
Not sure what you are aiming for --- I couldn't find any documentation on QtEmbeddedCanvas?
Koen
Updated by denis Bertini about 9 years ago
Yes Sorry, indeed this class QtEmbeddedCanvas does not exist in Qt.
But let me explain what i would like to do.
I have an external Library that i use for visualizing data in an interactive mode ( histograms, graphs plot etc ... ) .
This Library rely on the system graphics libraries ( X11 for example in the case of Linux )
Now i would like to have this graphics ( histogram etc ... ) rendered within Wt in a browser WITH the possibility to
interact with the graphic i.e. with handling of events.
In Qt i have create a QMainWindow as a dialog box for all events , puts inside my Canvas implementation defined as a central Widget (QWidget ).
Additionally i have created to handle the event a customised MainApplication with uses the main Qt event loop class ( QApplication )
The question: would it be possible to to this with a canvas derived WtWidget and a customised application that uses the main WtApplication ?
Thanks for hints.
Denis
Updated by Wim Dumon about 9 years ago
Hey,
The general strategy to port this quickly to the web is to keep rendering server-side, and forward interactions (panning, zooming, ...) from the client to the server so that the server can render the new image.
Things you might use for this: WPaintedWidget, or a WMemoryResource/WImage combination, with mouse handlers for the interactions that you want to allow. The quickest way to port is probably to keep your rendering as it is now, in a Qt canvas, convert that canvas to a PNG, and put that PNG in a WMemoryResource. Then show the picture with a WImage linked to the WMemoryResource.
Depending on the exact kind of interaction you need, Wt may have some classes that are more appropriate for your use case. Take e.g. a look at the mandelbrot example for panning/zooming.
BR,
Wim.
Updated by denis Bertini about 9 years ago
Hi
Ok i see. How this prepared image sending back and forth from server to client will then perform ?
Do you have some experience of such image based embedded graphics ?
ciao
Denis
Updated by Wim Dumon about 9 years ago
It depends on the quality of the link, you can have tens of updates per second on a local network.
I refer you to the mandelbrot example for an example of server-calculated images that are shown on the client side.
BR,
Wim.
Updated by Koen Deforche about 9 years ago
- Status changed from Feedback to Resolved
- Assignee set to Wim Dumon
Updated by Koen Deforche about 9 years ago
- Status changed from Resolved to Closed