| qabstractitemdelegate.cpp |
!
\class QAbstractItemDelegate
\brief The QAbstractItemDelegate class is used to display and edit
data items from a model.
\ingroup model-view
\inmodule QtWidgets
A QAbstractItemDelegate provides the interface and common functionality
for delegates in the model/view architecture. Delegates display
individual items in views, and handle the editing of model data.
The QAbstractItemDelegate class is one of the \l{Model/View Classes}
and is part of Qt's \l{Model/View Programming}{model/view framework}.
To render an item in a custom way, you must implement paint() and
sizeHint(). The QStyledItemDelegate class provides default implementations for
these functions; if you do not need custom rendering, subclass that
class instead.
We give an example of drawing a progress bar in items; in our case
for a package management program.
\image widgetdelegate.png {Package manager showing download progress}
We create the \c WidgetDelegate class, which inherits from
QStyledItemDelegate. We do the drawing in the paint() function:
\snippet widgetdelegate.cpp 0
Notice that we use a QStyleOptionProgressBar and initialize its
members. We can then use the current QStyle to draw it.
To provide custom editing, there are two approaches that can be
used. The first approach is to create an editor widget and display
it directly on top of the item. To do this you must reimplement
createEditor() to provide an editor widget, setEditorData() to populate
the editor with the data from the model, and setModelData() so that the
delegate can update the model with data from the editor.
The second approach is to handle user events directly by reimplementing
editorEvent().
\sa {model-view-programming}{Model/View Programming},
QStyledItemDelegate, QStyle
|
21861 |
- |
| qabstractitemdelegate.h |
|
3028 |
- |
| qabstractitemdelegate_p.h |
|
1231 |
- |
| qabstractitemview.cpp |
|
168523 |
- |
| qabstractitemview.h |
|
12520 |
- |
| qabstractitemview_p.h |
|
17431 |
- |
| qbsptree.cpp |
|
2985 |
- |
| qbsptree_p.h |
|
2400 |
- |
| qcolumnview.cpp |
!
\class QColumnView
\brief The QColumnView class provides a model/view implementation of a column view.
\ingroup model-view
\ingroup advanced
\inmodule QtWidgets
QColumnView displays a model in a number of QListViews, one for each
hierarchy in the tree. This is sometimes referred to as a cascading list.
The QColumnView class is one of the \l{Model/View Classes}
and is part of Qt's \l{Model/View Programming}{model/view framework}.
QColumnView implements the interfaces defined by the
QAbstractItemView class to allow it to display data provided by
models derived from the QAbstractItemModel class.
\image qcolumnview.png {Address information in a column view}
\sa {Model/View Programming}
|
35718 |
- |
| qcolumnview.h |
|
2796 |
- |
| qcolumnview_p.h |
!
This is a delegate that will paint the triangle
|
4925 |
- |
| qcolumnviewgrip.cpp |
\internal
\fn void QColumnViewGrip::gripMoved()
Signal that is emitted when the grip moves the parent widget.
|
3627 |
- |
| qcolumnviewgrip_p.h |
|
1624 |
- |
| qdatawidgetmapper.cpp |
|
23422 |
- |
| qdatawidgetmapper.h |
|
2250 |
- |
| qfileiconprovider.cpp |
!
\class QFileIconProvider
\inmodule QtWidgets
\brief The QFileIconProvider class provides file icons for the QFileSystemModel class.
|
5545 |
- |
| qfileiconprovider.h |
|
810 |
- |
| qfileiconprovider_p.h |
|
1498 |
- |
| qheaderview.cpp |
|
148156 |
- |
| qheaderview.h |
|
8730 |
- |
| qheaderview_p.h |
|
14927 |
- |
| qitemdelegate.cpp |
|
43173 |
- |
| qitemdelegate.h |
|
3736 |
- |
| qitemeditorfactory.cpp |
!
\class QItemEditorFactory
\brief The QItemEditorFactory class provides widgets for editing item data
in views and delegates.
\ingroup model-view
\inmodule QtWidgets
When editing data in an item view, editors are created and
displayed by a delegate. QStyledItemDelegate, which is the delegate by
default installed on Qt's item views, uses a QItemEditorFactory to
create editors for it. A default unique instance provided by
QItemEditorFactory is used by all item delegates. If you set a
new default factory with setDefaultFactory(), the new factory will
be used by existing and new delegates.
A factory keeps a collection of QItemEditorCreatorBase
instances, which are specialized editors that produce editors
for one particular QVariant data type (All Qt models store
their data in \l{QVariant}s).
\section1 Standard Editing Widgets
The standard factory implementation provides editors for a variety of data
types. These are created whenever a delegate needs to provide an editor for
data supplied by a model. The following table shows the relationship between
types and the standard editors provided.
\table
\header \li Type \li Editor Widget
\row \li bool \li QComboBox
\row \li double \li QDoubleSpinBox
\row \li int \li{1,2} QSpinBox
\row \li unsigned int
\row \li QDate \li QDateEdit
\row \li QDateTime \li QDateTimeEdit
\row \li QPixmap \li QLabel
\row \li QString \li QLineEdit
\row \li QTime \li QTimeEdit
\endtable
Additional editors can be registered with the registerEditor() function.
\sa QStyledItemDelegate, {Model/View Programming}
|
18310 |
- |
| qitemeditorfactory.h |
|
2221 |
- |
| qitemeditorfactory_p.h |
|
1546 |
- |
| qlistview.cpp |
!
\class QListView
\brief The QListView class provides a list or icon view onto a model.
\ingroup model-view
\ingroup advanced
\inmodule QtWidgets
\image fusion-listview.png {List of weather icons}
A QListView presents items stored in a model, either as a simple
non-hierarchical list, or as a collection of icons. This class is used
to provide lists and icon views that were previously provided by the
\c QListBox and \c QIconView classes, but using the more flexible
approach provided by Qt's model/view architecture.
The QListView class is one of the \l{Model/View Classes}
and is part of Qt's \l{Model/View Programming}{model/view framework}.
This view does not display horizontal or vertical headers; to display
a list of items with a horizontal header, use QTreeView instead.
QListView implements the interfaces defined by the
QAbstractItemView class to allow it to display data provided by
models derived from the QAbstractItemModel class.
Items in a list view can be displayed using one of two view modes:
In \l ListMode, the items are displayed in the form of a simple list;
in \l IconMode, the list view takes the form of an \e{icon view} in
which the items are displayed with icons like files in a file manager.
By default, the list view is in \l ListMode. To change the view mode,
use the setViewMode() function, and to determine the current view mode,
use viewMode().
Items in these views are laid out in the direction specified by the
flow() of the list view. The items may be fixed in place, or allowed
to move, depending on the view's movement() state.
If the items in the model cannot be completely laid out in the
direction of flow, they can be wrapped at the boundary of the view
widget; this depends on isWrapping(). This property is useful when the
items are being represented by an icon view.
The resizeMode() and layoutMode() govern how and when the items are
laid out. Items are spaced according to their spacing(), and can exist
within a notional grid of size specified by gridSize(). The items can
be rendered as large or small icons depending on their iconSize().
\section1 Improving Performance
It is possible to give the view hints about the data it is handling in order
to improve its performance when displaying large numbers of items. One approach
that can be taken for views that are intended to display items with equal sizes
is to set the \l uniformItemSizes property to true.
\sa {View Classes}, QTreeView, QTableView, QListWidget
|
123014 |
- |
| qlistview.h |
|
5694 |
- |
| qlistview_p.h |
|
18747 |
- |
| qlistwidget.cpp |
|
54456 |
- |
| qlistwidget.h |
|
10170 |
- |
| qlistwidget_p.h |
|
5257 |
- |
| qstyleditemdelegate.cpp |
|
21181 |
- |
| qstyleditemdelegate.h |
|
2319 |
- |
| qtableview.cpp |
\internal
Add a span to the collection. the collection takes the ownership.
|
126046 |
- |
| qtableview.h |
|
5079 |
- |
| qtableview_p.h |
\internal
This is a list of span with a binary index to look up quickly a span at a certain index.
The index is a map of map.
spans are mentaly divided into sub spans so that the start of any subspans doesn't overlap
with any other subspans. There is no real representation of the subspans.
The key of the first map is the row where the subspan starts, the value of the first map is
a list (map) of all subspans that starts at the same row. It is indexed with its row
|
8803 |
- |
| qtablewidget.cpp |
|
78251 |
- |
| qtablewidget.h |
|
12066 |
- |
| qtablewidget_p.h |
|
7131 |
- |
| qtreeview.cpp |
|
143194 |
- |
| qtreeview.h |
|
7447 |
- |
| qtreeview_p.h |
|
10260 |
- |
| qtreewidget.cpp |
\class QTreeModel
\brief The QTreeModel class manages the items stored in a tree view.
\ingroup model-view
\inmodule QtWidgets
|
98960 |
- |
| qtreewidget.h |
|
13895 |
- |
| qtreewidget_p.h |
|
8193 |
- |
| qtreewidgetitemiterator.cpp |
!
\class QTreeWidgetItemIterator
\ingroup model-view
\inmodule QtWidgets
\brief The QTreeWidgetItemIterator class provides a way to iterate over the
items in a QTreeWidget instance.
The iterator will walk the items in a pre-order traversal order, thus visiting the
parent node \e before it continues to the child nodes.
For example, the following code examples each item in a tree, checking the
text in the first column against a user-specified search string:
\snippet qtreewidgetitemiterator-using/mainwindow.cpp 0
It is also possible to filter out certain types of node by passing certain
\l{IteratorFlag}{flags} to the constructor of QTreeWidgetItemIterator.
\sa QTreeWidget, {Model/View Programming}, QTreeWidgetItem
|
13823 |
- |
| qtreewidgetitemiterator.h |
|
3267 |
- |
| qtreewidgetitemiterator_p.h |
|
2044 |
- |
| qwidgetitemdata_p.h |
|
1371 |
- |