Hey that works like a charm. Thanks a lot!Another way could be to install an event filter on the application object:
Qt Code:
{ Q_OBJECT ... public: { { if (!object->inherits("QGraphicsView")) { event->accept(); return true; } } return false; } protected: qApp->installEventFilter(this); } qApp->removeEventFilter(this); } };class MyTextItem : public QGraphicsTextItem // QGraphicsTextItem inherits QObject { Q_OBJECT ... public: bool eventFilter(QObject* object, QEvent* event) { if (event->type() == QEvent::Shortcut || event->type() == QEvent::ShortcutOverride) { if (!object->inherits("QGraphicsView")) { event->accept(); return true; } } return false; } protected: void focusInEvent(QFocusEvent* event) { QGraphicsTextItem::focusInEvent(event); qApp->installEventFilter(this); } void focusOutEvent(QFocusEvent* event) { QGraphicsTextItem::focusOutEvent(event); qApp->removeEventFilter(this); } };To copy to clipboard, switch view to plain text mode![]()





Reply With Quote
Bookmarks