pyQT 插槽装饰器什么是C++等价物
pyQT slot decorator what is the C++ equivalent
我有一个关于QT和PyQT的初学者水平的问题。我正在使用Python的PyQt绑定,并有以下简单的代码。根据一些谷歌搜索,插槽装饰器似乎主要用于将方法显式标记为插槽。我的问题是,如果我用C++编写此代码,等效方法是什么?
@QtCore.pyqtSlot()
def openDialog(self):
self.myDialog.show()
要在C++/Qt中创建槽,请使用以下语法:
class MyClass : public QObject {
Q_OBJECT
public slots:
void mySlot(/* parameters here */); // Definition may be here or in the implementation file
};
如果您使用的是no_keywords选项(这意味着您不想将Qt关键字用作普通C++关键字),只需将slots
替换为Q_SLOTS
您可以在官方文档中找到更多信息:http://qt-project.org/doc/qt-5.0/qtcore/signalsandslots.html
相关文章:
- 在C++STL中是否有Polyval(Matlab函数)等价物?
- python集合的C++等价物是什么.计数器
- C++中是否存在 std::conditional 的懒惰等价物?
- std::endl,在 Python 中是否有等价物?(返回 + 刷新)
- 在本征C++中 MKL 的函数"zgges"等价物是多少?
- 在C++中使用std或boost库的Qtimer等价物是什么
- GLM中的Java Matrix4.transform等价物
- 对于std::bitset,是否有一个ffs()等价物
- std::move() 或其在局部变量上的显式等价物可以允许 elision 吗?
- 这个 matlab 代码的C++等价物是什么(fread matlab vs fread C/C++)?
- 对于wchar_t,字符(0)或'