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

KDEUI

kplotwidget.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 KPLOTWIDGET_H
00022 #define KPLOTWIDGET_H
00023 
00024 #include <kdeui_export.h>
00025 
00026 #include <QtGui/QFrame>
00027 #include <QtCore/QList>
00028 
00029 class KPlotAxis;
00030 class KPlotObject;
00031 class KPlotPoint;
00032 
00080 class KDEUI_EXPORT KPlotWidget : public QFrame {
00081     Q_OBJECT
00082     Q_PROPERTY(int leftPadding READ leftPadding)
00083     Q_PROPERTY(int rightPadding READ rightPadding)
00084     Q_PROPERTY(int topPadding READ topPadding)
00085     Q_PROPERTY(int bottomPadding READ bottomPadding)
00086     Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
00087     Q_PROPERTY(QColor foregroundColor READ foregroundColor WRITE setForegroundColor)
00088     Q_PROPERTY(QColor gridColor READ gridColor WRITE setGridColor)
00089     Q_PROPERTY(bool grid READ isGridShown WRITE setShowGrid)
00090     Q_PROPERTY(bool objectToolTip READ isObjectToolTipShown WRITE setObjectToolTipShown)
00091 public:
00096     explicit KPlotWidget( QWidget * parent = 0 );
00097 
00101     virtual ~KPlotWidget();
00102 
00106     enum Axis
00107     {
00108         LeftAxis = 0,  
00109         BottomAxis,    
00110         RightAxis,     
00111         TopAxis        
00112     };
00113 
00117     virtual QSize minimumSizeHint() const;
00118 
00122     virtual QSize sizeHint() const;
00123 
00131     void setLimits( double x1, double x2, double y1, double y2 );
00132 
00154     void setSecondaryLimits( double x1, double x2, double y1, double y2 );
00155 
00161     void clearSecondaryLimits();
00162 
00168     QRectF dataRect() const;
00169 
00176     QRectF secondaryDataRect() const;
00177 
00182     QRect pixRect() const;
00183 
00190     void addPlotObject( KPlotObject *object );
00191 
00196     void addPlotObjects( const QList< KPlotObject* >& objects );
00197 
00201     QList< KPlotObject* > plotObjects() const;
00202 
00206     void removeAllPlotObjects();
00207 
00212     void resetPlotMask();
00213 
00217     void resetPlot();
00218 
00224     void replacePlotObject( int i, KPlotObject *o );
00225 
00231     QColor backgroundColor() const;
00232 
00239     QColor foregroundColor() const;
00240 
00246     QColor gridColor() const;
00247 
00252     void setBackgroundColor( const QColor &bg );
00253 
00258     void setForegroundColor( const QColor &fg );
00259 
00264     void setGridColor( const QColor &gc );
00265 
00270     bool isGridShown() const;
00271 
00276     bool isObjectToolTipShown() const;
00277 
00282     bool antialiasing() const;
00283 
00288     void setAntialiasing( bool b );
00289 
00297     int leftPadding() const;
00298 
00305     int rightPadding() const;
00306 
00313     int topPadding() const;
00314 
00321     int bottomPadding() const;
00322 
00327     void setLeftPadding( int padding );
00328 
00333     void setRightPadding( int padding );
00334 
00339     void setTopPadding( int padding );
00340 
00345     void setBottomPadding( int padding );
00346 
00351     void setDefaultPaddings();
00352 
00360     QPointF mapToWidget( const QPointF& p ) const;
00361 
00373     void maskRect( const QRectF &r, float value=1.0 );
00374 
00386     void maskAlongLine( const QPointF &p1, const QPointF &p2, float value=1.0 );
00387 
00400     void placeLabel( QPainter *painter, KPlotPoint *pp );
00401 
00406     KPlotAxis* axis( Axis type );
00407 
00412     const KPlotAxis* axis( Axis type ) const;
00413 
00414 
00415 public Q_SLOTS:
00421     void setShowGrid( bool show );
00422 
00428     void setObjectToolTipShown( bool show );
00429 
00430 protected:
00434     virtual bool event( QEvent* );
00435 
00439     virtual void paintEvent( QPaintEvent* );
00440 
00444     virtual void resizeEvent( QResizeEvent* );
00445 
00452     virtual void drawAxes( QPainter *p );
00453 
00458     void setPixRect();
00459 
00465     QList<KPlotPoint*> pointsUnderPoint( const QPoint& p ) const;
00466 
00467 private:
00468     class Private;
00469     Private * const d;
00470 
00471     Q_DISABLE_COPY( KPlotWidget )
00472 };
00473 
00474 #endif

KDEUI

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal