{ "info": { "author": "Aur\u00e9lien G\u00e2teau", "author_email": "mail@agateau.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", "Topic :: Software Development :: Build Tools" ], "description": "[![Build Status](https://travis-ci.org/agateau/qpropgen.svg?branch=master)](https://travis-ci.org/agateau/qpropgen)\n\n# qpropgen\n\nA tool to generate QML-friendly QObject-based C++ classes from class definition\nfiles.\n\nInstall it with:\n\n pip install qpropgen\n\n## Quick Intro\n\nDeclaring properties in a QObject class requires writing a lot of boilerplate\ncode. qpropgen goal is to write this boilerplate for you.\n\nSuppose we want to create a `Person` class, with `firstName`, `lastName` and\n`birthDate` properties.\n\nFirst we create a class definition file named `person.yaml` with the following\ncontent:\n\n```yaml\nclass: Person\nproperties:\n- name: firstName\n type: QString\n- name: lastName\n type: QString\n- name: birthDate\n type: QDateTime\n```\n\nNext, we generate its header and implementation with `qpropgen person.yaml`.\nThis produces two files: `person.h` and `person.cpp` (The filenames are based\non the filename of the class definition).\n\nNote: in practice, you probably want to inherit from the generated classes to\nimplement other aspects of the class to create and/or to override getters and\nsetters.\n\n## Syntax of class definition files\n\nA class definition file **must** contain the following fields:\n\n- `class`: the name of the class to generate.\n\n- `properties`: the list of its properties (see below).\n\nIt **may** also contain the following fields:\n\n- `includes`: a list of files to include in the header.\n\n- `baseClass`: name of the class to inherit from. Defaults to `QObject`.\n\n- `defaults`: default values for some property attributes (see below).\n\n### The `properties` field\n\n`properties` is an array of property definitions.\n\nA property definition **must** contain the following fields:\n\n- `type`\n- `name`\n\nIt **may** contain the following fields:\n\n- `access`: Can be `private` or `protected`. Defines the access modifier for\n the generated member variables. Defaults to `private`.\n\n- `mutability`: One of `constant`, `readonly`, `readwrite`. Defaults to\n `readwrite`.\n\n- `argType`: The type of the setter argument. If not set qpropgen uses const\n references for types which are not pointers and not known scalars (int, bool,\n qreal).\n\n- `varName`: Name of the variable backing the property. Defaults to `m`,\n so the variable of the `foo` property will be `mFoo`.\n\n- `setterName`: Name of the setter. Defaults to `set`, so the setter of\n the `foo` property will be `setFoo`.\n\n- `impl`: One of `plain` (getter and setter), `virtual` (virtual getter and\n setter) or `pure` (virtual pure getter and setter).\n\n- `value`: The default value of the property.\n\n### The `defaults` field\n\nAdding a field to the `defaults` object lets you define default values for all\nproperties.\n\nFor example you can define that all properties are of type `qreal` by default\nwith:\n\n```yaml\ndefaults:\n type: qreal\n```\n\nOf course fields which require a unique value, like `name`, should not have a\ndefault.\n\n## Build system integration\n\nThe `cmake/qpropgen.cmake` can be included in your project to integrate\nqpropgen. It takes care of finding the `qpropgen` executable and provides a\n`qpropgen()` CMake function.\n\nThis CMake function lets you define .yaml files to process. For example:\n\n\n```cmake\nset(prj_SRCS main.cpp)\nqpropgen(prj_QPROPGEN foo.yaml bar.yaml)\nadd_executable(prj ${prj_SRCS} ${prj_QPROPGEN})\n```\n\n## Examples\n\nThe `examples/` directory contains examples of the various settings. The\nproduced executable does nothing, but you can look in the build directory at\nthe .h and .cpp files produced by qpropgen during the build.\n\n## Tests\n\nThe project currently lacks real unit tests, so the examples serve as tests:\nthe `./tests.sh` script can be run to build the examples.\n\n## Trivia\n\nI started this project when I was working on the [SFXR-Qt][] sound generator (a\nQtQuick port of [SFXR][]), and was finding it too tedious to declare all the\nproperties necessary to represent sounds :)\n\n[SFXR-Qt]: https://github.com/agateau/sfxr-qt\n[SFXR]: http://www.drpetter.se/project_sfxr.html", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/agateau/qpropgen", "keywords": "qt,qml,commandline,qobject,generator", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "qpropgen", "package_url": "https://pypi.org/project/qpropgen/", "platform": "any", "project_url": "https://pypi.org/project/qpropgen/", "project_urls": { "Homepage": "https://github.com/agateau/qpropgen" }, "release_url": "https://pypi.org/project/qpropgen/0.1.2/", "requires_dist": null, "requires_python": "", "summary": "Generate QML-friendly QObject-based C++ classes from class definition files", "version": "0.1.2" }, "last_serial": 4665441, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "a8ada4fd4396961fb8ad87d1f424ad6d", "sha256": "c51512e352f7caeccf26e2e50cb34a67af35294d7a9fd3e80de93e6fc2319e22" }, "downloads": -1, "filename": "qpropgen-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a8ada4fd4396961fb8ad87d1f424ad6d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7059, "upload_time": "2018-12-08T19:06:00", "url": "https://files.pythonhosted.org/packages/aa/80/607bab06df5e63ee88ddd1e2250a8409e2f3b1a4e5bc1c09a19e8d5c08d0/qpropgen-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "f26128b4787077931da424bb2c1553d1", "sha256": "52fa07fadecabe20a74e4cf9c1f37a1188d32b7bdfe56f3c903d5fb958d1de9f" }, "downloads": -1, "filename": "qpropgen-0.1.1.tar.gz", "has_sig": false, "md5_digest": "f26128b4787077931da424bb2c1553d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7488, "upload_time": "2018-12-08T19:23:11", "url": "https://files.pythonhosted.org/packages/f1/3f/c31ffca007e8f84f6200d9381db6965a458d7949f1883c374cbb2bdc59f3/qpropgen-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "465653457aae834df58eebd1762d03d0", "sha256": "d7745d6d25d428fde373ea3b1c9f8436e380c9bc6b9ffde3ce02a037a55ba4f6" }, "downloads": -1, "filename": "qpropgen-0.1.2.tar.gz", "has_sig": false, "md5_digest": "465653457aae834df58eebd1762d03d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7802, "upload_time": "2019-01-06T12:11:59", "url": "https://files.pythonhosted.org/packages/bd/e6/e8ea64dc71720c616e7394133181699710a60867d9a78ebb95fa4481c7de/qpropgen-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "465653457aae834df58eebd1762d03d0", "sha256": "d7745d6d25d428fde373ea3b1c9f8436e380c9bc6b9ffde3ce02a037a55ba4f6" }, "downloads": -1, "filename": "qpropgen-0.1.2.tar.gz", "has_sig": false, "md5_digest": "465653457aae834df58eebd1762d03d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7802, "upload_time": "2019-01-06T12:11:59", "url": "https://files.pythonhosted.org/packages/bd/e6/e8ea64dc71720c616e7394133181699710a60867d9a78ebb95fa4481c7de/qpropgen-0.1.2.tar.gz" } ] }