Hi,

I want that my customized QGraphicsTextItem only stays in one line and don't accept whitespace. Therefore I have reimplemented keypressevent as following:
Qt Code:
  1. void TEXFWordItem::keyPressEvent(QKeyEvent *event)
  2. {
  3. if (event->key() != Qt::Key_Space && event->key() != Qt::Key_Tab && event->key() != Qt::Key_Return)
  4. QGraphicsTextItem::keyPressEvent(event);
  5. }
To copy to clipboard, switch view to plain text mode 

Spaces and return are blocked correct but Qt::Key_Tab seems to never reach this eventhandler. So a tabulator is still entered in the items editor. How to avoid that?


2nd question: How to catch past events to avoid special characters and different font style? (maybe without subclassing QTextDocument?)


Thanks,
Lykurg