QAction *action = qobject_cast<QAction *>(sender());
QAction *action;
QObject *object;
object = sender();
action = qobject_cast<QAction *>(object);//就是转换QObject类型到QAction类型。
基本上理解成action = (QAction*)object就可以了。
qobject_cast和上面的代码区别是:如果object不是QAction类型,返回0.