RInside Version 0.2.6
inst/examples/qt/qtdensity.h
Go to the documentation of this file.
00001 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
00002 //
00003 // Qt usage example for RInside, inspired by the standard 'density
00004 // sliders' example for other GUI toolkits
00005 //
00006 // Copyright (C) 2011  Dirk Eddelbuettel and Romain Francois
00007 
00008 #ifndef QTDENSITY_H
00009 #define QTDENSITY_H
00010 
00011 #include <RInside.h>
00012 
00013 #include <QMainWindow>
00014 #include <QHBoxLayout>
00015 #include <QSlider>
00016 #include <QSpinBox>
00017 #include <QLabel>
00018 #include <QTemporaryFile>
00019 #include <QSvgWidget>
00020 
00021 class QtDensity : public QMainWindow
00022 {
00023     Q_OBJECT
00024 
00025     public:
00026     QtDensity(RInside & R);
00027 
00028 private slots:
00029     void getBandwidth(int bw);
00030     void getKernel(int kernel);
00031     void getRandomDataCmd(QString txt);
00032     void runRandomDataCmd(void);
00033 
00034 private:
00035     void setupDisplay(void);    // standard GUI boilderplate of arranging things
00036     void plot(void);            // run a density plot in R and update the
00037     void filterFile(void);      // modify the richer SVG produced by R
00038 
00039     QSvgWidget *m_svg;          // the SVG device
00040     RInside & m_R;              // reference to the R instance passed to constructor
00041     QString m_tempfile;         // name of file used by R for plots
00042     QString m_svgfile;          // another temp file, this time from Qt
00043     int m_bw, m_kernel;         // parameters used to estimate the density
00044     QString m_cmd;              // random draw command string
00045 };
00046 
00047 #endif
 All Classes Files Functions Variables Enumerations Enumerator Defines