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

kalgebra

  • sources
  • kde-4.14
  • kdeedu
  • kalgebra
  • mobile
  • declarative
graph2dmobile.h
Go to the documentation of this file.
1 /*************************************************************************************
2  * Copyright (C) 2010 by Aleix Pol <aleixpol@kde.org> *
3  * *
4  * This program is free software; you can redistribute it and/or *
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 
20 #ifndef GRAPH2DMOBILE_H
21 #define GRAPH2DMOBILE_H
22 
23 #include <QDeclarativeItem>
24 #include <analitzaplot/plotter2d.h>
25 
26 namespace Analitza {
27 class Variables;
28 }
29 
30 class Graph2DMobile : public QDeclarativeItem, public Analitza::Plotter2D
31 {
32  Q_OBJECT
33  Q_PROPERTY(QAbstractItemModel* model READ model WRITE setModel)
34  Q_PROPERTY(QRectF viewport READ lastViewport WRITE setViewport)
35  Q_PROPERTY(bool showGrid READ showGrid WRITE setShowGrid)
36  Q_PROPERTY(bool keepAspectRatio READ keepAspectRatio WRITE setKeepAspectRatio)
37  Q_PROPERTY(bool currentFunction READ currentFunction WRITE setCurrentFunction)
38  Q_PROPERTY(bool ticksShown READ ticksShownAtAll WRITE setTicksShownAtAll)
39  public:
40  Graph2DMobile(QDeclarativeItem* parent = 0);
41 
42  virtual void forceRepaint();
43  virtual void viewportChanged() {}
44  virtual void modelChanged();
45  virtual int currentFunction() const { return m_currentFunction; }
46 
47  virtual void paint(QPainter* p, const QStyleOptionGraphicsItem* options, QWidget* w);
48 
49  void setCurrentFunction(int f) { m_currentFunction = f; }
50  bool ticksShownAtAll() const { return ticksShown()!=0; }
51  void setTicksShownAtAll(bool shown) { setShowTickLabels(shown ? Qt::Vertical|Qt::Horizontal : Qt::Orientations(0));}
52 
53  public slots:
54  void translate(qreal x, qreal y);
55  void scale(qreal s, int x, int y);
56  void resetViewport();
57  QStringList addFunction(const QString& expression, Analitza::Variables* vars=0);
58 
59  private slots:
60  void updateFuncs(const QModelIndex& start, const QModelIndex& end);
61  void addFuncs(const QModelIndex& parent, int start, int end);
62  void removeFuncs(const QModelIndex& parent, int start, int end);
63 
64  private:
65  bool m_dirty;
66  int m_currentFunction;
67 
68  QPixmap m_buffer;
69  QRectF defViewport;
70 };
71 
72 #endif // GRAPH2DMOBILE_H
Graph2DMobile::modelChanged
virtual void modelChanged()
Definition: graph2dmobile.cpp:76
QModelIndex
Graph2DMobile::translate
void translate(qreal x, qreal y)
Definition: graph2dmobile.cpp:99
QGraphicsItem::x
qreal x() const
QGraphicsItem::y
qreal y() const
QWidget
Graph2DMobile::resetViewport
void resetViewport()
Definition: graph2dmobile.cpp:71
Graph2DMobile::ticksShownAtAll
bool ticksShownAtAll() const
Definition: graph2dmobile.h:50
Qt::Orientations
typedef Orientations
Graph2DMobile::showGrid
bool showGrid
Definition: graph2dmobile.h:35
Graph2DMobile::model
QAbstractItemModel model
Definition: graph2dmobile.h:33
Graph2DMobile
Definition: graph2dmobile.h:30
Graph2DMobile::keepAspectRatio
bool keepAspectRatio
Definition: graph2dmobile.h:36
Graph2DMobile::setCurrentFunction
void setCurrentFunction(int f)
Definition: graph2dmobile.h:49
Graph2DMobile::ticksShown
bool ticksShown
Definition: graph2dmobile.h:38
QPainter
Graph2DMobile::viewportChanged
virtual void viewportChanged()
Definition: graph2dmobile.h:43
QString
QStringList
QPixmap
Graph2DMobile::setTicksShownAtAll
void setTicksShownAtAll(bool shown)
Definition: graph2dmobile.h:51
QRectF
Graph2DMobile::addFunction
QStringList addFunction(const QString &expression, Analitza::Variables *vars=0)
Definition: graph2dmobile.cpp:106
Graph2DMobile::forceRepaint
virtual void forceRepaint()
Definition: graph2dmobile.cpp:65
Graph2DMobile::currentFunction
virtual int currentFunction() const
Definition: graph2dmobile.h:45
QAbstractItemModel
QStyleOptionGraphicsItem
Graph2DMobile::viewport
QRectF viewport
Definition: graph2dmobile.h:34
QDeclarativeItem
Graph2DMobile::paint
virtual void paint(QPainter *p, const QStyleOptionGraphicsItem *options, QWidget *w)
Definition: graph2dmobile.cpp:42
QObject::parent
QObject * parent() const
QGraphicsItem::scale
qreal scale() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:11:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalgebra

Skip menu "kalgebra"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

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