I am writing an application in Qt with C++. In this application I have to display an amount of data in a text box.
Is there a way to use QTextEdit or QPlainTextEdit with the model/view concept in Qt? I only found list, tree, or table View classes with mvc functionality.
Is there a way to use QTextEdit or QPlainTextEdit with the model/view concept in Qt?
No.
For using model/view concept you need use already existed classes which inherit QAbstractItemView (such as: QColumnView
, QHeaderView
, QListView
, QTableView
and QTreeView
) or inherit your custom class.
Have a look at the Qt documentation. There are the options you have: http://doc.qt.io/qt-4.8/model-view-programming.html
QAbstractItemModel
provides an interface to data that is flexible enough to handle views that represent data in the form of tables, lists, and trees. However, when implementing new models for list and table-like data structures, theQAbstractListModel
andQAbstractTableModel
classes are better starting points because they provide appropriate default implementations of common functions.
QListView
displays a list of items,QTableView
displays data from a model in a table, andQTreeView
shows model items of data in a hierarchical list. Each of these classes is based on theQAbstractItemView
abstract base class.
QAbstractItemDelegate
is the abstract base class for delegates in the model/view framework.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With