Title: Using enum elements from C++ Qt Object in python · Issue #71 · MeVisLab/pythonqt · GitHub
Open Graph Title: Using enum elements from C++ Qt Object in python · Issue #71 · MeVisLab/pythonqt
X Title: Using enum elements from C++ Qt Object in python · Issue #71 · MeVisLab/pythonqt
Description: 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...
Open Graph Description: 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...
X Description: 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...
Opengraph URL: https://github.com/MeVisLab/pythonqt/issues/71
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Using enum elements from C++ Qt Object in python","articleBody":"### Short\r\nIn Python not found enum elements from C++ class derived from QObject added to PythonQt via addDecorators() and registerClass(QMetaObject*).\r\n### Versions\r\nQt 5.12.8 \r\nPython 3.8.10\r\ng++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 \r\nPythonQt master fb16d6e on 3 Nov 2021 \r\n### Example Code\r\nAdd to std example PyDecoratorsExample\r\n**ExternalWidget.h**\r\n```\r\n#ifndef EXTERNAL_W_HH_\r\n#define EXTERNAL_W_HH_\r\n\r\n#include \u003cQtWidgets/QWidget\u003e\r\n\r\nclass ExternalWidget : public QWidget\r\n{\r\n Q_OBJECT\r\n\r\npublic:\r\n enum EType\r\n {\r\n Aone,\r\n Atwo,\r\n Athree,\r\n Afour\r\n };\r\n\r\n Q_ENUM(EType)\r\n\r\n ExternalWidget(QWidget* parent = nullptr);\r\n ~ExternalWidget();\r\n\r\npublic slots:\r\n void widgetSlot(){};\r\n};\r\n\r\n#endif // EXTERNAL_W_HH_\r\n```\r\n**ExternalWidget.cpp** \r\n```\r\n#include \"ExternalWidget.h\"\r\n\r\nExternalWidget::ExternalWidget(QWidget* parent) : QWidget(parent)\r\n{\r\n}\r\n\r\nExternalWidget::~ExternalWidget()\r\n{\r\n}\r\n```\r\nadd to **main.cpp** \r\n``` \r\nPythonQt::self()-\u003eregisterClass(\u0026ExternalWidget::staticMetaObject, \"QtGui\");\r\n``` \r\nadd to example.py \r\n```\r\nw = QtGui.ExternalWidget()\r\nw.move(100,100)\r\nw.show()\r\n``` \r\n\r\nadd ExternalWidget.h and ExternalWidget.cpp to HEADERS a SOURCES in **PyDecoratorsExample.pro** \r\nIn python console can use \r\n`dir(QtGui.ExternalWidget)` \r\n\r\nThere are no enum elements **Aone, Atwo** e.t.c. and enum **EType** \r\n\r\nWhats wrong??? \r\nI try to use Q_ENUMS() and result is the same. :(\r\n","author":{"url":"https://github.com/kwisp","@type":"Person","name":"kwisp"},"datePublished":"2022-05-31T15:55:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/71/pythonqt/issues/71"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8238fb9f-51b0-b1bd-0320-1ea778086286 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DD2A:74018:261F139:32BB130:6971C110 |
| html-safe-nonce | 55b8a680e1bc83d4789c4f472dd5c65b1380463ddd08c76a88d90202b423c3df |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDJBOjc0MDE4OjI2MUYxMzk6MzJCQjEzMDo2OTcxQzExMCIsInZpc2l0b3JfaWQiOiI1NzgyNDQ3NTM5MDUwNjI3MzQ0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 03e029288030a939fd5d407c8d81be08ec40c674c9b2b22c84e15bce15ccaba8 |
| hovercard-subject-tag | issue:1254075206 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/MeVisLab/pythonqt/71/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cdc2aef38bd11fb5f0aa4c68622128b4195fc365fa59ac9d1a0dd70a7a098e08/MeVisLab/pythonqt/issues/71 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cdc2aef38bd11fb5f0aa4c68622128b4195fc365fa59ac9d1a0dd70a7a098e08/MeVisLab/pythonqt/issues/71 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kwisp |
| hostname | github.com |
| expected-hostname | github.com |
| None | c3b677fea7de290a6c0d1c9ccd6c9909b6a527cf8ee079649e09dc78092d24f1 |
| turbo-cache-control | no-preview |
| go-import | github.com/MeVisLab/pythonqt git https://github.com/MeVisLab/pythonqt.git |
| octolytics-dimension-user_id | 15028021 |
| octolytics-dimension-user_login | MeVisLab |
| octolytics-dimension-repository_id | 193056137 |
| octolytics-dimension-repository_nwo | MeVisLab/pythonqt |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 193056137 |
| octolytics-dimension-repository_network_root_nwo | MeVisLab/pythonqt |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 29d7fcca69cafb91ec8a596aaf222fd46e9bc934 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width