Suppaman
26th July 2013, 22:28
Hi
I'm tring to update a caracter under the mouse pointer, like an hiperlink do when the mouse pass over it.
My code is the following:
void MyClass::mouseMoveEvent(QMouseEvent *event)
{
QTextCharFormat Format;
QTextCursor Cursor;
Cursor = cursorForPosition(event->pos());
if(!Cursor.isNull())
{
Format= Cursor.charFormat();
if(Format.isValid())
{
Format.setFontUnderline(true);
Cursor.setCharFormat(Format);
}
}
}
but nothing happen and the character is not updated. Please, note that this is only an example code, the use of setFontUnderline() is just for explain thet also if I update the character under cursor my update doesn't reflect into the text edit widget. Is there an additional function to call for force the repaint of the character after set the new property?
Thank you
I'm tring to update a caracter under the mouse pointer, like an hiperlink do when the mouse pass over it.
My code is the following:
void MyClass::mouseMoveEvent(QMouseEvent *event)
{
QTextCharFormat Format;
QTextCursor Cursor;
Cursor = cursorForPosition(event->pos());
if(!Cursor.isNull())
{
Format= Cursor.charFormat();
if(Format.isValid())
{
Format.setFontUnderline(true);
Cursor.setCharFormat(Format);
}
}
}
but nothing happen and the character is not updated. Please, note that this is only an example code, the use of setFontUnderline() is just for explain thet also if I update the character under cursor my update doesn't reflect into the text edit widget. Is there an additional function to call for force the repaint of the character after set the new property?
Thank you