QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
qgscodeeditorhistorydialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscodeeditorhistorydialog.h
3 ----------------------
4 begin : October 2022
5 copyright : (C) 2022 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 QGSCODEEDITORHISTORYDIALOG_H
17#define QGSCODEEDITORHISTORYDIALOG_H
18
19#include "ui_qgscodeditorhistorydialogbase.h"
20#include <QDialog>
21#include <QPointer>
22#include <QStringListModel>
23#include "qgis_gui.h"
24#include "qgis_sip.h"
25
26#define SIP_NO_FILE
27
28class QgsCodeEditor;
29
30
32
33class CodeHistoryModel : public QStringListModel
34{
35 Q_OBJECT
36
37 public:
38 CodeHistoryModel( QObject *parent );
39 QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
40
41 private:
42
43 QFont mFont;
44};
45
47
48
56class GUI_EXPORT QgsCodeEditorHistoryDialog : public QDialog, private Ui::QgsCodeEditorHistoryDialogBase
57{
58 Q_OBJECT
59
60 public:
61
67 QgsCodeEditorHistoryDialog( QgsCodeEditor *editor, QWidget *parent SIP_TRANSFERTHIS = nullptr );
68
69 private slots:
70
71 void executeSelectedHistory();
72 void runCommand( const QModelIndex &index );
73 void saveHistory();
74 void reloadHistory();
75 void deleteItem();
76
77 private:
78
79 QPointer< QgsCodeEditor > mEditor;
80 CodeHistoryModel *mModel = nullptr;
81
82};
83
84#endif // QGSCODEEDITORHISTORYDIALOG_H
A dialog for displaying and managing command history for a QgsCodeEditor widget.
A text editor based on QScintilla2.
Definition: qgscodeeditor.h:93
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53