QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 <qgisgui.h>
22 #include "qgsmessageoutput.h"
23 
24 #include <QString>
25 
26 
30 class GUI_EXPORT QgsMessageViewer: public QDialog, public QgsMessageOutput, private Ui::QgsMessageViewer
31 {
32  Q_OBJECT
33  public:
34  QgsMessageViewer( QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags, bool deleteOnClose = true );
36 
37  virtual void setMessage( const QString& message, MessageType msgType ) override;
38 
39  virtual void appendMessage( const QString& message ) override;
40 
41  virtual void showMessage( bool blocking = true ) override;
42 
43  virtual void setTitle( const QString& title ) override;
44 
45  // Call one of the setMessage...() functions first.
46  // Subsequent calls to appendMessage use the format as determined
47  // by the call to setMessage...()
48 
49  // Treats the given text as html.
50  void setMessageAsHtml( const QString& msg );
51  // Treats the given text as plain text
52  void setMessageAsPlainText( const QString& msg );
53  // A checkbox that can be used for something like
54  // "don't show this message again"
55  void setCheckBoxText( const QString& text );
56  // Make the check box visible/invisible
57  void setCheckBoxVisible( bool visible );
58  // Sets the check state
59  void setCheckBoxState( Qt::CheckState state );
60  // Get checkbox state
61  Qt::CheckState checkBoxState();
62  // Specifies a QSettings tag to store/retrieve the checkbox
63  // state to/from. Use an empty QString to disable this feature.
64  void setCheckBoxQSettingsLabel( const QString& label );
65 
66  private slots:
67  void on_checkBox_toggled( bool );
68 
69 
70  private:
71  QString mCheckBoxQSettingsLabel;
72 };
73 
74 #endif
static const Qt::WindowFlags ModalDialogFlags
Definition: qgisgui.h:50
MessageType
message can be in plain text or in html format
virtual void setTitle(const QString &title)=0
set 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
set 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.
typedef WindowFlags
Interface for showing messages from QGIS in GUI independent way.