1

I am implementing a text editor by Qt. Since I added the editor to a QGraphicsScene, I chose QGraphicsTextItem to implement it. However, I want to change the status of some tool buttons(like "bold", "italic", "font", etc) when the cursor change. The problem is that in QGraphicsTextItem there is no such signal like "currentCharFormatChanged(QTextCharFormat)" in QTextEdit. How to get the signal when the position of cursor changed?

Liya Yang
  • 11
  • 1
  • You have to implement your custom QGraphicsTextItem. Let's start by implement: virtual void inputMethodEvent(QInputMethodEvent * event) and virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const. You could install your event filter in this element and handle every iteraction on it. Add a custom signal to handle your QTextCharFormatChanged event. – mohabouje Jul 28 '16 at 11:38

0 Answers0