Help!Max2025 and Qt6,when i want to get the name of a node,its output is garbled!

Help!Max2025 and Qt6,when i want to get the name of a node,its output is garbled!

2829024262
Contributor Contributor
507 Views
5 Replies
Message 1 of 6

Help!Max2025 and Qt6,when i want to get the name of a node,its output is garbled!

2829024262
Contributor
Contributor

I am using the Max 2025 SDK with Qt 6 and VS 2019. I want to get the name of an INode* type and output it using qDebug(), but the output is always garbled. How can I solve this?

 

I am using GB2312 encoding in VS2019, and I want to display the name of an INode* on a Qt-made UI, but it is also showing as garbled text.

 

INode* node=ip->GetSelNode(0)->GetName();

qDebug() << QString::fromWCharArray(node->GetName());

MSTR name(node->GetName());

qDebug() << name.operator QString();

MSTR t = node->GetName();
std::wstring tt = t.data();
qDebug()<< QString::fromStdWString(tt);c

qDebug() << QString::fromUtf8(QString::fromWCharArray(node->GetName()).toUtf8());

 

The result of the above four output methods is(in vs console output window):

"䕨\u0A12翶"
"䕨\u0A12翶"
"䕨\u0A12翶"
"䕨\u0A12翶"

0 Likes
Accepted solutions (1)
508 Views
5 Replies
Replies (5)
Message 2 of 6

istan
Advisor
Advisor

Have you also tried this?

TSTR nam = node->GetName();
QString str = nam;

0 Likes
Message 3 of 6

denisT.MaxDoctor
Advisor
Advisor

try:

MSTR name = node->GetName();
auto str = QString::fromWCharArray(name.data());
0 Likes
Message 4 of 6

2829024262
Contributor
Contributor

This is still wrong.😭

MSTR t = node->GetName();

auto str = QString::fromWCharArray(t.data());
qDebug() << str;

 

The result of the above four output methods is(in vs console output window):

"䕨䕆翶"

 

When I'm on the other version 2017-2024,How I use it is:qDebug() <<QString::fromWCharArray(node->GetName());.

I can print the name of node in the scene correctly, but I don't know why 2025 doesn't display correctly.

 

0 Likes
Message 5 of 6

2829024262
Contributor
Contributor

Yes, I tried.But it hints that there is no proper constructor to convert from const wchar_t* to CStr.

0 Likes
Message 6 of 6

2829024262
Contributor
Contributor
Accepted solution

I've found a solution,I added a macro "#define __T(x) L ## x" to the docs tchar.h.