Qt例程之trackdeditor

The QAbstractItemDelegate class is used to display and edit data items from a model
用于显示和从模型编辑数据item

void QAbstractItemView::setItemDelegate(QAbstractItemDelegate * delegate)
Sets the item delegate for this view and its model to delegate.
//为这个view设置item deleg ,设置model为delegate.
This is useful if you want complete control over the editing and display of items.
//你想完全控制item的编辑与显示

The QItemDelegate class provides display and editing facilities for data items from a model.
//从model中为数据item提供了显示和编辑faci

void QItemDelegate::drawDisplay(QPainter * painter, const QStyleOptionViewItem & option, const QRect & rect, const QString & text) const
Renders the item view text within the rectangle specified by rect using the given painter and style option.
//提供了item视图文本

The QTimeEdit class provides a widget for editing times based on the QDateTimeEdit widget.
//基于QDateTimeEdit编辑times的widget

displayFormat : QString
This property holds the format used to display the time/date of the date time edit.
拿着用于显示 date time 编辑的time/data的格式
oid setDisplayFormat(const QString & format)

time : QTime
This property holds the QTime that is set in the widget.
//拿着在widget中设置的Qtime
QTime time() const
void setTime(const QTime & time)

const QModelIndex & index) const
Reimplemented from QAbstractItemDelegate::setModelData().
Gets data from the editor widget and stores it in the specified model at the item index.
从editor widget得到数据,然后存到指定model的index处

void QAbstractItemDelegate::commitData(QWidget * editor)
This signal must be emitted when the editor widget has completed editing the data, and wants to write it back into the model.
//当editor widget完成数据编辑,信号发射,写回到model

void QAbstractItemDelegate::closeEditor(QWidget * editor, QAbstractItemDelegate::EndEditHint hint = NoHint)
This signal is emitted when the user has finished editing an item using the specified editor.
//使用指定的editor完成了编辑,会发射

const QAbstractItemModel * QModelIndex::model() const
Returns a pointer to the model containing the item that this index refers to.
/?返回指向model的指针,model包含 这个index参考的item

QVariant QAbstractItemModel::data(const QModelIndex & index, int role = Qt::DisplayRole) const
Returns the data stored under the given role for the item referred to by the index.
//返回存储在 为 由index参考的item 给定role 的数据,

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章