When I subclass QValue3DAxisFormatter in my application, the application simply hangs and then exits without an exception or explanation. I have tried removing every and all methods in my subclass (even though they are supposed to be implemented, according to the docs) just to test what the problem is, but it always simply exits without explanation. I have looked everywhere for examples of how to achieve this custom formatter in Python, but the only example I can find in any language is this example: https://code.qt.io/cgit/qt/qtdatavis3d.git/tree/examples/datavisualization/qmlaxisformatter?h=5.15, which is the code from the explanation found at https://doc.qt.io/qt-5/qtdatavisualization-qmlaxisformatter-example.html#custom-axis-formatter . I don't really understand how to translate that to Python code (I'm also not looking to make a calendar-based axis, nor am I using QML), though I've tried the basic setup as follows:
class AxisFormatter(QtDataVisualization.QtDataVisualization.QValue3DAxisFormatter):
def __init__(self):
super().__init__()
print("init")
def createNewInstance(self):
print("creating new instance")
return AxisFormatter()
def populateCopy(self, copy: QtDataVisualization.QtDataVisualization.QValue3DAxisFormatter):
print("populating copy")
super().populateCopy(copy)
def recalculate(self) -> None:
print("recalculating")
def stringForValue(self, value: float, format: str) -> str:
print('stringForValue')
return str(value)
(The only print statement that will print here is the "init" one, then after ~10 seconds of hanging, the application exits.) Ideally I would like to simply map the axis' (integer) value to an array that I provide as an argument to AxisFormatter, but I can't even get this simple boilerplate working.