17 #ifndef QGSTASKMANAGERWIDGET_H
18 #define QGSTASKMANAGERWIDGET_H
23 #include <QStyledItemDelegate>
24 #include <QToolButton>
31 class QgsTaskManagerModel;
57 void modelRowsInserted(
const QModelIndex &index,
int start,
int end );
58 void clicked(
const QModelIndex &index );
63 QTreeView *mTreeView =
nullptr;
64 QgsTaskManagerModel *mModel =
nullptr;
89 QgsTaskManagerFloatingWidget(
QgsTaskManager *manager, QWidget *parent =
nullptr );
101 class GUI_EXPORT QgsTaskManagerStatusBarWidget :
public QToolButton
112 QgsTaskManagerStatusBarWidget(
QgsTaskManager *manager, QWidget *parent =
nullptr );
114 QSize sizeHint()
const override;
118 void changeEvent( QEvent *event )
override;
122 void toggleDisplay();
123 void overallProgressChanged(
double progress );
124 void countActiveTasksChanged(
int count );
130 QgsTaskManagerFloatingWidget *mFloatingWidget =
nullptr;
131 QProgressBar *mProgressBar =
nullptr;
142 class GUI_EXPORT QgsTaskManagerModel:
public QAbstractItemModel
160 explicit QgsTaskManagerModel(
QgsTaskManager *manager, QObject *parent =
nullptr );
163 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
164 QModelIndex parent(
const QModelIndex &index )
const override;
165 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
166 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
167 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
168 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
169 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
175 QgsTask *indexToTask(
const QModelIndex &index )
const;
180 StatusRole = Qt::UserRole,
185 void taskAdded(
long id );
186 void taskDeleted(
long id );
187 void progressChanged(
long id,
double progress );
188 void statusChanged(
long id,
int status );
201 QList< long > mRowToTaskIdList;
204 int idToRow(
long id )
const;
205 QModelIndex idToIndex(
long id,
int column )
const;
206 static QString createTooltip(
QgsTask *task, ToolTipType type );
208 friend class QgsTaskManagerStatusBarWidget;
217 class GUI_EXPORT QgsTaskStatusWidget :
public QWidget
230 QSize sizeHint()
const override;
239 void setStatus(
int status );
246 void cancelClicked();
250 void paintEvent( QPaintEvent *e )
override;
251 void mousePressEvent( QMouseEvent *e )
override;
252 void mouseMoveEvent( QMouseEvent *e )
override;
253 void leaveEvent( QEvent *e )
override;
259 bool mInside =
false;
Task manager for managing a set of long-running QgsTask tasks.
Abstract base class for long running background tasks.
TaskStatus
Status of tasks.
@ Queued
Task is queued and has not begun.