QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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
QgsMeshDatasetListModel::data
QVariant data(const QModelIndex &index, int role) const override
Definition: qgsmeshstaticdatasetwidget.cpp:137
QgsMeshDatasetListModel::rowCount
int rowCount(const QModelIndex &parent) const override
Definition: qgsmeshstaticdatasetwidget.cpp:127
QgsMeshDatasetListModel::setMeshLayer
void setMeshLayer(QgsMeshLayer *layer)
Sets the layer.
Definition: qgsmeshstaticdatasetwidget.cpp:113
QgsMeshLayer
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Definition: qgsmeshlayer.h:98
QgsMeshDataProvider
Base class for providing data for QgsMeshLayer.
Definition: qgsmeshdataprovider.h:436
QgsMeshDatasetListModel
List model for dataset contained in dataset group, used to display by time dataset in widget.
Definition: qgsmeshstaticdatasetwidget.h:36
SIP_NO_FILE
#define SIP_NO_FILE
Definition: fromencodedcomponenthelper.h:18
qgsmeshdataset.h
QgsMeshDatasetListModel::QgsMeshDatasetListModel
QgsMeshDatasetListModel(QObject *parent)
Constructor.
Definition: qgsmeshstaticdatasetwidget.cpp:110
QgsMeshDatasetListModel::setDatasetGroup
void setDatasetGroup(int group)
Sets the dataset group.
Definition: qgsmeshstaticdatasetwidget.cpp:120