QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgslocaleawarenumericlineeditdelegate.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslocaleawarenumericlineeditdelegate.h - QgsLocaleAwareNumericLineEditDelegate
3 
4  ---------------------
5  begin : 5.11.2020
6  copyright : (C) 2020 by Alessandro Pasotti
7  email : elpaso at itopen dot it
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 #ifndef QGSLOCALEAWARENUMERICLINEEDITDELEGATE_H
17 #define QGSLOCALEAWARENUMERICLINEEDITDELEGATE_H
18 
19 #include <QStyledItemDelegate>
20 
21 #include "qgis.h"
22 
23 #define SIP_NO_FILE
24 
26 
36 class QgsLocaleAwareNumericLineEditDelegate: public QStyledItemDelegate
37 {
38 
39  Q_OBJECT
40 
41  public:
42 
48  QgsLocaleAwareNumericLineEditDelegate( Qgis::DataType dataType, QWidget *parent = nullptr );
49 
50  QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
51 
52  // QAbstractItemDelegate interface
53  public:
54  void setEditorData( QWidget *editor, const QModelIndex &index ) const override;
55  void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
56  QString displayText( const QVariant &value, const QLocale &locale ) const override;
57 
61  void setDataType( const Qgis::DataType &dataType );
62 
63  private:
64 
65  Qgis::DataType mDataType;
66 
67 };
68 
70 
71 #endif // QGSLOCALEAWARENUMERICLINEEDITDELEGATE_H
DataType
Raster data types.
Definition: qgis.h:119