Skip to content

Conversation

@Sunderland93
Copy link
Contributor

Description

count() is deprecated since Qt 6.4. Use size() instead

Related Issues

[Any issues this pull request may be addressing]

Related Pull Requests

[Any other PRs from related repositories that might be needed for this pull request to work]

Reviewers

[If possible @mention all the people that should review your pull request]

@Sunderland93 Sunderland93 changed the title ui/qt: replace deprecated "count" with "size" ui/qt: replace deprecated count() with size() Aug 12, 2025
@Sunderland93 Sunderland93 changed the title ui/qt: replace deprecated count() with size() ui/qt6: replace deprecated count() with size() Aug 12, 2025
@LibretroAdmin
Copy link
Contributor

Do these functions have any functional differences to strlen? What if we just used that instead so the code could work for all Qt versions? We would of course have to take that size() use out of the for loop declaration and put it in a variable outside instead

@Sunderland93
Copy link
Contributor Author

size()/count() in Qt return the container’s length in O(1) and work with QString/QByteArray, while strlen() only works with null-terminated char* and is O(n). For cross-Qt compatibility, keep size() (cache it if needed for loops).

@LibretroAdmin
Copy link
Contributor

Alright, size() seems to go as far back as Qt 4.8 so I think we are good then in terms of backwards compatibility (correct me if I'm wrong)

@LibretroAdmin LibretroAdmin merged commit f0370a1 into libretro:master Aug 12, 2025
31 checks passed
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.

2 participants