Details
-
Task
-
Resolution: Fixed
-
P2: Important
-
None
-
None
-
75f7a25ab (dev), be53d4ba6 (dev)
Description
This ticket is for considering pros and cons of different approaches to custom QML components with Qt Graphs (2D). Few places where these are already used:
- QXYSeries::pointMarker
- QBarSeries::barComponent
- QAbstractAxis::labelComponent (tbd)
Few ways how these could be implemented:
1) Utilize QML properties directly. Basically we could say that QAbstractAxis::labelComponent must be Text{} element, so AxisRenderer can fill the value directly.
Pros: Minimal amount of supporting code or magic properties.
Cons: Has limitations. For example what if user wants to add margin into Text? Or label to be a Button instead of Text?
2) Special data class. Example of this is BarComponent, so user is expected to use "barComponent: BarComponent { id: comp; ... }" and gets access the all required data with comp id.
Pros: Easy to document what data is available and add more.
Cons: Special QML elements need to be used.
3) Custom dynamic properties. Example of this is QXYSeries::pointMarker. User can use any QML component there and just add "property bool selected: false" etc. there. PointRenderer then checks if these properties exist with e.g. "if (marker->property("selected").isValid())"
Pros: No need to use specific data element.
Cons: How are these special properties documented? Currently QXYSeries::pointMarker doesn't document what properties it supports. Is there performance overhead with dynamic properties & checking them?
Attachments
Issue Links
- relates to
-
QTBUG-122337 Greater label control
- Reported
-
QTBUG-122243 Qt Charts/Qt Graphs 2D: Add support for tooltips on axis values
- Closed