LMMS
Loading...
Searching...
No Matches
lmms::gui::FloatModelEditorBase Class Reference

#include <FloatModelEditorBase.h>

Inheritance diagram for lmms::gui::FloatModelEditorBase:
lmms::gui::TypedModelView< FloatModel > lmms::gui::AutomatableModelView lmms::gui::ModelView lmms::gui::BarModelEditor lmms::gui::Draggable lmms::gui::Knob lmms::gui::TempoSyncBarModelEditor lmms::gui::AudioFileProcessorWaveView::knob lmms::gui::FreeBoyKnob lmms::gui::KickerKnob lmms::gui::KickerLargeKnob lmms::gui::OrganicKnob lmms::gui::Sf2Knob lmms::gui::SfxrKnob lmms::gui::TempoSyncKnob lmms::gui::TripleOscKnob lmms::gui::VolumeKnob lmms::gui::VstPluginKnob lmms::gui::XpressiveKnob lmms::gui::gigKnob lmms::gui::sidKnob

Public Types

enum class  DirectionOfManipulation : bool { Vertical , Horizontal }

Signals

void sliderPressed ()
void sliderReleased ()
void sliderMoved (float value)

Public Member Functions

 FloatModelEditorBase (DirectionOfManipulation directionOfManipulation=DirectionOfManipulation::Vertical, QWidget *_parent=nullptr, const QString &_name=QString())
 default ctor
 FloatModelEditorBase (const FloatModelEditorBase &other)=delete
void setHintText (const QString &txt_before, const QString &txt_after)
void setToolTip (const QString &tip)
 Sets the tooltip displayed when the mouse hovers over the control.
QString toolTip () const
void unsetToolTip ()
Public Member Functions inherited from lmms::gui::TypedModelView< FloatModel >
 TypedModelView (Model *model, QWidget *_this)
FloatModelmodel ()
const FloatModelmodel () const
Public Member Functions inherited from lmms::gui::AutomatableModelView
 AutomatableModelView (Model *model, QWidget *_this)
 ~AutomatableModelView () override=default
AutomatableModelmodelUntyped ()
const AutomatableModelmodelUntyped () const
void setModel (Model *model, bool isOldModelValid=true) override
void unsetModel () override
template<typename T>
value () const
void setDescription (const QString &desc)
void setUnit (const QString &unit)
void addDefaultActions (QMenu *menu)
void setConversionFactor (float factor)
float getConversionFactor ()
Public Member Functions inherited from lmms::gui::ModelView
 ModelView (Model *model, QWidget *widget)
virtual ~ModelView ()
Modelmodel ()
const Modelmodel () const
template<class T>
T * castModel ()
template<class T>
const T * castModel () const

Protected Types

enum class  InteractionType : std::uint8_t { None , MouseHover , MouseDrag , MouseWheel }
 Types of user interaction with the control. More...
enum class  FloatingTextType : std::uint8_t { None , Static , Dynamic }

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *me) override
void dragEnterEvent (QDragEnterEvent *dee) override
void dropEvent (QDropEvent *de) override
void focusOutEvent (QFocusEvent *fe) override
void mousePressEvent (QMouseEvent *me) override
void mouseReleaseEvent (QMouseEvent *me) override
void mouseMoveEvent (QMouseEvent *me) override
void mouseDoubleClickEvent (QMouseEvent *me) override
void paintEvent (QPaintEvent *me) override
void wheelEvent (QWheelEvent *me) override
void enterEvent (QEnterEvent *) override
void leaveEvent (QEvent *event) override
virtual float getValue (const QPoint &p)
virtual QString currentValueToText ()
virtual std::optional< QString > currentValueToTextUpdate ()
virtual QString getDynamicFloatingText (const QString &currentValue) const
 Provides the text to be shown in dynamic floating text.
void doConnections () override
void showTextFloat (int msecBeforeDisplay, int msecDisplayTime, bool forceTextUpdate=false)
void showTextFloat (bool forceTextUpdate=false)
const SimpleTextFloattextFloat () const
void setPosition (const QPoint &p)
float pageSize () const
DirectionOfManipulation directionOfManipulation () const
InteractionType currentInteraction () const
void updateInteractionState (QEvent *event)
 Updates m_interaction based on the event and current state.
FloatingTextType floatingTextType () const
Protected Member Functions inherited from lmms::gui::ModelView
virtual void modelChanged ()
QWidget * widget ()

Protected Attributes

QPoint m_lastMousePos
 mouse position in last mouseMoveEvent
float m_leftOver
Protected Attributes inherited from lmms::gui::AutomatableModelView
QString m_description
QString m_unit
float m_conversionFactor

Private Slots

virtual void enterValue ()
void friendlyUpdate ()
void toggleScale ()

Private Member Functions

void initUi (const QString &name)
 to be called by ctors

Private Attributes

InteractionType m_interaction = InteractionType::None
DirectionOfManipulation m_directionOfManipulation
std::optional< QString > m_staticToolTip

Static Private Attributes

static SimpleTextFloats_textFloat = nullptr

Member Enumeration Documentation

◆ DirectionOfManipulation

Enumerator
Vertical 
Horizontal 

◆ FloatingTextType

enum class lmms::gui::FloatModelEditorBase::FloatingTextType : std::uint8_t
strongprotected
Enumerator
None 

No floating text.

Static 

Traditional static tooltip.

Dynamic 

Dynamic floating text.

◆ InteractionType

enum class lmms::gui::FloatModelEditorBase::InteractionType : std::uint8_t
strongprotected

Types of user interaction with the control.

Enumerator
None 

The user is not interacting with the control. No floating text is shown.

MouseHover 

The mouse is hovering over the control without any other interaction. If a static tooltip is set (see setToolTip), it will be displayed, otherwise dynamic floating text will be displayed.

MouseDrag 

The user is dragging the control to adjust the model's value. This always results in dynamic floating text, not a static tooltip.

MouseWheel 

The user is using the mouse wheel on the control to adjust the model's value. This always results in dynamic floating text, not a static tooltip.

Constructor & Destructor Documentation

◆ FloatModelEditorBase() [1/2]

lmms::gui::FloatModelEditorBase::FloatModelEditorBase ( DirectionOfManipulation directionOfManipulation = DirectionOfManipulation::Vertical,
QWidget * _parent = nullptr,
const QString & _name = QString() )

default ctor

◆ FloatModelEditorBase() [2/2]

lmms::gui::FloatModelEditorBase::FloatModelEditorBase ( const FloatModelEditorBase & other)
delete

Member Function Documentation

◆ contextMenuEvent()

void lmms::gui::FloatModelEditorBase::contextMenuEvent ( QContextMenuEvent * me)
overrideprotected

◆ currentInteraction()

InteractionType lmms::gui::FloatModelEditorBase::currentInteraction ( ) const
inlineprotected
Returns
how the user is interacting with the control

◆ currentValueToText()

QString lmms::gui::FloatModelEditorBase::currentValueToText ( )
protectedvirtual
Returns
the current value of the model as a string
Note
This method is called just prior to displaying dynamic floating text in order to set its value. If the currentValueToTextUpdate method is not overridden, this method is also called to periodically update the floating text.

Reimplemented in lmms::gui::VolumeKnob, and lmms::gui::VstPluginKnob.

◆ currentValueToTextUpdate()

virtual std::optional< QString > lmms::gui::FloatModelEditorBase::currentValueToTextUpdate ( )
inlineprotectedvirtual
Returns
the current value of the model as a string, or std::nullopt to indicate the previous value should continue being used
Note
This method is called periodically while dynamic floating text is visible and the value of the float model is changing, allowing dynamic updates of the floating text.

Reimplemented in lmms::gui::VstPluginKnob.

◆ directionOfManipulation()

DirectionOfManipulation lmms::gui::FloatModelEditorBase::directionOfManipulation ( ) const
inlineprotected

◆ doConnections()

void lmms::gui::FloatModelEditorBase::doConnections ( )
overrideprotectedvirtual

Reimplemented from lmms::gui::ModelView.

◆ dragEnterEvent()

void lmms::gui::FloatModelEditorBase::dragEnterEvent ( QDragEnterEvent * dee)
overrideprotected

◆ dropEvent()

void lmms::gui::FloatModelEditorBase::dropEvent ( QDropEvent * de)
overrideprotected

◆ enterEvent()

void lmms::gui::FloatModelEditorBase::enterEvent ( QEnterEvent * event)
overrideprotected

◆ enterValue

void lmms::gui::FloatModelEditorBase::enterValue ( )
privatevirtualslot

Reimplemented in lmms::gui::VolumeKnob.

◆ floatingTextType()

auto lmms::gui::FloatModelEditorBase::floatingTextType ( ) const
protected
Returns
which type of floating text is currently being displayed based on how the user is interacting with the control and whether a static tooltip has been set for the control.

◆ focusOutEvent()

void lmms::gui::FloatModelEditorBase::focusOutEvent ( QFocusEvent * fe)
overrideprotected

◆ friendlyUpdate

void lmms::gui::FloatModelEditorBase::friendlyUpdate ( )
privateslot

◆ getDynamicFloatingText()

QString lmms::gui::FloatModelEditorBase::getDynamicFloatingText ( const QString & currentValue) const
protectedvirtual

Provides the text to be shown in dynamic floating text.

Parameters
currentValuetext from currentValueToText or currentValueToTextUpdate
Returns
formatted text to display in dynamic floating text
Note
The default format is: "[description] [current value][unit]"

Reimplemented in lmms::gui::VolumeKnob.

◆ getValue()

float lmms::gui::FloatModelEditorBase::getValue ( const QPoint & p)
protectedvirtual

◆ initUi()

void lmms::gui::FloatModelEditorBase::initUi ( const QString & name)
private

to be called by ctors

◆ leaveEvent()

void lmms::gui::FloatModelEditorBase::leaveEvent ( QEvent * event)
overrideprotected

◆ mouseDoubleClickEvent()

void lmms::gui::FloatModelEditorBase::mouseDoubleClickEvent ( QMouseEvent * me)
overrideprotected

◆ mouseMoveEvent()

void lmms::gui::FloatModelEditorBase::mouseMoveEvent ( QMouseEvent * me)
overrideprotected

◆ mousePressEvent()

void lmms::gui::FloatModelEditorBase::mousePressEvent ( QMouseEvent * me)
overrideprotectedvirtual

Reimplemented from lmms::gui::AutomatableModelView.

◆ mouseReleaseEvent()

void lmms::gui::FloatModelEditorBase::mouseReleaseEvent ( QMouseEvent * me)
overrideprotected

◆ pageSize()

float lmms::gui::FloatModelEditorBase::pageSize ( ) const
inlineprotected

◆ paintEvent()

void lmms::gui::FloatModelEditorBase::paintEvent ( QPaintEvent * me)
overrideprotected

◆ setHintText()

void lmms::gui::FloatModelEditorBase::setHintText ( const QString & txt_before,
const QString & txt_after )
inline

◆ setPosition()

void lmms::gui::FloatModelEditorBase::setPosition ( const QPoint & p)
protected

◆ setToolTip()

void lmms::gui::FloatModelEditorBase::setToolTip ( const QString & tip)
inline

Sets the tooltip displayed when the mouse hovers over the control.

Unlike the dynamic floating text from getDynamicFloatingText which represents the current value of the model, this is static text intended to provide a helpful description of the control. That is, it's just a traditional tooltip, though it uses SimpleTextFloat rather than QWidget's own tooltip for consistency with the dynamic floating text.

If no static tooltip is set (when this method is not called), dynamic floating text is used in its place. See InteractionType for more information.

Parameters
tipThe static tooltip. If empty, neither a static nor dynamic tooltip will be displayed when the mouse hovers over the control.

◆ showTextFloat() [1/2]

void lmms::gui::FloatModelEditorBase::showTextFloat ( bool forceTextUpdate = false)
protected

◆ showTextFloat() [2/2]

void lmms::gui::FloatModelEditorBase::showTextFloat ( int msecBeforeDisplay,
int msecDisplayTime,
bool forceTextUpdate = false )
protected

◆ sliderMoved

void lmms::gui::FloatModelEditorBase::sliderMoved ( float value)
signal

◆ sliderPressed

void lmms::gui::FloatModelEditorBase::sliderPressed ( )
signal

◆ sliderReleased

void lmms::gui::FloatModelEditorBase::sliderReleased ( )
signal

◆ textFloat()

const SimpleTextFloat & lmms::gui::FloatModelEditorBase::textFloat ( ) const
inlineprotected

◆ toggleScale

void lmms::gui::FloatModelEditorBase::toggleScale ( )
privateslot

◆ toolTip()

QString lmms::gui::FloatModelEditorBase::toolTip ( ) const
inline

◆ unsetToolTip()

void lmms::gui::FloatModelEditorBase::unsetToolTip ( )
inline

Removes the static tooltip set by a previous call to setToolTip(). The dynamic floating text will be used in its place.

Note
This is currently unused.

◆ updateInteractionState()

void lmms::gui::FloatModelEditorBase::updateInteractionState ( QEvent * event)
protected

Updates m_interaction based on the event and current state.

◆ wheelEvent()

void lmms::gui::FloatModelEditorBase::wheelEvent ( QWheelEvent * me)
overrideprotected

Member Data Documentation

◆ m_directionOfManipulation

DirectionOfManipulation lmms::gui::FloatModelEditorBase::m_directionOfManipulation
private

◆ m_interaction

InteractionType lmms::gui::FloatModelEditorBase::m_interaction = InteractionType::None
private

◆ m_lastMousePos

QPoint lmms::gui::FloatModelEditorBase::m_lastMousePos
protected

mouse position in last mouseMoveEvent

◆ m_leftOver

float lmms::gui::FloatModelEditorBase::m_leftOver
protected

◆ m_staticToolTip

std::optional<QString> lmms::gui::FloatModelEditorBase::m_staticToolTip
private

◆ s_textFloat

SimpleTextFloat * lmms::gui::FloatModelEditorBase::s_textFloat = nullptr
staticprivate

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