Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriding QCPGraph::selectTest breaks the selection #6

Open
naquad opened this issue Dec 28, 2022 · 0 comments
Open

Overriding QCPGraph::selectTest breaks the selection #6

naquad opened this issue Dec 28, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@naquad
Copy link

naquad commented Dec 28, 2022

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.

@salsergey salsergey added the bug Something isn't working label Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants