RInside Version 0.2.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
qtdensity.h
Go to the documentation of this file.
1 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 //
3 // Qt usage example for RInside, inspired by the standard 'density
4 // sliders' example for other GUI toolkits
5 //
6 // Copyright (C) 2011 - 2013 Dirk Eddelbuettel and Romain Francois
7 
8 #ifndef QTDENSITY_H
9 #define QTDENSITY_H
10 
11 #include <RInside.h>
12 
13 #include <QtGui>
14 #include <QWidget>
15 #include <QLabel>
16 #include <QLineEdit>
17 #include <QRadioButton>
18 #include <QGroupBox>
19 #include <QButtonGroup>
20 #include <QMainWindow>
21 #include <QHBoxLayout>
22 #include <QSlider>
23 #include <QSpinBox>
24 #include <QLabel>
25 #include <QTemporaryFile>
26 #include <QSvgWidget>
27 
28 class QtDensity : public QMainWindow
29 {
30  Q_OBJECT
31 
32  public:
33  QtDensity(RInside & R);
34 
35 private slots:
36  void getBandwidth(int bw);
37  void getKernel(int kernel);
38  void getRandomDataCmd(QString txt);
39  void runRandomDataCmd(void);
40 
41 private:
42  void setupDisplay(void); // standard GUI boilderplate of arranging things
43  void plot(void); // run a density plot in R and update the
44  void filterFile(void); // modify the richer SVG produced by R
45 
46  QSvgWidget *m_svg; // the SVG device
47  RInside & m_R; // reference to the R instance passed to constructor
48  QString m_tempfile; // name of file used by R for plots
49  QString m_svgfile; // another temp file, this time from Qt
50  int m_bw, m_kernel; // parameters used to estimate the density
51  QString m_cmd; // random draw command string
52 };
53 
54 #endif
RInside & m_R
Definition: qtdensity.h:47
void getKernel(int kernel)
Definition: qtdensity.cpp:114
int m_bw
Definition: qtdensity.h:50
QString m_svgfile
Definition: qtdensity.h:49
QSvgWidget * m_svg
Definition: qtdensity.h:46
void getRandomDataCmd(QString txt)
Definition: qtdensity.cpp:121
QString m_tempfile
Definition: qtdensity.h:48
void runRandomDataCmd(void)
Definition: qtdensity.cpp:125
void plot(void)
Definition: qtdensity.cpp:94
int m_kernel
Definition: qtdensity.h:50
void setupDisplay(void)
Definition: qtdensity.cpp:21
QtDensity(RInside &R)
Definition: qtdensity.cpp:10
void filterFile(void)
Definition: qtdensity.cpp:131
QString m_cmd
Definition: qtdensity.h:51
void getBandwidth(int bw)
Definition: qtdensity.cpp:107