OpenMS
ParamEditorDelegate Class Reference

Internal delegate class for QTreeWidget. More...

#include <OpenMS/VISUAL/ParamEditor.h>

Inheritance diagram for ParamEditorDelegate:
[legend]
Collaboration diagram for ParamEditorDelegate:
[legend]

Signals

void modified (bool) const
 signal for showing ParamEditor if the Model data changed More...
 

Public Member Functions

 ParamEditorDelegate (QObject *parent)
 Constructor. More...
 
QWidgetcreateEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Returns the widget(combobox or QLineEdit) used to edit the item specified by index for editing. Prevents edit operations on nodes' values and types. More...
 
void setEditorData (QWidget *editor, const QModelIndex &index) const override
 Sets the data to be displayed and edited by the editor for the item specified by index. More...
 
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
 Sets the data for the specified model and item index from that supplied by the editor. If data changed in a cell, that is if it is different from an initial value, then set its background color to yellow and emit the modified signal otherwise make it white. More...
 
void updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Updates the editor for the item specified by index according to the style option given. More...
 
bool hasUncommittedData () const
 true if the underlying tree has an open QLineEdit which has uncommitted data More...
 

Protected Member Functions

bool eventFilter (QObject *editor, QEvent *event) override
 a shortcut to calling commit(), which calls setModelData(); useful for embedded editors, but not for QDialogs etc More...
 
bool exists_ (const QString &name, QModelIndex index) const
 Checks if a name is valid for the entry corresponding to index (checks if it would be duplicate) More...
 

Private Slots

void commitAndCloseEditor_ ()
 For closing any editor and updating ParamEditor. More...
 
void closeEditor_ ()
 if cancel in any editor is clicked, the Dialog is closed and changes are rejected More...
 
void commitAndCloseLineEdit_ ()
 ... a bit special, because reset uncommited data More...
 

Private Member Functions

 ParamEditorDelegate ()
 Not implemented. More...
 

Private Attributes

QString fileName_
 used to modify value of output and input files( not for output and input lists) More...
 
bool has_uncommited_data_
 true if a QLineEdit is still open and has not committed its data yet (so storing the current param is a bad idea) More...
 

Detailed Description

Internal delegate class for QTreeWidget.

This handles editing of items.

Constructor & Destructor Documentation

◆ ParamEditorDelegate() [1/2]

Constructor.

◆ ParamEditorDelegate() [2/2]

ParamEditorDelegate ( )
private

Not implemented.

Member Function Documentation

◆ closeEditor_

void closeEditor_ ( )
privateslot

if cancel in any editor is clicked, the Dialog is closed and changes are rejected

◆ commitAndCloseEditor_

void commitAndCloseEditor_ ( )
privateslot

For closing any editor and updating ParamEditor.

◆ commitAndCloseLineEdit_

void commitAndCloseLineEdit_ ( )
privateslot

... a bit special, because reset uncommited data

◆ createEditor()

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

Returns the widget(combobox or QLineEdit) used to edit the item specified by index for editing. Prevents edit operations on nodes' values and types.

◆ eventFilter()

bool eventFilter ( QObject editor,
QEvent *  event 
)
overrideprotected

a shortcut to calling commit(), which calls setModelData(); useful for embedded editors, but not for QDialogs etc

◆ exists_()

bool exists_ ( const QString &  name,
QModelIndex  index 
) const
protected

Checks if a name is valid for the entry corresponding to index (checks if it would be duplicate)

◆ hasUncommittedData()

bool hasUncommittedData ( ) const

true if the underlying tree has an open QLineEdit which has uncommitted data

◆ modified

void modified ( bool  ) const
signal

signal for showing ParamEditor if the Model data changed

◆ setEditorData()

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

Sets the data to be displayed and edited by the editor for the item specified by index.

◆ setModelData()

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

Sets the data for the specified model and item index from that supplied by the editor. If data changed in a cell, that is if it is different from an initial value, then set its background color to yellow and emit the modified signal otherwise make it white.

◆ updateEditorGeometry()

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

Updates the editor for the item specified by index according to the style option given.

Member Data Documentation

◆ fileName_

QString fileName_
mutableprivate

used to modify value of output and input files( not for output and input lists)

◆ has_uncommited_data_

bool has_uncommited_data_
mutableprivate

true if a QLineEdit is still open and has not committed its data yet (so storing the current param is a bad idea)