How do I create a custom slot in qt4 designer?

前端 未结 10 587
我在风中等你
我在风中等你 2020-12-14 18:29

Whenever I use the signal/slot editor dialog box, I have to choose from the existing list of slots. So the question is how do I create a custom named slot?

10条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 18:49

    You can use the magic slot format of

    void on_objectName_signal() {
    // slot code here, where objectname is the Qt Designer object name
    // and the signal is the emission
    }
    

    The connection to this method is established by the method connectSlotsByName and whenever the signal is emitted, this slot is invoked.

提交回复
热议问题