6#include "mission_parameter.h"
7#include "oclero/qlementine/widgets/ColorEditor.hpp"
8#include "style_helpers.h"
9#include "typing/type_definition.h"
10#include "typing/type_reference.h"
23namespace oclero::qlementine
39void addCompleter(
const QStringList& items, QWidget* parent);
87 static WidgetAlignment Form(maki::WidgetGroup* widgetGroup,
int width = 0,
Direction dir = Direction::SPREAD)
89 return maki::WidgetAlignment{
112 GridGroup(
const QString& label,
int rows,
int cols, QWidget* parent);
154 WidgetGroup(
const QString& label, QWidget* parent);
155 WidgetGroup(
const QString& label, oclero::qlementine::TextRole role, QWidget* parent);
180 virtual void removeWidget(QWidget* widget);
181 virtual void clear();
182 virtual void setPadding(
int padding);
186 QWidget* mContentWidget =
nullptr;
187 QVBoxLayout* mContentLayout =
nullptr;
199 WidgetScrollGroup(
const QString& label, oclero::qlementine::TextRole role, QWidget* parent);
202class InputWidget :
public QWidget
206 InputWidget(
const QString& label, QWidget* inputField,
WidgetAlignment alignment, QWidget* parent =
nullptr);
207 virtual ~InputWidget() =
default;
209 void addDescription(
const QString& text);
210 void setToolTip(
const QString& text);
212 void setType(
const koda::types::TypeReference& type);
213 void setValue(
const Value& value);
214 Value getValue()
const;
216 virtual void writeValueToWidget(
const Value& value) = 0;
218 virtual QList<QWidget*> focusWidgets()
const
220 return {mInputField};
223 bool isReference()
const;
224 void setReference(
const QString&
id);
225 void clearReference();
226 void setSupportedReferences(
const QVector<MissionParameter>& parameters);
230 void openParameter(
const QString& parameter);
233 koda::types::TypeReference mType;
235 QWidget* mInputField =
nullptr;
236 QMenu* mParameterMenu;
238 QToolButton* mParameterButton =
nullptr;
239 QHBoxLayout* mContainerLayout =
nullptr;
241 void createReferenceWidgets();
242 QWidget* createLayout(oclero::qlementine::Label* label,
WidgetAlignment alignment);
246class TypedInputWidget :
public InputWidget
249 TypedInputWidget(
const QString& label, W* inputField,
WidgetAlignment alignment, QWidget* parent =
nullptr)
250 : InputWidget(label, inputField, alignment, parent)
256 return qobject_cast<W*>(mInputField);
277 bool getValue()
const;
278 void setValue(
bool value);
280 void writeValueToWidget(
const Value& value)
override;
294class StringWidget :
public TypedInputWidget<oclero::qlementine::LineEdit>
306 StringWidget(
const QString& label,
const QString& placeholder,
WidgetAlignment alignment,
const QString& tooltip, QWidget* parent);
308 QString getValue()
const;
309 void setValue(
const QString& value);
311 void writeValueToWidget(
const Value& value)
override;
321 QTimer* mUpdateTimer =
nullptr;
341 IntegerWidget(
const QString& label,
const QString& placeholder,
WidgetAlignment alignment, QWidget* parent,
int min = INT32_MIN,
int max = INT32_MAX);
349 void writeValueToWidget(
const Value& value)
override;
351 int getValue()
const;
352 void setValue(
int value);
353 void setValue(
const QString& value);
370class FloatWidget :
public TypedInputWidget<oclero::qlementine::LineEdit>
383 FloatWidget(
const QString& label,
const QString& placeholder,
WidgetAlignment alignment, QWidget* parent, qreal min = std::numeric_limits<qreal>::min(),
384 qreal max = std::numeric_limits<qreal>::max());
392 void writeValueToWidget(
const Value& value)
override;
394 double getValue()
const;
395 void setValue(
double value);
396 void setValue(
const QString& value);
425 SpinWidget(
const QString& label,
int placeholder, QWidget* parent,
WidgetAlignment alignment,
int min = INT32_MIN,
int max = INT32_MAX);
427 int getValue()
const;
428 void setValue(
int value);
430 void writeValueToWidget(
const Value& value)
override;
469 QVariant getData()
const;
470 void setData(
const QString& value);
472 QString getValue()
const;
473 void setValue(
const QString& value);
480 void addItem(
const QString& name,
const QVariant& value);
482 void writeValueToWidget(
const Value& value)
override;
490 void dataChanged(
const QString& text,
const QVariant& value);
521 void setIcon(
const QIcon& icon);
533 void setText(
const QString& text);
549class ColorWidget :
public TypedInputWidget<oclero::qlementine::ColorEditor>
561 QColor getValue()
const;
562 void setValue(
const QColor& value);
564 void writeValueToWidget(
const Value& color)
override;
619 void writeValueToWidget(
const Value& value)
override;
635 SearchWidget(
const QString& placeholder, QWidget* parent);
647 void setValue(
const QString& value);
659 QLineEdit*
widget()
const;
679class ListWidget :
public TypedInputWidget<WidgetGroup>
683 ListWidget(
const QString& label,
const koda::types::TypeReference& elementType,
WidgetAlignment alignment, QWidget* parent =
nullptr);
685 ListValue getValue()
const;
686 void setValue(
const ListValue& value);
688 void writeValueToWidget(
const Value& value)
override;
690 virtual QList<QWidget*> focusWidgets()
const override;
693 koda::types::TypeReference mElementType;
695 QWidget* mItems =
nullptr;
696 QVBoxLayout* mItemsLayout =
nullptr;
698 std::vector<InputWidget*> mEditors;
700 void addItem(
const Value& value);
704class MapWidget :
public TypedInputWidget<WidgetGroup>
708 MapWidget(
const QString& label,
const koda::types::TypeReference& keyType,
const koda::types::TypeReference& valueType,
WidgetAlignment alignment,
709 QWidget* parent =
nullptr);
711 MapValue getValue()
const;
712 void setValue(
const MapValue& value);
714 void writeValueToWidget(
const Value& value)
override;
716 virtual QList<QWidget*> focusWidgets()
const override;
719 koda::types::TypeReference mKeyType;
720 koda::types::TypeReference mValueType;
722 QWidget* mItems =
nullptr;
723 QVBoxLayout* mItemsLayout =
nullptr;
731 std::vector<MapField> mEditors;
733 void addItem(
const Value& key,
const Value& value);
737class RecordWidget :
public TypedInputWidget<WidgetGroup>
741 RecordWidget(
const QString& containerLabel,
const QString& label,
const koda::types::TypeDefinition& definition,
WidgetAlignment alignment,
742 QWidget* parent =
nullptr);
744 RecordValue getValue()
const;
745 void setValue(
const RecordValue& value);
747 void writeValueToWidget(
const Value& value)
override;
749 virtual QList<QWidget*> focusWidgets()
const override;
758 std::vector<RecordField> mEditors;
759 const koda::types::TypeDefinition mDefinition;
761 void addItem(
const QString&
id,
const Value& value);
769 EnumWidget(
const QString& label,
const koda::types::TypeDefinition& definition,
WidgetAlignment alignment, QWidget* parent =
nullptr);
772 const koda::types::TypeDefinition mDefinition;
778 static InputWidget* create(
const QString& label,
const koda::types::TypeReference& type,
const Value& value,
WidgetAlignment alignment, QWidget* parent);
Definition double_variable.h:6
Definition int_variable.h:6
Definition clickable_label.h:8
void addLayout(QLayout *layout)
Adds a layout to the next available cell in the grid.
Definition widget_factory.cpp:151
void addWidget(QWidget *widget)
Adds a widget to the next available cell in the grid.
Definition widget_factory.cpp:135
const int mRows
Total number of rows in the grid.
Definition widget_factory.h:134
GridGroup(const QString &label, int rows, int cols, QWidget *parent)
Constructs a grid group with a label and fixed grid dimensions.
Definition widget_factory.cpp:99
int mCurrentRow
Current row where the next item will be inserted.
Definition widget_factory.h:137
QWidget * widget() const
Returns the internal content widget of the group.
Definition widget_factory.cpp:130
QWidget * mContent
Internal content widget that owns the grid contents.
Definition widget_factory.h:133
int mCurrentCol
Current column where the next item will be inserted.
Definition widget_factory.h:138
const int mCols
Total number of columns in the grid.
Definition widget_factory.h:135
Definition widget_factory.h:776
Contains UI helper widgets and layout grouping utilities used by MAKI.
Definition generator.h:10