Limo
A simple mod manager
Loading...
Searching...
No Matches
versionboxdelegate.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include "modlistproxymodel.h"
9#include "ui/modlistview.h"
10#include <QStyledItemDelegate>
11#include <QTableView>
12
13
17class VersionBoxDelegate : public QStyledItemDelegate
18{
19 Q_OBJECT
20public:
26 explicit VersionBoxDelegate(ModListProxyModel* proxy, QObject* parent);
27
36 QWidget* createEditor(QWidget* parent,
37 const QStyleOptionViewItem& option,
38 const QModelIndex& index) const override;
45 void setEditorData(QWidget* editor, const QModelIndex& index) const override;
53 void setModelData(QWidget* editor,
54 QAbstractItemModel* model,
55 const QModelIndex& index) const override;
62 void updateEditorGeometry(QWidget* editor,
63 const QStyleOptionViewItem& option,
64 const QModelIndex& index) const override;
72 void paint(QPainter* painter,
73 const QStyleOptionViewItem& option,
74 const QModelIndex& view_index) const override;
79 void setIsBackupDelegate(bool is_backup);
80
81private:
85 bool is_backup_delegate_ = false;
88
89signals:
95 void activeGroupMemberChanged(int group, int new_id) const;
101 void modVersionChanged(int mod_id, QString version) const;
107 void activeBackupChanged(int target, int backup) const;
114 void backupNameEdited(int target, int backup, QString name) const;
115};
Used to sort or filter the mod list.
Definition modlistproxymodel.h:16
Displays mod data in the form of a mod list using a ModListModel.
Definition modlistview.h:21
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 ...
Definition versionboxdelegate.cpp:48
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...
Definition versionboxdelegate.cpp:46
void activeGroupMemberChanged(int group, int new_id) const
Signals that the active member of a group has changed.
bool is_backup_delegate_
Indicates if this is used to manage the backup list.
Definition versionboxdelegate.h:85
void setIsBackupDelegate(bool is_backup)
Sets if this is used to handle the backup list.
Definition versionboxdelegate.cpp:173
ModListView * parent_view_
Convenience pointer to parent view. Points to the same address as this->parent.
Definition versionboxdelegate.h:87
ModListProxyModel * proxy_model_
Proxy model used to sort or filter the underlying model.
Definition versionboxdelegate.h:83
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.
Definition versionboxdelegate.cpp:19
void backupNameEdited(int target, int backup, QString name) const
Signals that the name of a backup has been edited by the user.
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 updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Updates the given editors geometry.
Definition versionboxdelegate.cpp:103
VersionBoxDelegate(ModListProxyModel *proxy, QObject *parent)
Constructor.
Definition versionboxdelegate.cpp:14
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...
Definition versionboxdelegate.cpp:110
uint32_t version
Archive format version.
Definition lspakheader.h:3
Header for the ModListProxyModel class.
Header for the ModListView class.