• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

Analitza

  • sources
  • kde-4.14
  • kdeedu
  • analitza
  • analitzagui
expressionedit.h
Go to the documentation of this file.
1 /*************************************************************************************
2  * *
3  * This program is free software; you can redistribute it and/or *
4  * Copyright (C) 2007 by Aleix Pol <aleixpol@kde.org> *
5  * modify it under the terms of the GNU General Public License *
6  * as published by the Free Software Foundation; either version 2 *
7  * of the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the Free Software *
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
17  *************************************************************************************/
18 
19 #ifndef EXPRESSIONEDIT_H
20 #define EXPRESSIONEDIT_H
21 
22 #include <QPlainTextEdit>
23 #include <QCompleter>
24 #include <QLabel>
25 #include <QTreeView>
26 #include <analitzagui/algebrahighlighter.h>
27 
28 #include "analitzaguiexport.h"
29 
30 class QKeyEvent;
31 
32 class OperatorsModel;
33 
34 namespace Analitza
35 {
36 class Variables;
37 class Analyzer;
38 class Expression;
39 
50 class ANALITZAGUI_EXPORT ExpressionEdit : public QPlainTextEdit
51 {
52  Q_OBJECT
53  public:
58  explicit ExpressionEdit(QWidget *parent = 0, AlgebraHighlighter::Mode ini=AlgebraHighlighter::Autodetect);
59 
61  ~ExpressionEdit();
62 
64  AlgebraHighlighter::Mode mode() { return m_highlight->mode(); }
65 
67  void setMode(AlgebraHighlighter::Mode en);
68 
70  void setAutocomplete(bool a);
71 
73  bool autocomplete();
74 
76  bool isMathML() const;
77 
79  void setAnalitza(Analitza::Analyzer* in);
80 
82  QString text() const { return this->toPlainText();}
83 
85  void setText(const QString &str) { setPlainText(str);}
86 
88  void setCorrect(bool cor);
89 
91  bool isCorrect() const;
92 
94  void setAns(const QString &ans) { m_ans=ans; }
95 
97  QString ans() const { return m_ans; }
98 
100  void setExpression(const Analitza::Expression& e);
101 
103  Analitza::Expression expression() const;
104 
106  void setExamples(const QStringList& ex) { m_examples=ex; }
107  public slots:
108 
110  void insertText(const QString& text);
111 
112  private slots:
113  void showSimplified();
114  void cursorMov();
115  void updateCompleter();
116  void setActionText(QAction* text);
117 
119  void helper(const QString& str);
120 
122  void completed(const QString &word);
123 
125  void toMathML() { setMode(AlgebraHighlighter::MathML); }
126 
128  void toExpression() { setMode(AlgebraHighlighter::Expression); }
129 
131  void simplify();
132 
134  void returnP(); //FIXME: Change my name please
135 
136  signals:
138  void returnPressed();
139 
141  void signalHelper(QString);
142 
143  protected:
145  void contextMenuEvent(QContextMenuEvent * e);
146 
147  private:
148  bool returnPress();
149  QString helpShow(const QString& funcname, int param, bool bounds, const Analitza::Variables* v) const;
150  void helper(const QString&, const QPoint& p);
151  QString lastWord(int);
152  void focusInEvent (QFocusEvent * event);
153  void focusOutEvent ( QFocusEvent * event );
154 
155  void removenl();
156  void keyPressEvent(QKeyEvent * e);
157 
158  QLabel *m_helptip;
159  AlgebraHighlighter *m_highlight;
160 
161  int m_histPos;
162  QStringList m_history;
163 
164  Analitza::Analyzer *a;
165  bool m_correct;
166  QString m_ans;
167  QCompleter *m_completer;
168  OperatorsModel *m_ops;
169 
170  QStringList m_examples;
171  QTimer* m_hideHelpTip;
172  int m_lineHeight;
173 };
174 
175 }
176 
177 #endif
QWidget
AlgebraHighlighter::Mode
Mode
Defines the format status that could be used.
Definition: algebrahighlighter.h:36
Analitza::ExpressionEdit::text
QString text() const
Returns the expression string that we have.
Definition: expressionedit.h:82
AlgebraHighlighter::Expression
String expression format.
Definition: algebrahighlighter.h:37
analitzaguiexport.h
Analitza::Analyzer
The parser: Evaluates and calculates math expressions.
Definition: analyzer.h:59
Analitza::ExpressionEdit::setAns
void setAns(const QString &ans)
Sets the string ans that will be entered when an operator is pressed.
Definition: expressionedit.h:94
QPlainTextEdit
QPoint
AlgebraHighlighter::MathML
MathML format.
Definition: algebrahighlighter.h:38
ANALITZAGUI_EXPORT
#define ANALITZAGUI_EXPORT
Definition: analitzaguiexport.h:28
Analitza::ExpressionEdit::setText
void setText(const QString &str)
Sets the expression string str we have.
Definition: expressionedit.h:85
Analitza::ExpressionEdit::mode
AlgebraHighlighter::Mode mode()
Returns the ExpressionEdit input mode.
Definition: expressionedit.h:64
Analitza::ExpressionEdit::setExamples
void setExamples(const QStringList &ex)
Sets the examples to be shown in the context menu.
Definition: expressionedit.h:106
QTimer
QContextMenuEvent
AlgebraHighlighter::Autodetect
Try to guess which format is being used.
Definition: algebrahighlighter.h:39
QString
QStringList
Analitza::ExpressionEdit::ans
QString ans() const
Returns the string that will be entered when the first operator is pressed.
Definition: expressionedit.h:97
algebrahighlighter.h
Analitza::Variables
Stores the variables in a hash map and make them available.
Definition: variables.h:42
AlgebraHighlighter
Definition: algebrahighlighter.h:32
QKeyEvent
OperatorsModel
Operators model is a model class that has a relation of all operators string with their OperatorType...
Definition: operatorsmodel.h:32
Analitza::ExpressionEdit
A widget for manipulate mathemathical expressions.
Definition: expressionedit.h:50
QAction
Analitza::Expression
Represents a mathematical expression.
Definition: expression.h:45
QCompleter
QLabel
QFocusEvent
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:11:37 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Analitza

Skip menu "Analitza"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal