ramón
ramón

Reputation: 101

Qt: model/view concept with text browser

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.

Upvotes: 7

Views: 798

Answers (2)

holzkohlengrill
holzkohlengrill

Reputation: 1242

Have a look at the Qt documentation. There are the options you have: http://doc.qt.io/qt-4.8/model-view-programming.html

Models

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, the QAbstractListModel and QAbstractTableModel classes are better starting points because they provide appropriate default implementations of common functions.

Views

QListView displays a list of items, QTableView displays data from a model in a table, and QTreeView shows model items of data in a hierarchical list. Each of these classes is based on the QAbstractItemView abstract base class.

Controller

QAbstractItemDelegate is the abstract base class for delegates in the model/view framework.

Upvotes: 2

Gluttton
Gluttton

Reputation: 5988

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.

Upvotes: 2

Related Questions