PDA

View Full Version : currentCharFormatChanged() not reporting List or Table formats



KrishnaPG
13th March 2009, 16:11
In QTextEdit, when the cursor is moved and the underlying formatting attributes change, the currentCharFormatChanged() signal is emitted to reflect the new attributes at the new cursor position.

However, this is working only for charformats. How to identify List and Table/TableCell formats?

Even the TextEdit sample does not have this in the code. As a result, when cursor is put on a list or table text, the tool bars are not getting updated correctly for the format type.

How to retrieve the List and Table formats ?

Thank you,
P.Gopalakrishna
http://www.CineFxLabs.com

KrishnaPG
13th March 2009, 16:26
Never Mind.

Using cursorPositionChanged() got the updates.

Something like below:

------------
void TextEdit::cursorPositionChanged()
{
// Update the Style of text in the ComboBox
QTextCursor cursor = textEdit->textCursor();
if (cursor.currentList())
{
QTextListFormat listFmt = cursor.currentList()->format();
this->comboStyle->setCurrentIndex(abs(listFmt.style())); // List Text Type
}
else
this->comboStyle->setCurrentIndex(0); // Standard Text type
}
------------