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:
class TBook
{
public:
TBook(){};
~TBook();
uint getGenre();
qreal getProgress();
private:
uint genre;
qreal progress;
};
Q_DECLARE_METATYPE(TBook);
class TBook
{
public:
TBook(QString, QString, uint, QString, qreal);
TBook(){};
~TBook();
void setData(QString, QString, uint, QString, qreal);
QString getTitle();
QString getAuthor();
uint getGenre();
QString getPath();
qreal getProgress();
static QStringList getAllGenres();
void setTitle(QString);
private:
QString title;
QString author;
uint genre;
QString path;
qreal progress;
};
Q_DECLARE_METATYPE(TBook);
To copy to clipboard, switch view to plain text mode
Please, help me
Bookmarks