[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/kalgebra
From: Aleix Pol Gonzalez <aleixpol () gmail ! com>
Date: 2011-02-21 14:53:22
Message-ID: 20110221145322.6FCC5AC8BF () svn ! kde ! org
[Download RAW message or body]
SVN commit 1222060 by apol:
Some further polishing regarding mobile integration.
- Make it possible to trim down the functionedit dialog.
- Add some missing functionalities to the view.
- Share some functionview properties between mobile and desktop versions
M +11 -6 analitzagui/functionedit.cpp
M +5 -2 analitzagui/functionedit.h
M +2 -0 analitzagui/functionsview.cpp
M +23 -1 mobile/functionsdialog.cpp
M +2 -0 mobile/functionsdialog.h
M +0 -2 src/kalgebra.cpp
--- trunk/KDE/kdeedu/kalgebra/analitzagui/functionedit.cpp #1222059:1222060
@@ -80,9 +80,9 @@
m_funcsModel->setResolution(resolution);
// m_funcsModel->addFunction(function(m_name->text(), m_func->expression(), m_color->color()));
- KTabWidget* viewTabs=new KTabWidget(this);
+ m_viewTabs=new KTabWidget(this);
- m_graph = new Graph2D(m_funcsModel, viewTabs);
+ m_graph = new Graph2D(m_funcsModel, m_viewTabs);
m_graph->setViewport(QRect(QPoint(-5, 7), QPoint(5, -7)));
m_graph->setFocusPolicy(Qt::NoFocus);
m_graph->setMouseTracking(false);
@@ -90,8 +90,8 @@
m_graph->setReadOnly(true);
m_graph->setSquares(false);
- viewTabs->addTab(m_graph, KIcon("document-preview"), i18n("Preview"));
- QWidget *options=new QWidget(viewTabs);
+ m_viewTabs->addTab(m_graph, KIcon("document-preview"), i18n("Preview"));
+ QWidget *options=new QWidget(m_viewTabs);
options->setLayout(new QVBoxLayout);
m_uplimit=new ExpressionEdit(options);
m_downlimit=new ExpressionEdit(options);
@@ -102,7 +102,7 @@
options->layout()->addWidget(new QLabel(i18n("To:"), options));
options->layout()->addWidget(m_uplimit);
options->layout()->addItem(new QSpacerItem(0,0, QSizePolicy::Expanding, QSizePolicy::Expanding));
- viewTabs->addTab(options, KIcon("configure"), i18n("Options"));
+ m_viewTabs->addTab(options, KIcon("configure"), i18n("Options"));
connect(m_uplimit, SIGNAL(textChanged()), this, SLOT(updateUplimit()));
connect(m_downlimit, SIGNAL(textChanged()), this, SLOT(updateDownlimit()));
@@ -118,7 +118,7 @@
topLayout->addWidget(m_func);
topLayout->addWidget(m_color);
topLayout->addLayout(validLayout);
- topLayout->addWidget(viewTabs);
+ topLayout->addWidget(m_viewTabs);
topLayout->addLayout(m_butts);
m_name->hide(); //FIXME: Remove this when the name has any sense
@@ -314,4 +314,9 @@
return m_func->isMathML();
}
+void FunctionEdit::setOptionsShown(bool shown)
+{
+ m_viewTabs->setVisible(shown);
+}
+
#include "functionedit.moc"
--- trunk/KDE/kdeedu/kalgebra/analitzagui/functionedit.h #1222059:1222060
@@ -29,6 +29,7 @@
#include "analitzaguiexport.h"
+class KTabWidget;
class Function;
class Graph2D;
class FunctionsModel;
@@ -88,6 +89,8 @@
Analitza::Variables* variables() const { return m_vars; }
+ void setOptionsShown(bool shown);
+
public slots:
/** Clears the dialog. */
void clear();
@@ -105,6 +108,7 @@
private:
void setState(const QString& text, bool negative);
+ void focusInEvent(QFocusEvent*);
ExpressionEdit *m_func;
ExpressionEdit *m_uplimit, *m_downlimit;
@@ -119,8 +123,7 @@
Analitza::Variables* m_vars;
bool m_modmode;
-
- void focusInEvent(QFocusEvent*);
+ KTabWidget* m_viewTabs;
};
#endif
--- trunk/KDE/kdeedu/kalgebra/analitzagui/functionsview.cpp #1222059:1222060
@@ -26,6 +26,8 @@
FunctionsView::FunctionsView(QWidget * parent) : QTreeView(parent)
{
+ setRootIsDecorated(false);
+ setSortingEnabled(false);
}
void FunctionsView::selectionChanged(const QItemSelection & selected, const QItemSelection &)
--- trunk/KDE/kdeedu/kalgebra/mobile/functionsdialog.cpp #1222059:1222060
@@ -32,12 +32,21 @@
setLayout(new QVBoxLayout);
m_view = new FunctionsView(this);
+ m_view->setSelectionMode(QAbstractItemView::SingleSelection);
m_view->setModel(m_model);
layout()->addWidget(m_view);
+ QHBoxLayout* actionsLayout = new QHBoxLayout;
QPushButton* add = new QPushButton(KIcon("list-add"), i18n("Add"), this);
connect(add, SIGNAL(clicked(bool)), SLOT(addFunction()));
- layout()->addWidget(add);
+ actionsLayout->addWidget(add);
+ QPushButton* remove = new QPushButton(KIcon("list-remove"), i18n("Remove"), this);
+ connect(remove, SIGNAL(clicked(bool)), SLOT(removeFunction()));
+ actionsLayout->addWidget(remove);
+ QPushButton* clear = new QPushButton(KIcon("edit-clear-list"), i18n("Clear"), this);
+ connect(clear, SIGNAL(clicked(bool)), SLOT(clearFunctions()));
+ actionsLayout->addWidget(clear);
+ layout()->addItem(actionsLayout);
QDialogButtonBox* box = new QDialogButtonBox(QDialogButtonBox::Close);
layout()->addWidget(box);
@@ -49,6 +58,7 @@
m_editDialog->setLayout(new QVBoxLayout);
m_edit = new FunctionEdit(m_editDialog);
+ m_edit->setOptionsShown(false);
m_edit->setVariables(m_vars);
m_editDialog->layout()->addWidget(m_edit);
connect(m_edit, SIGNAL(accept()), m_editDialog, SLOT(accept()));
@@ -64,4 +74,16 @@
void FunctionsDialog::addEditedFunction()
{
m_model->addFunction(m_edit->createFunction());
+ m_view->setCurrentIndex(m_model->index(m_model->rowCount()-1, 0));
}
+
+void FunctionsDialog::clearFunctions()
+{
+ m_model->clear();
+}
+
+void FunctionsDialog::removeFunction()
+{
+ if(m_model->rowCount()>0)
+ m_model->removeRow(m_view->selectionModel()->currentIndex().row());
+}
--- trunk/KDE/kdeedu/kalgebra/mobile/functionsdialog.h #1222059:1222060
@@ -38,6 +38,8 @@
public slots:
void addFunction();
void addEditedFunction();
+ void removeFunction();
+ void clearFunctions();
private:
QTreeView* m_view;
--- trunk/KDE/kdeedu/kalgebra/src/kalgebra.cpp #1222059:1222060
@@ -198,8 +198,6 @@
b_funcs->setModel(b_funcsModel);
b_funcs->header()->resizeSections(QHeaderView::ResizeToContents);
b_funcs->setSelectionMode(QAbstractItemView::SingleSelection);
- b_funcs->setRootIsDecorated(false);
- b_funcs->setSortingEnabled(false);
b_tools->addTab(b_funcs, i18n("List"));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic