[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] QPersistentModelIndex problem
From: Roberto Alsina <ralsina () kde ! org>
Date: 2009-02-07 3:32:12
Message-ID: 200902070132.12443.ralsina () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
I am trying to inherit QAbstractItemModel and am having problems implementing
parent().
In order to do it correctly to represent a tree structure, I am storing a
QPersistentModelIndex in my tree node.
However, parent needs to return a plain QModelIndex.
AFAICS, this is how you convert:
QPersistentModelIndex::operator const QModelIndex & () const
Cast operator that returns a const QModelIndex&.
But how can I do that from python?
[Attachment #5 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \
"http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style \
type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'Droid Sans \
Mono'; font-size:8pt; font-weight:400; font-style:normal;">I am trying to inherit QAbstractItemModel and \
am having problems implementing parent().<br> <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br></p>In order to do it correctly to represent a tree structure, I am storing a \
QPersistentModelIndex in my tree node.<br> <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br></p>However, parent needs to return a plain QModelIndex.<br> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>AFAICS, this is how you convert:<br> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p><span style=" \
font-style:italic;">QPersistentModelIndex::operator const QModelIndex & () const</span><br> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0; font-style:italic;"><br></p><p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0; font-style:italic;">Cast operator that returns a const \
QModelIndex&.</p><p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0; \
font-style:italic;"><br></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0; font-style:italic;"><span \
style=" font-style:normal;">But how can I do that from python?</span></p></body></html>
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic