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

KDEUI

  • sources
  • kde-4.12
  • kdelibs
  • kdeui
  • plotting
kplotwidget.h
Go to the documentation of this file.
1 /* -*- C++ -*-
2  This file is part of the KDE libraries
3  Copyright (C) 2003 Jason Harris <kstars@30doradus.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef KPLOTWIDGET_H
22 #define KPLOTWIDGET_H
23 
24 #include <kdeui_export.h>
25 
26 #include <QtGui/QFrame>
27 #include <QtCore/QList>
28 
29 class KPlotAxis;
30 class KPlotObject;
31 class KPlotPoint;
32 
80 class KDEUI_EXPORT KPlotWidget : public QFrame {
81  Q_OBJECT
82  Q_PROPERTY(int leftPadding READ leftPadding)
83  Q_PROPERTY(int rightPadding READ rightPadding)
84  Q_PROPERTY(int topPadding READ topPadding)
85  Q_PROPERTY(int bottomPadding READ bottomPadding)
86  Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
87  Q_PROPERTY(QColor foregroundColor READ foregroundColor WRITE setForegroundColor)
88  Q_PROPERTY(QColor gridColor READ gridColor WRITE setGridColor)
89  Q_PROPERTY(bool grid READ isGridShown WRITE setShowGrid)
90  Q_PROPERTY(bool objectToolTip READ isObjectToolTipShown WRITE setObjectToolTipShown)
91 public:
96  explicit KPlotWidget( QWidget * parent = 0 );
97 
101  virtual ~KPlotWidget();
102 
106  enum Axis
107  {
108  LeftAxis = 0,
109  BottomAxis,
110  RightAxis,
111  TopAxis
112  };
113 
117  virtual QSize minimumSizeHint() const;
118 
122  virtual QSize sizeHint() const;
123 
131  void setLimits( double x1, double x2, double y1, double y2 );
132 
154  void setSecondaryLimits( double x1, double x2, double y1, double y2 );
155 
161  void clearSecondaryLimits();
162 
168  QRectF dataRect() const;
169 
176  QRectF secondaryDataRect() const;
177 
182  QRect pixRect() const;
183 
190  void addPlotObject( KPlotObject *object );
191 
196  void addPlotObjects( const QList< KPlotObject* >& objects );
197 
201  QList< KPlotObject* > plotObjects() const;
202 
206  void removeAllPlotObjects();
207 
212  void resetPlotMask();
213 
217  void resetPlot();
218 
224  void replacePlotObject( int i, KPlotObject *o );
225 
231  QColor backgroundColor() const;
232 
239  QColor foregroundColor() const;
240 
246  QColor gridColor() const;
247 
252  void setBackgroundColor( const QColor &bg );
253 
258  void setForegroundColor( const QColor &fg );
259 
264  void setGridColor( const QColor &gc );
265 
270  bool isGridShown() const;
271 
276  bool isObjectToolTipShown() const;
277 
282  bool antialiasing() const;
283 
288  void setAntialiasing( bool b );
289 
297  int leftPadding() const;
298 
305  int rightPadding() const;
306 
313  int topPadding() const;
314 
321  int bottomPadding() const;
322 
327  void setLeftPadding( int padding );
328 
333  void setRightPadding( int padding );
334 
339  void setTopPadding( int padding );
340 
345  void setBottomPadding( int padding );
346 
351  void setDefaultPaddings();
352 
360  QPointF mapToWidget( const QPointF& p ) const;
361 
373  void maskRect( const QRectF &r, float value=1.0 );
374 
386  void maskAlongLine( const QPointF &p1, const QPointF &p2, float value=1.0 );
387 
400  void placeLabel( QPainter *painter, KPlotPoint *pp );
401 
406  KPlotAxis* axis( Axis type );
407 
412  const KPlotAxis* axis( Axis type ) const;
413 
414 
415 public Q_SLOTS:
421  void setShowGrid( bool show );
422 
428  void setObjectToolTipShown( bool show );
429 
430 protected:
434  virtual bool event( QEvent* );
435 
439  virtual void paintEvent( QPaintEvent* );
440 
444  virtual void resizeEvent( QResizeEvent* );
445 
452  virtual void drawAxes( QPainter *p );
453 
458  void setPixRect();
459 
465  QList<KPlotPoint*> pointsUnderPoint( const QPoint& p ) const;
466 
467 private:
468  class Private;
469  Private * const d;
470 
471  Q_DISABLE_COPY( KPlotWidget )
472 };
473 
474 #endif
QColor
KPlotPoint
Encapsulates a point in the plot.
Definition: kplotpoint.h:40
QWidget
KPlotWidget::Axis
Axis
The four types of plot axes.
Definition: kplotwidget.h:106
KPlotObject
Encapsulates a data set to be plotted in a KPlotWidget.
Definition: kplotobject.h:53
KPlotWidget
Generic data plotting widget.
Definition: kplotwidget.h:80
KPlotAxis
Axis for KPlotWidget.
Definition: kplotaxis.h:37
QPoint
QRect
kdeui_export.h
QSize
KPlotWidget::RightAxis
the right axis
Definition: kplotwidget.h:110
KPlotWidget::BottomAxis
the bottom axis
Definition: kplotwidget.h:109
QFrame
QList< KPlotObject * >
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:15 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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