18 #ifndef QGSPALETTEDRENDERERWIDGET_H
19 #define QGSPALETTEDRENDERERWIDGET_H
27 #include "ui_qgspalettedrendererwidgetbase.h"
39 class QgsPalettedRendererClassGatherer:
public QThread
46 , mBandNumber( bandNumber )
48 , mClasses( existingClasses )
49 , mWasCanceled( false )
58 mFeedbackMutex.lock();
61 mFeedbackMutex.unlock();
67 bool wasCanceled()
const {
return mWasCanceled; }
76 void collectedClasses();
82 void progressChanged(
double progress );
88 std::unique_ptr< QgsColorRamp > mRamp;
92 QMutex mFeedbackMutex;
96 class QgsPalettedRendererModel :
public QAbstractItemModel
109 QgsPalettedRendererModel( QObject *parent =
nullptr );
115 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
116 QModelIndex parent(
const QModelIndex &index )
const override;
117 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
118 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
119 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
120 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
121 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
122 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
123 bool removeRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
124 bool insertRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
125 Qt::DropActions supportedDropActions()
const override;
126 QStringList mimeTypes()
const override;
127 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
128 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
130 QModelIndex addEntry(
const QColor &color );
138 void classesChanged();
169 QMenu *mContextMenu =
nullptr;
170 QMenu *mAdvancedMenu =
nullptr;
171 QAction *mLoadFromLayerAction =
nullptr;
172 QgsPalettedRendererModel *mModel =
nullptr;
176 QgsPalettedRendererClassGatherer *mGatherer =
nullptr;
180 void setSelectionColor(
const QItemSelection &selection,
const QColor &color );
187 void changeOpacity();
189 void applyColorRamp();
190 void loadColorTable();
191 void saveColorTable();
193 void loadFromLayer();
194 void bandChanged(
int band );
196 void gatheredClasses();
197 void gathererThreadFinished();
202 #endif // QGSPALETTEDRENDERERWIDGET_H