|
Olive
|
The LabelSlider class. More...
#include <labelslider.h>
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) | |
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.
|
signal |
clicked signal
Emitted if the user clicks on the LabelSlider in any way
| 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.
| bool LabelSlider::is_dragging | ( | ) |
Returns whether the user is currently dragging.
| 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).
| void LabelSlider::set_color | ( | QString | c = nullptr | ) |
Set the display color.
| c | Color to set to |
| 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.
| v | Value to set as default |
| void LabelSlider::set_display_type | ( | int | type | ) |
Sets the way to display the value.
LABELSLIDER_NORMAL - Shows the value as a normal numberLABELSLIDER_FRAMENUMBER - Shows the number as a timecode according to config.timecode_view. By default, will render hh:mm:ss:ffLABELSLIDER_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.| type | The display type to set to. Should be a member of enum LabelSliderDisplayType. |
| 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.
| d |
| 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.
| v | Value to set as maximum |
| 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.
| v | Value to set as minimum |
| 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.
| void LabelSlider::set_value | ( | double | v, |
| bool | userSet | ||
| ) |
Set the value.
| v | Value to set to. |
| userSet | TRUE 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. |
| double LabelSlider::value | ( | ) |
Returns the internal value as a double.
display_type, i.e. 100% will return as 1.0, 12dB will return as 400%, and a timecode will return as a frame number.
|
signal |
valueChanged signal
Emitted if the value changed at it was instigated by the user.
| QString LabelSlider::valueToString | ( | ) |
Convert the internal value to a displayed string according to display_type
| int LabelSlider::decimal_places |
Set how many decimal places to show for a floating-point number.
Defaults to 1
1.8.15