QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
codeeditors
qgscodeeditorwidget.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgscodeeditorwidget.h
3
--------------------------------------
4
Date : May 2024
5
Copyright : (C) 2024 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 QGSCODEEDITORWIDGET_H
17
#define QGSCODEEDITORWIDGET_H
18
19
#include "qgis_gui.h"
20
#include "
qgis_sip.h
"
21
#include "
qgspanelwidget.h
"
22
23
#include <QDateTime>
24
25
class
QgsCodeEditor
;
26
class
QgsFilterLineEdit
;
27
class
QToolButton;
28
class
QCheckBox;
29
class
QgsMessageBar
;
30
class
QgsScrollBarHighlightController
;
31
32
SIP_IF_MODULE
( HAVE_QSCI_SIP )
33
34
48
class GUI_EXPORT
QgsCodeEditorWidget
: public
QgsPanelWidget
49
{
50
Q_OBJECT
51
52
public
:
61
QgsCodeEditorWidget
(
QgsCodeEditor
*
editor
SIP_TRANSFER
,
QgsMessageBar
*
messageBar
=
nullptr
, QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
);
62
~QgsCodeEditorWidget
()
override
;
63
64
void
resizeEvent
( QResizeEvent *event )
override
;
65
void
showEvent
( QShowEvent *event )
override
;
66
bool
eventFilter
( QObject *obj, QEvent *event )
override
;
67
71
QgsCodeEditor
*
editor
() {
return
mEditor; }
72
76
bool
isSearchBarVisible()
const
;
77
81
QgsMessageBar
*messageBar();
82
87
QgsScrollBarHighlightController
*scrollbarHighlightController();
88
97
void
addWarning(
int
lineNumber,
const
QString &warning );
98
107
void
clearWarnings();
108
115
QString
filePath
()
const
{
return
mFilePath; }
116
123
bool
save(
const
QString &path = QString() );
124
125
public
slots:
126
133
void
showSearchBar();
134
141
void
hideSearchBar();
142
150
void
setSearchBarVisible(
bool
visible );
151
157
void
setReplaceBarVisible(
bool
visible );
158
165
void
triggerFind();
166
175
bool
loadFile(
const
QString &path );
176
184
void
setFilePath(
const
QString &path );
185
199
bool
openInExternalEditor(
int
line = -1,
int
column = -1 );
200
208
bool
shareOnGist(
bool
isPublic );
209
210
signals:
211
215
void
searchBarToggled
(
bool
visible );
216
223
void
filePathChanged
(
const
QString &path );
224
229
void
loadedExternalChanges
();
230
231
private
slots:
232
233
bool
findNext();
234
void
findPrevious();
235
void
textSearchChanged(
const
QString &text );
236
void
updateSearch();
237
void
replace();
238
void
replaceSelection();
239
void
replaceAll();
240
241
private
:
242
void
clearSearchHighlights();
243
void
addSearchHighlights();
244
int
searchFlags()
const
;
245
bool
findText(
bool
forward,
bool
findFirst );
246
void
updateHighlightController();
247
void
searchMatchCountChanged(
int
matchCount );
248
249
enum
HighlightCategory
250
{
251
SearchMatch = 0,
252
Warning = 1
253
};
254
255
QgsCodeEditor
*mEditor =
nullptr
;
256
QWidget *mFindWidget =
nullptr
;
257
QgsFilterLineEdit
*mLineEditFind =
nullptr
;
258
QgsFilterLineEdit
*mLineEditReplace =
nullptr
;
259
QToolButton *mFindPrevButton =
nullptr
;
260
QToolButton *mFindNextButton =
nullptr
;
261
QToolButton *mCaseSensitiveButton =
nullptr
;
262
QToolButton *mWholeWordButton =
nullptr
;
263
QToolButton *mRegexButton =
nullptr
;
264
QToolButton *mWrapAroundButton =
nullptr
;
265
QToolButton *mShowReplaceBarButton =
nullptr
;
266
QToolButton *mReplaceButton =
nullptr
;
267
QToolButton *mReplaceAllButton =
nullptr
;
268
int
mBlockSearching = 0;
269
QgsMessageBar
*mMessageBar =
nullptr
;
270
std::unique_ptr<QgsScrollBarHighlightController> mHighlightController;
271
QString mFilePath;
272
QDateTime mLastModified;
273
};
274
275
#endif
// QGSCODEEDITORWIDGET_H
QgsCodeEditorWidget::showEvent
void showEvent(QShowEvent *event) override
Definition
qgscodeeditorwidget.cpp:250
QgsCodeEditorWidget::loadedExternalChanges
void loadedExternalChanges()
Emitted when the widget loads in text from the associated file to bring in changes made externally to...
QgsCodeEditorWidget::messageBar
QgsMessageBar * messageBar()
Returns the message bar associated with the widget, to use for user feedback.
Definition
qgscodeeditorwidget.cpp:319
QgsCodeEditorWidget::searchBarToggled
void searchBarToggled(bool visible)
Emitted when the visibility of the search bar is changed.
QgsCodeEditorWidget::filePathChanged
void filePathChanged(const QString &path)
Emitted when the widget's associated file path is changed.
QgsCodeEditorWidget::editor
QgsCodeEditor * editor()
Returns the wrapped code editor.
Definition
qgscodeeditorwidget.h:71
QgsCodeEditorWidget::filePath
QString filePath() const
Returns the widget's associated file path.
Definition
qgscodeeditorwidget.h:115
QgsCodeEditorWidget::QgsCodeEditorWidget
QgsCodeEditorWidget(QgsCodeEditor *editor, QgsMessageBar *messageBar=nullptr, QWidget *parent=nullptr)
Constructor for QgsCodeEditorWidget, wrapping the specified editor widget.
Definition
qgscodeeditorwidget.cpp:48
QgsCodeEditorWidget::eventFilter
bool eventFilter(QObject *obj, QEvent *event) override
Definition
qgscodeeditorwidget.cpp:256
QgsCodeEditorWidget::resizeEvent
void resizeEvent(QResizeEvent *event) override
Definition
qgscodeeditorwidget.cpp:244
QgsCodeEditorWidget::~QgsCodeEditorWidget
~QgsCodeEditorWidget() override
QgsCodeEditor
A text editor based on QScintilla2.
Definition
qgscodeeditor.h:103
QgsFilterLineEdit
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
Definition
qgsfilterlineedit.h:41
QgsMessageBar
A bar for displaying non-blocking messages to the user.
Definition
qgsmessagebar.h:61
QgsPanelWidget::QgsPanelWidget
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.
Definition
qgspanelwidget.cpp:30
QgsScrollBarHighlightController
Adds highlights (colored markers) to a scrollbar.
Definition
qgsdecoratedscrollbar.h:80
qgis_sip.h
SIP_IF_MODULE
#define SIP_IF_MODULE(condition)
Definition
qgis_sip.h:27
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:35
qgspanelwidget.h
Generated on
for QGIS API Documentation by
1.17.0