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

KDEUI

  • 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
29class KPlotAxis;
30class KPlotObject;
31class KPlotPoint;
32
80class 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)
91public:
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
415public Q_SLOTS:
421 void setShowGrid( bool show );
422
428 void setObjectToolTipShown( bool show );
429
430protected:
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
467private:
468 class Private;
469 Private * const d;
470
471 Q_DISABLE_COPY( KPlotWidget )
472};
473
474#endif
KPlotAxis
Axis for KPlotWidget.
Definition: kplotaxis.h:37
KPlotObject
Encapsulates a data set to be plotted in a KPlotWidget.
Definition: kplotobject.h:53
KPlotPoint
Encapsulates a point in the plot.
Definition: kplotpoint.h:40
KPlotWidget
Generic data plotting widget.
Definition: kplotwidget.h:80
KPlotWidget::Axis
Axis
The four types of plot axes.
Definition: kplotwidget.h:107
KPlotWidget::BottomAxis
@ BottomAxis
the bottom axis
Definition: kplotwidget.h:109
KPlotWidget::RightAxis
@ RightAxis
the right axis
Definition: kplotwidget.h:110
QFrame
QList
QWidget
kdeui_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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