Qt: dynamic widgets signal and slot connection

后端 未结 2 594
借酒劲吻你
借酒劲吻你 2020-12-20 01:27

In my Qt app, I create some of my widgets dynamically. Among them are QToolButtons that need to have a similar behavior.

Here is how the widgets are created:

相关标签:
2条回答
  • 2020-12-20 02:04

    Although using QObject::sender() is perfectly fine, the idealistic approach would be QSignalMapper

    0 讨论(0)
  • 2020-12-20 02:31

    Use QObject::sender() inside your slot to get the Sender. It will return the object that emit the signal. hope this helps.

    0 讨论(0)
提交回复
热议问题