1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

update dicttreemodel

This commit is contained in:
tianduanrui 2020-04-27 15:07:56 +08:00
parent 8f09e187de
commit 4466499ae8
2 changed files with 21 additions and 1 deletions

View File

@ -83,7 +83,7 @@ public:
QTextOption o;
o.setAlignment ( Qt::AlignLeft | Qt::AlignVCenter );
QRect localRect2 ( option.rect );
localRect2.setLeft ( localRect2.left() + localRect.height() );
localRect2.setLeft ( localRect2.left() + localRect2.height() );
painter->drawText ( localRect2, QString ( "%1" ).arg ( value ), o );
painter->restore();

View File

@ -45,6 +45,26 @@ protected:
private:
QQtDictionary* pdict;
#if 0
// QAbstractItemModel interface
// 一般EditRole和DisplayRole保存一样的数据。
public:
virtual QVariant data ( const QModelIndex& index, int role ) const override {
//根据index的column从字典中获取数据返回。
if ( !pdict )
return QVariant();
//返回默认的也可以,二选一。
}
virtual bool setData ( const QModelIndex& index, const QVariant& value, int role ) override {
//根据index的column向字典中设置数据。
if ( !pdict )
return false;
//返回默认的也可以,二选一。
}
#endif
};
#endif // QQTDICTTREEMODEL_H