32 lines
575 B
C++
32 lines
575 B
C++
|
|
|
|
#ifndef PYTHONEMBED_H
|
|
#define PYTHONEMBED_H
|
|
|
|
#include <QTextEdit>
|
|
#include <QProcess>
|
|
#include <QObject>
|
|
|
|
class PythonEmbed : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
PythonEmbed(QTextEdit* outputWidget, QObject* parent = nullptr);
|
|
~PythonEmbed();
|
|
|
|
void runScript(const QString& scriptContent);
|
|
void stopScript();
|
|
|
|
private slots:
|
|
void onOutputAvailable();
|
|
void onErrorAvailable();
|
|
void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
|
|
|
private:
|
|
QTextEdit* m_outputWidget;
|
|
QProcess* m_process;
|
|
};
|
|
|
|
#endif // PYTHONEMBED_H
|
|
|