[PR #195] [MERGED] Replace usage of QString::asprintf #236

Closed
opened 2026-05-05 11:21:22 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/qmlnet/qmlnet/pull/195
Author: @jdpage
Created: 4/23/2020
Status: Merged
Merged: 4/24/2020
Merged by: @pauldotknopf

Base: developHead: develop


📝 Commits (1)

  • 470fc43 Replace usage of QString::asprintf for new Qt

📊 Changes

1 file changed (+4 additions, -8 deletions)

View changed files

📝 src/native/QmlNet/Hosting/CoreHost.cpp (+4 -8)

📄 Description

In Qt5, QString::asprintf is a static method which returns a new string, rather than an instance method which updates the existing string (as it was in Qt4), so the code was passing empty strings to the managed entry point. Additionally, the documentation warns against it.

The static QString::number method is available in both Qt4 and Qt5. I haven't tested against Qt4 but it works in 5.14.2.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/qmlnet/qmlnet/pull/195 **Author:** [@jdpage](https://github.com/jdpage) **Created:** 4/23/2020 **Status:** ✅ Merged **Merged:** 4/24/2020 **Merged by:** [@pauldotknopf](https://github.com/pauldotknopf) **Base:** `develop` ← **Head:** `develop` --- ### 📝 Commits (1) - [`470fc43`](https://github.com/qmlnet/qmlnet/commit/470fc433ed29b2f5633a6d267c78c92318ab0c84) Replace usage of QString::asprintf for new Qt ### 📊 Changes **1 file changed** (+4 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/native/QmlNet/Hosting/CoreHost.cpp` (+4 -8) </details> ### 📄 Description In Qt5, `QString::asprintf` is a static method which returns a new string, rather than an instance method which updates the existing string (as it was in Qt4), so the code was passing empty strings to the managed entry point. Additionally, [the documentation warns against it](https://doc.qt.io/qt-5/qstring.html#asprintf). The static [QString::number](https://doc.qt.io/qt-5/qstring.html#number) method is available in both Qt4 and Qt5. I haven't tested against Qt4 but it works in 5.14.2. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 11:21:22 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/qmlnet#236
No description provided.