Console line with simple auto completion

This commit is contained in:
2025-08-17 17:39:01 +02:00
parent 32f91d7b2f
commit 1b9f218acb
5 changed files with 238 additions and 42 deletions
+20
View File
@@ -3,6 +3,9 @@
#include <QDialog>
#include <QFileSystemWatcher>
#include <QStringListModel>
#include <QCompleter>
#include <QLineEdit>
#include "scriptengine.h"
namespace Ui { class BatchProcessing; }
@@ -16,8 +19,12 @@ class BatchProcessing : public QDialog
QString _scriptBasePath;
QFileSystemWatcher _fileWatcher;
Script::ScriptEngineThread *_engineThread = nullptr;
Script::ScriptEngine *_engine = nullptr;
QColor _textColor;
Database *_database;
QStringListModel *_completerModel = nullptr;
QCompleter *_completer = nullptr;
QList<QPair<QString, QString>> _paths;
private slots:
void scanScriptDir();
public:
@@ -25,6 +32,7 @@ public:
~BatchProcessing();
protected:
void closeEvent(QCloseEvent *event);
void refreshPaths();
public slots:
void addFiles();
void addDir();
@@ -47,6 +55,18 @@ public slots:
void plot(const QVariant &graph);
};
class ConsoleLine : public QLineEdit
{
Q_OBJECT
public:
explicit ConsoleLine(QWidget *parent = nullptr);
void addLine();
void keyReleaseEvent(QKeyEvent *event) override;
private:
int _currentLine = 0;
QStringList _history;
};
void openDir(const QString &path);
#endif // BATCHPROCESSING_H