1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/codeeditors/qgscodeeditorwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsCodeEditorWidget : QgsPanelWidget
{
%Docstring(signature="appended")
A widget which wraps a :py:class:`QgsCodeEditor` in additional
functionality.
This widget wraps an existing :py:class:`QgsCodeEditor` object in a
widget which provides additional standard functionality, such as
search/replace tools. The caller must create an unparented
:py:class:`QgsCodeEditor` object (or a subclass of
:py:class:`QgsCodeEditor`) first, and then construct a
:py:class:`QgsCodeEditorWidget` passing this object to the constructor.
.. note::
may not be available in Python bindings, depending on platform support
.. versionadded:: 3.38
%End
%TypeHeaderCode
#include "qgscodeeditorwidget.h"
%End
public:
QgsCodeEditorWidget( QgsCodeEditor *editor /Transfer/, QgsMessageBar *messageBar = 0, QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsCodeEditorWidget, wrapping the specified ``editor``
widget.
Ownership of ``editor`` will be transferred to this widget.
If an explicit ``messageBar`` is specified then it will be used to
provide feedback, otherwise an integrated message bar will be used.
%End
~QgsCodeEditorWidget();
virtual void resizeEvent( QResizeEvent *event );
virtual void showEvent( QShowEvent *event );
virtual bool eventFilter( QObject *obj, QEvent *event );
QgsCodeEditor *editor();
%Docstring
Returns the wrapped code editor.
%End
bool isSearchBarVisible() const;
%Docstring
Returns ``True`` if the search bar is visible.
%End
QgsMessageBar *messageBar();
%Docstring
Returns the message bar associated with the widget, to use for user
feedback.
%End
QgsScrollBarHighlightController *scrollbarHighlightController();
%Docstring
Returns the scrollbar highlight controller, which can be used to add
highlights in the code editor scrollbar.
%End
void addWarning( int lineNumber, const QString &warning );
%Docstring
Adds a ``warning`` message and indicator to the specified a
``lineNumber``.
This method calls :py:func:`QgsCodeEditor.addWarning()`, but also
automatically adds highlights to the widget scrollbars locating the
warning location.
.. seealso:: :py:func:`clearWarnings`
%End
void clearWarnings();
%Docstring
Clears all warning messages from the editor.
This method calls :py:func:`QgsCodeEditor.clearWarnings()`, but also
removes highlights from the widget scrollbars at the warning locations.
.. seealso:: :py:func:`addWarning`
%End
QString filePath() const;
%Docstring
Returns the widget's associated file path.
.. seealso:: :py:func:`setFilePath`
.. seealso:: :py:func:`filePathChanged`
%End
bool save( const QString &path = QString() );
%Docstring
Saves the code editor content into the file ``path``.
:return: ``False`` if the file path has not previously been set, or if
writing the file fails.
.. note::
When the path is empty, the content will be saved to the current file path if not empty.
.. versionadded:: 3.38.2
%End
public slots:
void showSearchBar();
%Docstring
Shows the search bar.
.. seealso:: :py:func:`hideSearchBar`
.. seealso:: :py:func:`setSearchBarVisible`
%End
void hideSearchBar();
%Docstring
Hides the search bar.
.. seealso:: :py:func:`showSearchBar`
.. seealso:: :py:func:`setSearchBarVisible`
%End
void setSearchBarVisible( bool visible );
%Docstring
Sets whether the search bar is ``visible``.
.. seealso:: :py:func:`showSearchBar`
.. seealso:: :py:func:`hideSearchBar`
.. seealso:: :py:func:`setReplaceBarVisible`
%End
void setReplaceBarVisible( bool visible );
%Docstring
Sets whether the replace bar is ``visible``.
.. seealso:: :py:func:`setSearchBarVisible`
%End
void triggerFind();
%Docstring
Triggers a find operation, using the default behavior.
This will automatically open the search bar and start a find operation
using the default behavior, e.g. searching for any selected text in the
code editor.
%End
bool loadFile( const QString &path );
%Docstring
Loads the file at the specified ``path`` into the widget, replacing the
code editor's content with that from the file.
This automatically sets the widget's
:py:func:`~QgsCodeEditorWidget.filePath`
Returns ``True`` if the file was loaded successfully.
%End
void setFilePath( const QString &path );
%Docstring
Sets the widget's associated file ``path``.
.. seealso:: :py:func:`loadFile`
.. seealso:: :py:func:`filePathChanged`
.. seealso:: :py:func:`filePath`
%End
bool openInExternalEditor( int line = -1, int column = -1 );
%Docstring
Attempts to opens the script from the editor in an external text editor.
This requires that the widget has an associated
:py:func:`~QgsCodeEditorWidget.filePath` set.
Optionally a target ``line`` and ``column`` number can be specified to
open the editor at the corresponding location. (Not all external editors
support this.) Line/column numbers of -1 indicate that the current
cursor position should be used. A ``line`` number of 0 corresponds to
the first line, and a column number of 0 corresponds to the first
column.
:return: ``True`` if the file was opened successfully.
%End
bool shareOnGist( bool isPublic );
%Docstring
Shares the contents of the code editor on GitHub Gist.
Requires that the user has configured an API token with appropriate
permission in advance.
:return: ``False`` if the user has not configured a GitHub personal
access token.
%End
signals:
void searchBarToggled( bool visible );
%Docstring
Emitted when the visibility of the search bar is changed.
%End
void filePathChanged( const QString &path );
%Docstring
Emitted when the widget's associated file path is changed.
.. seealso:: :py:func:`setFilePath`
.. seealso:: :py:func:`filePath`
%End
void loadedExternalChanges();
%Docstring
Emitted when the widget loads in text from the associated file to bring
in changes made externally to the file.
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/codeeditors/qgscodeeditorwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|