【发布时间】:2024-01-05 12:31:01
【问题描述】:
我有这个代码:
QString carda = "000123";
QString queryStringAnet("SELECT * FROM [records] WHERE ([user]='" + carda.toInt() + "' AND [apl]='"+apl+"' AND [tasktype]='"+taskType+"' AND [taskkind]='"+taskKind+"' AND [timestamp]='"+timestamp+"')");
当我使用 carda.toInt() 时从 QString 到 Int 的转换我有这个错误:
错误:二进制表达式的操作数无效('const char *' 和 'const char [14]')
和警告:
warning: adding 'int' to a string does not append to the string
use array indexing to silence this warning
我不明白为什么 QString.toInt() 不会工作......有什么想法吗?
【问题讨论】:
标签: qt type-conversion qt5 qstring