-
Notifications
You must be signed in to change notification settings - Fork 87
Add HashSet of flags to ParsedQPoperty for optional getters and setters #994
New issue
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
Changes from 1 commit
dc49d33
452ba32
4e82194
1eead3f
50df978
eb0bdb5
fe3ecfd
1fa65fa
865d7fe
209bff4
eeb2ba6
73e3cc9
8570970
5dfe239
dd50978
4c3b3fd
eea3a53
ffccc51
5f4917f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,8 @@ | |
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased](https://github.com/KDAB/cxx-qt/compare/v0.6.1...HEAD) | ||
Check failure on line 18 in CHANGELOG.md
|
||
- Add support for specifying read write and notify in qproperty macro, including support for custom user defined functions | ||
Check failure on line 19 in CHANGELOG.md
|
||
|
||
### Added | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,8 +131,20 @@ | |
|
||
These setters and getters assure that the changed signal is emitted every time the property is edited. | ||
|
||
> Note that in the future it will be possible to specify custom getters and setters | ||
It is also possible to specify custom getters, setters and on-changed functions, using flags passed like so: | ||
LeonMatthesKDAB marked this conversation as resolved.
Show resolved
Hide resolved
|
||
`#[qproperty(TYPE, NAME, read = myGetter, write = mySetter, notify = myOnChanged)]` | ||
|
||
> Note: currently TypeName lookups are not currently supported, so either the name must be camel case or specified like `#[cxx_name = "my_getter"]` | ||
LeonMatthesKDAB marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
It is also possible to use any combination of custom functions or omitting entirely, but if flags are specified, read must be one of them as all properties need to be able to be read. | ||
LeonMatthesKDAB marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Examples: | ||
Check failure on line 141 in book/src/bridge/extern_rustqt.md
|
||
- `#[qproperty(TYPE, NAME, read)]` A read only prop | ||
Check failure on line 142 in book/src/bridge/extern_rustqt.md
|
||
- `#[qproperty(TYPE, NAME, read = myGetter, write, notify)]` custom getter provided but will generate setter and on-changed | ||
- `#[qproperty(TYPE, NAME)]` is syntactic sugar for `#[qproperty(TYPE, NAME, read, write, notify)]` | ||
- `#[qproperty(TYPE, NAME, write)]` is an error as read was not passed | ||
|
||
|
||
Check failure on line 147 in book/src/bridge/extern_rustqt.md
|
||
## Methods | ||
|
||
Any signature with a `self` parameter is interpreted as a Rust method and exposed to C++ method for the given type. | ||
|
Uh oh!
There was an error while loading. Please reload this page.