Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_warning_block.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023 L. E. Segovia <amy@amyspark.me>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#include "kis_warning_block.h"
8
9#include <QHBoxLayout>
10#include <QLabel>
11#include <qnamespace.h>
12
13struct Q_DECL_HIDDEN KisWarningBlock::Private {
14 QLabel *lblIcon = nullptr;
15 QLabel *lblText = nullptr;
16};
17
19 : QGroupBox(parent)
20 , m_d(new Private())
21{
22 QHBoxLayout *layout = new QHBoxLayout(this);
23
24 m_d->lblIcon = new QLabel(this);
25 m_d->lblText = new QLabel(this);
26
27 m_d->lblText->setTextFormat(Qt::RichText);
28 m_d->lblIcon->setAlignment(Qt::AlignLeft | Qt::AlignTop);
29 m_d->lblText->setWordWrap(true);
30 m_d->lblText->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByMouse);
31 m_d->lblText->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
32
33 layout->addWidget(m_d->lblIcon);
34 layout->addWidget(m_d->lblText);
35 layout->setAlignment(Qt::AlignVCenter | Qt::AlignJustify);
36
37 connect(m_d->lblText, &QLabel::linkActivated, this, &KisWarningBlock::linkActivated);
38}
39
40QString KisWarningBlock::text() const
41{
42 return m_d->lblText->text();
43}
44
46{
47 return m_d->lblIcon->pixmap(Qt::ReturnByValue);
48}
49
50void KisWarningBlock::setText(const QString &text)
51{
52 m_d->lblText->setText(text);
53}
54
55void KisWarningBlock::setPixmap(const QPixmap &icon)
56{
57 m_d->lblIcon->setPixmap(icon);
58}
59
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void setText(const QString &)
void linkActivated(const QString &link)
void setPixmap(const QPixmap &)
QScopedPointer< Private > m_d
~KisWarningBlock() override
KisWarningBlock(QWidget *parent=nullptr)