QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
16 #ifndef QGSMESHDATASETGROUPTREE_H
17 #define QGSMESHDATASETGROUPTREE_H
26 #include <QItemSelection>
27 #include <QStandardItemModel>
28 #include <QStyledItemDelegate>
30 #include <QSortFilterProxyModel>
47 QMenu *
createSaveMenu(
int groupIndex, QMenu *parentMenu =
nullptr );
57 void saveDatasetGroup(
int datasetGroup,
const QString &driver,
const QString &fileSuffix );
81 QVariant
data(
const QModelIndex &
index,
int role )
const override;
82 Qt::ItemFlags
flags(
const QModelIndex &
index )
const override;
83 QVariant
headerData(
int section, Qt::Orientation orientation,
84 int role = Qt::DisplayRole )
const override;
85 QModelIndex
index(
int row,
int column,
86 const QModelIndex &
parent = QModelIndex() )
const override;
87 QModelIndex
parent(
const QModelIndex &
index )
const override;
88 int rowCount(
const QModelIndex &
parent = QModelIndex() )
const override;
119 std::unique_ptr<QgsMeshDatasetGroupTreeItem> mRootItem;
132 QVariant
data(
const QModelIndex &
index,
int role )
const override;
133 bool setData(
const QModelIndex &
index,
const QVariant &value,
int role )
override;
134 Qt::ItemFlags
flags(
const QModelIndex &
index )
const override;
135 QVariant
headerData(
int section, Qt::Orientation orientation,
int role )
const override;
139 QString textDisplayed(
const QModelIndex &
index )
const;
140 QColor backGroundColor(
const QModelIndex &
index )
const;
152 Qt::ItemFlags
flags(
const QModelIndex &index )
const override;
153 QVariant
data(
const QModelIndex &index,
int role )
const override;
171 bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent )
const override;
174 int mActiveScalarGroupIndex = -1;
175 int mActiveVectorGroupIndex = -1;
190 void paint( QPainter *painter,
191 const QStyleOptionViewItem &option,
192 const QModelIndex &index )
const override;
195 QRect
iconRect(
const QRect &rect,
bool isVector )
const;
197 QSize
sizeHint(
const QStyleOptionViewItem &option,
198 const QModelIndex &index )
const override;
200 const QPixmap mScalarSelectedPixmap;
201 const QPixmap mScalarDeselectedPixmap;
202 const QPixmap mVectorSelectedPixmap;
203 const QPixmap mVectorDeselectedPixmap;
205 QRect
iconRect(
const QRect &rect,
int pos )
const;
229 void selectAllGroups();
230 void deselectAllGroups();
233 void contextMenuEvent( QContextMenuEvent *event )
override;
236 void removeCurrentItem();
237 void onDatasetGroupSaved(
const QString &uri );
243 void selectAllItem(
bool isChecked );
244 QMenu *createContextMenu();
266 int activeScalarGroup()
const;
269 int activeVectorGroup()
const;
274 void mousePressEvent( QMouseEvent *event )
override;
278 void setActiveScalarGroup(
int group );
281 void setActiveVectorGroup(
int group );
285 void activeScalarGroupChanged(
int groupIndex );
288 void activeVectorGroupChanged(
int groupIndex );
291 void setActiveGroup();
310 int rowCount(
const QModelIndex &parent )
const override;
311 QVariant data(
const QModelIndex &index,
int role )
const override;
313 void setDisplayProviderName(
bool displayProviderName );
315 QStringList variableNames()
const;
319 bool mDisplayProviderName =
false;
322 #endif // QGSMESHDATASETGROUPTREE_H
QVariant data(const QModelIndex &index, int role) const override
int activeScalarGroup() const
Returns index of active group for contours.
void setActiveScalarGroup(int group)
Sets active group for contours.
QgsMeshDatasetGroupProxyModel(QAbstractItemModel *sourceModel)
QModelIndex parent(const QModelIndex &index) const override
Tree widget for display of the mesh dataset groups.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
QVariant data(const QModelIndex &index, int role) const override
QgsMeshAvailableDatasetGroupTreeModel(QObject *parent=nullptr)
Tree item for display of the mesh dataset groups. Dataset group is set of datasets with the same name...
bool isEnabled(const QModelIndex &index) const
Returns whether the dataset groups related to the QModelIndex is set as enabled.
void syncToLayer(QgsMeshLayer *layer)
Add groups to the model from mesh layer.
QgsMeshDatasetGroupTreeItemDelagate(QObject *parent=nullptr)
QVariant data(const QModelIndex &index, int role) const override
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
@ IsActiveVectorDatasetGroup
void syncToLayer(QgsMeshLayer *layer)
Synchronizes groups to the model from mesh layer.
void removeItem(const QModelIndex &index)
Removes an item from the tree.
Item Model for QgsMeshDatasetGroupTreeItem.
QgsMeshDatasetGroupTreeItem * datasetGroupTreeItem(int groupIndex)
Returns the dataset group tree item with index, keeps ownership.
void resetDefault(QgsMeshLayer *meshLayer)
Resets all groups with default state from the mesh layer.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
void setActiveVectorGroup(int group)
Sets active vector group.
QgsMeshDatasetGroupTreeItem * datasetGroupTreeRootItem()
Returns the dataset group root tree item, keeps ownership.
QgsMeshDatasetGroupTreeModel(QObject *parent=nullptr)
int activeVectorGroup() const
Returns index of active group for vectors.
@ IsActiveScalarDatasetGroup
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
void setAllGroupsAsEnabled(bool isEnabled)
Sets all groups as enabled.
QRect iconRect(const QRect &rect, bool isVector) const
Icon rectangle for given item rectangle.
bool setData(const QModelIndex &index, const QVariant &value, int role) override
Qt::ItemFlags flags(const QModelIndex &index) const override
Tree widget for display of the mesh dataset groups.
void setPersistentDatasetGroup(const QModelIndex &index, const QString &uri)
Sets the dataset group as persistent with specified uri and for specified index.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Delegate to display tree item with a contours and vector selector.
Qt::ItemFlags flags(const QModelIndex &index) const override