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

qtrangeslider doesn't respond to drag properly on macOS 12 with Qt5.15 #74

Closed
sfhbarnett opened this issue Mar 21, 2022 · 4 comments · Fixed by #117
Closed

qtrangeslider doesn't respond to drag properly on macOS 12 with Qt5.15 #74

sfhbarnett opened this issue Mar 21, 2022 · 4 comments · Fixed by #117
Labels
bug Something isn't working

Comments

@sfhbarnett
Copy link
Contributor

Describe the bug
Qtrangeslider is not behaving properly. Dragging one of the handles causes the other handle to disappear (It looks like the slider thinks I have grabbed the top slider when I grab the bottom one). I've attached a video of the behaviour.

To Reproduce
Steps to reproduce the behavior:
The code below can reproduce the behaviour on my computer

    import sys
    from PyQt5 import QtCore, QtWidgets
    from superqt import QRangeSlider
    
    
    class MainWindow(QtWidgets.QMainWindow):
    
        def __init__(self, *args, **kwargs):
            super(MainWindow, self).__init__(*args, **kwargs)
    
            vlayout2 = QtWidgets.QHBoxLayout()
            self.qtr = QRangeSlider(QtCore.Qt.Orientation.Vertical)
            vlayout2.addWidget(self.qtr)
            widget = QtWidgets.QWidget()
            widget.setLayout(vlayout2)
            self.setCentralWidget(widget)
    
    
    def main():
        if not QtWidgets.QApplication.instance():
            app = QtWidgets.QApplication(sys.argv)
        else:
            app = QtWidgets.QApplication.instance()
        app.setQuitOnLastWindowClosed(True)
        main = MainWindow()
        main.show()
        sys.exit(app.exec_())
    
    if __name__ == '__main__':
        m = main()

Expected behavior
Normal slider behaviour

Screenshots

Screen.Recording.2022-03-21.at.09.48.18.mov

Desktop (please complete the following information):

  • macOS 12.1
  • PyQt5 5.15.6
  • superqt 0.3.1
  • Python 3.9.7
@tlambert03
Copy link
Member

Thanks, I was able to reproduce this on PyQt5-5.15.6 and pyside2-5.15.2.1, but interestingly it works fine on PyQt6-Qt6-6.2.3 and pyside6-6.2.4 ... I went back and this has been there since at least v0.2.0, which is very surprising!
I also happened to be on macOS 12.3 this time, so want to check some other machines to see if this depends on os version too.

thanks for the report!

@tlambert03 tlambert03 added the bug Something isn't working label Mar 21, 2022
@tlambert03
Copy link
Member

tlambert03 commented Mar 22, 2022

Was not able to reproduce on macOS 10.15 (catalina), so at this point, it appears to be specific to macos >= 11 and Qt < 6

@tlambert03 tlambert03 changed the title qtrangeslider doesn't respond to drag properly qtrangeslider doesn't respond to drag properly on macOS 12 with Qt5.15 Mar 22, 2022
@sfhbarnett
Copy link
Contributor Author

Ok thanks for the updates! I don't have an issue moving to PyQt6 so that counts as a fix to me.

@tlambert03
Copy link
Member

doing some more research on this...
it appears to be a bug with Qt itself on monterey: https://bugreports.qt.io/browse/QTBUG-98093

also described here: https://stackoverflow.com/questions/69890284/qslider-in-qt-misbehaves-in-new-macos-monterey-v12-0-1-any-workaround/69890285#69890285

it also looks like using a custom style sheet can solve it (for example, the styled sliders in the demo widget work fine)... so perhaps we can find a "cheat" solution similar to the SO post above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants