QGIS API Documentation 3.99.0-Master (26c88405ac0)
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_core.h"
21#include "qgis_sip.h"
22
23#include <QObject>
24#include <QString>
25
27typedef QgsMessageOutput *( *MESSAGE_OUTPUT_CREATOR )() SIP_SKIP;
28
29
43class CORE_EXPORT QgsMessageOutput
44{
45 public:
46
49
50 virtual ~QgsMessageOutput() = default;
51
53 virtual void setMessage( const QString &message, MessageType msgType ) = 0;
54
56 virtual void appendMessage( const QString &message ) = 0;
57
59 virtual void setTitle( const QString &title ) = 0;
60
62 virtual void showMessage( bool blocking = true ) = 0;
63
67 static void showMessage( const QString &title, const QString &message, MessageType msgType );
68
69 // TODO: implementation where Python class could be passed
70
76
82
83 private:
84
86 static MESSAGE_OUTPUT_CREATOR mMessageOutputCreator;
87};
88
89
97class CORE_EXPORT QgsMessageOutputConsole : public QObject, public QgsMessageOutput
98{
99 Q_OBJECT
100
101 public:
102
104
105 void setMessage( const QString &message, MessageType msgType ) override;
106
107 void appendMessage( const QString &message ) override;
108
109 void setTitle( const QString &title ) override;
110
112 void showMessage( bool blocking = true ) override;
113
114 signals:
115
117 void destroyed();
118
119 private:
120
122 QString mMessage;
123
125 QString mTitle;
126
127 MessageType mMsgType = MessageText;
128};
129
130#endif
void setMessage(const QString &message, MessageType msgType) override
Sets message, it won't be displayed until.
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 showMessage(bool blocking=true) override
sends the message to the standard output
Interface for showing messages from QGIS in GUI independent way.
MessageType
message can be in plain text or in html format
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, MessageType msgType)=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:134
QgsMessageOutput *(* MESSAGE_OUTPUT_CREATOR)()