hydrogen 1.2.3
Rotary Class Reference

Custom rotary widget. More...

#include <Rotary.h>

Inheritance diagram for Rotary:
WidgetWithInput Object< Rotary > MidiLearnable Base EventListener

Public Types

enum class  Type { Normal , Center , Small }
 

Public Slots

void onPreferencesChanged (H2Core::Preferences::Changes changes)
 

Public Member Functions

 Rotary (const Rotary &)=delete
 
 Rotary (QWidget *parent, Type type, QString sBaseTooltip, bool bUseIntSteps, float fMin=0.0, float fMax=1.0, bool bModifyOnChange=true)
 
 ~Rotary ()
 
Rotaryoperator= (const Rotary &rhs)=delete
 
- Public Member Functions inherited from WidgetWithInput
 WidgetWithInput (QWidget *parent, bool bUseIntSteps, QString sBaseTooltip, int nScrollSpeed, int nScrollSpeedFast, float fMin, float fMax, bool bModifyOnChange)
 
 ~WidgetWithInput ()
 
QString getBaseTooltip () const
 
float getDefaultValue () const
 
bool getIsActive () const
 
float getMax () const
 
float getMin () const
 
int getScrollSpeed () const
 
int getScrollSpeedFast () const
 
float getValue () const
 
int getWidgetHeight () const
 
int getWidgetWidth () const
 
void resetValueToDefault ()
 
void setBaseTooltip (const QString &sBaseTooltip)
 
void setDefaultValue (float fDefaultValue)
 
void setIsActive (bool bIsActive)
 
void setMax (float fMax)
 
void setMin (float fMin)
 
void setScrollSpeed (int nScrollSpeed) const
 
void setScrollSpeedFast (int nScrollSpeedFast) const
 
virtual void setValue (float fValue, bool bTriggeredByUserInteraction=false)
 
void setWidgetHeight (int nWidgetHeight)
 
void setWidgetWidth (int nWidgetWidth)
 
- Public Member Functions inherited from MidiLearnable
 MidiLearnable ()
 
 ~MidiLearnable ()
 
std::shared_ptr< ActiongetAction () const
 
void midiMapChangedEvent () override
 Update m_registeredMidiEvents since the underlying #H2Core::MidiMap changed.
 
void setAction (std::shared_ptr< Action > pAction)
 
- Public Member Functions inherited from Object< Rotary >
 Object ()
 
 Object (const Object< Rotary > &other)
 
- Public Member Functions inherited from Base
 Base ()
 
 Base (const Base &other)
 
virtual const char * class_name () const
 
void Print (bool bShort=true) const
 Prints content of toQString() via DEBUGLOG.
 
virtual QString toQString (const QString &sPrefix="", bool bShort=true) const
 Formatted string version for debugging purposes.
 

Private Member Functions

virtual void paintEvent (QPaintEvent *ev) override
 

Private Attributes

QSvgRenderer * m_background
 
QSvgRenderer * m_knob
 
Type m_type
 

Additional Inherited Members

- Signals inherited from WidgetWithInput
void valueChanged (WidgetWithInput *ref)
 
- Static Public Member Functions inherited from Base
static const char * _class_name ()
 return the class name
 
static QString base_clock (const QString &sMsg)
 Measures the current time and stores it in __last_clock.
 
static QString base_clock_in (const QString &sMsg)
 
static int bootstrap (Logger *logger, bool count=false)
 must be called before any Object instantiation !
 
static bool count_active ()
 
static int getAliveObjectCount ()
 
static object_map_t getObjectMap ()
 
static Loggerlogger ()
 return the logger instance
 
static int objects_count ()
 
static void printObjectMapDiff (object_map_t map)
 Creates the difference between a snapshot of the object map and its current state and prints it to std::cout.
 
static void set_count (bool flag)
 enable/disable class instances counting
 
static void write_objects_map_to (std::ostream &out, object_map_t *map=nullptr)
 output the full objects map to a given ostream
 
static void write_objects_map_to_cerr ()
 output objects map to stderr
 
- Static Public Attributes inherited from Base
static QString sPrintIndention = " "
 String used to format the debugging string output of some core classes.
 
- Protected Member Functions inherited from WidgetWithInput
virtual void enterEvent (QEvent *ev)
 
virtual void keyPressEvent (QKeyEvent *ev)
 
virtual void leaveEvent (QEvent *ev)
 
virtual void mouseMoveEvent (QMouseEvent *ev)
 
virtual void mousePressEvent (QMouseEvent *ev)
 
virtual void mouseReleaseEvent (QMouseEvent *ev)
 
void updateTooltip () override
 Indicates child class to recalculate its tool tip in case m_registeredMidiEvents changed.
 
virtual void wheelEvent (QWheelEvent *ev)
 
- Protected Member Functions inherited from Object< Rotary >
 ~Object ()
 
- Protected Member Functions inherited from Base
 ~Base ()
 
- Static Protected Member Functions inherited from Base
static void registerClass (const char *name, const atomic_obj_cpt_t *counters)
 
- Protected Attributes inherited from WidgetWithInput
bool m_bEntered
 
bool m_bIgnoreMouseMove
 
bool m_bIsActive
 
bool m_bModifyOnChange
 Whether Hydrogen::setIsModified() is invoked with true as soon as the value of the widget does change.
 
bool m_bUseIntSteps
 
float m_fDefaultValue
 
float m_fMax
 
float m_fMin
 
float m_fMousePressValue
 
float m_fMousePressY
 
float m_fValue
 
double m_inputBufferTimeout
 Number of seconds before m_sInputBuffer will be flushed (happens asynchronically whenever the next key input occurs.)
 
timeval m_inputBufferTimeval
 
int m_nScrollSpeed
 
int m_nScrollSpeedFast
 Fast version used when the Control modifier is pressed.
 
int m_nWidgetHeight
 
int m_nWidgetWidth
 
QString m_sBaseTooltip
 
QString m_sInputBuffer
 All key input will be appended to this string.
 
- Protected Attributes inherited from MidiLearnable
std::shared_ptr< Actionm_pAction
 
std::vector< std::pair< H2Core::MidiMessage::Event, int > > m_registeredMidiEvents
 Stores all MIDI events mapped to m_pAction.
 
- Static Protected Attributes inherited from Base
static bool __count = false
 should we count class instances
 
static timeval __last_clock = { 0, 0 }
 
static Logger__logger = nullptr
 

Detailed Description

Custom rotary widget.

The background image - for Rotary::Type::Normal and Rotary::Type::Center - as well as the knob is loaded via a SVG image. The arc indicating the current value will the painted within Qt.

Definition at line 44 of file Rotary.h.

Member Enumeration Documentation

◆ Type

enum class Type
strong
Enumerator
Normal 

The arc is of solid red color.

Center 

The arc features a point at its upmost position.

If set by the user, it shows a green color. If another value is used, a grey and smaller dot will be displayed instead.

Small 

No arc will be drawn.

Definition at line 49 of file Rotary.h.

Constructor & Destructor Documentation

◆ Rotary() [1/2]

Rotary ( const Rotary & )
delete

◆ Rotary() [2/2]

Rotary ( QWidget * parent,
Type type,
QString sBaseTooltip,
bool bUseIntSteps,
float fMin = 0.0,
float fMax = 1.0,
bool bModifyOnChange = true )

Definition at line 34 of file Rotary.cpp.

◆ ~Rotary()

~Rotary ( )

Definition at line 91 of file Rotary.cpp.

Member Function Documentation

◆ onPreferencesChanged

void onPreferencesChanged ( H2Core::Preferences::Changes changes)
slot

Definition at line 301 of file Rotary.cpp.

◆ operator=()

Rotary & operator= ( const Rotary & rhs)
delete

◆ paintEvent()

void paintEvent ( QPaintEvent * ev)
overrideprivatevirtual

Definition at line 94 of file Rotary.cpp.

Field Documentation

◆ m_background

QSvgRenderer* m_background
private

Definition at line 71 of file Rotary.h.

◆ m_knob

QSvgRenderer* m_knob
private

Definition at line 72 of file Rotary.h.

◆ m_type

Type m_type
private

Definition at line 70 of file Rotary.h.