http://www.qtocube.co.kr/?page_id=478

'Qt' 카테고리의 다른 글

Qt using libtag  (0) 2015.11.17
멋진 플레이어  (0) 2015.11.16
리스트 QAbstractListModel[11_10]  (0) 2015.11.10
Qt 에서 이벤트 처리하기 event  (0) 2015.10.30
Q_ENUMS  (0) 2015.10.26

http://doc.qt.io/qt-5/qabstractlistmodel.html


Header:#include <QAbstractListModel>
qmake: QT += core
Inherits:QAbstractItemModel
Inherited By:

EnginioModel and QStringListModel







 virtual bool

 dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent)

 virtual Qt::ItemFlags

 flags(const QModelIndex & index) const

 virtual QModelIndex

 index(int row, int column = 0, const QModelIndex & parent = QModelIndex()) const

 virtual QModelIndex

 sibling(int row, int column, const QModelIndex & idx) const



If you need to use a number of list models to manage data, it may be more appropriate to subclass QAbstractTableModel instead.




we could implement a simple read-only QStringList-based model that provides a list of strings to a QListView widget. In such a case, we only need to implement the rowCount() function to return the number of items in the list, and the data() function to retrieve items from the list.

Since the model represents a one-dimensional structure, the rowCount() function returns the total number of items in the model. The columnCount() function is implemented for interoperability with all kinds of views, but by default informs views that the model contains only one column.

rowCount()  , data() 함수 필요 

roleNames() 함수는 QML 에서 접근하기 위해 필요하다.

list model을 수정하기위해 setData(), flags() 함수를 사용한다.

insertRows(), removeRows()

중요 아래

Note: Some general guidelines for subclassing models are available in the Model Subclassing Reference.

See also Model Classes, Model Subclassing Reference, QAbstractItemView, QAbstractTableModel, and Item Views Puzzle Example.



Model Subclassing Reference

3개의 그룹으로 나뉜다
  • Item data handling: All models need to implement functions to enable views and delegates to query the dimensions of the model, examine items, and retrieve data.
  • Navigation and index creation: Hierarchical models need to provide functions that views can call to navigate the tree-like structures they expose, and obtain model indexes for items.
  • Drag and drop support and MIME type handling: Models inherit functions that control the way that internal and external drag and drop operations are performed. These functions allow items of data to be described in terms of MIME types that other components and applications can understand.
http://doc.qt.io/qt-5/qabstractitemmodel.html#roleNames


QHash<intQByteArray> QAbstractItemModel::roleNames() const         [virtual]    

 
 model's role names 를 반환  The  default role names set by Qt are  
Qt RoleQML Role Name
Qt::DisplayRoledisplay
Qt::DecorationRoledecoration
Qt::EditRoleedit
Qt::ToolTipRoletoolTip
Qt::StatusTipRolestatusTip
Qt::WhatsThisRolewhatsThis
ex )
 




단어 

'Qt' 카테고리의 다른 글

멋진 플레이어  (0) 2015.11.16
QML_Binding C++  (0) 2015.11.12
Qt 에서 이벤트 처리하기 event  (0) 2015.10.30
Q_ENUMS  (0) 2015.10.26
QQuickView 옵션  (0) 2015.10.26





참고 사이트 

http://kbdyj.tistory.com/m/post/42  (좋음)

Qt 에서 이벤트 처리하기

데빌쿠 | 2014/10/09 01:27 | archive(자료


'Qt' 카테고리의 다른 글

QML_Binding C++  (0) 2015.11.12
리스트 QAbstractListModel[11_10]  (0) 2015.11.10
Q_ENUMS  (0) 2015.10.26
QQuickView 옵션  (0) 2015.10.26
다국어처리  (0) 2015.10.26

+ Recent posts