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

Python code example for QValue3DAxisFormatter

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Won't Do
    • P4: Low
    • None
    • all
    • Documentation, PySide
    • None
    • 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

          Activity

            People

              Unassigned Unassigned
              elunomas Mike S
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: