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 的數據,

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