用于将 QString 转换为 C-style ASCII 字符串的 toAscii() 函数似乎已被弃用。在 Qt 中,可以使用 QString::toLatin1() 或 QString::toUtf8() 函数进行此类转换,它们会返回一个 QByteArray,分别代表拉丁-1(ISO 8859-1)或UTF-8 编码的字符串。
修改前:
qDebug("idx: %d, name: %s (axes: %d, buttons: %d, hats: %d)",
j->index,
j->name.toAscii().data(),
j->numAxes,
j->numButtons,
j->numHats);
修改后:
qDebug("idx: %d, name: %s (axes: %d, buttons: %d, hats: %d)",
j->index,
j->name.toUtf8().constData(), // Using toUtf8() instead of toAscii()
j->numAxes,
j->numButtons,
j->numHats);