Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Education
KmPlot
Commits
09a9cf6b
Commit
09a9cf6b
authored
Mar 14, 2004
by
Matthias Messmer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
function name is calculated automatically if leaving blanc
svn path=/trunk/kdeedu/kmplot/; revision=295868
parent
1929bb92
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
4 deletions
+39
-4
kmplot/keditfunction.cpp
kmplot/keditfunction.cpp
+32
-0
kmplot/keditfunction.h
kmplot/keditfunction.h
+1
-0
kmplot/qeditfunction.ui
kmplot/qeditfunction.ui
+6
-4
No files found.
kmplot/keditfunction.cpp
View file @
09a9cf6b
...
...
@@ -136,12 +136,17 @@ void KEditFunction::setWidgets()
void
KEditFunction
::
accept
()
{
// if we are editing an existing function, first delete the old one
if
(
m_index
!=
-
1
)
{
m_parser
->
delfkt
(
m_index
);
m_index
=
-
1
;
}
// find a name not allready used
if
(
kLineEditName
->
text
().
isEmpty
()
)
kLineEditName
->
setText
(
newName
()
);
int
index
=
m_parser
->
addfkt
(
yFunction
()
);
if
(
index
==
-
1
)
{
...
...
@@ -191,6 +196,33 @@ void KEditFunction::accept()
QEditFunction
::
accept
();
}
QString
KEditFunction
::
newName
()
{
int
i
=
0
;
QString
name
;
// prepend the correct prefix
switch
(
m_type
)
{
case
Function
:
name
=
"f%1"
;
break
;
case
Parametric
:
name
=
"xf%1"
;
break
;
case
Polar
:
name
=
"rf%1"
;
}
do
{
i
++
;
}
while
(
m_parser
->
getfix
(
name
.
arg
(
i
)
)
!=
-
1
);
// cut of prefix again, will be added later again
if
(
m_type
==
Parametric
||
m_type
==
Polar
)
name
=
name
.
right
(
name
.
length
()
-
1
);
return
name
.
arg
(
i
);
}
QString
KEditFunction
::
xFunction
()
{
return
"x"
+
kLineEditName
->
text
()
+
"(t)="
+
kLineEditXFunction
->
text
();
...
...
kmplot/keditfunction.h
View file @
09a9cf6b
...
...
@@ -48,6 +48,7 @@ class KEditFunction : public QEditFunction
void
setVisibleWidgets
();
void
clearWidgets
();
void
setWidgets
();
QString
newName
();
void
splitEquation
(
const
QString
equation
,
QString
&
name
,
QString
&
expression
);
FunctionType
m_type
;
XParser
*
m_parser
;
...
...
kmplot/qeditfunction.ui
View file @
09a9cf6b
...
...
@@ -8,8 +8,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
2
82
</width>
<height>
48
4
</height>
<width>
2
93
</width>
<height>
48
6
</height>
</rect>
</property>
<property
name=
"sizePolicy"
>
...
...
@@ -71,7 +71,8 @@
<string>
enter the expression
</string>
</property>
<property
name=
"whatsThis"
stdset=
"0"
>
<string>
Enter an expression for the function.
</string>
<string>
Enter an expression for the function. The dummy variable is t.
Example: t^2
</string>
</property>
</widget>
<widget
class=
"KLineEdit"
row=
"0"
column=
"1"
>
...
...
@@ -85,7 +86,8 @@
<string>
name of the function
</string>
</property>
<property
name=
"whatsThis"
stdset=
"0"
>
<string>
Enter the name of the function.
</string>
<string>
Enter the name of the function.
The name of a function must be unique. If you leave this line empty KmPlot will set a default name. You can change it later.
</string>
</property>
</widget>
<widget
class=
"QLayoutWidget"
row=
"2"
column=
"0"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment