PDA

View Full Version : Bulleted List



ToddAtWSU
3rd January 2008, 22:46
I have a QStringList I want to display on the screen and was hoping to do this in a bulleted list fashion. From what I can see is I could possibly use a QTextEdit and make it read-only. But my confusion comes in how I would display this QStringList of items into the QTextEdit. It looks like I would have to set the AutoFormattingFlag to AutoBulletList but how do I add text to this? Or am I going about this all in the wrong direction? Any idea on what I should do to display a bulleted list would be great. I searched the forums thinking this had been done, but much to my dismay, I saw no topic related to creating a bulleted list. I am using Qt 4.3. Thanks!

jacek
3rd January 2008, 22:53
Dig around QTextDocument, QTextCursor::insertList() and QTextList. Or simply change your list into:

<html>
<body>
<ul>
<li>string1</li>
<li>string2</li>
<li>string3</li>
...
</ul>
</body>
</html>
and use QTextEdit::setHtml().