Skip to content

connect darkMode slots only once#3145

Merged
j9ac9k merged 1 commit intopyqtgraph:masterfrom
pijyoi:darkmode-once
Sep 8, 2024
Merged

connect darkMode slots only once#3145
j9ac9k merged 1 commit intopyqtgraph:masterfrom
pijyoi:darkmode-once

Conversation

@pijyoi
Copy link
Copy Markdown
Contributor

@pijyoi pijyoi commented Sep 8, 2024

fixes #3143

In PySide6 > 6.7.2, it is no longer possible to use UniqueConnection with free-standing functions. The end result of supplying that mode is that no connection will be made at all.

This can be worked-around by manually keeping track of whether a connection has already been made.

In fact, the original code has a recursion issue. In the slot, mkQApp() is called, which then attempts to connect the slot again, relying on UniqueConnection to mask out this recursion.

)
QAPP.setProperty("darkMode", darkMode)
if not _pgAppInitialized:
_pgAppInitialized = True

Check notice

Code scanning / CodeQL

Unused global variable

The global variable '_pgAppInitialized' is not used.
@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Sep 8, 2024

Thanks for fixing this @pijyoi a global is the right solution here for sure.

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

Successfully merging this pull request may close these issues.

Dark/Light mode change will no longer work in PySide6 > 6.7.2

2 participants