Sunday, June 28, 2009

Qt4 Canvas Plugins

Today, during my Sunday morning bike trip I've had an Idea on how to simply implement a Canvas Plugins in Qt Applications, to give you an idea of How browser external plugins like flash or others works. The Code is really simple there's a class CanvasPlugin with a couple of Abstract Methods Init, UnInit, Resize, MouseEvent and a signal that says "Hey, Paint this Image!". To give you an Idea of the result below you can see a Window with two Widgets, a CanvasPluginViewer and a Label. Canvas Plugin Viewer load an external Library (.so) passed to the command line as first argument.

You can interact with the canvas like a normal widget (the red square moves along the window and you can stop and resume its animation). But you can extend the sample sending and receiving information from a server, or you can do other crazy external things. (See flash usage for more ideas).

That's all folks, it's lunch time. If you've any question send me a mail or write a comment, and remember that this is just a couple of minutes coded example, so don't use in your highly stable app. :)

The Source Code is Available Here: Qt4 Canvas Plugins Source Code.

No comments:

Post a Comment