4 #include <QScriptEngine>
50 return n1()==pt.
n1() &&
n2()==pt.
n2() &&
n3()==pt.
n3() &&
x()==pt.
x() &&
y()==pt.
y() &&
r1()==pt.
r1() &&
r2() == pt.
r2() &&
az()==pt.
az();
55 return n1()!=pt.
n1() ||
n2()!=pt.
n2() ||
n3()!=pt.
n3() ||
x()!=pt.
x() ||
y()!=pt.
y() ||
r1()!=pt.
r1() ||
r2() != pt.
r2() ||
az()!=pt.
az();
60 settings->beginGroup(name);
62 settings->setValue(
"n1",
n1());
63 settings->setValue(
"n2",
n2());
64 settings->setValue(
"n3",
n3());
65 settings->setValue(
"x",
x());
66 settings->setValue(
"y",
y());
67 settings->setValue(
"r1",
r1());
68 settings->setValue(
"r2",
r2());
69 settings->setValue(
"az",
az());
83 return QObject::tr(
"[%1, %2, %3, %4, %5, %6, %7, %8]").arg(
n1()).arg(
n2()).arg(
n3()).arg(
x()).arg(
y()).arg(
r1()).arg(
r2()).arg(
az());
88 qRegisterMetaType< QxrdPowderPoint >(
"QxrdPowderPoint");
90 qRegisterMetaTypeStreamOperators< QxrdPowderPoint >(
"QxrdPowderPoint");
97 QScriptValue obj = engine->newObject();
99 obj.setProperty(
"n1", pt.
n1());
100 obj.setProperty(
"n2", pt.
n2());
101 obj.setProperty(
"n3", pt.
n3());
102 obj.setProperty(
"x", pt.
x());
103 obj.setProperty(
"y", pt.
y());
104 obj.setProperty(
"r1", pt.
r1());
105 obj.setProperty(
"r2", pt.
r2());
106 obj.setProperty(
"az", pt.
az());
113 pt.
n1() = obj.property(
"n1").toInteger();
114 pt.
n2() = obj.property(
"n2").toInteger();
115 pt.
n3() = obj.property(
"n3").toInteger();
116 pt.
x() = obj.property(
"x").toNumber();
117 pt.
y() = obj.property(
"y").toNumber();
118 pt.
r1() = obj.property(
"r1").toNumber();
119 pt.
r2() = obj.property(
"r2").toNumber();
120 pt.
az() = obj.property(
"az").toNumber();
125 settings->beginWriteArray(name, count());
127 for (
int i=0; i<count(); i++) {
128 settings->setArrayIndex(i);
130 settings->setValue(
"n1", pt.
n1());
131 settings->setValue(
"n2", pt.
n2());
132 settings->setValue(
"n3", pt.
n3());
133 settings->setValue(
"x", pt.
x());
134 settings->setValue(
"y", pt.
y());
135 settings->setValue(
"r1", pt.
r1());
136 settings->setValue(
"r2", pt.
r2());
137 settings->setValue(
"az", pt.
az());
140 settings->endArray();
154 for (
int i=0; i<count(); i++) {
159 res += at(i).toString();
169 qRegisterMetaType< QxrdPowderPointVector >(
"QxrdPowderPointVector");
171 qRegisterMetaTypeStreamOperators< QxrdPowderPointVector >(
"QxrdPowderPointVector");
181 QScriptValue res = engine->newArray(n);
183 for (
int i=0; i<n; i++) {
185 QScriptValue obj = engine->newObject();
187 obj.setProperty(
"n1", pt.
n1());
188 obj.setProperty(
"n2", pt.
n2());
189 obj.setProperty(
"n3", pt.
n3());
190 obj.setProperty(
"x", pt.
x());
191 obj.setProperty(
"y", pt.
y());
192 obj.setProperty(
"r1", pt.
r1());
193 obj.setProperty(
"r2", pt.
r2());
194 obj.setProperty(
"az", pt.
az());
196 res.setProperty(i, obj);
205 int n=obj.property(
"length").toInteger();
209 for (
int i=0; i<n; i++) {
210 QScriptValue pt = obj.property(i);
213 vec[i].n1() = pt.property(
"n1").toInteger();
214 vec[i].n2() = pt.property(
"n2").toInteger();
215 vec[i].n3() = pt.property(
"n3").toInteger();
216 vec[i].x() = pt.property(
"x").toNumber();
217 vec[i].y() = pt.property(
"y").toNumber();
218 vec[i].r1() = pt.property(
"r1").toNumber();
219 vec[i].r2() = pt.property(
"r2").toNumber();
220 vec[i].az() = pt.property(
"az").toNumber();
225 #ifndef QT_NO_DATASTREAM
229 stream << pt.
n1() << pt.
n2() << pt.
n3() << pt.
x() << pt.
y() << pt.
r1() << pt.
r2() << pt.
az();
236 stream >> pt.
n1() >> pt.
n2() >> pt.
n3() >> pt.
x() >> pt.
y() >> pt.
r1() >> pt.
r2() >> pt.
az();
static void registerMetaTypes()
bool operator==(const QxrdPowderPoint &pt) const
static void fromScriptValue(const QScriptValue &obj, QxrdPowderPoint &pt)
static void registerMetaTypes()
void setSettingsValue(QSettings *settings, QString name)
static void customSaver(const QVariant &val, QSettings *settings, QString name)
static QScriptValue toScriptValue(QScriptEngine *engine, const QxrdPowderPoint &pt)
static QScriptValue toScriptValue(QScriptEngine *engine, const QxrdPowderPointVector &vec)
void setSettingsValue(QSettings *settings, QString name)
bool operator!=(const QxrdPowderPoint &pt) const
QDataStream & operator>>(QDataStream &stream, QxrdPowderPoint &pt)
QDataStream & operator<<(QDataStream &stream, const QxrdPowderPoint &pt)
static void fromScriptValue(const QScriptValue &obj, QxrdPowderPointVector &vec)
static void registerCustomSaver(QString typeName, CustomSettingsSaver *saver)
static void customSaver(const QVariant &val, QSettings *settings, QString name)