Olive
Signals | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
LabelSlider Class Reference

The LabelSlider class. More...

#include <labelslider.h>

Inheritance diagram for LabelSlider:

Signals

void valueChanged ()
 valueChanged signal More...
 
void clicked ()
 clicked signal More...
 

Public Member Functions

 LabelSlider (QWidget *parent=nullptr)
 
void set_frame_rate (double d)
 Set the display frame rate. More...
 
void set_display_type (int type)
 Sets the way to display the value. More...
 
void set_value (double v, bool userSet)
 Set the value. More...
 
void set_default_value (double v)
 Set the default value. More...
 
void set_minimum_value (double v)
 Set the minimum value. More...
 
void set_maximum_value (double v)
 Set the maximum value. More...
 
double value ()
 Returns the internal value as a double. More...
 
bool is_set ()
 Returns whether a value has been set or not. More...
 
bool is_dragging ()
 Returns whether the user is currently dragging. More...
 
QString valueToString ()
 Convert the internal value to a displayed string according to display_type More...
 
double getPreviousValue ()
 Returns whatever value was set before the last set_value() More...
 
void set_previous_value ()
 Updates previous value. More...
 
void set_color (QString c=nullptr)
 Set the display color. More...
 

Public Attributes

int decimal_places
 Set how many decimal places to show for a floating-point number. More...
 

Protected Member Functions

void mousePressEvent (QMouseEvent *ev)
 
void mouseMoveEvent (QMouseEvent *ev)
 
void mouseReleaseEvent (QMouseEvent *ev)
 

Private Member Functions

void set_default_cursor ()
 Internal function to set the standard cursor (usually SizeHorCursor)
 
void set_active_cursor ()
 Internal function to set the cursor while dragging (usually NoCursor aka invisible)
 

Private Attributes

double default_value
 
double internal_value
 
double drag_start_value
 
double previous_value
 
bool min_enabled
 
double min_value
 
bool max_enabled
 
double max_value
 
bool drag_start
 
bool drag_proc
 
int drag_start_x
 
int drag_start_y
 
bool set
 
int display_type
 
double frame_rate
 

Detailed Description

The LabelSlider class.

A UI element that shows a number and can be dragged to increase/decrease its value or clicked to enter a specific one.

Member Function Documentation

◆ clicked

void LabelSlider::clicked ( )
signal

clicked signal

Emitted if the user clicks on the LabelSlider in any way

◆ getPreviousValue()

double LabelSlider::getPreviousValue ( )

Returns whatever value was set before the last set_value()

For various reasons (largely undo capabilities) it is helpful to retrieve whatever the value was before the current one. If the user dragged the current value, this will return the value just before the user started dragging.

Returns
The previous value

◆ is_dragging()

bool LabelSlider::is_dragging ( )

Returns whether the user is currently dragging.

Returns
TRUE if the user is dragging, FALSE if not.

◆ is_set()

bool LabelSlider::is_set ( )

Returns whether a value has been set or not.

If a value has been entered by any means (i.e. if set_value() was called), this will be TRUE. If set_value() has not been called and is_set() is FALSE, calling set_default_value() will automatically set the value to the default value WITHOUT changing the is_set() state (i.e. it will still be FALSE and calling set_default_value() again will change the current value again unless it's been changed through some other means in that time).

Returns
TRUE if a value has been set, FALSE if not.

◆ set_color()

void LabelSlider::set_color ( QString  c = nullptr)

Set the display color.

Parameters
cColor to set to

◆ set_default_value()

void LabelSlider::set_default_value ( double  v)

Set the default value.

If a default value is set, alt+clicking the LabelSlider will return to the default value.

Parameters
vValue to set as default

◆ set_display_type()

void LabelSlider::set_display_type ( int  type)

Sets the way to display the value.

  • LABELSLIDER_NORMAL - Shows the value as a normal number
  • LABELSLIDER_FRAMENUMBER - Shows the number as a timecode according to config.timecode_view. By default, will render hh:mm:ss:ff
  • LABELSLIDER_PERCENT - Shows the number as a percentage. 1.0 becomes "100%", 0.5 becomes 50%, etc.
  • LABELSLIDER_DECIBLE - Shows the number as a decibel. 1.0 becomes "0 dB", 2.0 becames roughly "6 dB", 0.5 becomes roughly "-6 dB", etc.
Parameters
typeThe display type to set to. Should be a member of enum LabelSliderDisplayType.

◆ set_frame_rate()

void LabelSlider::set_frame_rate ( double  d)

Set the display frame rate.

If the display_type is set to LABELSLIDER_FRAMENUMBER, this function sets how many frames per second the timecode will be in.

Parameters
d

◆ set_maximum_value()

void LabelSlider::set_maximum_value ( double  v)

Set the maximum value.

If a maximum value is set, the value will never go above it. If the user manually sets a value higher than the maximum, it will automatically snap to the maximum.

Parameters
vValue to set as maximum

◆ set_minimum_value()

void LabelSlider::set_minimum_value ( double  v)

Set the minimum value.

If a minimum value is set, the value will never go below it. If the user manually sets a value lower than the minimum, it will automatically snap to the minimum.

Parameters
vValue to set as minimum

◆ set_previous_value()

void LabelSlider::set_previous_value ( )

Updates previous value.

Called internally to store the current value as the previous value in anticipation of an upcoming value change. Can also be called externally (mainly for dragged EffectGizmos) in anticipation of an external change.

◆ set_value()

void LabelSlider::set_value ( double  v,
bool  userSet 
)

Set the value.

Parameters
vValue to set to.
userSetTRUE if this was called through a user action, FALSE if this was called through some other way. The only difference is TRUE will emit a signal (valueChanged()) indicating that the value has changed, and FALSE will not.

◆ value()

double LabelSlider::value ( )

Returns the internal value as a double.

Returns
The internal value. This will not respect the display_type, i.e. 100% will return as 1.0, 12dB will return as 400%, and a timecode will return as a frame number.

◆ valueChanged

void LabelSlider::valueChanged ( )
signal

valueChanged signal

Emitted if the value changed at it was instigated by the user.

◆ valueToString()

QString LabelSlider::valueToString ( )

Convert the internal value to a displayed string according to display_type

Returns
The internal value as a string

Member Data Documentation

◆ decimal_places

int LabelSlider::decimal_places

Set how many decimal places to show for a floating-point number.

Defaults to 1


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