Skip to content

Conversation

ElTh0r0
Copy link
Contributor

@ElTh0r0 ElTh0r0 commented Jul 15, 2025

This PR fixes #4077

I doubled checked it with the old Qt 5 build and dis-/enabling tool buttons worked on Windows. With Qt 6 loading the saved configuration didn't work anymore and debug console output was showing: "QVariant::load: unknown user type with name QList."

There must have been changes in the Qt meta-type system and platform-specific differences. QList is not a built-in QVariant type. To use custom types we need to register them using Q_DECLARE_METATYPE(QList) and qRegisterMetaType<QList>().

In Qt 5, handling of QList was more permissive, so QList sometimes worked without explicit registration. Starting with Qt 6, the meta-type system has become stricter and does not recognize QList natively anymore. This causes the type to be unknown when deserializing (e.g. from QSettings), unless explicitly registered.

I couldn't find clear explanation for the differences on Windows and Linux, but AI mentioned: "The Qt build configuration or available precompiled meta-types can differ between Windows and Linux, which is why the problem only appears on one platform."

I tested this PR on Windows and on Manjaro and it worked on both systems, so I'd say we don't need explicit #if defined(Q_OS_WIN).

@borgmanJeremy
Copy link
Collaborator

Thanks for the quick fix! I also tested and it didn't break anything.

@borgmanJeremy borgmanJeremy merged commit 31899d8 into flameshot-org:master Jul 15, 2025
14 checks passed
@ElTh0r0 ElTh0r0 deleted the fix_button_settings_windows branch July 16, 2025 16:11
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.

Button Selection not being remembered after restart
2 participants