更新时间:2023-10-17 21:15:16
创建一个新类(从QObject派生),其插槽名为myslot,然后:
Create new class (derived from QObject) with a slot called, e.g. myslot, then:
class MyClass : public QObject {
Q_OBJECT
...
public slots:
void mySlot();
};
myObject = new MyClass();
connect(action1, SIGNAL(triggered()), myObject, SLOT(mySlot()));