KTextAddons

textautogeneratenotworkingwidget.cpp
1/*
2 SPDX-FileCopyrightText: 2025 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "textautogeneratenotworkingwidget.h"
8#include "widgets/textautogeneratedialog.h"
9#include <KLocalizedString>
10#include <KMessageWidget>
11#include <QPushButton>
12#include <QVBoxLayout>
13
14using namespace TextAutogenerateText;
15using namespace Qt::Literals::StringLiterals;
16TextAutogenerateNotWorkingWidget::TextAutogenerateNotWorkingWidget(QWidget *parent)
17 : QWidget{parent}
18 , mMessageWidget(new KMessageWidget(this))
19{
20 auto mainLayout = new QVBoxLayout(this);
21 mainLayout->setObjectName("mainLayout"_L1);
22 mainLayout->setContentsMargins({});
23
24 mMessageWidget->setObjectName("mMessageWidget"_L1);
25 mainLayout->addWidget(mMessageWidget);
26 mMessageWidget->setCloseButtonVisible(false);
27
28 auto configureButton = new QPushButton(i18n("Configure…"), this);
29 configureButton->setObjectName("configureButton"_L1);
30 connect(configureButton, &QPushButton::clicked, this, &TextAutogenerateNotWorkingWidget::slotConfigure);
31 mainLayout->addWidget(configureButton, 0, Qt::AlignVCenter);
32}
33
34TextAutogenerateNotWorkingWidget::~TextAutogenerateNotWorkingWidget() = default;
35
36void TextAutogenerateNotWorkingWidget::setMessageError(const QString &str)
37{
38 mMessageWidget->setText(str);
39 mMessageWidget->animatedShow();
40}
41
42void TextAutogenerateNotWorkingWidget::clearMessage()
43{
44 mMessageWidget->setText({});
45 mMessageWidget->animatedHide();
46}
47
48void TextAutogenerateNotWorkingWidget::slotConfigure()
49{
50 TextAutogenerateText::TextAutogenerateDialog d(this);
51 d.exec();
52}
53
54#include "moc_textautogeneratenotworkingwidget.cpp"
QString i18n(const char *text, const TYPE &arg...)
void clicked(bool checked)
AlignVCenter
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 18 2025 12:00:52 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.