3
我對Qt並不陌生,但我找不到如何將自定義css類添加到QTextEdit中的選定塊。將自定義HTML類屬性添加到QTextEdit中的選定塊
據我所知,格式改變絲毫這樣的代碼:
QTextCursor cursor = textEdit->textCursor();
QTextBlockFormat bfmt;
// Apply format changes
cursor.setBlockFormat(bfmt);
當我這樣做時,生成的HTML代碼創建了它內聯風格的跨度,但我要的是插入css類:
<SPAN class='myclass'>text</span>
我在QTextBlockFormat中缺少一個函數來設置文本的css類。