QGIS API Documentation  3.24.2-Tisler (13c1a02865)
qgsmeshstaticdatasetwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmeshstaticdatasetwidget.h
3  -------------------------------------
4  begin : March 2020
5  copyright : (C) 2020 by Vincent Cloarec
6  email : vcloarec at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSMESHSTATICDATASETWIDGET_H
16 #define QGSMESHSTATICDATASETWIDGET_H
17 
18 #include <QAbstractListModel>
19 
20 #include "qgis_gui.h"
21 #include "ui_qgsmeshstaticdatasetwidgetbase.h"
22 #include "qgsmeshdataset.h"
23 
25 
26 class QgsMeshLayer;
28 
36 class QgsMeshDatasetListModel: public QAbstractListModel
37 {
38  public:
40  QgsMeshDatasetListModel( QObject *parent );
41 
43  void setMeshLayer( QgsMeshLayer *layer );
45  void setDatasetGroup( int group );
46 
47  int rowCount( const QModelIndex &parent ) const override;
48  QVariant data( const QModelIndex &index, int role ) const override;
49 
50  private:
51  QgsMeshLayer *mLayer = nullptr;
52  int mDatasetGroup = -1;
53 };
54 
61 class GUI_EXPORT QgsMeshStaticDatasetWidget : public QWidget, private Ui::QgsMeshStaticDatasetWidget
62 {
63  Q_OBJECT
64  public:
66  QgsMeshStaticDatasetWidget( QWidget *parent = nullptr );
67 
69  void setLayer( QgsMeshLayer *layer );
70 
72  void syncToLayer();
73 
75  void apply();
76 
77  public slots:
79  void setScalarDatasetGroup( int index );
81  void setVectorDatasetGroup( int index );
82 
83  private:
84  void setScalarDatasetIndex( int index );
85  void setVectorDatasetIndex( int index );
86 
87  int mScalarDatasetGroup = -1;
88  int mVectorDatasetGroup = -1;
89 
90  QgsMeshDatasetListModel *mDatasetScalarModel = nullptr;
91  QgsMeshDatasetListModel *mDatasetVectorModel = nullptr;
92 
93  QgsMeshLayer *mLayer;
94 };
95 
96 #endif // QGSMESHSTATICDATASETWIDGET_H
Base class for providing data for QgsMeshLayer.
List model for dataset contained in dataset group, used to display by time dataset in widget.
void setDatasetGroup(int group)
Sets the dataset group.
void setMeshLayer(QgsMeshLayer *layer)
Sets the layer.
int rowCount(const QModelIndex &parent) const override
QVariant data(const QModelIndex &index, int role) const override
QgsMeshDatasetListModel(QObject *parent)
Constructor.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Definition: qgsmeshlayer.h:97
A widget for setup of the static dataset of a mesh layer.
#define SIP_NO_FILE