diff options
Diffstat (limited to 'vcl/qt5/Qt5Tools.cxx')
-rw-r--r-- | vcl/qt5/Qt5Tools.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/vcl/qt5/Qt5Tools.cxx b/vcl/qt5/Qt5Tools.cxx index 5ce038b2b054..ec090a69dcbd 100644 --- a/vcl/qt5/Qt5Tools.cxx +++ b/vcl/qt5/Qt5Tools.cxx @@ -21,8 +21,37 @@ #include <cairo.h> +#include <vcl/event.hxx> + void CairoDeleter::operator()(cairo_surface_t *pSurface) const { cairo_surface_destroy( pSurface ); } +sal_uInt16 GetKeyModCode( Qt::KeyboardModifiers eKeyModifiers ) +{ + sal_uInt16 nCode = 0; + if( eKeyModifiers & Qt::ShiftModifier ) + nCode |= KEY_SHIFT; + if( eKeyModifiers & Qt::ControlModifier ) + nCode |= KEY_MOD1; + if( eKeyModifiers & Qt::AltModifier ) + nCode |= KEY_MOD2; + if( eKeyModifiers & Qt::MetaModifier ) + nCode |= KEY_MOD3; + return nCode; +} + +sal_uInt16 GetMouseModCode( Qt::MouseButtons eButtons ) +{ + sal_uInt16 nCode = 0; + if( eButtons & Qt::LeftButton ) + nCode |= MOUSE_LEFT; + if( eButtons & Qt::MidButton ) + nCode |= MOUSE_MIDDLE; + if( eButtons & Qt::RightButton ) + nCode |= MOUSE_RIGHT; + return nCode; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |