I try to subclass QStandardItem, I think, this is the solution!
public:
NumberItem(const int number);
private:
int value;
public:
int type() const;
QVariant data
(int role
= Qt
::UserRole + 1) const;
};
value = number;
}
int NumberItem::type() const {
}
return new NumberItem(*this);
}
}
class NumberItem : public QStandardItem {
public:
NumberItem(const int number);
private:
int value;
public:
int type() const;
QStandardItem *clone() const;
QVariant data(int role = Qt::UserRole + 1) const;
};
NumberItem::NumberItem(const int number) : QStandardItem() {
value = number;
}
int NumberItem::type() const {
return QStandardItem::UserType;
}
QStandardItem *NumberItem::clone() const {
return new NumberItem(*this);
}
QVariant NumberItem::data(int) const {
return QVariant(number);
}
To copy to clipboard, switch view to plain text mode
than I append this to the model:
column5.append(new NumberItem(12345));
column5.append(new NumberItem(12345));
To copy to clipboard, switch view to plain text mode
It work's, the numbers are in the column 5 of tableView, but all number cells are checkable and disabled!? I don't know, why! setCheckable(false) and setEnabled(true) doesn't work!
Bookmarks