23 #ifndef SUIT_TREEMODEL_H
24 #define SUIT_TREEMODEL_H
30 #include <QAbstractItemModel>
31 #include <QSortFilterProxyModel>
32 #include <QModelIndex>
33 #include <QItemDelegate>
38 #pragma warning( disable:4251 )
60 operator const QObject*()
const;
64 virtual SUIT_DataObject* object(
const QModelIndex& = QModelIndex() )
const = 0;
66 virtual bool autoDeleteTree()
const = 0;
67 virtual void setAutoDeleteTree(
const bool ) = 0;
68 virtual bool autoUpdate()
const = 0;
69 virtual void setAutoUpdate(
const bool ) = 0;
70 virtual bool updateModified()
const = 0;
71 virtual void setUpdateModified(
const bool ) = 0;
72 virtual QAbstractItemDelegate* delegate()
const = 0;
73 virtual bool customSorting(
const int )
const = 0;
74 virtual bool lessThan(
const QModelIndex& left,
const QModelIndex& right )
const = 0;
77 virtual void updateTree(
const QModelIndex& ) = 0;
80 virtual void registerColumn(
const int group_id,
const QString& name,
const int custom_id ) = 0;
81 virtual void unregisterColumn(
const int group_id,
const QString& name ) = 0;
82 virtual void setColumnIcon(
const QString& name,
const QPixmap& icon ) = 0;
83 virtual QPixmap columnIcon(
const QString& name )
const = 0;
84 virtual void setAppropriate(
const QString& name,
const Qtx::Appropriate appr ) = 0;
86 virtual void setVisibilityState(
const QString&
id,
Qtx::VisibilityState state,
bool emitChanged =
true) = 0;
111 DisplayRole = Qt::DisplayRole,
112 DecorationRole = Qt::DecorationRole,
113 EditRole = Qt::EditRole,
114 ToolTipRole = Qt::ToolTipRole,
115 StatusTipRole = Qt::StatusTipRole,
116 WhatsThisRole = Qt::WhatsThisRole,
117 FontRole = Qt::FontRole,
118 TextAlignmentRole = Qt::TextAlignmentRole,
119 BackgroundRole = Qt::BackgroundRole,
120 ForegroundRole = Qt::ForegroundRole,
121 CheckStateRole = Qt::CheckStateRole,
122 SizeHintRole = Qt::SizeHintRole,
123 BaseColorRole = Qt::UserRole,
137 virtual QVariant data(
const QModelIndex&,
int = DisplayRole )
const;
138 virtual bool setData(
const QModelIndex&,
const QVariant&,
int = EditRole );
139 virtual Qt::ItemFlags flags(
const QModelIndex& )
const;
140 virtual QVariant headerData(
int,
Qt::Orientation,
int = Qt::DisplayRole )
const;
142 virtual Qt::DropActions supportedDropActions()
const;
144 virtual QModelIndex
index(
int,
int,
const QModelIndex& = QModelIndex() )
const;
145 virtual QModelIndex parent(
const QModelIndex& )
const;
147 virtual int columnCount(
const QModelIndex& = QModelIndex() )
const;
148 virtual int rowCount(
const QModelIndex& = QModelIndex() )
const;
149 virtual void registerColumn(
const int group_id,
const QString& name,
const int custom_id );
151 virtual void setColumnIcon(
const QString& name,
const QPixmap& icon );
152 virtual QPixmap
columnIcon(
const QString& name )
const;
176 virtual bool lessThan(
const QModelIndex& left,
const QModelIndex& right )
const;
179 QAbstractItemDelegate*
delegate()
const;
184 virtual QStringList mimeTypes()
const;
185 virtual QMimeData* mimeData (
const QModelIndexList& indexes)
const;
186 virtual bool dropMimeData (
const QMimeData *data, Qt::DropAction action,
187 int row,
int column,
const QModelIndex &parent);
190 virtual void updateTree(
const QModelIndex& );
203 TreeItem* treeItem(
const QModelIndex& )
const;
206 QString objectId(
const QModelIndex& = QModelIndex() )
const;
210 void updateItem(
TreeItem*,
bool emitLayoutChanged );
219 typedef QMap<SUIT_DataObject*, TreeItem*>
ItemMap;
269 bool isSortingEnabled()
const;
273 virtual bool lessThan(
const QModelIndex&,
const QModelIndex& )
const;
274 virtual void registerColumn(
const int group_id,
const QString& name,
const int custom_id );
276 virtual void setColumnIcon(
const QString& name,
const QPixmap& icon );
277 virtual QPixmap
columnIcon(
const QString& name )
const;
290 QAbstractItemDelegate*
delegate()
const;
293 virtual void updateTree(
const QModelIndex& );
295 void setSortingEnabled(
bool );
305 virtual bool filterAcceptsRow(
int,
const QModelIndex& )
const;
318 virtual void paint( QPainter*,
const QStyleOptionViewItem&,
319 const QModelIndex& )
const;
321 virtual QSize sizeHint (
const QStyleOptionViewItem & option,
const QModelIndex & index )
const;
325 #pragma warning( default:4251 )
328 #endif // SUIT_TREEMODEL_H