|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.core.QAbstractItemModel
com.trolltech.qt.gui.QTreeModel
public abstract class QTreeModel
The QTreeModel
class provides a convenience base class for hierarchical item models in the Qt Itemview Framework. QTreeModel
extends the more generic QAbstractItemModel
class with an API that is both simpler and more suitable for Java. The API differs from the rest of the Qt Itemviews API in that it is primarily using node objects directly rather than QModelIndex objects. Note, for example, that the related selection and filter models use QModelIndex objects. QTreeModel
provides the indexToValue()
function to translate the model indexes into node objects. QTreeModel
also encapsulates and hides the parent()
concept of QAbstractItemModel
.
When deriving from the QTreeModel
class, make sure that the pure virtual childCount()
, child()
and text()
functions are implemented.
Using the standard QTreeView
class to view the content's of the model, the text is rendered using QTreeView
's fonts. This behavior can be altered by reimplementing QTreeModel
's data()
function, providing access to all the various item roles (i.e., background color, font, size hint, etc.). Reimplement the icon()
function to get graphical nodes. It is also possible to implement a custom QItemDelegate
class for the view and reimplement the QItemDelegate
.paint()
function.
Internally, the QTreeModel
class caches the datastructures of nodes that have been expanded. Call the releaseChildren()
function to release parts of this memory pool when they are no longer needed, for example when the view collapses a subtree:
view.collapsed.connect(model, "releaseChildren(QModelIndex)");Note that if the model is shared between multiple views, calling the model's
releaseChildren()
function affects all.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Field Summary |
---|
Fields inherited from class com.trolltech.qt.core.QAbstractItemModel |
---|
dataChanged, headerDataChanged, layoutAboutToBeChanged, layoutChanged |
Method Summary | |
---|---|
abstract java.lang.Object |
child(java.lang.Object parent,
int index)
Returns the child specified by index, of the given node. |
abstract int |
childCount(java.lang.Object parent)
Returns the given node's number of children, or 0 if the node is a leaf node. |
void |
childrenInserted(QModelIndex parent,
int first,
int last)
Inserts last - first + 1 nodes into the given parent, before the node specified by first. |
void |
childrenRemoved(QModelIndex parent,
int first,
int last)
Removes the nodes from first to last from the given parent, including the node specified by last. |
java.lang.Object |
data(java.lang.Object value,
int role)
Using the standard QTreeView class to view the content's of the model, the text is rendered using QTreeView 's fonts. |
static QTreeModel |
fromNativePointer(QNativePointer nativePointer)
|
QIcon |
icon(java.lang.Object value)
Reimplement this function to get graphical nodes. |
java.lang.Object |
indexToValue(QModelIndex index)
Translates the given index to a value node and returns the node. |
void |
releaseChildren(QModelIndex index)
Releases datastructures that are no longer needed, from the memory pool. |
abstract java.lang.String |
text(java.lang.Object value)
Returns a string representation of the given value. |
QModelIndex |
valueToIndex(java.lang.Object object)
Returns the model index for object. |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Method Detail |
---|
public final void childrenInserted(QModelIndex parent, int first, int last)
beginInsertRows()
.
public final void childrenRemoved(QModelIndex parent, int first, int last)
beginDeleteRows()
.
public final java.lang.Object indexToValue(QModelIndex index)
public final void releaseChildren(QModelIndex index)
Internally, the QTreeModel
class caches the datastructures of nodes that have been expanded. Call the releaseChildren()
function to release parts of this memory pool when they are no longer needed, for example when the view collapses a subtree.
Note that if the model is shared between multiple views, calling the model's releaseChildren()
function affects all.
public final QModelIndex valueToIndex(java.lang.Object object)
public abstract java.lang.Object child(java.lang.Object parent, int index)
public abstract int childCount(java.lang.Object parent)
public java.lang.Object data(java.lang.Object value, int role)
QTreeView
class to view the content's of the model, the text is rendered using QTreeView
's fonts. Reimplement this function to alter the view's rendering behavior. The default implementation is calling text()
and icon()
function for the given value and role.
public QIcon icon(java.lang.Object value)
public abstract java.lang.String text(java.lang.Object value)
public static QTreeModel fromNativePointer(QNativePointer nativePointer)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |