I'd like to know if it's possible to store a QPushButton in a QVariant. More precisely, I am trying to use it in a QStandardItemModel with the function setData
. Here's what I want to do :
QPushButton* button = new QPushButton("Update");
setData(index(0, 0), "Button");
setData(index(0, 1), button);
But obviously, it doesn't work like that so I tried this :
QVariant variant;
variant.setValue(button);
setData(index(0, 1), QVariant::fromValue(variant));
And it's not working either. I'd like to do it without using a QTableView (I know there is a setIndexWidget in this kind of view).
Thanks in advance!