Hi,
This is a question for experimented qt scribe classes programmers.
I am trying to simulate check box widget inside my rich text.
so i have created a QTextObjectInterface that paint this 'check box' for me. I do store the 'check state' inside the a custom QTextChartFormat created for with this interface.
Code:
bool isChecked = false; format.setObjectType(CheckBoxTextFormat); //CheckBox::CB_IsChecked format.setProperty(CheckBox::CB_IsChecked,isChecked);
When user click the 'checkbox' i do call this code to simulate a click
Code:
// QTextCursor cursor, QTextCharFormat format are in the right position where i have my QTextObject bool isChecked = format.property(CheckBox::CB_IsChecked).toBool(); isChecked = !isChecked; cursor.beginEditBlock(); cursor.mergeCharFormat(format); //for some reason this don't work cursor.cursor.setCharFormat(format); // also this don't work // when painting the QTextObjectInterface read always the same value from format.property(CheckBox::CB_IsChecked).toBool(); // even if it was changed by above code. cursor.endEditBlock();
Is this the proper manner to do such thing ?
Moez.