UID:94151
UID:81955
UID:80073
UID:7394
引用楼主zsw8766于2010-03-31 10:22发表的 如何判断触发同一槽的不同的信号发送者!? :槽函数里能判断触发该槽的信号的发送者吗?我要实现的是:菜单ActonOpen的单击事件和菜单AcionNew的单击事件都能触发QtreeWidget的show事件,QtreeWidget根据不同触发者(是谁发送的单击信号),来发送不同的信号,以激发不同的槽
QObject * QObject::sender () const [protected]Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. The pointer is valid only during the execution of the slot that calls this function from this object's thread context.The pointer returned by this function becomes invalid if the sender is destroyed, or if the slot is disconnected from the sender's signal.Warning: This function violates the object-oriented principle of modularity. However, getting access to the sender might be useful when many signals are connected to a single slot.Warning: As mentioned above, the return value of this function is not valid when the slot is called via a Qt::DirectConnection from a thread different from this object's thread. Do not use this function in this type of scenario.See also QSignalMapper.
UID:88244