Limo
A simple mod manager
Loading...
Searching...
No Matches
ModNameDelegate Class Reference

Provides a line edit to change mod names. More...

#include <modnamedelegate.h>

Inheritance diagram for ModNameDelegate:
Collaboration diagram for ModNameDelegate:

Signals

void modNameChanged (int mod_id, QString name) const
 Signals that a mod name has been changed by the user.
 

Public Member Functions

 ModNameDelegate (ModListProxyModel *proxy, QObject *parent)
 Constructor.
 
QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Creates a QLineEdit object at the given index in the given view.
 
void setEditorData (QWidget *editor, const QModelIndex &index) const override
 Sets the line edits data to the name of the mod in the given row.
 
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
 Emits modNameChanged with the new mod name.
 
void updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Updates the given line edits geometry.
 
- Public Member Functions inherited from TableCellDelegate
 TableCellDelegate (QSortFilterProxyModel *proxy, QObject *parent)
 Constructor.
 
void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &view_index) const override
 Paints the cells background and text or icon.
 

Additional Inherited Members

- Protected Attributes inherited from TableCellDelegate
QSortFilterProxyModel * proxy_model_ = nullptr
 Proxy model used to sort or filter the underlying model.
 
ModListViewparent_view_
 Convenience pointer to parent view. Points to the same address as this->parent.
 

Detailed Description

Provides a line edit to change mod names.

Constructor & Destructor Documentation

◆ ModNameDelegate()

ModNameDelegate::ModNameDelegate ( ModListProxyModel * proxy,
QObject * parent )
explicit

Constructor.

Parameters
parentParent of this object.
proxyProxy model used, or nullptr if non is used.

Member Function Documentation

◆ createEditor()

QWidget * ModNameDelegate::createEditor ( QWidget * parent,
const QStyleOptionViewItem & option,
const QModelIndex & index ) const
override

Creates a QLineEdit object at the given index in the given view.

Parameters
parentView for which to display the line edit.
optionStyle options.
indexTarget index for the line edit.
Returns
The new QLineEdit.

◆ modNameChanged

void ModNameDelegate::modNameChanged ( int mod_id,
QString name ) const
signal

Signals that a mod name has been changed by the user.

Parameters
mod_idTarget mod id.
nameNew name.

◆ setEditorData()

void ModNameDelegate::setEditorData ( QWidget * editor,
const QModelIndex & index ) const
override

Sets the line edits data to the name of the mod in the given row.

Parameters
editorQLineEdit for which to set data.
indexIndex of the mod.

◆ setModelData()

void ModNameDelegate::setModelData ( QWidget * editor,
QAbstractItemModel * model,
const QModelIndex & index ) const
override

Emits modNameChanged with the new mod name.

Parameters
editorLine edit used to change the name.
modelIgnored.
indexIndex for the edited name.

◆ updateEditorGeometry()

void ModNameDelegate::updateEditorGeometry ( QWidget * editor,
const QStyleOptionViewItem & option,
const QModelIndex & index ) const
override

Updates the given line edits geometry.

Parameters
editorTarget editor.
optionStyle options.
indexIndex for the editor.

The documentation for this class was generated from the following files: