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

Horizontal scrolling not updated until wndow resize event #599

Open
hrdl-github opened this issue Dec 18, 2023 · 3 comments
Open

Horizontal scrolling not updated until wndow resize event #599

hrdl-github opened this issue Dec 18, 2023 · 3 comments

Comments

@hrdl-github
Copy link
Contributor

Wide figures (e.g. produced using import matplotlib.pyplot as plt; plt.figure(dpi=300); plt.plot([1,2,3])) are truncated when the window is narrow enough. Resizing the window causes the horizontal scrollbar to appear / be updated. Horizontal scrolling allows the entire figure to be viewed then.

qtconsole version: 5.5.1

@ccordoba12
Copy link
Collaborator

Hey @hrdl-github, thanks for reporting. I also think it's important to fix this issue but I don't have time to take a look at it.

Could you try to solve it to see how hard it is?

@hrdl-github
Copy link
Contributor Author

I don't know enough about GUI frameworks to make sense of this. Apparently both the vertical scroll bar's visibility policy and whether we update the vertical scrollbar's range influence whether the horizontal scrollbar behaves as expected.

Removing

scrollbar.setRange(0, round(maximum))
while setting control.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) seems to work. Doing the former with any other value or not explicitly setting affects prevents both scrollbars from being displayed.

Also, calling e.g. self._control.horizontalScrollBar().setRange(0, 10) in adjust_scrollbars() will cause this function to be called infinitely often.

@hrdl-github
Copy link
Contributor Author

Under certain conditions this breaks vertical scrolling, so it's more of a starting point to investigate what goes wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants