We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In Python not found enum elements from C++ class derived from QObject added to PythonQt via addDecorators() and registerClass(QMetaObject*).
Qt 5.12.8 Python 3.8.10 g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 PythonQt master fb16d6e on 3 Nov 2021
Add to std example PyDecoratorsExample ExternalWidget.h
#ifndef EXTERNAL_W_HH_ #define EXTERNAL_W_HH_ #include <QtWidgets/QWidget> class ExternalWidget : public QWidget { Q_OBJECT public: enum EType { Aone, Atwo, Athree, Afour }; Q_ENUM(EType) ExternalWidget(QWidget* parent = nullptr); ~ExternalWidget(); public slots: void widgetSlot(){}; }; #endif // EXTERNAL_W_HH_
ExternalWidget.cpp
#include "ExternalWidget.h" ExternalWidget::ExternalWidget(QWidget* parent) : QWidget(parent) { } ExternalWidget::~ExternalWidget() { }
add to main.cpp
PythonQt::self()->registerClass(&ExternalWidget::staticMetaObject, "QtGui");
add to example.py
w = QtGui.ExternalWidget() w.move(100,100) w.show()
add ExternalWidget.h and ExternalWidget.cpp to HEADERS a SOURCES in PyDecoratorsExample.pro In python console can use dir(QtGui.ExternalWidget)
dir(QtGui.ExternalWidget)
There are no enum elements Aone, Atwo e.t.c. and enum EType
Whats wrong??? I try to use Q_ENUMS() and result is the same. :(
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Short
In Python not found enum elements from C++ class derived from QObject added to PythonQt via addDecorators() and registerClass(QMetaObject*).
Versions
Qt 5.12.8
Python 3.8.10
g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
PythonQt master fb16d6e on 3 Nov 2021
Example Code
Add to std example PyDecoratorsExample
ExternalWidget.h
ExternalWidget.cpp
add to main.cpp
add to example.py
add ExternalWidget.h and ExternalWidget.cpp to HEADERS a SOURCES in PyDecoratorsExample.pro
In python console can use
dir(QtGui.ExternalWidget)
There are no enum elements Aone, Atwo e.t.c. and enum EType
Whats wrong???
I try to use Q_ENUMS() and result is the same. :(
The text was updated successfully, but these errors were encountered: