QGIS API Documentation  3.2.0-Bonn (bc43194)
qgsmessageviewer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmessageviewer.h - description
3  -------------------
4  begin : Wed Jun 4 2003
5  copyright : (C) 2002 by Gary E.Sherman
6  email : sherman at mrcc.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 #ifndef QGSMESSAGEVIEWER_H
18 #define QGSMESSAGEVIEWER_H
19 
20 #include "ui_qgsmessageviewer.h"
21 #include "qgsguiutils.h"
22 #include "qgsmessageoutput.h"
23 #include "qgis_gui.h"
24 
25 #include <QString>
26 
27 
32 class GUI_EXPORT QgsMessageViewer: public QDialog, public QgsMessageOutput, private Ui::QgsMessageViewer
33 {
34  Q_OBJECT
35  public:
36  QgsMessageViewer( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, bool deleteOnClose = true );
37  ~QgsMessageViewer() override;
38 
39  void setMessage( const QString &message, MessageType msgType ) override;
40 
41  void appendMessage( const QString &message ) override;
42 
43  void showMessage( bool blocking = true ) override;
44 
45  void setTitle( const QString &title ) override;
46 
47  // Call one of the setMessage...() functions first.
48  // Subsequent calls to appendMessage use the format as determined
49  // by the call to setMessage...()
50 
51  // Treats the given text as html.
52  void setMessageAsHtml( const QString &msg );
53  // Treats the given text as plain text
54  void setMessageAsPlainText( const QString &msg );
55  // A checkbox that can be used for something like
56  // "don't show this message again"
57  void setCheckBoxText( const QString &text );
58  // Make the checkbox visible/invisible
59  void setCheckBoxVisible( bool visible );
60  // Sets the check state
61  void setCheckBoxState( Qt::CheckState state );
62  // Get checkbox state
63  Qt::CheckState checkBoxState();
64  // Specifies a QgsSettings tag to store/retrieve the checkbox
65  // state to/from. Use an empty QString to disable this feature.
66  void setCheckBoxQgsSettingsLabel( const QString &label );
67 
68  private slots:
69  void checkBox_toggled( bool );
70 
71 
72  private:
73  QString mCheckBoxQgsSettingsLabel;
74 };
75 
76 #endif
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
MessageType
message can be in plain text or in html format
virtual void setTitle(const QString &title)=0
Sets title for the messages.
virtual void appendMessage(const QString &message)=0
message to be appended to the current text
virtual void setMessage(const QString &message, MessageType msgType)=0
Sets message, it won&#39;t be displayed until.
virtual void showMessage(bool blocking=true)=0
display the message to the user and deletes itself
A generic message view for displaying QGIS messages.
Interface for showing messages from QGIS in GUI independent way.