Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2025

Python code example for QValue3DAxisFormatter

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Reported
    • Priority: Not Evaluated
    • Resolution: Unresolved
    • Affects Version/s: all
    • Fix Version/s: None
    • Component/s: Documentation, PySide
    • Labels:
      None
    • Platform/s:
      All

      Description

       It'd be helpful to have a Python version of the code for subclassing QValue3DAxisFormatter added to: 
      https://doc.qt.io/qtforpython/examples/index.html#datavisualization 
      There is currently this one:Qt Quick 2 Axis Formatter Example - Qt for Python, but it doesn't  appear to all be Python code or runnable in any way.
      In particular, the documented access and modification of gridPositions(), labelPositions(), and labelStrings() does not work:

      gridPositions().resize(gridCount)
      .....
      gridPositions()[i] = float(gridValue)
      labelPositions()[i] = float(gridValue)
      labelStrings() << minFullDate.addDays.toString(axis().labelFormat())

      In Python, each of the methods on the left (if prepended with 'self.') returns a list that cannot be modified or assigned anything nor has a resize method.  The code seems to be mixed with direct copy from the C++ example found at [Qt Quick 2 Axis Formatter Example | Qt Data Visualization 5.15.10|https://doc.qt.io/qt-5/qtdatavisualization-qmlaxisformatter-example.html#custom-axis-formatter].

       QList<float> &QValue3DAxisFormatter::gridPositions() const
       QList<float> &QValue3DAxisFormatter::labelPositions() const
       QStringList &QValue3DAxisFormatter::labelStrings() const
      

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              kleint Friedemann Kleint
              Reporter:
              elunomas Mike S
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: