c++ - Qt - Storing a widget pointer in a QAction? -
in qt have table each row has button in 1 of columns , button opens drop-down menu can click actions. connect triggered() signal of actions slot handle them, in slot have know row action triggered. can't store in setdata(), because stores qvariant. how else can store pointer widget?
q_declare_metatype(qpushbutton *) ...
qpushbutton *pb = new qpushbutton; qvariant v = qvariant::fromvalue(pb); qdebug() << pb << v.value < qpushbutton * >(); works me.
Comments
Post a Comment