Mercurial > hg > orthanc-stone
changeset 284:38b0ac8055b9 am-2
Qt: catch and forward keyboard events
author | am@osimis.io |
---|---|
date | Tue, 28 Aug 2018 11:09:37 +0200 |
parents | 300d8b8c48b3 |
children | 3c190e2bb3af |
files | Applications/Qt/QCairoWidget.cpp Applications/Qt/QCairoWidget.h TODO |
diffstat | 3 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/Qt/QCairoWidget.cpp Tue Aug 28 10:01:31 2018 +0200 +++ b/Applications/Qt/QCairoWidget.cpp Tue Aug 28 11:09:37 2018 +0200 @@ -29,6 +29,7 @@ QWidget(parent), context_(NULL) { + setFocusPolicy(Qt::StrongFocus); // catch keyPressEvents } QCairoWidget::~QCairoWidget() @@ -134,6 +135,12 @@ } } +void QCairoWidget::keyPressEvent(QKeyEvent *event) +{ + OrthancStone::KeyboardModifiers stoneModifiers = GetKeyboardModifiers(event); + + context_->GetCentralViewport().KeyPressed(event->text()[0].toLatin1(), stoneModifiers); +} void QCairoWidget::resizeEvent(QResizeEvent* event)
--- a/Applications/Qt/QCairoWidget.h Tue Aug 28 10:01:31 2018 +0200 +++ b/Applications/Qt/QCairoWidget.h Tue Aug 28 11:09:37 2018 +0200 @@ -51,6 +51,8 @@ virtual void wheelEvent(QWheelEvent *event); + virtual void keyPressEvent(QKeyEvent *event); + public: explicit QCairoWidget(QWidget *parent);
--- a/TODO Tue Aug 28 10:01:31 2018 +0200 +++ b/TODO Tue Aug 28 11:09:37 2018 +0200 @@ -12,6 +12,7 @@ * Allow Interactor to create Pan/ZoomMouseTracker in IWorldSceneMouseTracker* CreateMouseTracker (problem: PanMouseTracker is a IMouseTracker and CreateMouseTracker shall return a IWorldSceneMouseTracker). WorldSceneWidet shall not create Pan/ZoomMouseTracker when the Interactor does not create one +* Update SimpleViewer sample to have 2 buttons to select the measure tracker --------------------------------- Radiotherapy and nuclear medicine