MeVisLab Resolution Independence API
SoQtViewerProxy Class Reference

#include <SoQtViewerProxy.h>

Inheritance diagram for SoQtViewerProxy:
SoViewerProxy

Public Member Functions

 SoQtViewerProxy (SoQtRenderArea *renderArea=nullptr)
 This class implements access to the state of the SoQtMeVis viewer. More...
 
 ~SoQtViewerProxy () override
 Destructor. More...
 
void setCursor (int shapeID) override
 Set cursor of viewer to pre- or user-defined shape, invalid positive values will set cursor to default shape, negative values will do nothing. More...
 
void setForceCursor (int shapeID) override
 Enforce setting the cursor, even from mouseOverUpdates. More...
 
int getCursor ()
 Returns the requested cursor shape. More...
 
bool hasShape (int shapeID) override
 Check if this shape has already been defined. More...
 
int defineCursor (const char *cursorImgFileName, int hotSpotX=-1, int hotSpotY=-1, int id=-1) override
 Define new cursor shape - successful operation is only guaranteed with PNG-Images with size 32x32, containing only black, white and transparent pixels. More...
 
bool getCurrentCursorPosition (int &x, int &y) override
 Get current cursor position relative to the viewing window. More...
 
bool isInitialRendering () const override
 returns true if the viewer does the initial rendering after it became visible More...
 
bool isUserInterationEventInQueue () const override
 returns if a user interaction event is the the GUI event queue More...
 
double getDevicePixelRatio () override
 Returns the ratio between physical pixels and device-independent pixels for the viewer. More...
 
- Public Member Functions inherited from SoViewerProxy
virtual ~SoViewerProxy ()
 Destructor. More...
 
virtual bool isHighQualityOffscreenRendering () const
 returns true if high quality offscreen rendering (e.g. for OffscreenRenderer) is desired More...
 
virtual SoMetaInformationMapgetMetaInformationMap ()
 returns the current SoMetaInformationMap, which allows storing of the current meta information / render state as key/value pairs. More...
 

Static Public Member Functions

static bool forceDefineCursor (int id, const char *cursorImgFileName, int hotSpotX=-1, int hotSpotY=-1)
 defineCursor simply calls this method, which will overwrite previous shapes More...
 
static void initializeDefaultCursors ()
 On some platforms it may not be possible to initialize the default cursors at any time, so one may have to call this in advance. More...
 
static QCursor getCursor (int shapeID)
 Get the QCursor associated with the given shapeID. More...
 
static QPixmap getPixmap (int shapeID)
 Get the QPixmap associated with the given shapeID in 1x resolution. More...
 
static QPixmap getPixmap2x (int shapeID)
 Get the QPixmap associated with the given shapeID in 2x resolution. More...
 
static int getShapeID (const QCursor &cursor)
 Get the shape ID associated with the given cursor. More...
 
static bool isSameCursor (const QCursor &a, const QCursor &b)
 Compare cursor shapes: More...
 
- Static Public Member Functions inherited from SoViewerProxy
static const char *const * cursorShapeNames ()
 return list of strings containing cursor shape names; this includes UNDEFINED_CURSOR, so you must add 1 when indexing this array More...
 
static int getPredefinedCursorCount ()
 get number of predefined cursors from code (instead of requiring a re-compilation of all using libraries when using the value PREDEFINED_CURSOR_COUNT) More...
 
static const ml::EnumValues< cursorShapeEnum > & getCursorShapeEnumValues ()
 get enum values record for use with ml::TypedEnumField More...
 
static int getNextFreeShapeID ()
 return the next free id for defining your own cursor shape More...
 

Protected Attributes

SoQtRenderArea * _renderArea
 pointer to the actual viewer: More...
 
int _requestedShape
 currently requested cursor shape More...
 
bool _cursorEnforced
 cursor setting was enforced More...
 
virtual void resetCursor ()
 reset stored cursor shape (must be called before event handling traversal) More...
 
virtual void evaluateCursor ()
 evaluate set cursor shape (must be called after event handling traversal) More...
 
virtual bool actionMayChangeCursor (SoAction *action)
 Returns if the given action may change the cursor, this is typically the case for SoHandleEvent actions with the exception of the artificial SoLocation2RefreshEvent event. More...
 
static void resetCursorCB (void *userData, SoAction *action)
 This callback can be used together with a SoCallback node, userData must be set to the pointer to this (or a derived) proxy. More...
 
static void evaluateCursorCB (void *userData, SoAction *action)
 This callback can be used together with a SoCallback node, userData must be set to the pointer to this (or a derived) proxy. More...
 

Additional Inherited Members

- Public Types inherited from SoViewerProxy
enum  cursorShapeEnum {
  UNDEFINED_CURSOR = -1 , DEFAULT_CURSOR = 0 , FORBIDDEN_CURSOR , POINTING_HAND_CURSOR ,
  OPEN_HAND_CURSOR , CLOSED_HAND_CURSOR , MOVE_ALL_CURSOR , MOVE_HORI_CURSOR ,
  MOVE_VERT_CURSOR , MOVE_FDIAG_CURSOR , MOVE_BDIAG_CURSOR , MOVE_INOUT_CURSOR ,
  ROTATE_X_CURSOR , ROTATE_Y_CURSOR , ROTATE_Z_CURSOR , ROTATE_XY_CURSOR ,
  ZOOM_CURSOR , ZOOM_IN_CURSOR , ZOOM_OUT_CURSOR , CROSS_CURSOR ,
  CROSS_PLUS_CURSOR , CROSS_MINUS_CURSOR , CROSS_MOVE_CURSOR , CROSS_ROTATE_CURSOR ,
  CROSS_RECT_CURSOR , CROSS_OVAL_CURSOR , CROSS_VECTOR_CURSOR , CROSS_FREEFORM_CURSOR ,
  CROSS_POINT_CURSOR , CROSS_LINE_CURSOR , CROSS_CURVE_CURSOR , CROSS_POLYLINE_CURSOR ,
  CROSS_POLYGON_CURSOR , CROSS_FILL_CURSOR , CROSS_LINK_CURSOR , CROSS_0_CURSOR ,
  CROSS_1_CURSOR , CROSS_2_CURSOR , CROSS_3_CURSOR , CROSS_4_CURSOR ,
  CROSS_5_CURSOR , CROSS_6_CURSOR , CROSS_7_CURSOR , CROSS_8_CURSOR ,
  CROSS_9_CURSOR , LUT_CURSOR , LUT_1_CURSOR , LUT_2_CURSOR ,
  LUT_3_CURSOR , SLICING_CURSOR , BLANK_CURSOR , OTHER_CURSOR_0 ,
  OTHER_CURSOR_1 , OTHER_CURSOR_2 , OTHER_CURSOR_3 , OTHER_CURSOR_4 ,
  OTHER_CURSOR_5 , OTHER_CURSOR_6 , OTHER_CURSOR_7 , OTHER_CURSOR_8 ,
  OTHER_CURSOR_9 , OTHER_CURSOR_10 , OTHER_CURSOR_11 , OTHER_CURSOR_12 ,
  OTHER_CURSOR_13 , OTHER_CURSOR_14 , OTHER_CURSOR_15 , OTHER_CURSOR_16 ,
  OTHER_CURSOR_17 , OTHER_CURSOR_18 , OTHER_CURSOR_19 , OTHER_CURSOR_20 ,
  OTHER_CURSOR_21 , OTHER_CURSOR_22 , OTHER_CURSOR_23 , OTHER_CURSOR_24 ,
  OTHER_CURSOR_25 , OTHER_CURSOR_26 , OTHER_CURSOR_27 , OTHER_CURSOR_28 ,
  OTHER_CURSOR_29 , OTHER_CURSOR_30 , OTHER_CURSOR_31 , OTHER_CURSOR_32 ,
  OTHER_CURSOR_33 , OTHER_CURSOR_34 , OTHER_CURSOR_35 , OTHER_CURSOR_36 ,
  OTHER_CURSOR_37 , OTHER_CURSOR_38 , OTHER_CURSOR_39 , OTHER_CURSOR_40 ,
  OTHER_CURSOR_41 , OTHER_CURSOR_42 , OTHER_CURSOR_43 , OTHER_CURSOR_44 ,
  OTHER_CURSOR_45 , OTHER_CURSOR_46 , OTHER_CURSOR_47 , OTHER_CURSOR_48 ,
  OTHER_CURSOR_49 , OTHER_CURSOR_50 , OTHER_CURSOR_51 , OTHER_CURSOR_52 ,
  OTHER_CURSOR_53 , OTHER_CURSOR_54 , OTHER_CURSOR_55 , OTHER_CURSOR_56 ,
  OTHER_CURSOR_57 , OTHER_CURSOR_58 , OTHER_CURSOR_59 , OTHER_CURSOR_60 ,
  OTHER_CURSOR_61 , OTHER_CURSOR_62 , OTHER_CURSOR_63 , OTHER_CURSOR_64 ,
  OTHER_CURSOR_65 , OTHER_CURSOR_66 , OTHER_CURSOR_67 , OTHER_CURSOR_68 ,
  OTHER_CURSOR_69 , PREDEFINED_CURSOR_COUNT
}
 pre-defined cursor shapes; note that you must adapt the list of names in SoViewerProxy.cpp if you change this list More...
 
- Protected Member Functions inherited from SoViewerProxy
 SoViewerProxy ()
 Protected constructor. Class must be derived to be adapted to actual viewer. More...
 

Detailed Description

Definition at line 28 of file SoQtViewerProxy.h.

Constructor & Destructor Documentation

◆ SoQtViewerProxy()

SoQtViewerProxy::SoQtViewerProxy ( SoQtRenderArea *  renderArea = nullptr)

This class implements access to the state of the SoQtMeVis viewer.

Constructor

◆ ~SoQtViewerProxy()

SoQtViewerProxy::~SoQtViewerProxy ( )
inlineoverride

Destructor.

Definition at line 64 of file SoQtViewerProxy.h.

Member Function Documentation

◆ actionMayChangeCursor()

virtual bool SoQtViewerProxy::actionMayChangeCursor ( SoAction *  action)
virtual

Returns if the given action may change the cursor, this is typically the case for SoHandleEvent actions with the exception of the artificial SoLocation2RefreshEvent event.

◆ defineCursor()

int SoQtViewerProxy::defineCursor ( const char *  cursorImgFileName,
int  hotSpotX = -1,
int  hotSpotY = -1,
int  id = -1 
)
overridevirtual

Define new cursor shape - successful operation is only guaranteed with PNG-Images with size 32x32, containing only black, white and transparent pixels.

If the operation failed, -1 is returned. If id is set, you can change the cursor shape of an already existing cursor (the file name is cached per id, so the actual operation is only performed on the first call).

Reimplemented from SoViewerProxy.

◆ evaluateCursor()

virtual void SoQtViewerProxy::evaluateCursor ( )
virtual

evaluate set cursor shape (must be called after event handling traversal)

◆ evaluateCursorCB()

static void SoQtViewerProxy::evaluateCursorCB ( void *  userData,
SoAction *  action 
)
static

This callback can be used together with a SoCallback node, userData must be set to the pointer to this (or a derived) proxy.

This need to be called after before event traversal. It calls the virtual evaluateCursor() method, which should be overwritten in specialized proxies, e.g. for remote rendering.

◆ forceDefineCursor()

static bool SoQtViewerProxy::forceDefineCursor ( int  id,
const char *  cursorImgFileName,
int  hotSpotX = -1,
int  hotSpotY = -1 
)
static

defineCursor simply calls this method, which will overwrite previous shapes

◆ getCurrentCursorPosition()

bool SoQtViewerProxy::getCurrentCursorPosition ( int &  x,
int &  y 
)
overridevirtual

Get current cursor position relative to the viewing window.

Returns true if the position is inside of the viewing window.

Reimplemented from SoViewerProxy.

◆ getCursor() [1/2]

int SoQtViewerProxy::getCursor ( )
inline

Returns the requested cursor shape.

Definition at line 75 of file SoQtViewerProxy.h.

◆ getCursor() [2/2]

static QCursor SoQtViewerProxy::getCursor ( int  shapeID)
static

Get the QCursor associated with the given shapeID.

◆ getPixmap()

static QPixmap SoQtViewerProxy::getPixmap ( int  shapeID)
static

Get the QPixmap associated with the given shapeID in 1x resolution.

◆ getPixmap2x()

static QPixmap SoQtViewerProxy::getPixmap2x ( int  shapeID)
static

Get the QPixmap associated with the given shapeID in 2x resolution.

◆ getShapeID()

static int SoQtViewerProxy::getShapeID ( const QCursor &  cursor)
static

Get the shape ID associated with the given cursor.

Will return -1 if the cursor is not used for any shape ID. Note that if different shape IDs use the same cursor, the lowest shape ID will be returned.

◆ hasShape()

bool SoQtViewerProxy::hasShape ( int  shapeID)
overridevirtual

Check if this shape has already been defined.

Reimplemented from SoViewerProxy.

◆ initializeDefaultCursors()

static void SoQtViewerProxy::initializeDefaultCursors ( )
static

On some platforms it may not be possible to initialize the default cursors at any time, so one may have to call this in advance.

◆ isInitialRendering()

bool SoQtViewerProxy::isInitialRendering ( ) const
overridevirtual

returns true if the viewer does the initial rendering after it became visible

Reimplemented from SoViewerProxy.

◆ isSameCursor()

static bool SoQtViewerProxy::isSameCursor ( const QCursor &  a,
const QCursor &  b 
)
static

Compare cursor shapes:

◆ isUserInterationEventInQueue()

bool SoQtViewerProxy::isUserInterationEventInQueue ( ) const
overridevirtual

returns if a user interaction event is the the GUI event queue

Reimplemented from SoViewerProxy.

◆ resetCursor()

virtual void SoQtViewerProxy::resetCursor ( )
virtual

reset stored cursor shape (must be called before event handling traversal)

The methods resetCursor and evaluateCursor must be called before and after traversal of the scene graph: The underlying idea is to only set the cursor if it has been set during event traversal, and only to the last shape (if it has been set more than once). So the cursor change can only be executed after the traversal and must be prepared by resetting the cursor shape before the traversal.

◆ resetCursorCB()

static void SoQtViewerProxy::resetCursorCB ( void *  userData,
SoAction *  action 
)
static

This callback can be used together with a SoCallback node, userData must be set to the pointer to this (or a derived) proxy.

This need to be called before event traversal.

◆ setCursor()

void SoQtViewerProxy::setCursor ( int  shapeID)
overridevirtual

Set cursor of viewer to pre- or user-defined shape, invalid positive values will set cursor to default shape, negative values will do nothing.

Reimplemented from SoViewerProxy.

◆ setForceCursor()

void SoQtViewerProxy::setForceCursor ( int  shapeID)
overridevirtual

Enforce setting the cursor, even from mouseOverUpdates.

This may lead to cursor flickering. You should probably not use this function!

Reimplemented from SoViewerProxy.

Member Data Documentation

◆ _cursorEnforced

bool SoQtViewerProxy::_cursorEnforced
protected

cursor setting was enforced

Definition at line 166 of file SoQtViewerProxy.h.

◆ _renderArea

SoQtRenderArea* SoQtViewerProxy::_renderArea
protected

pointer to the actual viewer:

Definition at line 160 of file SoQtViewerProxy.h.

◆ _requestedShape

int SoQtViewerProxy::_requestedShape
protected

currently requested cursor shape

Definition at line 163 of file SoQtViewerProxy.h.


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