File: qgsmessagebar.sip.in

package info (click to toggle)
qgis 3.40.10%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,183,672 kB
  • sloc: cpp: 1,595,771; python: 372,544; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 161
file content (259 lines) | stat: -rw-r--r-- 8,952 bytes parent folder | download | duplicates (12)
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
252
253
254
255
256
257
258
259
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/gui/qgsmessagebar.h                                              *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/






class QgsMessageBar : QFrame
{
%Docstring(signature="appended")
A bar for displaying non-blocking messages to the user.

:py:class:`QgsMessageBar` is a reusable widget which allows for
providing feedback to users in a non-intrusive way. Messages are shown
in a horizontal bar widget, which is styled automatically to reflect the
severity ("message level") of the displayed message (e.g. warning
messages are styled in an orange color scheme, critical errors are shown
in red, etc).

The message bar supports automatic stacking of multiple messages, so
that only the most recent message is shown to users. Users can then
manually dismiss individual messages to remove them from the stack,
causing the next-most-recent message to be shown. If no messages are
available to show then the message bar automatically hides.

The class also supports pushing custom widgets to the notification stack
via the :py:func:`~pushWidget` method.
%End

%TypeHeaderCode
#include "qgsmessagebar.h"
%End
  public:
    QgsMessageBar( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsMessageBar
%End

    void pushItem( QgsMessageBarItem *item /Transfer/ );
%Docstring
Display a message ``item`` on the bar, after hiding the currently
visible one and putting it in a stack.

The message bar will take ownership of ``item``.
%End

    QgsMessageBarItem *pushWidget( QWidget *widget /Transfer/, Qgis::MessageLevel level = Qgis::MessageLevel::Info, int duration = 0 );
%Docstring
Display a ``widget`` as a message on the bar, after hiding the currently
visible one and putting it in a stack.

:param widget: message widget to display
:param level: is :py:class:`Qgis`.MessageLevel.Info, Warning, Critical
              or Success
:param duration: timeout duration of message in seconds, 0 value
                 indicates no timeout (i.e. the message must be manually
                 cleared by the user).
%End

    bool popWidget( QgsMessageBarItem *item );
%Docstring
Remove the specified ``item`` from the bar, and display the next most
recent one in the stack. If no messages remain in the stack, then the
bar will be hidden.

:param item: previously added item to remove.

:return: ``True`` if ``item`` was removed, ``False`` otherwise
%End

    static QgsMessageBarItem *createMessage( const QString &text, QWidget *parent = 0 ) /Factory/;
%Docstring
Creates message bar item widget containing a message ``text`` to be
displayed on the bar.

The caller takes ownership of the returned item.

.. note::

   This is a low-level API call. Users are recommended to use the high-level :py:func:`~QgsMessageBar.pushMessage` API call
   instead.
%End

    static QgsMessageBarItem *createMessage( const QString &title, const QString &text, QWidget *parent = 0 ) /Factory/;
%Docstring
Creates message bar item widget containing a ``title`` and message
``text`` to be displayed on the bar.

The caller takes ownership of the returned item.

.. note::

   This is a low-level API call. Users are recommended to use the high-level :py:func:`~QgsMessageBar.pushMessage` API call
   instead.
%End

    static QgsMessageBarItem *createMessage( QWidget *widget, QWidget *parent = 0 ) /Factory/;
%Docstring
Creates message bar item widget containing a custom ``widget`` to be
displayed on the bar.

The caller takes ownership of the returned item.

.. note::

   This is a low-level API call. Users are recommended to use the high-level :py:func:`~QgsMessageBar.pushWidget` API call
   instead.
%End

    void pushMessage( const QString &text, Qgis::MessageLevel level = Qgis::MessageLevel::Info, int duration = -1 );
%Docstring
A convenience method for pushing a message with the specified ``text``
to the bar.

The ``level`` argument specifies the desired message level (severity) of
the message, which controls how the message bar is styled.

The optional ``duration`` argument can be used to specify the message
timeout in seconds. If ``duration`` is set to 0, then the message must
be manually dismissed by the user. Since QGIS 3.18, a duration of -1
indicates that the default timeout for the message ``level`` should be
used.
%End

    void pushMessage( const QString &title, const QString &text, Qgis::MessageLevel level = Qgis::MessageLevel::Info, int duration = -1 );
%Docstring
A convenience method for pushing a message with the specified ``title``
and ``text`` to the bar.

The ``level`` argument specifies the desired message level (severity) of
the message, which controls how the message bar is styled.

The optional ``duration`` argument can be used to specify the message
timeout in seconds. If ``duration`` is set to 0, then the message must
be manually dismissed by the user. Since QGIS 3.18, a duration of -1
indicates that the default timeout for the message ``level`` should be
used.
%End

    void pushMessage( const QString &title, const QString &text, const QString &showMore, Qgis::MessageLevel level = Qgis::MessageLevel::Info, int duration = -1 );
%Docstring
A convenience method for pushing a message with the specified ``title``
and ``text`` to the bar. Additional message content specified via
``showMore`` will be shown when the user presses a "more" button.

The ``level`` argument specifies the desired message level (severity) of
the message, which controls how the message bar is styled.

The optional ``duration`` argument can be used to specify the message
timeout in seconds. If ``duration`` is set to 0, then the message must
be manually dismissed by the user. Since QGIS 3.18, a duration of -1
indicates that the default timeout for the message ``level`` should be
used.
%End

    QgsMessageBarItem *currentItem();
%Docstring
Returns the current visible item, or ``None`` if no item is shown.
%End

    QList<QgsMessageBarItem *> items();
%Docstring
Returns a list of all items currently visible or queued for the bar.

.. versionadded:: 3.14
%End

    static int defaultMessageTimeout( Qgis::MessageLevel level = Qgis::MessageLevel::NoLevel );
%Docstring
Returns the default timeout in seconds for timed messages of the
specified ``level``.

.. versionadded:: 3.18
%End

  signals:

    void widgetAdded( QgsMessageBarItem *item );
%Docstring
Emitted whenever an ``item`` is added to the bar.
%End

    void widgetRemoved( QgsMessageBarItem *item );
%Docstring
Emitted whenever an ``item`` was removed from the bar.
%End

  public slots:

    bool popWidget();
%Docstring
Remove the currently displayed item from the bar and display the next
item in the stack. If no remaining items are present, the bar will be
hidden.

:return: ``True`` if the widget was removed, ``False`` otherwise
%End

    bool clearWidgets();
%Docstring
Removes all items from the bar.

:return: ``True`` if all items were removed, ``False`` otherwise
%End

    void pushSuccess( const QString &title, const QString &message );
%Docstring
Pushes a success ``message`` with default timeout to the message bar.

:param title: title string for message
:param message: The message to be displayed
%End

    void pushInfo( const QString &title, const QString &message );
%Docstring
Pushes a information ``message`` with default timeout to the message
bar.

:param title: title string for message
:param message: The message to be displayed
%End

    void pushWarning( const QString &title, const QString &message );
%Docstring
Pushes a warning ``message`` that must be manually dismissed by the
user. Before QGIS 3.18 the default timeout was used.

:param title: title string for message
:param message: The message to be displayed
%End

    void pushCritical( const QString &title, const QString &message );
%Docstring
Pushes a critical warning ``message`` that must be manually dismissed by
the user. Before QGIS 3.18 the default timeout was used.

:param title: title string for message
:param message: The message to be displayed
%End

  protected:
    virtual void mousePressEvent( QMouseEvent *e );


};

/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/gui/qgsmessagebar.h                                              *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/