Provides either a QLineEdit or a QComboBox to edit a mods version.
More...
#include <versionboxdelegate.h>
|
void | activeGroupMemberChanged (int group, int new_id) const |
| Signals that the active member of a group has changed.
|
|
void | modVersionChanged (int mod_id, QString version) const |
| Signals that the version string of a mod has changed.
|
|
void | activeBackupChanged (int target, int backup) const |
| Signals that the active backup for the current backup target has changed.
|
|
void | backupNameEdited (int target, int backup, QString name) const |
| Signals that the name of a backup has been edited by the user.
|
|
|
| VersionBoxDelegate (ModListProxyModel *proxy, QObject *parent) |
| Constructor.
|
|
QWidget * | createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| Creates either a QLineEdit or a QComboBox depending on whether or not the mod belongs to a group.
|
|
void | setEditorData (QWidget *editor, const QModelIndex &index) const override |
| Initializes either the line edit with the mods version or the combo box with the versions of all mods belonging to the same group.
|
|
void | setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override |
| Emits modVersionChanged if the mod version has been edited or activeGroupMemberChanged if the editor is a combo box and its index has been changed.
|
|
void | updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| Updates the given editors geometry.
|
|
void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &view_index) const override |
| If the target index references a mod in a group: Paints an editable combo box at the given index into the given view.
|
|
void | setIsBackupDelegate (bool is_backup) |
| Sets if this is used to handle the backup list.
|
|
|
ModListProxyModel * | proxy_model_ = nullptr |
| Proxy model used to sort or filter the underlying model.
|
|
bool | is_backup_delegate_ = false |
| Indicates if this is used to manage the backup list.
|
|
ModListView * | parent_view_ |
| Convenience pointer to parent view. Points to the same address as this->parent.
|
|
Provides either a QLineEdit or a QComboBox to edit a mods version.
◆ VersionBoxDelegate()
VersionBoxDelegate::VersionBoxDelegate |
( |
ModListProxyModel * | proxy, |
|
|
QObject * | parent ) |
|
explicit |
Constructor.
- Parameters
-
proxy | Proxy model used to sort or filter the underlying model. |
parent | Parent view of this delegate. |
◆ activeBackupChanged
void VersionBoxDelegate::activeBackupChanged |
( |
int | target, |
|
|
int | backup ) const |
|
signal |
Signals that the active backup for the current backup target has changed.
- Parameters
-
target | Current target. |
backup | New active backup. |
◆ activeGroupMemberChanged
void VersionBoxDelegate::activeGroupMemberChanged |
( |
int | group, |
|
|
int | new_id ) const |
|
signal |
Signals that the active member of a group has changed.
- Parameters
-
group | Target group. |
new_id | New active member. |
◆ backupNameEdited
void VersionBoxDelegate::backupNameEdited |
( |
int | target, |
|
|
int | backup, |
|
|
QString | name ) const |
|
signal |
Signals that the name of a backup has been edited by the user.
- Parameters
-
target | Target to which the backup belongs. |
backup | The edited backup. |
name | The new name. |
◆ createEditor()
QWidget * VersionBoxDelegate::createEditor |
( |
QWidget * | parent, |
|
|
const QStyleOptionViewItem & | option, |
|
|
const QModelIndex & | index ) const |
|
override |
Creates either a QLineEdit or a QComboBox depending on whether or not the mod belongs to a group.
- Parameters
-
parent | Parent view. |
option | Style options. |
index | Index at which to create the editor. |
- Returns
◆ modVersionChanged
void VersionBoxDelegate::modVersionChanged |
( |
int | mod_id, |
|
|
QString | version ) const |
|
signal |
Signals that the version string of a mod has changed.
- Parameters
-
mod_id | Target mod. |
version | New version string. |
◆ paint()
void VersionBoxDelegate::paint |
( |
QPainter * | painter, |
|
|
const QStyleOptionViewItem & | option, |
|
|
const QModelIndex & | view_index ) const |
|
override |
If the target index references a mod in a group: Paints an editable combo box at the given index into the given view.
- Parameters
-
painter | Painter used to draw. |
option | Style options. |
view_index | The target views index. |
◆ setEditorData()
void VersionBoxDelegate::setEditorData |
( |
QWidget * | editor, |
|
|
const QModelIndex & | index ) const |
|
override |
Initializes either the line edit with the mods version or the combo box with the versions of all mods belonging to the same group.
- Parameters
-
editor | Target editor. |
index | Index for the editor. |
◆ setIsBackupDelegate()
void VersionBoxDelegate::setIsBackupDelegate |
( |
bool | is_backup | ) |
|
Sets if this is used to handle the backup list.
- Parameters
-
is_backup | True for backup, else false. |
◆ setModelData()
void VersionBoxDelegate::setModelData |
( |
QWidget * | editor, |
|
|
QAbstractItemModel * | model, |
|
|
const QModelIndex & | index ) const |
|
override |
Emits modVersionChanged if the mod version has been edited or activeGroupMemberChanged if the editor is a combo box and its index has been changed.
- Parameters
-
editor | Editor used to change the data. |
model | Ignored. |
index | Index for the edited mod version. |
◆ updateEditorGeometry()
void VersionBoxDelegate::updateEditorGeometry |
( |
QWidget * | editor, |
|
|
const QStyleOptionViewItem & | option, |
|
|
const QModelIndex & | index ) const |
|
override |
Updates the given editors geometry.
- Parameters
-
editor | Target editor. |
option | Style options. |
index | Index for the editor. |
The documentation for this class was generated from the following files: