SoQtMouse(3)

πŸ“¦
version 1.6.2 Β· 3 versions
, in opensuse-leap 16.0

✨ SoQtMouse ✨

okay so bestie, welcome to the SoQtMouse page πŸ’… this is the mouse input device abstraction for SoQt, and honestly it's kind of a big deal. it lives in the SoQt manual (section 3, iykyk) and we're gonna walk through it together, fr fr 🫢


🌸 SYNOPSIS 🌸

#include <Inventor/Qt/devices/SoQtMouse.h>

Inherits SoQtDevice. yes bestie, it's part of the family tree 🧚

πŸ’– Public Types πŸ’–

enum Events { BUTTON_PRESS = 0x01, BUTTON_RELEASE = 0x02, POINTER_MOTION
    = 0x04, BUTTON_MOTION = 0x08, ALL_EVENTS = BUTTON_PRESS |
    BUTTON_RELEASE | POINTER_MOTION | BUTTON_MOTION }

πŸŽ€ Public Member Functions πŸŽ€

SoQtMouse (int eventmask=ALL_EVENTS)
virtual ~SoQtMouse (void)
virtual void enable (QWidget *widget, SoQtEventHandler *handler, void
    *closure)
virtual void disable (QWidget *widget, SoQtEventHandler *handler, void
    *closure)
virtual const SoEvent * translateEvent (QEvent *event)

Public Member Functions inherited from SoQtDevice:

virtual ~SoQtDevice ()
void setWindowSize (const SbVec2s size)
SbVec2s getWindowSize (void) const

Public Member Functions inherited from SoQtObject:

virtual SoType getTypeId (void) const =0
SbBool isOfType (SoType type) const

🌈 Additional Inherited Members 🌈

Static Public Member Functions inherited from SoQtDevice:

static void initClasses (void)

Static Public Member Functions inherited from SoQtObject:

static void initClass (void)
static SoType getClassTypeId (void)
static void init (void)

Protected Member Functions inherited from SoQtDevice:

SoQtDevice (void)
void setEventPosition (SoEvent *event, int x, int y) const
void addEventHandler (QWidget *, SoQtEventHandler *, void *)
void removeEventHandler (QWidget *, SoQtEventHandler *, void *)
void invokeHandlers (QEvent *event)

Static Protected Member Functions inherited from SoQtDevice:

static SbVec2s getLastEventPosition (void)

πŸ¦‹ Detailed Description πŸ¦‹

So like, the SoQtMouse class is the mouse input device abstraction. that's the whole vibe. it's literally the glue between native mouse handling and all the mouse interaction happening in the Inventor scene graph πŸŽ€

fun fact: all components derived from the SoQtRenderArea have got an SoQtMouse device attached by default. so you're already covered, bestie, no extra setup needed ✨

okay so here's the tea β˜• and it's important for application programmers: our mappings to SoMouseButtonEvent::BUTTON2 and SoMouseButtonEvent::BUTTON3 do not match the mappings in SGI's InventorXt library or TGS's SoWin library for 3-button mice. like, they just don't. and we need you to know that. πŸ™ˆ

their mapping for 3-button mice is giving:

  • left button: SoMouseButtonEvent::BUTTON1
  • middle button: SoMouseButtonEvent::BUTTON2
  • right button: SoMouseButtonEvent::BUTTON3

meanwhile in this SIM SoQt library, the mappings are:

  • left button: SoMouseButtonEvent::BUTTON1
  • middle button: SoMouseButtonEvent::BUTTON3
  • right button: SoMouseButtonEvent::BUTTON2

and honestly? this is a conscious design decision we've made. periodt. the reason is that BUTTON2 should be the right mouse button whether you have a 2-button mouse or a 3-button mouse. it's giving consistency, it's giving main character energy πŸ‘‘


πŸ’œ Member Enumeration Documentation πŸ’œ

enum SoQtMouse::Events

so this enum is literally the enumeration over supported mouse events. it's iconic, it's necessary 🌟

  • BUTTON_PRESS β€” the maskbit for mouse button press events πŸ’₯
  • BUTTON_RELEASE β€” the maskbit for mouse button release events 🫢
  • POINTER_MOTION β€” the maskbit for mouse pointer motion events πŸ¦‹
  • BUTTON_MOTION β€” the maskbit for mouse pointer motion events with one or more mouse buttons pressed. yes, buttons pressed. it's a whole combo move πŸ’…
  • ALL_EVENTS β€” the mask which includes all the maskbits in the enum (i.e. use this to signal interest in all kinds of events for the mouse device). it's the "give me everything" option, and honestly? obsessed 🌈

πŸ”₯ Constructor & Destructor Documentation πŸ”₯

SoQtMouse::SoQtMouse (int mask = ALL_EVENTS)

the constructor, bestie πŸŽ€ the mask argument should contain the set of SoQtMouse::Events one is interested in tracking. so you get to pick your vibe, no cap.

SoQtMouse::~SoQtMouse (void ) [virtual]

the destructor. it cleans up. that's it. that's the whole note πŸ’€


⭐ Member Function Documentation ⭐

void SoQtMouse::enable (QWidget * widget, SoQtEventHandler * handler, void * closure) [virtual]

this method will enable the device for the widget. and like, handler is invoked with the closure argument when an event occur in widget. yes bestie, that's the whole flow 🧚 Implements SoQtDevice.

void SoQtMouse::disable (QWidget * widget, SoQtEventHandler * handler, void * closure) [virtual]

this method will disable the handler for the device. simple as that, no drama πŸ¦‹ Implements SoQtDevice.

const SoEvent * SoQtMouse::translateEvent (QEvent * event) [virtual]

okay so this one is the translator πŸ’… it translates a native event from the underlying toolkit into a generic event.

this is then returned in the form of an instance of a subclass of the Inventor API's SoEvent class, either an SoMouseButtonEvent or an SoLocation2Event, depending on whether the native event is a mouse button press / release, or a mouse cursor movement event. like, it just knows. iykyk 🌸

the mapping of the mouse buttons upon generation of SoMouseButtonEvent events will be done as follows:

  • left mouse button: SoMouseButtonEvent::BUTTON1
  • right mouse button: SoMouseButtonEvent::BUTTON2
  • middle mouse button, if available: SoMouseButtonEvent::BUTTON3
  • forward motion on a wheel mouse: SoMouseButtonEvent::BUTTON4
  • backward motion on a wheel mouse: SoMouseButtonEvent::BUTTON5
note that the rightmost mouse button will always map to SoMouseButtonEvent::BUTTON2, even on a 3-button mouse. like, always. put that in your notes bestie πŸ“

Implements SoQtDevice.


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for SoQt from the source code. so like, a robot wrote this part, not me. but we're still grateful 🫢


and that's the whole page, bestie!! πŸ’– kudos for making it to the end, you're literally a scholar now, no cap πŸŽ“πŸ’…

Version 1.6.2 β€” Sat Jan 6 2024 12:20:55 β€” stay slaying out there, and remember: the rightmost mouse button is always BUTTON2 πŸŒˆβœ¨πŸ‘‘

πŸ“¦ where this page comes from