new Graphic feature - floatingAxisType: Free, TraceX/Y
qpicalculator moved to PIEvaluator
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "mainwindow.h"
|
||||
#include "piqt.h"
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget * parent): QMainWindow(parent), Ui::MainWindow() {
|
||||
@@ -62,7 +63,7 @@ void MainWindow::redrawGraphics() {
|
||||
graphic->setGraphicName(ti->text(1), i);
|
||||
pol.clear();
|
||||
if (ti->checkState(0) == Qt::Checked) {
|
||||
if (evaluator.check(ti->text(1))) {
|
||||
if (evaluator.check(Q2PIString(ti->text(1)))) {
|
||||
cx = sx;
|
||||
while (cx < fx) {
|
||||
evaluator.setVariable(vi, complexd(cx, 0.));
|
||||
@@ -140,19 +141,19 @@ void MainWindow::saving(QPIConfig & conf) {
|
||||
|
||||
|
||||
void MainWindow::on_lineInput_textChanged(QString text) {
|
||||
if (evaluator.check(text)) lineInput->setPalette(npal);
|
||||
if (evaluator.check(Q2PIString(text))) lineInput->setPalette(npal);
|
||||
else lineInput->setPalette(epal);
|
||||
labelParsed->setText(evaluator.expression());
|
||||
labelError->setText(evaluator.error());
|
||||
labelParsed->setText(PI2QString(evaluator.expression()));
|
||||
labelError->setText(PI2QString(evaluator.error()));
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_lineInput_returnPressed() {
|
||||
bool ret = evaluator.check(lineInput->text());
|
||||
bool ret = evaluator.check(Q2PIString(lineInput->text()));
|
||||
if (ret) lineInput->setPalette(npal);
|
||||
else lineInput->setPalette(epal);
|
||||
labelParsed->setText(evaluator.expression());
|
||||
labelError->setText(evaluator.error());
|
||||
labelParsed->setText(PI2QString(evaluator.expression()));
|
||||
labelError->setText(PI2QString(evaluator.error()));
|
||||
if (!ret) return;
|
||||
complexd val = evaluator.evaluate();
|
||||
evaluator.setVariable(ans, val);
|
||||
@@ -182,6 +183,16 @@ void MainWindow::on_lineInput_returnPressed() {
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_treeGraphics_itemSelectionChanged() {
|
||||
buttonGraphicDel->setDisabled(treeGraphics->selectedItems().isEmpty());
|
||||
if (treeGraphics->currentItem()) {
|
||||
int ind = treeGraphics->indexOfTopLevelItem(treeGraphics->currentItem());
|
||||
if (ind < 0 || ind >= graphic->graphicsCount()) return;
|
||||
graphic->setCurrentGraphic(ind);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_treeGraphics_itemDoubleClicked(QTreeWidgetItem * item, int column) {
|
||||
Qt::ItemFlags f = item->flags();
|
||||
if (column != 1) f &= ~Qt::ItemIsEditable;
|
||||
@@ -254,7 +265,7 @@ void MainWindow::on_tabWidget_currentChanged(int index) {
|
||||
vn = treeVariables->topLevelItem(i)->text(0);
|
||||
vv = treeVariables->topLevelItem(i)->text(1);
|
||||
eval.check(vv);
|
||||
evaluator.setVariable(vn, eval.evaluate());
|
||||
evaluator.setVariable(Q2PIString(vn), eval.evaluate());
|
||||
}
|
||||
if (index == 0) on_lineInput_returnPressed();
|
||||
if (index == 2) redrawGraphics();
|
||||
|
||||
Reference in New Issue
Block a user