Messagelib

optionseteditor.cpp
1/******************************************************************************
2 *
3 * SPDX-FileCopyrightText: 2008 Szymon Tomasz Stefanek <pragma@kvirc.net>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 *
7 *******************************************************************************/
8
9#include "utils/optionseteditor.h"
10#include "core/optionset.h"
11
12#include <QGridLayout>
13#include <QLabel>
14
15#include <KLocalizedString>
16#include <KTextEdit>
17#include <QLineEdit>
18
19using namespace MessageList::Utils;
20using namespace MessageList::Core;
21
22OptionSetEditor::OptionSetEditor(QWidget *parent)
23 : QTabWidget(parent)
24{
25 // General tab
26 auto tab = new QWidget(this);
27 addTab(tab, i18nc("@title:tab General options of a view mode", "General"));
28
29 auto tabg = new QGridLayout(tab);
30
31 auto l = new QLabel(i18nc("@label:textbox Name of the option", "Name:"), tab);
32 tabg->addWidget(l, 0, 0);
33
34 mNameEdit = new QLineEdit(tab);
35
36 tabg->addWidget(mNameEdit, 0, 1);
37
39
40 l = new QLabel(i18nc("@label:textbox Description of the option", "Description:"), tab);
41 tabg->addWidget(l, 1, 0);
42
43 mDescriptionEdit = new KTextEdit(tab);
44 mDescriptionEdit->setAcceptRichText(false);
45 tabg->addWidget(mDescriptionEdit, 1, 1, 2, 1);
46
47 tabg->setColumnStretch(1, 1);
48 tabg->setRowStretch(2, 1);
49}
50
51OptionSetEditor::~OptionSetEditor() = default;
52
53void OptionSetEditor::setReadOnly(bool readOnly)
54{
55 mDescriptionEdit->setReadOnly(readOnly);
56 mNameEdit->setReadOnly(readOnly);
57}
58
60{
61 return mDescriptionEdit;
62}
63
65{
66 return mNameEdit;
67}
68
69#include "moc_optionseteditor.cpp"
virtual void setReadOnly(bool readOnly)
QLineEdit * nameEdit() const
Returns the editor for the name of the OptionSet.
virtual void slotNameEditTextEdited(const QString &newName)=0
Handles editing of the name field.
KTextEdit * descriptionEdit() const
Returns the editor for the description of the OptionSet.
QString i18nc(const char *context, const char *text, const TYPE &arg...)
The implementation independent part of the MessageList library.
Definition aggregation.h:22
void setReadOnly(bool)
void textEdited(const QString &text)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:12:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.