Messagelib

optionseteditor.cpp
1 /******************************************************************************
2  *
3  * SPDX-FileCopyrightText: 2008 Szymon Tomasz Stefanek <[email protected]>
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 <QLabel>
13 #include <QGridLayout>
14 
15 #include <QLineEdit>
16 #include <KLocalizedString>
17 #include <KTextEdit>
18 
19 using namespace MessageList::Utils;
20 using namespace MessageList::Core;
21 
22 OptionSetEditor::OptionSetEditor(QWidget *parent)
23  : QTabWidget(parent)
24 {
25  // General tab
26  QWidget *tab = new QWidget(this);
27  addTab(tab, i18nc("@title:tab General options of a view mode", "General"));
28 
29  QGridLayout *tabg = new QGridLayout(tab);
30 
31  QLabel *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 
38  connect(mNameEdit, &QLineEdit::textEdited, this, &OptionSetEditor::slotNameEditTextEdited);
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 
51 OptionSetEditor::~OptionSetEditor()
52 {
53 }
54 
55 void OptionSetEditor::setReadOnly(bool readOnly)
56 {
57  mDescriptionEdit->setReadOnly(readOnly);
58  mNameEdit->setReadOnly(readOnly);
59 }
60 
61 KTextEdit *OptionSetEditor::descriptionEdit() const
62 {
63  return mDescriptionEdit;
64 }
65 
66 QLineEdit *OptionSetEditor::nameEdit() const
67 {
68  return mNameEdit;
69 }
void addWidget(QWidget *widget, int row, int column, Qt::Alignment alignment)
The implementation independent part of the MessageList library.
Definition: aggregation.h:21
void setRowStretch(int row, int stretch)
QString i18nc(const char *context, const char *text, const TYPE &arg...)
void textEdited(const QString &text)
void setColumnStretch(int column, int stretch)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Oct 18 2020 23:18:49 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.