Description: * Patch to reset the 3D Graph View on clicking 3D Graph->Reset View. Author: Prathibha B --- The information above should follow the Patch Tagging Guidelines, please checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here are templates for supplementary fields that you might want to add: Origin: , Bug: Bug-Debian: https://bugs.debian.org/ Bug-Ubuntu: https://launchpad.net/bugs/ Forwarded: Reviewed-By: Last-Update: --- kalgebra-4.14.2.orig/src/kalgebra.cpp +++ kalgebra-4.14.2/src/kalgebra.cpp @@ -297,29 +297,18 @@ KAlgebra::KAlgebra(QWidget *parent) : KM /////3DGraph #ifdef HAVE_OPENGL - QWidget *tridim = new QWidget(m_tabs); - QVBoxLayout *t_layo = new QVBoxLayout(tridim); - t_exp = new Analitza::ExpressionEdit(tridim); - t_exp->setExamples(QStringList() << "sin x+sin y" << "(x,y)->x" << "x*y"); - t_exp->setAns("x"); - t_model3d = new Analitza::PlotsModel(this); - m_graph3d = new Analitza::PlotsView3D(tridim); - m_graph3d->setModel(t_model3d); - m_graph3d->setUseSimpleRotation(true); - + tridim = new QWidget(m_tabs); + t_layo = new QVBoxLayout(tridim); + set3DGraph(); tridim->setLayout(t_layo); m_tabs->addTab(tridim, i18n("&3D Graph")); - t_layo->addWidget(m_graph3d); - t_layo->addWidget(t_exp); - - connect(t_exp, SIGNAL(returnPressed()), this, SLOT(new_func3d())); c_results->addOptionsObserver(new Add3DOption(this)); ////////menu t_menu = menuBar()->addMenu(i18n("3D &Graph")); QAction* t_actions[5]; t_menu->addAction(KStandardAction::save(this, SLOT(save3DGraph()), this)); - t_menu->addAction(KIcon("zoom-original"), i18n("&Reset View"), m_graph3d, SLOT(resetView())); + t_menu->addAction(KIcon("zoom-original"), i18n("&Reset View"), this, SLOT(viewReset())); t_menu->addSeparator(); t_actions[2] = t_menu->addAction(i18n("Dots"), this, SLOT(set_dots())); t_actions[3] = t_menu->addAction(i18n("Lines"), this, SLOT(set_lines())); @@ -767,3 +756,30 @@ void KAlgebra::fullScreen(bool isFull) show(); } } + +void KAlgebra::viewReset() +{ + t_layo->removeWidget(m_graph3d); + t_layo->removeWidget(t_exp); + + set3DGraph(); + m_status->setText(i18nc("@info:status", "Ready")); +} + +void KAlgebra::set3DGraph() +{ + t_exp = new Analitza::ExpressionEdit(tridim); + t_exp->setExamples(QStringList() << "sin x+sin y" << "(x,y)->x" << "x*y"); + t_exp->setAns("x"); + t_exp->setFocus(); + + t_model3d = new Analitza::PlotsModel(this); + m_graph3d = new Analitza::PlotsView3D(tridim); + m_graph3d->setModel(t_model3d); + m_graph3d->setUseSimpleRotation(true); + connect(t_exp, SIGNAL(returnPressed()), this, SLOT(new_func3d())); + t_layo->addWidget(m_graph3d); + t_layo->addWidget(t_exp); + +} + --- kalgebra-4.14.2.orig/src/kalgebra.h +++ kalgebra-4.14.2/src/kalgebra.h @@ -27,6 +27,7 @@ #include #include #include +#include namespace Analitza { class PlotsView2D; @@ -55,6 +56,8 @@ class KAlgebra : public KMainWindow QPixmap px; QLabel *m_status; QTabWidget* m_tabs; + QVBoxLayout *t_layo; + QWidget *tridim; //consoleeWidget QMenu* c_menu; @@ -121,6 +124,8 @@ class KAlgebra : public KMainWindow void set_solid(); void save3DGraph(); void save3D(); + void set3DGraph(); + void viewReset(); void saveGraph(); void functools ( int );