Skip to content

Conversation

@dnlkrs
Copy link
Contributor

@dnlkrs dnlkrs commented Dec 3, 2024

Qt changed some of their private API with version 6.8.1, which causes compilation errors.
Specifically they removed QWinRegistryKey::dwordValue(...) in favor of QWinRegistryKey::value(...)

@dnlkrs
Copy link
Contributor Author

dnlkrs commented Dec 3, 2024

Here the commit in qtbase
qt/qtbase@7a63a25

@wangwenx190
Copy link
Collaborator

Thanks! But I think we should use new API in user code instead of restoring the old Qt API.

@wangwenx190 wangwenx190 self-requested a review December 5, 2024 07:43
@wangwenx190 wangwenx190 added the enhancement New feature or request label Dec 5, 2024
@dnlkrs
Copy link
Contributor Author

dnlkrs commented Dec 5, 2024

Yes this was my first thought aswell, but I can not test Qt versions below 5.14.0

#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)

For the most recent commit I confirmed compilation with these Qt versions (Windows, MinGW):

  • 6.2.13
  • 6.7.3
  • 6.8.1

Copy link
Collaborator

@wangwenx190 wangwenx190 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Only minor tweaks needed.

return qMakePair(value, ok);
}

template<>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

template implementations should be placed in header files


template<>
std::optional<DWORD> WindowsRegistryKey::value(QStringView subKey) const {
auto dv = dwordValue(subKey);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be const

template<>
std::optional<DWORD> WindowsRegistryKey::value(QStringView subKey) const {
auto dv = dwordValue(subKey);
if(!dv.second) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space after if

return dv.first;
}
#elif QT_VERSION < QT_VERSION_CHECK(6, 8, 1)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty line not needed

{
}

template<>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto, place this in header file


template<>
std::optional<DWORD> WindowsRegistryKey::value(QStringView subKey) const {
auto dv = dwordValue(subKey);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto, can be const

template<>
std::optional<DWORD> WindowsRegistryKey::value(QStringView subKey) const {
auto dv = dwordValue(subKey);
if(!dv.second) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto, space after if

#endif

} No newline at end of file
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something that should not be changed

QPair<DWORD, bool> dwordValue(QStringView subKey) const;

template<typename T>
std::optional<T> value(QStringView subKey) const { return {}; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you don't want this function to be called directly, so we can use static_cast(false, "xxx") to ensure this.

explicit WindowsRegistryKey(HKEY parentHandle, QStringView subKey, REGSAM permissions = KEY_READ, REGSAM access = 0);

template<typename T>
std::optional<T> value(QStringView subKey) const { return {}; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto, use static_assert here

- Moved template specializations to header, had to add inline for this to work
- Added const qualifiers
- Added space after if
- Removed unneeded new lines
- Removed new lines inserted by the IDE
- Removed general template implementation, static asserts did not compile (due to MOC i think). Using the function with any other type than DWORD will still cause a compilation error
@dnlkrs dnlkrs requested a review from wangwenx190 December 5, 2024 14:07
Copy link
Collaborator

@wangwenx190 wangwenx190 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, you may misunderstand my words. Please apply some more minor tweaks. Really thanks!

QPair<DWORD, bool> dwordValue(QStringView subKey) const;

template<typename T>
const std::optional<T> value(QStringView subKey) const;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mean the return value should be const, sorry for my misleading word. You can remove the const keyword from the return value

}

template<>
inline const std::optional<DWORD> WindowsRegistryKey::value(QStringView subKey) const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this const keyword


template<>
inline const std::optional<DWORD> WindowsRegistryKey::value(QStringView subKey) const {
auto dv = dwordValue(subKey);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was meant to make this "dv" const, but never mind, const or not doesn't really matter.

explicit WindowsRegistryKey(HKEY parentHandle, QStringView subKey, REGSAM permissions = KEY_READ, REGSAM access = 0);

template<typename T>
inline const std::optional<T> value(QStringView subKey) const;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, please remove the const keyword

};

template<>
inline const std::optional<DWORD> WindowsRegistryKey::value(QStringView subKey) const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove const

#endif

#endif // QWINDOWKIT_WINDOWS_H
#endif // QWINDOWKIT_WINDOWS_H No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the line ending is changed? Could you please restore it?

@dnlkrs dnlkrs requested a review from wangwenx190 December 6, 2024 13:46
@wangwenx190
Copy link
Collaborator

Thanks!

@wangwenx190 wangwenx190 merged commit 91274c5 into stdware:main Dec 6, 2024
GerritRingMirror pushed a commit to savoirfairelinux/jami-client-qt that referenced this pull request Mar 31, 2025
This commit updates QWindowKit in order to fix the following build issue
on Qt 6.8: stdware/qwindowkit#154

GitLab: #1944
Change-Id: Iab82514b51577148ff5dc1ba382f8bb517c94f8a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants