简体   繁体   English

如何在Qt中设置Bold,Italic和Underlined字体?

[英]How to set font Bold, Italic, and Underlined in Qt?

I want to make a program that's like a simple text editor using Qt 4.6.2. 我想制作一个类似于使用Qt 4.6.2的简单文本编辑器的程序。

When the user block any text in a TextEdit and click on a button, the text will be bold/italic/underlined depend on the button.. 当用户阻止TextEdit中的任何文本并单击按钮时,文本将以粗体/斜体/下划线取决于按钮。

I'm a beginner in Qt Programming, so if Possible, can you insert the programming code in Qt to do that? 我是Qt编程的初学者,所以如果可能的话,你能在Qt中插入编程代码吗?

Please answer this ASAP,, thank you very much!! 请尽快回答,非常感谢!! :) :)

See setFontWeight for bold, setFontItalic for italic and setFontUnderline for underline. 请参阅setFontWeight的粗体, setFontItalic的斜体和setFontUnderline的下划线。 These methods set the corresponding attribute of the selected text. 这些方法设置所选文本的相应属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM