[PyQt] Converting C++ to Python
Rajeev J Sebastian
rajeev.sebastian at gmail.com
Thu Sep 20 15:10:59 BST 2007
Hi Phil,
Thanks for the response, but I would like some clarification:
I should do
if (self.textInteractionFlags() & QtCore.Qt.TextEditable):
... do some stuff ...
is that correct ?
Also, I have another question.
In the diagramscene app, in the QGraphicsScene subclass, I do the following:
for item in self.items():
print item
Which prints the following:
<PyQt4.QtGui.QGraphicsItem object at 0xa7a7a0ac>
<__main__.DiagramItem object at 0xa7a7acac>
<__main__.DiagramItem object at 0xa7a7abac>
<__main__.Arrow object at 0xa7a7ad2c>
The problem is that the first element *should* actually be a
<__main__.DiagramTextItem> rather than a QGraphicsItem.
(DiagramTextItem is a subclass of QGraphicsTextItem).
In other words, for some reason, python subclasses of
QGraphicsTextItem arent recognized correctly when the same are
returned from C++.
I can see that QGraphicsTextItem gets some special treatment in the
.sip files ... would this affect its use ?
Regards
Rajeev J Sebastian
On 9/20/07, Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
> On Thursday 20 September 2007, Rajeev J Sebastian wrote:
> > Hi,
> >
> > I am working on the diagramscene example, when I reached upon the
> > following:
> >
> > if (textInteractionFlags() & Qt::TextEditable) {
> >
> >
> > How can I convert that to Python ?
> >
> > I tried several variations, such as
> >
> > self.textInteractionFlags() & QtCore.Qt.TextEditable
>
> The above is correct.
>
> > (self.textInteractionFlags() & QtCore.QtTextEditable ) > 0
> >
> >
> > .... but I dont think any of them work.
> >
> >
> > Basically, I am not able to move the text item in the graphics view.
>
> Then the problem is probably somewhere else.
>
> Phil
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
More information about the PyQt
mailing list