The ComboField class. More...
#include <combofield.h>
Signals | |
void | DataChanged (const QVariant &) |
Signal emitted whenever a connected widget's data gets changed. More... | |
![]() | |
void | Changed () |
Changed signal. More... | |
void | Clicked () |
Clicked signal. More... | |
void | EnabledChanged (bool) |
Enable change state signal. More... | |
Public Member Functions | |
ComboField (EffectRow *parent, const QString &id) | |
Reimplementation of EffectField::EffectField(). More... | |
void | AddItem (const QString &text, const QVariant &data) |
Add an item to this ComboField. More... | |
virtual QWidget * | CreateWidget (QWidget *existing=nullptr) override |
Reimplementation of EffectField::CreateWidget() More... | |
virtual void | UpdateWidgetValue (QWidget *widget, double timecode) override |
Reimplementation of EffectField::UpdateWidgetValue() More... | |
![]() | |
EffectField (EffectRow *parent, const QString &i, EffectFieldType t) | |
EffectField Constructor. More... | |
EffectRow * | GetParentRow () |
Get the EffectRow that this field is a member of. More... | |
const EffectFieldType & | type () |
Get the type of data to expect from this field. More... | |
const QString & | id () |
Get the unique identifier of this field set in the constructor. More... | |
QVariant | GetValueAt (double timecode) |
Get the value of this field at a given timecode. More... | |
void | SetValueAt (double time, const QVariant &value) |
Set the value of this field at a given timecode. More... | |
double | Now () |
Get the current clip/media time. More... | |
void | PrepareDataForKeyframing (bool enabled, ComboAction *ca) |
Set up keyframing on this field. More... | |
int | GetColumnSpan () |
Get field's column span. More... | |
void | SetColumnSpan (int i) |
Set field's column span. More... | |
virtual QString | ConvertValueToString (const QVariant &v) |
Convert a value from this field to a string. More... | |
virtual QVariant | ConvertStringToValue (const QString &s) |
Convert a string to a value appropriate for this field. More... | |
double | GetValidKeyframeHandlePosition (int key, bool post) |
Get the correct X position/time value of a bezier keyframe's handles. More... | |
bool | IsEnabled () |
Return whether this field is enabled or not. More... | |
void | SetEnabled (bool e) |
Set the enabled state of this field. More... | |
Private Slots | |
void | UpdateFromWidget (int index) |
Internal function connected to any QWidget made from CreateWidget() to update the value based on user input. More... | |
Private Attributes | |
QVector< ComboFieldItem > | items_ |
Internal array of string+value pair items. More... | |
Additional Inherited Members | |
![]() | |
enum | EffectFieldType { EFFECT_FIELD_DOUBLE, EFFECT_FIELD_COLOR, EFFECT_FIELD_STRING, EFFECT_FIELD_BOOL, EFFECT_FIELD_COMBO, EFFECT_FIELD_FONT, EFFECT_FIELD_FILE, EFFECT_FIELD_UI } |
The EffectFieldType enum. More... | |
![]() | |
QVariant | persistent_data_ |
Persistent data object. More... | |
QVector< EffectKeyframe > | keyframes |
Keyframe array. More... | |
The ComboField class.
An EffectField derivative to produce arbitrary data based on a fixed selection of items.
ComboField::ComboField | ( | EffectRow * | parent, |
const QString & | id | ||
) |
Reimplementation of EffectField::EffectField().
void ComboField::AddItem | ( | const QString & | text, |
const QVariant & | data | ||
) |
Add an item to this ComboField.
Adds a choice that the user can choose from this ComboField. All choices need text (for the on-screen choice) and data, which gets read on the backend. The selected data is what gets saved and loaded from project files, and therefore the data should be unique to this item. In case more items get added to this ComboField later, old project files will still open correctly. This is also why simple selected indices are not available. The text is only shown on the UI so it can be safely translated during runtime.
text | The text to show at this index. |
data | The data to be retrieved at this index. |
|
overridevirtual |
Reimplementation of EffectField::CreateWidget()
Creates and connects to a QComboBox with the set of items added in AddItem().
Implements EffectField.
|
signal |
Signal emitted whenever a connected widget's data gets changed.
Useful for UI events that need to occur with the change of this ComboField's value.
|
privateslot |
Internal function connected to any QWidget made from CreateWidget() to update the value based on user input.
b | The current index of the QWidget (QComboBox in this case). Automatically set when this slot is connected to the QComboBox::currentIndexChanged() signal. This is the only time ComboFields deal with indices since the QComboBox's indices will match precisely to the items_ array. Outside of this function, QVariant data is preferred. |
|
overridevirtual |
Reimplementation of EffectField::UpdateWidgetValue()
Reimplemented from EffectField.
|
private |
Internal array of string+value pair items.