Hi!
I have custom model with list of my custom objects - QList<TBook *> bookList;
Also I have delegate in this model. In delegate I have index.model()->data(index, Qt::DisplayRole) - this is QVariant. How can I convert this to TBook? Here is definition of my custom class:
Qt Code:
  1. class TBook
  2. {
  3. public:
  4. TBook(QString, QString, uint, QString, qreal);
  5. TBook(){};
  6. ~TBook();
  7. void setData(QString, QString, uint, QString, qreal);
  8. QString getTitle();
  9. QString getAuthor();
  10. uint getGenre();
  11. QString getPath();
  12. qreal getProgress();
  13. static QStringList getAllGenres();
  14. void setTitle(QString);
  15.  
  16. private:
  17. QString title;
  18. QString author;
  19. uint genre;
  20. QString path;
  21. qreal progress;
  22. };
  23. Q_DECLARE_METATYPE(TBook);
To copy to clipboard, switch view to plain text mode 

Please, help me