Versions
Python: 3.10.8
PyQt5: 5.15.7
PyQt5-sip: 12.11.0
QCustomPlot_PyQt5: 2.1.1.1
Description
I've tried to subclass QCPGraph to add extra handling for selection but found that overriding selectTest() method breaks the selection completely.
Test case
#!/usr/bin/env python3
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPen, QColor
from PyQt5.QtWidgets import QMainWindow, QApplication
import QCustomPlot_PyQt5 as qcp
class CustomGraph(qcp.QCPGraph):
def selectTest(self, *args): # I've also tried with the signature, no luck
return super().selectTest(*args)
app = QApplication([])
win = QMainWindow()
win.setWindowTitle('Test')
win.setMinimumSize(1024, 768)
plot = qcp.QCustomPlot()
plot.setInteraction(qcp.QCP.iSelectPlottables, True)
data = list(range(1, 100))
graph = CustomGraph(plot.xAxis, plot.yAxis)
graph.setPen(QPen(QColor(Qt.red), 10))
graph.setData(data, data)
win.setCentralWidget(plot)
win.show()
app.exec_()
Expected behavior
Clicks select the plottable.
Actual behavior
No selection happens.
A note: while the click selection is broken, the rect selection is working somehow.
Versions
Python: 3.10.8
PyQt5: 5.15.7
PyQt5-sip: 12.11.0
QCustomPlot_PyQt5: 2.1.1.1
Description
I've tried to subclass QCPGraph to add extra handling for selection but found that overriding
selectTest()method breaks the selection completely.Test case
Expected behavior
Clicks select the plottable.
Actual behavior
No selection happens.
A note: while the click selection is broken, the rect selection is working somehow.