tuchulcha  0.10.1
Graphical Workflow Configuration Editor
InspectorDelegate Class Reference

delegate to handle parameter types and offer specialized editors More...

#include <InspectorDelegate.h>

Inheritance diagram for InspectorDelegate:

Public Member Functions

 InspectorDelegate (QObject *parent=0)
 standart constructor More...
 
virtual QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
 create own editors, if necessary More...
 
bool eventFilter (QObject *object, QEvent *event)
 filter editor events More...
 
virtual void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
 Sets the data for the item at the given index in the model to the contents of the given editor. More...
 

Protected Slots

void _handleCloseEditor (QWidget *, QAbstractItemDelegate::EndEditHint)
 reset working dir
 
void _setFileDialogFlag (bool flag)
 set _fileDialogFlag
 

Protected Attributes

bool _fileDialogFlag
 file dialog opened
 
QString _workingDir
 cache
 

Detailed Description

This delegate takes care of showing eanough digits of float/double values and of file/path specialized editors as well as dropdown selections. Editors for int/float/double/string/etc. are handled by the default editors of the QStyledItemDelegate, only the digit number is fixed.

The following special types are recognized:

  • fileopen, openfile: open file editor
  • filewrite, writefile, filename: write file editor
  • path: path selection editor
  • {opt1,opt2,opt3}: selection editor (dropdown box, replace optX by the string options you want)

Definition at line 56 of file InspectorDelegate.h.

Constructor & Destructor Documentation

InspectorDelegate::InspectorDelegate ( QObject *  parent = 0)

parent is passed to QStyledItemDelegate constructor

Parameters
parentparent widget

Definition at line 48 of file InspectorDelegate.cpp.

References _handleCloseEditor().

Member Function Documentation

QWidget * InspectorDelegate::createEditor ( QWidget *  parent,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
virtual

Returns the widget used to edit the item specified by index for editing. The parent widget and style option are used to control how the editor widget appears.

Parameters
parentparent widget
optionstyle option
indexmodel index
Returns
editor widget

Definition at line 55 of file InspectorDelegate.cpp.

References _setFileDialogFlag(), _workingDir, QDirEdit::acceptFiles(), ParameterFileModel::data(), exists(), ParameterFileModel::fileName(), ParameterFileModel::getType(), ParameterFileModel::onlyParams(), ParameterFileModel::prefix(), and type().

bool InspectorDelegate::eventFilter ( QObject *  object,
QEvent *  event 
)

workaround for what looks like a bug in Qt on Mac OS X where it doesn't create a QWidget wrapper for the native file dialog so the Qt library ends up assuming the focus was lost to something else

Parameters
objectevent object
eventevent
Return values
trueevent has to be handled

Definition at line 170 of file InspectorDelegate.cpp.

References _fileDialogFlag.

void InspectorDelegate::setModelData ( QWidget *  editor,
QAbstractItemModel *  model,
const QModelIndex &  index 
) const
virtual
Parameters
editoreditor widget
modelmodel
indexitem index

Definition at line 132 of file InspectorDelegate.cpp.

References ParameterFileModel::fileName().


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