BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
The SessionModelDelegate class presents the content of SessionModel items in standard QTreeView. More...
Public Slots | |
void | onCustomEditorDataChanged (const QVariant &) |
Notifies everyone that the editor has completed editing the data. More... | |
Public Member Functions | |
SessionModelDelegate (QObject *parent) | |
QWidget * | createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const |
void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const |
void | setEditorData (QWidget *editor, const QModelIndex &index) const |
Propagates the data change from the model to the editor (if it is still opened). More... | |
void | setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const |
Propagates changed data from the editor to the model. More... | |
QSize | sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const |
Increases height of the row by 20% wrt the default. More... | |
void | updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const |
Makes an editor occupying whole available space in a cell. More... | |
Private Member Functions | |
void | paintCustomLabel (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, const QString &text) const |
Paints custom text in a a place corresponding given index. More... | |
The SessionModelDelegate class presents the content of SessionModel items in standard QTreeView.
Extents base QItemDelegate with possibility to show/edit our custom QVariant's.
Definition at line 24 of file SessionModelDelegate.h.
SessionModelDelegate::SessionModelDelegate | ( | QObject * | parent | ) |
Definition at line 26 of file SessionModelDelegate.cpp.
QWidget * SessionModelDelegate::createEditor | ( | QWidget * | parent, |
const QStyleOptionViewItem & | option, | ||
const QModelIndex & | index | ||
) | const |
Definition at line 38 of file SessionModelDelegate.cpp.
References CustomEditor::dataChanged(), and onCustomEditorDataChanged().
|
slot |
Notifies everyone that the editor has completed editing the data.
Definition at line 105 of file SessionModelDelegate.cpp.
References ASSERT.
Referenced by PropertyWidgetItem::connectEditor(), and createEditor().
void SessionModelDelegate::paint | ( | QPainter * | painter, |
const QStyleOptionViewItem & | option, | ||
const QModelIndex & | index | ||
) | const |
Definition at line 28 of file SessionModelDelegate.cpp.
References PropertyEditorFactory::hasStringRepresentation(), paintCustomLabel(), and PropertyEditorFactory::toString().
|
private |
Paints custom text in a a place corresponding given index.
Definition at line 114 of file SessionModelDelegate.cpp.
Referenced by paint().
void SessionModelDelegate::setEditorData | ( | QWidget * | editor, |
const QModelIndex & | index | ||
) | const |
Propagates the data change from the model to the editor (if it is still opened).
Definition at line 71 of file SessionModelDelegate.cpp.
Referenced by PropertyWidgetItem::setItemEditor().
void SessionModelDelegate::setModelData | ( | QWidget * | editor, |
QAbstractItemModel * | model, | ||
const QModelIndex & | index | ||
) | const |
Propagates changed data from the editor to the model.
Definition at line 57 of file SessionModelDelegate.cpp.
QSize SessionModelDelegate::sizeHint | ( | const QStyleOptionViewItem & | option, |
const QModelIndex & | index | ||
) | const |
Increases height of the row by 20% wrt the default.
Definition at line 84 of file SessionModelDelegate.cpp.
void SessionModelDelegate::updateEditorGeometry | ( | QWidget * | editor, |
const QStyleOptionViewItem & | option, | ||
const QModelIndex & | index | ||
) | const |
Makes an editor occupying whole available space in a cell.
If cell contains an icon as a decoration (i.e. icon of material property), it will be hidden as soon as editor up and running.
Definition at line 96 of file SessionModelDelegate.cpp.