Baloo Widgets

keditcommentdialog.cpp
1 /* This file is part of the KDE libraries
2  Copyright (C) 2014 Felix Eisele
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 #include "keditcommentdialog.h"
19 
20 #include <QDialogButtonBox>
21 #include <QPushButton>
22 #include <QWidget>
23 #include <QLayout>
24 #include <QLabel>
25 #include <QTextEdit>
26 
27 #include <KLocalizedString>
28 
29 KEditCommentDialog::KEditCommentDialog(QWidget* parent, const QString& commentText, const QString& captionText)
30  : QDialog(parent)
31 {
32  setWindowTitle(captionText);
33 
35  setLayout(layout);
36 
37  m_editor = new QTextEdit(this);
38  m_editor->setText(commentText);
39 
40  layout->addWidget(m_editor);
41 
42  QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
43  layout->addWidget(buttonBox);
44 
45  buttonBox->addButton(i18n("Save"), QDialogButtonBox::AcceptRole);
47 
50 
51  resize(sizeHint());
52 }
53 
54 KEditCommentDialog::~KEditCommentDialog()
55 {
56 }
57 
58 QString KEditCommentDialog::getCommentText() const
59 {
60  return m_editor->toPlainText();
61 }
virtual QLayout * layout() override
virtual void reject()
void addButton(QAbstractButton *button, QDialogButtonBox::ButtonRole role)
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
virtual void accept()
QString i18n(const char *text, const TYPE &arg...)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 18 2021 23:07:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.