KDEUI
kplotobject.h
Go to the documentation of this file.
00001 /* -*- C++ -*- 00002 This file is part of the KDE libraries 00003 Copyright (C) 2003 Jason Harris <kstars@30doradus.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KPLOTOBJECT_H 00022 #define KPLOTOBJECT_H 00023 00024 #include <kdeui_export.h> 00025 00026 #include <QtCore/QString> 00027 #include <QtGui/QColor> 00028 00029 class QBrush; 00030 class QPainter; 00031 class QPen; 00032 class QPointF; 00033 class KPlotWidget; 00034 class KPlotPoint; 00035 00053 class KDEUI_EXPORT KPlotObject{ 00054 public: 00064 enum PlotType 00065 { 00066 UnknownType = 0, 00067 Points = 1, 00068 Lines = 2, 00069 Bars = 4 00070 }; 00071 Q_DECLARE_FLAGS( PlotTypes, PlotType ) 00072 00073 00076 enum PointStyle 00077 { 00078 NoPoints = 0, 00079 Circle = 1, 00080 Letter = 2, 00081 Triangle = 3, 00082 Square = 4, 00083 Pentagon = 5, 00084 Hexagon = 6, 00085 Asterisk = 7, 00086 Star = 8, 00087 UnknwonPoint 00088 }; 00089 00099 explicit KPlotObject( const QColor &color = Qt::white, PlotType otype = Points, double size = 2, PointStyle ps = Circle ); 00100 00104 ~KPlotObject(); 00105 00109 PlotTypes plotTypes() const; 00110 00115 void setShowPoints( bool b ); 00116 00121 void setShowLines( bool b ); 00122 00127 void setShowBars( bool b ); 00128 00132 double size() const; 00133 00138 void setSize( double s ); 00139 00143 PointStyle pointStyle() const; 00144 00149 void setPointStyle( PointStyle p ); 00150 00156 const QPen& pen() const; 00157 00162 void setPen( const QPen &p ); 00163 00167 const QPen& linePen() const; 00168 00173 void setLinePen( const QPen &p ); 00174 00178 const QPen& barPen() const; 00179 00184 void setBarPen( const QPen &p ); 00185 00189 const QPen& labelPen() const; 00190 00195 void setLabelPen( const QPen &p ); 00196 00200 const QBrush brush() const; 00201 00206 void setBrush( const QBrush &b ); 00207 00211 const QBrush barBrush() const; 00212 00217 void setBarBrush( const QBrush &b ); 00218 00222 QList< KPlotPoint* > points() const; 00223 00232 void addPoint( const QPointF &p, const QString &label = QString(), double barWidth = 0.0 ); 00233 00239 void addPoint( KPlotPoint *p ); 00240 00251 void addPoint( double x, double y, const QString &label = QString(), double barWidth = 0.0 ); 00252 00257 void removePoint( int index ); 00258 00262 void clearPoints(); 00263 00270 void draw( QPainter *p, KPlotWidget *pw ); 00271 00272 private: 00273 class Private; 00274 Private * const d; 00275 00276 Q_DISABLE_COPY( KPlotObject ) 00277 }; 00278 Q_DECLARE_OPERATORS_FOR_FLAGS( KPlotObject::PlotTypes ) 00279 00280 #endif
KDE 4.6 API Reference