A generic QAbstractTableModel subclass to view and edit list of various data types.
More...
#include <editablelistmodel.h>
Inherits QAbstractTableModel.
template<typename T,
EditableListModelType TYPE = EditableListModelType::DEFAULT>
class librepcb::editor::EditableListModel< T, TYPE >
A generic QAbstractTableModel subclass to view and edit list of various data types.
This class is similar to QStringListModel, but supports various other item types than QString.
Special Features:
- Adds an additional column and row to allow modifying the model with librepcb::editor::EditableTableWidget.
- Automatic pretty printing and input validation for various data types:
- Locales, e.g. "de_DE" -> "Deutsch (Deutschland)"
- URLs
- Optionally providing a QComboBox to choose from a predefined set of values (setChoices()). Values are automatically sorted by their text.
- Support custom display text (setDisplayText()).
- Support icons (setIcon()).
- Duplicate values are revoked.
◆ ValueType
◆ Column
| Enumerator |
|---|
| COLUMN_TEXT | |
| COLUMN_ACTIONS | |
| _COLUMN_COUNT | |
◆ EditableListModel() [1/2]
◆ EditableListModel() [2/2]
◆ ~EditableListModel()
◆ getValues()
| const T & getValues |
( |
| ) |
const |
|
inlinenoexcept |
◆ setDefaultValue()
| void setDefaultValue |
( |
const ValueType & |
value | ) |
|
|
inlinenoexcept |
◆ setPlaceholderText()
| void setPlaceholderText |
( |
const QString & |
text | ) |
|
|
inlinenoexcept |
◆ setValues()
| void setValues |
( |
const T & |
values | ) |
|
|
inlinenoexcept |
◆ setChoices()
| void setChoices |
( |
const T & |
choices | ) |
|
|
inlinenoexcept |
◆ setDisplayText()
| void setDisplayText |
( |
const ValueType & |
value, |
|
|
const QString & |
text |
|
) |
| |
|
inlinenoexcept |
◆ setIcon()
| void setIcon |
( |
const ValueType & |
value, |
|
|
const QIcon & |
icon |
|
) |
| |
|
inlinenoexcept |
◆ add()
| void add |
( |
const QPersistentModelIndex & |
itemIndex | ) |
|
|
inlinenoexcept |
◆ remove()
| void remove |
( |
const QPersistentModelIndex & |
itemIndex | ) |
|
|
inlinenoexcept |
◆ moveUp()
| void moveUp |
( |
const QPersistentModelIndex & |
itemIndex | ) |
|
|
inlinenoexcept |
◆ moveDown()
| void moveDown |
( |
const QPersistentModelIndex & |
itemIndex | ) |
|
|
inlinenoexcept |
◆ rowCount()
| int rowCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
inlineoverride |
◆ columnCount()
| int columnCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
inlineoverride |
◆ data()
| QVariant data |
( |
const QModelIndex & |
index, |
|
|
int |
role = Qt::DisplayRole |
|
) |
| const |
|
inlineoverride |
◆ headerData()
| QVariant headerData |
( |
int |
section, |
|
|
Qt::Orientation |
orientation, |
|
|
int |
role = Qt::DisplayRole |
|
) |
| const |
|
inlineoverride |
◆ flags()
| Qt::ItemFlags flags |
( |
const QModelIndex & |
index | ) |
const |
|
inlineoverride |
◆ setData()
| bool setData |
( |
const QModelIndex & |
index, |
|
|
const QVariant & |
value, |
|
|
int |
role = Qt::EditRole |
|
) |
| |
|
inlineoverride |
◆ operator=()
◆ getDisplayText() [1/3]
| QString getDisplayText |
( |
const Uuid & |
value | ) |
const |
|
inlineprivatenoexcept |
◆ getDisplayText() [2/3]
| QString getDisplayText |
( |
const QUrl & |
value | ) |
const |
|
inlineprivatenoexcept |
◆ getDisplayText() [3/3]
| QString getDisplayText |
( |
const QString & |
value | ) |
const |
|
inlineprivatenoexcept |
◆ getDataForValue() [1/3]
| QVariant getDataForValue |
( |
const Uuid & |
value | ) |
const |
|
inlineprivatenoexcept |
◆ getDataForValue() [2/3]
| QVariant getDataForValue |
( |
const QUrl & |
value | ) |
const |
|
inlineprivatenoexcept |
◆ getDataForValue() [3/3]
| QVariant getDataForValue |
( |
const QString & |
value | ) |
const |
|
inlineprivatenoexcept |
◆ convertInputValue() [1/3]
| std::optional< Uuid > convertInputValue |
( |
const QVariant & |
input, |
|
|
const std::optional< Uuid > & |
tag |
|
) |
| const |
|
inlineprivatenoexcept |
◆ convertInputValue() [2/3]
| std::optional< QString > convertInputValue |
( |
const QVariant & |
input, |
|
|
const std::optional< QString > & |
tag |
|
) |
| const |
|
inlineprivatenoexcept |
◆ convertInputValue() [3/3]
| std::optional< QUrl > convertInputValue |
( |
const QVariant & |
input, |
|
|
const std::optional< QUrl > & |
tag |
|
) |
| const |
|
inlineprivatenoexcept |
◆ updateComboBoxItems()
| void updateComboBoxItems |
( |
| ) |
|
|
inlineprivatenoexcept |
◆ mChoices
◆ mValues
◆ mDefaultValue
◆ mNewValue
◆ mPlaceholderText
◆ mDisplayTexts
◆ mIcons
◆ mComboBoxItems
The documentation for this class was generated from the following file: