QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgsexpressionfinder.h
Go to the documentation of this file.
1/*********************************************************************************
2 qgsexpressionfinder.h - A helper class to locate expression in text editors
3 --------------------------------------
4 begin : September 2023
5 copyright : (C) 2023 by Yoann Quenach de Quivillic
6 email : yoann dot quenach 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 QGSEXPRESSIONFINDER_H
17#define QGSEXPRESSIONFINDER_H
18
19#include <QString>
20
21#include "qgis_sip.h"
22#include "qgis_gui.h"
23
24#define SIP_NO_FILE
25
26class QgsCodeEditor;
27class QTextEdit;
28class QPlainTextEdit;
29
36class GUI_EXPORT QgsExpressionFinder
37{
38 public:
39
54 static void findExpressionAtPos( const QString &text, int startSelectionPos, int endSelectionPos, int &start, int &end, QString &expression, const QString &pattern = QString() );
55
62 static QString findAndSelectActiveExpression( QgsCodeEditor *editor, const QString &pattern = QString() );
63
70 static QString findAndSelectActiveExpression( QTextEdit *editor, const QString &pattern = QString() );
71
78 static QString findAndSelectActiveExpression( QPlainTextEdit *editor, const QString &pattern = QString() );
79
80
81};
82
83#endif // QGSEXPRESSIONFINDER_H
A text editor based on QScintilla2.
Definition: qgscodeeditor.h:93
Helper methods to locate expressions within text editors.