[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [review] [PyKDE] Canvas in a widget
From:       Detlev Offenbach <detlev () die-offenbachs ! de>
Date:       2004-07-22 17:27:54
Message-ID: 200407221927.54318.detlev () die-offenbachs ! de
[Download RAW message or body]

Hi,

if you look for an example I could recommend eric3. The graphics module 
uses the QCanvas to show some UML like diagrams that have some 
interactivity.

Detlev

Am Donnerstag, 22. Juli 2004 18:53 schrieb Jim Bublitz:
> On Thursday 22 July 2004 01:15, Angel Lopez Muņoz wrote:
> > Hello,
> >
> > what is the better way to use a canvas inside a widget created with
> > QtDesigner??
> >
> > I have a frame waiting for the canvasView, but I don't know what
> > classes, subclasess, parents, I have to make.
>
> I haven't used QCanvas, but it looks like the process would be similar
> to other things I've done in Qt. The frame that holds the QCanvas
> should be a QCanvasView rather than something like a QFrame or
> QScrollView. QCanvasView is a descendant of both of those, so all of
> their methods and features - shape, shadow, scrollbars, etc - are
> available from QCanvasView.
>
> If you already have a canvas to display and a main widget which will
> hold the view, you would do something like:
>
>   canvasView = QCanvasView (canvas, mainWidget)
>
> From the Qt docs, it seems that to make the canvas view interactive,
> you need to subclass QCanvasView and overload some of its methods
> related to mouse events. There is a simple example in the C++ Qt docs
> which might help (the docs for QFrame and QScrollView might be useful
> too). It also appears you need to be aware of some co-ordinate
> transformations. Those features are beyond my knowledge of the
> subject.
>
> To subclass QCanvasView, all you need to do is:
>
> class CanvasView (QCanvasView):
> 	def __init__ (self, canvas, parent):  # can add more args if needed
> 	    QCanvasView.__init__ (self, canvas, parent)
>
> 	<add more init code and def new or overloaded methods here>
>
> > What I need is a place in the widget where display an image an the
> > click in it to draw some points and lines. The application must know
> > the position of the points in order to recalculate something and the
> > draw another lines... (just to be a little descriptive)
>
> Jim
>
> _______________________________________________
> PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

-- 
Detlev Offenbach
detlev@die-offenbachs.de

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic