HI high_flyer.
This is all the code from the header file (including the previously discussed attempts at creating nested classes and some function defs):
#ifndef ATTEMPT1_H
#define ATTEMPT1_H
//#include <QWidget>
//#include <iostream>
//#include <fstream>
//#include <string>
//#include <vector>
//#include <windows.h>
//#include <QTextEdit>
//#include <QString>
#include <QFileDialog>
//using namespace std;
//#include <QtCore/QFile>
//#include <QtCore/QTextStream>
void FileOpen
(QString fileName, QVector<double>
& x, QVector<QVector<double> >
& y
);
// this is using pointers for output void FiCalc(double lambda, double TwoThetaMin, double TwoThetaMax);
QList<QList<int> > Combinations(int a, int b, int c,int aa,int bb,int cc);
QList<double> AtomicScattering
(QString Symbol,QList<float> dSpace
);
namespace Ui {
class attempt1;
}
{
Q_OBJECT
public:
explicit attempt1
(QWidget *parent
= 0);
~attempt1();
private:
Ui::attempt1 *ui;
private slots:
void on_save_clicked();
void on_run_clicked();
void on_load_clicked();
};
#endif // ATTEMPT1_H
#ifndef ATTEMPT1_H
#define ATTEMPT1_H
//#include <QWidget>
//#include <iostream>
//#include <fstream>
//#include <string>
//#include <vector>
//#include <windows.h>
//#include <QTextEdit>
//#include <QString>
#include <QFileDialog>
//using namespace std;
//#include <QtCore/QFile>
//#include <QtCore/QTextStream>
void FileOpen(QString fileName, QVector<double>& x, QVector<QVector<double> >& y); // this is using pointers for output
void FiCalc(double lambda, double TwoThetaMin, double TwoThetaMax);
QList<QList<int> > Combinations(int a, int b, int c,int aa,int bb,int cc);
QList<double> AtomicScattering(QString Symbol,QList<float> dSpace);
namespace Ui {
class attempt1;
}
class attempt1 : public QWidget
{
Q_OBJECT
public:
explicit attempt1(QWidget *parent = 0);
~attempt1();
private:
Ui::attempt1 *ui;
private slots:
void on_save_clicked();
void on_run_clicked();
void on_load_clicked();
};
#endif // ATTEMPT1_H
To copy to clipboard, switch view to plain text mode
class atom
{
public:
};
class data
{
//int size;
public:
QString name;
//string for standard name from CIF // QList < QList <QList<float> > >xyz; //3d array for XYZ values from CIF
// data(int);
int size;
double aSide;
double bSide;
double cSide;
double alpha;
double beta;
double gamma;
double volume;
QList<float> dSpace; //use a float as we only want to compare to 8 significant figures
QList<QList<int> > hkl;
QList<float> TwoTheta;
QList<float> I;
atom atom1;
atom atom2;
};
class atom
{
public:
QString type;
};
class data
{
//int size;
public:
QString name; //string for standard name from CIF
// QList < QList <QList<float> > >xyz; //3d array for XYZ values from CIF
// data(int);
int size;
double aSide;
double bSide;
double cSide;
double alpha;
double beta;
double gamma;
double volume;
QList<float> dSpace; //use a float as we only want to compare to 8 significant figures
QList<QList<int> > hkl;
QList<float> TwoTheta;
QList<float> I;
atom atom1;
atom atom2;
};
To copy to clipboard, switch view to plain text mode
The code im using in the cpp file id just what you wrote below:
QMap<QString,atom*> m_mapAtoms;
atom *pAtom = new atom;
//Storing
m_mapAtoms["atom1"] = pAtom;
//using
pAtom = m_mapAtoms["atom1"];
QMap<QString,atom*> m_mapAtoms;
atom *pAtom = new atom;
//Storing
m_mapAtoms["atom1"] = pAtom;
//using
pAtom = m_mapAtoms["atom1"];
To copy to clipboard, switch view to plain text mode
Is this the information you need?
thanks
Matt
Added after 19 minutes:
Sorry high_flyer I just realised i didnt include <QMap> (im still getting used to including things as in matlab you don't do this!).
I will have a look at QMap now - in your opinion is this the best way to organize data sets each containing lots of different data types?
Thanks for your help again!
Matt
Bookmarks