Created
March 8, 2016 08:35
-
-
Save 0xlitf/4d0cbec48e7ead697719 to your computer and use it in GitHub Desktop.
C++调用python时,object.h中变量为slots的问题
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //解决办法,在object.h中头文件开始#undef slots 在最后#define slots | |
| #ifndef MAINWINDOW_H | |
| #define MAINWINDOW_H | |
| #pragma comment(lib,"C:/Python34/libs/python34.lib") | |
| #include <QtWidgets/QMainWindow> | |
| #include "ui_mainwindow.h" | |
| #include <QDebug> | |
| #include "C:\Python34\include\Python.h" | |
| class MyClass :public QObject | |
| { | |
| Q_OBJECT | |
| public: | |
| MyClass() | |
| { | |
| connect(this, SIGNAL(sig()), SLOT(test())); | |
| } | |
| ~MyClass() | |
| { | |
| } | |
| public slots: | |
| void test() | |
| { | |
| qDebug() << "aa"; | |
| } | |
| signals: | |
| void sig(); | |
| private: | |
| }; | |
| class MainWindow : public QMainWindow | |
| { | |
| Q_OBJECT | |
| public: | |
| MainWindow(QWidget *parent = 0); | |
| ~MainWindow(); | |
| private: | |
| Ui::MainWindowClass ui; | |
| }; | |
| #endif // MAINWINDOW_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment