Image Component Library (ICL)
Public Member Functions | Private Attributes | List of all members
icl::qt::MouseEvent Class Reference

Provided by interface MouseGrabber. More...

#include <MouseEvent.h>

Public Member Functions

 MouseEvent (const utils::Point &widgetPos, const utils::Point &imagePos, const utils::Point32f &imagePos32f, const utils::Point32f &relImagePos, const bool downMask[3], const std::vector< double > &color, const utils::Point &wheelDelta, MouseEventType type, ICLWidget *widget)
 constructor with given parameters More...
 
 MouseEvent ()
 Create an empty mouse event. More...
 
int getWidgetX () const
 returns event's x coordinate wrt. widget frame More...
 
int getWidgetY () const
 returns event's y coordinate wrt. widget frame More...
 
const utils::PointgetWidgetPos () const
 returns event's location wrt. widget frame More...
 
int getX () const
 returns event's x coordinate wrt. image frame More...
 
int getY () const
 returns event's y coordinate wrt. image frame More...
 
const utils::PointgetPos () const
 returns event's location wrt. image frame More...
 
float getX32f () const
 returns event's x coordinate wrt. image frame More...
 
float getY32f () const
 returns event's y coordinate wrt. image frame More...
 
const utils::Point32fgetPos32f () const
 returns event's location wrt. image frame More...
 
const utils::PointgetWheelDelta () const
 wheel delta (x: horizontal wheel, y: vertical wheel (common)) More...
 
float getRelX () const
 returns event's relative x coordinate wrt. image frame More...
 
float getRelY () const
 returns event's relative y coordinate wrt. image frame More...
 
const utils::Point32f getRelPos () const
 returns event's relative location wrt. image frame More...
 
const std::vector< double > & getColor () const
 returns clicked pixels color (or a zero length vector, if there was no pixel) More...
 
bool hitImage () const
 returns if the widget's image was hit (and a color is available) More...
 
std::vector< bool > getDownMask () const
 returns the downmask in order [left, middle, right]- button More...
 
bool isLeft () const
 convenience function for left button More...
 
bool isMiddle () const
 convenience function for middle button More...
 
bool isRight () const
 convenience function for right button More...
 
bool isLeftOnly () const
 convenience function for left button More...
 
bool isMiddleOnly () const
 convenience function for middle button More...
 
bool isRightOnly () const
 convenience function for right button More...
 
const MouseEventType getType () const
 returns the event type More...
 
bool isMoveEvent () const
 convenience function for special event type More...
 
bool isDragEvent () const
 convenience function for special event type More...
 
bool isPressEvent () const
 convenience function for special event type More...
 
bool isReleaseEvent () const
 convenience function for special event type More...
 
bool isEnterEvent () const
 convenience function for special event type More...
 
bool isLeaveEvent () const
 convenience function for special event type More...
 
bool isWheelEvent () const
 convenience function for special event type More...
 
ICLWidgetgetWidget () const
 returns the ICLWidget, which produced this event More...
 
int getKeyboardModifiers () const
 returns all active keyboard modifiers (ored) More...
 
bool isModifierActive (KeyboardModifier m) const
 returns whether a certain modifier is currently active More...
 
MouseEvent remapEvent (const utils::Point32f &imagePos) const
 creates a new MouseEvent instance with a different image position More...
 

Private Attributes

utils::Point m_widgetPos
 event location in widget coordinates More...
 
utils::Point m_imagePos
 event location in image coordinates (common) More...
 
utils::Point32f m_imagePos32f
 event location in image coordinates in float More...
 
utils::Point32f m_relImagePos
 relative image coordinates More...
 
utils::Point m_wheelDelta
 wheel delta (x: horizontal wheel, y: vertical wheel) More...
 
bool m_downMask [3]
 button downMask More...
 
std::vector< double > m_color
 clicked color More...
 
ICLWidgetm_widget
 ICLWidget where the event occured. More...
 
MouseEventType m_type
 Type of this event (press, release, move, ...) More...
 
int m_keyboardModifiers
 ored list of active keyboard modifiers More...
 

Detailed Description

Provided by interface MouseGrabber.

Most commonly, mouse events are processed wrt. the current image coordinate frame of the ICLWidget where the mouse event occurs. So, getX(), getY() and getPos() return the pixel coordinate of a mouse event. If mouse interaction shall be visualized, this coordinates can directly be passed to the drawing functions of ICLDrawWidget's.

Constructor & Destructor Documentation

icl::qt::MouseEvent::MouseEvent ( const utils::Point widgetPos,
const utils::Point imagePos,
const utils::Point32f imagePos32f,
const utils::Point32f relImagePos,
const bool  downMask[3],
const std::vector< double > &  color,
const utils::Point wheelDelta,
MouseEventType  type,
ICLWidget widget 
)

constructor with given parameters

icl::qt::MouseEvent::MouseEvent ( )

Create an empty mouse event.

Member Function Documentation

const std::vector<double>& icl::qt::MouseEvent::getColor ( ) const
inline

returns clicked pixels color (or a zero length vector, if there was no pixel)

std::vector<bool> icl::qt::MouseEvent::getDownMask ( ) const
inline

returns the downmask in order [left, middle, right]- button

int icl::qt::MouseEvent::getKeyboardModifiers ( ) const
inline

returns all active keyboard modifiers (ored)

A certain KeyboardModifier m can be checked for presence by

bool is_m_present = event.getKeyboardModifiers() & m;

or by using the isModifierActive(KeyboardModifier) method directly.

const utils::Point& icl::qt::MouseEvent::getPos ( ) const
inline

returns event's location wrt. image frame

const utils::Point32f& icl::qt::MouseEvent::getPos32f ( ) const
inline

returns event's location wrt. image frame

const utils::Point32f icl::qt::MouseEvent::getRelPos ( ) const
inline

returns event's relative location wrt. image frame

float icl::qt::MouseEvent::getRelX ( ) const
inline

returns event's relative x coordinate wrt. image frame

float icl::qt::MouseEvent::getRelY ( ) const
inline

returns event's relative y coordinate wrt. image frame

const MouseEventType icl::qt::MouseEvent::getType ( ) const
inline

returns the event type

const utils::Point& icl::qt::MouseEvent::getWheelDelta ( ) const
inline

wheel delta (x: horizontal wheel, y: vertical wheel (common))

We use the unit of Qt's QWheelEvent's delta:

MouseEvent event = ...;
int numDegrees = event.getWheelDelta().y / 8;
int numSteps = numDegrees / 15;

A positive delta value means that the wheel was rotated forward (for y) and to the right (for x)

ICLWidget* icl::qt::MouseEvent::getWidget ( ) const
inline

returns the ICLWidget, which produced this event

const utils::Point& icl::qt::MouseEvent::getWidgetPos ( ) const
inline

returns event's location wrt. widget frame

int icl::qt::MouseEvent::getWidgetX ( ) const
inline

returns event's x coordinate wrt. widget frame

int icl::qt::MouseEvent::getWidgetY ( ) const
inline

returns event's y coordinate wrt. widget frame

int icl::qt::MouseEvent::getX ( ) const
inline

returns event's x coordinate wrt. image frame

float icl::qt::MouseEvent::getX32f ( ) const
inline

returns event's x coordinate wrt. image frame

int icl::qt::MouseEvent::getY ( ) const
inline

returns event's y coordinate wrt. image frame

float icl::qt::MouseEvent::getY32f ( ) const
inline

returns event's y coordinate wrt. image frame

bool icl::qt::MouseEvent::hitImage ( ) const
inline

returns if the widget's image was hit (and a color is available)

bool icl::qt::MouseEvent::isDragEvent ( ) const
inline

convenience function for special event type

bool icl::qt::MouseEvent::isEnterEvent ( ) const
inline

convenience function for special event type

bool icl::qt::MouseEvent::isLeaveEvent ( ) const
inline

convenience function for special event type

bool icl::qt::MouseEvent::isLeft ( ) const
inline

convenience function for left button

bool icl::qt::MouseEvent::isLeftOnly ( ) const
inline

convenience function for left button

bool icl::qt::MouseEvent::isMiddle ( ) const
inline

convenience function for middle button

bool icl::qt::MouseEvent::isMiddleOnly ( ) const
inline

convenience function for middle button

bool icl::qt::MouseEvent::isModifierActive ( KeyboardModifier  m) const
inline

returns whether a certain modifier is currently active

bool icl::qt::MouseEvent::isMoveEvent ( ) const
inline

convenience function for special event type

bool icl::qt::MouseEvent::isPressEvent ( ) const
inline

convenience function for special event type

bool icl::qt::MouseEvent::isReleaseEvent ( ) const
inline

convenience function for special event type

bool icl::qt::MouseEvent::isRight ( ) const
inline

convenience function for right button

bool icl::qt::MouseEvent::isRightOnly ( ) const
inline

convenience function for right button

bool icl::qt::MouseEvent::isWheelEvent ( ) const
inline

convenience function for special event type

MouseEvent icl::qt::MouseEvent::remapEvent ( const utils::Point32f imagePos) const
inline

creates a new MouseEvent instance with a different image position

This method can be used to simulate normal mouse-events, acutally received from another source, such as an 3D component

Member Data Documentation

std::vector<double> icl::qt::MouseEvent::m_color
private

clicked color

bool icl::qt::MouseEvent::m_downMask[3]
private

button downMask

utils::Point icl::qt::MouseEvent::m_imagePos
private

event location in image coordinates (common)

utils::Point32f icl::qt::MouseEvent::m_imagePos32f
private

event location in image coordinates in float

int icl::qt::MouseEvent::m_keyboardModifiers
private

ored list of active keyboard modifiers

utils::Point32f icl::qt::MouseEvent::m_relImagePos
private

relative image coordinates

MouseEventType icl::qt::MouseEvent::m_type
private

Type of this event (press, release, move, ...)

utils::Point icl::qt::MouseEvent::m_wheelDelta
private

wheel delta (x: horizontal wheel, y: vertical wheel)

ICLWidget* icl::qt::MouseEvent::m_widget
private

ICLWidget where the event occured.

utils::Point icl::qt::MouseEvent::m_widgetPos
private

event location in widget coordinates


The documentation for this class was generated from the following file: