QGIS API Documentation 3.99.0-Master (c22de0620c0)
Loading...
Searching...
No Matches
qgsmessageoutput.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmessageoutput.h - interface for showing messages
3 ----------------------
4 begin : April 2006
5 copyright : (C) 2006 by Martin Dobias
6 email : wonder.sk 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
17#ifndef QGSMESSAGEOUTPUT_H
18#define QGSMESSAGEOUTPUT_H
19
20#include "qgis.h"
21#include "qgis_core.h"
22#include "qgis_sip.h"
23
24#include <QObject>
25#include <QString>
26
28typedef QgsMessageOutput *( *MESSAGE_OUTPUT_CREATOR )() SIP_SKIP;
29
30
44class CORE_EXPORT QgsMessageOutput
45{
46 public:
47
48 virtual ~QgsMessageOutput() = default;
49
51 virtual void setMessage( const QString &message, Qgis::StringFormat format ) = 0;
52
54 virtual void appendMessage( const QString &message ) = 0;
55
57 virtual void setTitle( const QString &title ) = 0;
58
60 virtual void showMessage( bool blocking = true ) = 0;
61
65 static void showMessage( const QString &title, const QString &message, Qgis::StringFormat format );
66
67 // TODO: implementation where Python class could be passed
68
74
80
81 private:
82
84 static MESSAGE_OUTPUT_CREATOR mMessageOutputCreator;
85};
86
87
95class CORE_EXPORT QgsMessageOutputConsole : public QObject, public QgsMessageOutput
96{
97 Q_OBJECT
98
99 public:
100
102
103 void setMessage( const QString &message, Qgis::StringFormat format ) override;
104
105 void appendMessage( const QString &message ) override;
106
107 void setTitle( const QString &title ) override;
108
110 void showMessage( bool blocking = true ) override;
111
112 signals:
113
115 void destroyed();
116
117 private:
118
120 QString mMessage;
121
123 QString mTitle;
124
126};
127
128#endif
StringFormat
Format of log message.
Definition qgis.h:173
@ PlainText
Text message.
Definition qgis.h:174
void setTitle(const QString &title) override
Sets title for the messages.
void destroyed()
signals that object will be destroyed and shouldn't be used anymore
QgsMessageOutputConsole()=default
void appendMessage(const QString &message) override
message to be appended to the current text
void setMessage(const QString &message, Qgis::StringFormat format) override
Sets message, it won't be displayed until.
void showMessage(bool blocking=true) override
sends the message to the standard output
Interface for showing messages from QGIS in GUI independent way.
virtual void showMessage(bool blocking=true)=0
display the message to the user and deletes itself
virtual void appendMessage(const QString &message)=0
message to be appended to the current text
static QgsMessageOutput * createMessageOutput()
function that returns new class derived from QgsMessageOutput (don't forget to delete it then if show...
static void setMessageOutputCreator(MESSAGE_OUTPUT_CREATOR f)
sets function that will be used to create message output
virtual ~QgsMessageOutput()=default
virtual void setMessage(const QString &message, Qgis::StringFormat format)=0
Sets message, it won't be displayed until.
virtual void setTitle(const QString &title)=0
Sets title for the messages.
#define SIP_SKIP
Definition qgis_sip.h:133
QgsMessageOutput *(* MESSAGE_OUTPUT_CREATOR)()