[Qt-interest] parse items of QTreeWidget into file/QSettings

Mystical Groovy mysticalgr at gmail.com
Sat Nov 7 16:39:31 CET 2009


Hi and thanks for your reply,
I think i got it

i wrote on my .h file

class MyItemData : public QAbstractItemModel

{

Q_OBJECT

public:

QMap<int, QVariant> itemData ( const QModelIndex & index, int role =
Qt::DisplayRole ) const ;

};


and on my .cpp file:

QMap<int, QVariant> MyItemData::itemData( const QModelIndex & index, int
> role ) const
>
> {
>
> if (role == Qt::DisplayRole) {
>
> //ill handle this later
>
> }
>
> return QMap::key(index, role);
>
> }
>

 now it gives me
*error: 'template<class Key, class T> class QMap' used without template
parameters* error...

Thanks again, and I hope Ive understood what you said correctly :-)



2009/11/7 Arnold Krille <arnold at arnoldarts.de>

> On Saturday 07 November 2009 15:28:23 you wrote:
> > Ahh thank you for your answer, but I didnt actually understand what you
> > meant,
> > Im I supposed to use a QTreeView instead of treeWidget or reimplement the
> > QTreeWidget class?
>
>
> No. QTreeWidgets IS a QTreeView which in turn IS a QAbstractItemView. And
> there for you can access the underlying model with
> QAbstractItemView::model().
>
> A bit of reading up on the Model-View-Pattern would be needed. But its
> worth
> it.
>
> Arnold
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091107/2e336db3/attachment.html 


More information about the Qt-interest-old mailing list