QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsvaliditycheckresultswidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvaliditycheckresultswidget.cpp
3 ----------------------------------
4 begin : November 2018
5 copyright : (C) 2018 by Nyall Dawson
6 email : nyall dot dawson 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
16#ifndef QGSVALIDITYCHECKRESULTSWIDGET_H
17#define QGSVALIDITYCHECKRESULTSWIDGET_H
18
19#include "ui_qgsvaliditycheckresultsbase.h"
20
21#include "qgis_gui.h"
22#include "qgis_sip.h"
24
25#include <QAbstractItemModel>
26#include <QWidget>
27
29
37class GUI_EXPORT QgsValidityCheckResultsModel : public QAbstractItemModel
38{
39 Q_OBJECT
40 public:
41 // *INDENT-OFF*
42
50 {
51 Description SIP_MONKEYPATCH_COMPAT_NAME( DescriptionRole ) = Qt::UserRole + 1,
52 };
53 Q_ENUM( CustomRole )
54 // *INDENT-ON*
55
56
59 QgsValidityCheckResultsModel( const QList<QgsValidityCheckResult> &results, QObject *parent SIP_TRANSFERTHIS = nullptr );
60
61 QModelIndex index( int row, int column, const QModelIndex &parent ) const override;
62 QModelIndex parent( const QModelIndex &child ) const override;
63 int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
64 int columnCount( const QModelIndex &parent ) const override;
65 QVariant data( const QModelIndex &index, int role ) const override;
66
67 private:
68 QList<QgsValidityCheckResult> mResults;
69};
70
78class GUI_EXPORT QgsValidityCheckResultsWidget : public QWidget, private Ui::QgsValidityCheckResultsBase
79{
80 Q_OBJECT
81
82 public:
83
88
93 void setDescription( const QString &description );
94
98 void setResults( const QList<QgsValidityCheckResult> &results );
99
120 static bool runChecks( int type, const QgsValidityCheckContext *context, const QString &title, const QString &description, QWidget *parent = nullptr );
121
122 private slots:
123
124 void selectionChanged( const QModelIndex &current, const QModelIndex &previous );
125
126 private:
127 QgsValidityCheckResultsModel *mResultsModel = nullptr;
128};
129
130#endif // QGSVALIDITYCHECKRESULTSWIDGET_H
Base class for validity check contexts.
A QAbstractItemModel subclass for displaying the results from a QgsAbstractValidityCheck.
QgsValidityCheckResultsModel(const QList< QgsValidityCheckResult > &results, QObject *parent=nullptr)
Constructor for QgsValidityCheckResultsModel, showing the specified list of checks results.
QgsValidityCheckResultsWidget(QWidget *parent)
Constructor for QgsValidityCheckResultsWidget, with the specified parent widget.
void setDescription(const QString &description)
Sets a description label to show at the top of the widget, e.g.
static bool runChecks(int type, const QgsValidityCheckContext *context, const QString &title, const QString &description, QWidget *parent=nullptr)
Runs all registered validity checks of the given type, and if any warnings or critical errors are enc...
void setResults(const QList< QgsValidityCheckResult > &results)
Sets the list of check results to show in the dialog.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:268
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Definition qgis_sip.h:270