Qt,如何将文本编辑滚动条设置到底部? C++
我将文本编辑框作为聊天窗口,但我想知道是否有办法将滚动条设置在底部以显示最新更新的消息。
我目前正在使用 Qt3 和 C++。
chat_box->....我尝试查找,但只能找到“ScrollBarMode”,但它只能让我打开或关闭或自动...这并没有真正的帮助。
感谢您的帮助:D
I have the text edit box as a chat window, but I was wondering if there was a way to set the scroll bar to be at the bottom to show the most updated message.
I am currently using Qt3 and C++.
chat_box->.... I tried looking and was only able to find "ScrollBarMode" but it only lets me turn it on or off or auto... which doesn't really help.
Thanks for the help :D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将其放在插入文本的行之后。
Put that after the line where you insert text.
斯科奇的答案 是正确的。 Qt3 解决方案类似于:
我没有测试这段代码,因为我不再有 Qt3。检查它是否有效。
scotchi's answer would be correct if it was Qt4. Qt3 solution would be something like:
I didn't test this code since I don't have Qt3 anymore. Check if it works.
...如果可能的话(我不知道你的环境)请切换到 Qt4 - Qt3 有很多缺点,缺少支持,缺少功能等。
再见,
Chris
PS:切换到 Qt4 相当容易 - 您不必重写所有代码,因为 Qt4 内置了 Qt3-Support 以及适用于您的源代码的转换器工具。
...if possible (I don't know your environment) please switch to Qt4 - there are so many disadvantages and missing supprt, missing functionality etc. in Qt3.
ciao,
Chris
PS: It's fairly easy to switch to Qt4 - you don't have to rewrite all of your code, because Qt4 has build in Qt3-Support with a converter tool for your sources.