Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-124507

Custom components with Qt Graphs

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • P2: Important
    • 6.8
    • None
    • Graphs: 2D
    • None

    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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kagro Kaj Grönholm
              kagro Kaj Grönholm
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes