22 : QDialog( parent, fl )
25 connect( checkBox, &QCheckBox::toggled,
this, &QgsMessageViewer::checkBox_toggled );
28 setAttribute( Qt::WA_DeleteOnClose );
35 restoreGeometry( settings.
value( QStringLiteral(
"Windows/MessageViewer/geometry" ) ).toByteArray() );
46 txtMessage->setHtml( msg );
51 txtMessage->setPlainText( msg );
56 txtMessage->append( msg );
72 QApplication::setOverrideCursor( Qt::ArrowCursor );
74 QApplication::restoreOverrideCursor();
84 setWindowTitle( title );
89 checkBox->setText( text );
94 checkBox->setVisible( visible );
99 checkBox->setCheckState( state );
104 return checkBox->checkState();
109 mCheckBoxQgsSettingsLabel = label;
113 void QgsMessageViewer::checkBox_toggled(
bool toggled )
116 if ( !mCheckBoxQgsSettingsLabel.isEmpty() )
119 if ( checkBox->checkState() == Qt::Checked )
120 settings.
setValue( mCheckBoxQgsSettingsLabel,
false );
122 settings.
setValue( mCheckBoxQgsSettingsLabel,
true );
~QgsMessageViewer() override
MessageType
message can be in plain text or in html format
This class is a composition of two QSettings instances:
Qt::CheckState checkBoxState()
void setTitle(const QString &title) override
set title for the messages
void saveGeometry(QWidget *widget, const QString &keyName)
Save the wigget geometry into settings.
void setMessageAsHtml(const QString &msg)
bool restoreGeometry(QWidget *widget, const QString &keyName)
Restore the wigget geometry from settings.
void setValue(const QString &key, const QVariant &value, const QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
void setCheckBoxState(Qt::CheckState state)
void setMessageAsPlainText(const QString &msg)
void appendMessage(const QString &message) override
message to be appended to the current text
void showMessage(bool blocking=true) override
display the message to the user and deletes itself
void setMessage(const QString &message, MessageType msgType) override
set message, it won't be displayed until
void setCheckBoxText(const QString &text)
void setCheckBoxQgsSettingsLabel(const QString &label)
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), const Section section=NoSection) const
Returns the value for setting key.
QgsMessageViewer(QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags, bool deleteOnClose=true)
void setCheckBoxVisible(bool visible)