Commit 4545306a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add icon for messagebox

parent 64375f19
Pipeline #74574 canceled with stage
......@@ -24,10 +24,18 @@ void ConfirmBeforeDeletingMessageBoxWidgetTest::shouldHaveDefaultValues()
QVERIFY(!mUseSameResultForOtherCheck->text().isEmpty());
QVERIFY(!mUseSameResultForOtherCheck->isChecked());
auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
auto mainLayout = w.findChild<QHBoxLayout *>(QStringLiteral("mainLayout"));
QVERIFY(mainLayout);
QCOMPARE(mainLayout->contentsMargins(), {});
auto textLayout = w.findChild<QVBoxLayout *>(QStringLiteral("textLayout"));
QVERIFY(textLayout);
QCOMPARE(textLayout->contentsMargins(), {});
auto iconLabel = w.findChild<QLabel *>(QStringLiteral("iconLabel"));
QVERIFY(iconLabel);
QVERIFY(iconLabel->text().isEmpty());
auto mLabelInfo = w.findChild<QLabel *>(QStringLiteral("mLabelInfo"));
QVERIFY(mLabelInfo);
QVERIFY(mLabelInfo->text().isEmpty());
......
......@@ -10,22 +10,40 @@
#include <QVBoxLayout>
#include <KLocalizedString>
#include <QStyle>
#include <QStyleOption>
ConfirmBeforeDeletingMessageBoxWidget::ConfirmBeforeDeletingMessageBoxWidget(QWidget *parent)
: QWidget(parent)
, mLabelInfo(new QLabel(this))
, mUseSameResultForOtherCheck(new QCheckBox(i18n("Reuse..."), this)) // TODO fix i18n
{
auto mainLayout = new QVBoxLayout(this);
auto mainLayout = new QHBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mainLayout->setContentsMargins({});
const QIcon tmpIcon = style()->standardIcon(QStyle::SP_MessageBoxQuestion, nullptr, this);
auto iconLabel = new QLabel(this);
iconLabel->setObjectName(QStringLiteral("iconLabel"));
if (!tmpIcon.isNull()) {
QStyleOption option;
option.initFrom(this);
iconLabel->setPixmap(tmpIcon.pixmap(style()->pixelMetric(QStyle::PM_MessageBoxIconSize, &option, this)));
}
mainLayout->addWidget(iconLabel);
auto textLayout = new QVBoxLayout;
textLayout->setObjectName(QStringLiteral("textLayout"));
textLayout->setContentsMargins({});
mainLayout->addLayout(textLayout);
mLabelInfo->setObjectName(QStringLiteral("mLabelInfo"));
mLabelInfo->setWordWrap(true);
mainLayout->addWidget(mLabelInfo);
textLayout->addWidget(mLabelInfo);
mUseSameResultForOtherCheck->setObjectName(QStringLiteral("mUseSameResultForOtherCheck"));
mainLayout->addWidget(mUseSameResultForOtherCheck);
textLayout->addWidget(mUseSameResultForOtherCheck);
mUseSameResultForOtherCheck->setChecked(false);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment