How to set user data for a QWidget?

Barney Szabolcs picture Barney Szabolcs · Oct 22, 2012 · Viewed 18.9k times · Source

I would like to set an integer number to be stored in a QWidget, and I think the setUserData member function would do the trick but I can't find any documentation. Any hints?

Answer

Frédéric Hamidi picture Frédéric Hamidi · Oct 22, 2012

You might be looking for QObject::setProperty() (which is of course inherited by QWidget).