20 #include <QMessageBox> 23 : QDialog( parent, fl )
27 connect( mDetailPushButton, &QPushButton::clicked,
this, &QgsErrorDialog::mDetailPushButton_clicked );
28 connect( mDetailCheckBox, &QCheckBox::stateChanged,
this, &QgsErrorDialog::mDetailCheckBox_stateChanged );
30 if ( title.isEmpty() )
31 setWindowTitle( tr(
"Error" ) );
33 setWindowTitle( title );
36 QMessageBox messageBox( QMessageBox::Critical, QString(), QString() );
37 mIconLabel->setPixmap( messageBox.iconPixmap() );
38 mSummaryTextBrowser->setOpenExternalLinks(
true );
39 mDetailTextBrowser->setOpenExternalLinks(
true );
40 mDetailTextBrowser->hide();
42 QPalette p = palette();
43 p.setColor( QPalette::Base, Qt::transparent );
44 mSummaryTextBrowser->setPalette( p );
46 mDetailCheckBox->hide();
48 mSummaryTextBrowser->setText( mError.
summary() );
51 resize( width(), 150 );
54 Qt::CheckState state = ( Qt::CheckState ) settings.
value( QStringLiteral(
"Error/dialog/detail" ), 0 ).toInt();
55 mDetailCheckBox->setCheckState( state );
56 if ( state == Qt::Checked )
57 mDetailPushButton_clicked();
66 void QgsErrorDialog::mDetailPushButton_clicked()
68 mSummaryTextBrowser->hide();
69 mDetailTextBrowser->show();
70 mDetailCheckBox->show();
71 mDetailPushButton->hide();
72 resize( width(), 400 );
75 void QgsErrorDialog::mDetailCheckBox_stateChanged(
int state )
78 settings.
setValue( QStringLiteral(
"Error/dialog/detail" ), state );
This class is a composition of two QSettings instances:
QString message(QgsErrorMessage::Format format=QgsErrorMessage::Html) const
Full error messages description.
static void show(const QgsError &error, const QString &title, QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
Show dialog with error.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
QgsErrorDialog(const QgsError &error, const QString &title, QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
Constructor for QgsErrorDialog.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
QgsError is container for error messages (report).
QString summary() const
Short error description, usually the first error in chain, the real error.