16 #include <QApplication>
18 #include <QMessageBox>
19 #include <QPushButton>
22 #include <QVBoxLayout>
26 const QSize default_dialog_size(512, 300);
30 const QString& details)
32 , m_topLabel(new QLabel)
33 , m_textEdit(new QTextEdit)
35 setWindowTitle(title);
39 m_textEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
40 setWindowFlags(Qt::Dialog);
42 resize(default_dialog_size);
43 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
45 QColor bgColor(240, 240, 240, 255);
47 palette.setColor(QPalette::Window, bgColor);
48 setAutoFillBackground(
true);
51 auto* topLayout =
new QHBoxLayout;
54 topLayout->addStretch(1);
56 auto* mainLayout =
new QVBoxLayout;
57 mainLayout->addLayout(topLayout);
61 setLayout(mainLayout);
63 setSizeGripEnabled(
true);
80 auto* result =
new QVBoxLayout;
82 QIcon icon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning);
84 auto* label =
new QLabel;
85 label->setPixmap(icon.pixmap(128));
87 result->addWidget(label);
88 result->setContentsMargins(5, 5, 5, 5);
99 auto* result =
new QVBoxLayout;
101 result->setContentsMargins(5, 5, 5, 5);
109 auto* result =
new QHBoxLayout;
111 auto* okButton =
new QPushButton(
"Ok");
112 connect(okButton, &QPushButton::clicked,
this, &DetailedMessageBox::reject);
114 result->addStretch(1);
115 result->addWidget(okButton);
Defines class DetailedMessageBox.
void setText(const QString &text)
void setDetailedText(const QString &text)
DetailedMessageBox(QWidget *parent, const QString &title, const QString &text, const QString &details)
QBoxLayout * createButtonLayout()
Creates button layout with buttons.
QBoxLayout * createInfoLayout()
Creates right layout with text and QComboBox selection.
QBoxLayout * createLogoLayout()
Returns layout with icon for left part of the widget.