QT QMessageBox控制线路破解
我使用QT Qmessagebox显示错误消息。 问题是,当错误消息类似于
Error opening file at location 'C:\Users\User\some_folder\some_file'
QT之后的QT插入“:”路径之后的线路破解时,而不是使用一个空格之一:
Error opening file at location 'C:
\Users\User\some_folder\some_file'
有没有办法告诉您在char之后不要断开线':':':'? 我可能有
Error opening file at location
'C:\Users\User\some_folder\some_file'
I use QT QMessageBox to show an error message.
The problem is, when the error message is something like
Error opening file at location 'C:\Users\User\some_folder\some_file'
qt inserts linebreak after the ':' in the path, instead of using one of the withespaces:
Error opening file at location 'C:
\Users\User\some_folder\some_file'
Is there a way to tell not to break line after char ':'?
I would likely have
Error opening file at location
'C:\Users\User\some_folder\some_file'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定这是否有效,因为我尚未测试它,但是您可以使用QT建议的HTML子集。该子集包含
< nobr>
元素。参见 https://doc.qt.io/qt.io/qt-5/richtext-5/richtext-5/richtext-5/richtext-5/richtext- -html-subset.html因此,请尝试以下
QString msg =“位置< nobr>'c:\ users \ user \ user \ user \ some_folder \ some_file”代码>,然后将此字符串发送到
QmessageBox
。I am not sure if this will work, as I have not tested it, but you can use HTML subset which is suppoertd by Qt. This subset contains
<nobr>
element. See https://doc.qt.io/qt-5/richtext-html-subset.htmlSo try this
QString msg = "Error opening file at location <nobr>'C:\Users\User\some_folder\some_file'</nobr>";
and then send this string to theQMessageBox
.