File indexing completed on 2024-03-24 03:44:49

0001 /*
0002     KmPlot - a math. function plotter for the KDE-Desktop
0003 
0004     SPDX-FileCopyrightText: 2006 David Saxton <david@bluehaze.org>
0005 
0006     This file is part of the KDE Project.
0007     KmPlot is part of the KDE-EDU Project.
0008 
0009     SPDX-License-Identifier: GPL-2.0-or-later
0010 
0011 */
0012 
0013 #include "equationeditor.h"
0014 
0015 #include "equationeditorwidget.h"
0016 #include "equationeditwidget.h"
0017 #include <QDialogButtonBox>
0018 
0019 EquationEditor::EquationEditor(QWidget *parent)
0020     : QDialog(parent)
0021 {
0022     m_widget = new EquationEditorWidget(this);
0023     m_widget->edit->showEditButton(false);
0024     m_widget->edit->m_equationEditWidget->setClearSelectionOnFocusOut(false);
0025     m_widget->layout()->setContentsMargins(0, 0, 0, 0);
0026 
0027     setWindowTitle(i18nc("@title:window", "Equation Editor"));
0028     QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
0029     connect(buttonBox, &QDialogButtonBox::rejected, this, &EquationEditor::reject);
0030     QVBoxLayout *dialogLayout = new QVBoxLayout(this);
0031     dialogLayout->addWidget(m_widget);
0032     dialogLayout->addWidget(buttonBox);
0033 
0034     connect(m_widget->edit, &EquationEdit::returnPressed, this, &EquationEditor::accept);
0035 }
0036 
0037 QString EquationEditor::text() const
0038 {
0039     return m_widget->edit->text();
0040 }
0041 
0042 EquationEdit *EquationEditor::edit() const
0043 {
0044     return m_widget->edit;
0045 }
0046 
0047 #include "moc_equationeditor.cpp"