OTB  6.7.0
Orfeo Toolbox
otbWrapperQtWidgetListEditItemModel.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbListEditItemModel_h
22 #define otbListEditItemModel_h
23 
24 #include "otbMacro.h"
25 #include "OTBQtWidgetExport.h"
26 #include <QtCore>
27 
28 namespace otb
29 {
30 
31 namespace Wrapper
32 {
33 
34 // Internal classes forward declarations
35 class StringListInterface;
36 
44 class OTBQtWidget_EXPORT ListEditItemModel :
45  public QAbstractItemModel
46 {
47 
48  Q_OBJECT;
49 
50 // Public types
51 public:
52 
53  enum Columns
54  {
55  COLUMN_NONE = -1,
56  //
57  COLUMN_NAME = 0,
58  // COLUMN_BROWSE = 1,
59  //
61  };
62 
63  enum UserRole
64  {
65  USER_ROLE_NONE = Qt::UserRole,
68  };
69 
70 // Public methods
71 public:
72 
75  QObject * p = nullptr );
76 
78  ~ListEditItemModel() override;
79 
80  // QAbstractItemModel overloads.
81 
85  int columnCount( const QModelIndex & p = QModelIndex() ) const override;
86 
90  QVariant
91  data( const QModelIndex & index,
92  int role = Qt::DisplayRole ) const override;
93 
97  Qt::ItemFlags flags( const QModelIndex & index ) const override;
98 
102  bool hasChildren( const QModelIndex & p = QModelIndex() ) const override;
103 
107  QVariant headerData( int section,
108  Qt::Orientation orientation,
109  int role = Qt::DisplayRole ) const override;
110 
114  QModelIndex
115  index( int row,
116  int column,
117  const QModelIndex & p = QModelIndex() ) const override;
118 
122  bool
123  insertRow( int row, const QModelIndex & parent = QModelIndex() );
124 
128  bool
129  insertRows( int row,
130  int count,
131  const QModelIndex & p = QModelIndex() ) override;
132 
136  QModelIndex parent( const QModelIndex & index ) const override;
137 
141  bool
142  removeRows( int row,
143  int count,
144  const QModelIndex & p = QModelIndex() ) override;
145 
149  int rowCount( const QModelIndex & p = QModelIndex() ) const override;
150 
154  bool
155  setData( const QModelIndex & index,
156  const QVariant & value,
157  int role = Qt::EditRole ) override;
158 
159  virtual bool Swap( int, int );
160 
161  virtual bool IsInput() const;
162 
163  virtual QString GetFilter() const;
164 
165  virtual bool IsBrowsable() const;
166 
167 // Private attributes
168 private:
170 
171 };
172 
173 } // end namespace 'Wrapper'.
174 
175 } // end namespace 'otb'.
176 
177 #endif // otbListEditItemModel_h
This class represents a list of InputFilename parameter.