#1 fixed und einiges mehr

git-svn-id: http://svn.lsim.tuxzone.org/trunk@10 4bec179b-ab65-46ed-a5f8-55b8b5c735d0
This commit is contained in:
catdog2
2008-11-02 20:34:58 +00:00
parent dc3d1dd8cb
commit 1f68e40c77
17 changed files with 162 additions and 37 deletions

View File

@@ -70,8 +70,8 @@
<prefixSet>set</prefixSet> <prefixSet>set</prefixSet>
<prefixVariable>m_,_</prefixVariable> <prefixVariable>m_,_</prefixVariable>
<parameterName>theValue</parameterName> <parameterName>theValue</parameterName>
<inlineGet>true</inlineGet> <inlineGet>false</inlineGet>
<inlineSet>true</inlineSet> <inlineSet>false</inlineSet>
</creategettersetter> </creategettersetter>
<splitheadersource> <splitheadersource>
<enabled>false</enabled> <enabled>false</enabled>

Binary file not shown.

View File

@@ -1,7 +1,7 @@
<?xml version = '1.0' encoding = 'UTF-8'?> <?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE KDevPrjSession> <!DOCTYPE KDevPrjSession>
<KDevPrjSession> <KDevPrjSession>
<DocsAndViews NumberOfDocuments="19" > <DocsAndViews NumberOfDocuments="23" >
<Doc0 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homoefielditem.cpp" > <Doc0 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homoefielditem.cpp" >
<View0 Encoding="" Type="Source" /> <View0 Encoding="" Type="Source" />
</Doc0> </Doc0>
@@ -12,7 +12,7 @@
<View0 Encoding="" Type="Source" /> <View0 Encoding="" Type="Source" />
</Doc2> </Doc2>
<Doc3 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.cpp" > <Doc3 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.cpp" >
<View0 Encoding="" Type="Source" /> <View0 Encoding="UTF-8" Type="Source" />
</Doc3> </Doc3>
<Doc4 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/constants.h" > <Doc4 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/constants.h" >
<View0 Encoding="" Type="Source" /> <View0 Encoding="" Type="Source" />
@@ -21,7 +21,7 @@
<View0 Encoding="" Type="Source" /> <View0 Encoding="" Type="Source" />
</Doc5> </Doc5>
<Doc6 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/lsim.cpp" > <Doc6 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/lsim.cpp" >
<View0 Encoding="" Type="Source" /> <View0 Encoding="" line="171" Type="Source" />
</Doc6> </Doc6>
<Doc7 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.h" > <Doc7 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.h" >
<View0 Encoding="" Type="Source" /> <View0 Encoding="" Type="Source" />
@@ -48,17 +48,29 @@
<View0 Encoding="" Type="Source" /> <View0 Encoding="" Type="Source" />
</Doc14> </Doc14>
<Doc15 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/expdoublespinbox.cpp" > <Doc15 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/expdoublespinbox.cpp" >
<View0 Encoding="" Type="Source" /> <View0 Encoding="" line="110" Type="Source" />
</Doc15> </Doc15>
<Doc16 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/fielditem.h" > <Doc16 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/fielditem.h" >
<View0 Encoding="" Type="Source" /> <View0 Encoding="" Type="Source" />
</Doc16> </Doc16>
<Doc17 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/fielditem.cpp" > <Doc17 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/fielditem.cpp" >
<View0 Encoding="" line="48" Type="Source" /> <View0 Encoding="" Type="Source" />
</Doc17> </Doc17>
<Doc18 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homobfieldwidget.cpp" > <Doc18 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homobfieldwidget.cpp" >
<View0 Encoding="" line="86" Type="Source" /> <View0 Encoding="" Type="Source" />
</Doc18> </Doc18>
<Doc19 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homobfielditem.h" >
<View0 Encoding="" Type="Source" />
</Doc19>
<Doc20 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homobfieldwidget.h" >
<View0 Encoding="" Type="Source" />
</Doc20>
<Doc21 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/graphicsview.cpp" >
<View0 Encoding="" line="4" Type="Source" />
</Doc21>
<Doc22 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/expdoublespinbox.h" >
<View0 Encoding="" line="49" Type="Source" />
</Doc22>
</DocsAndViews> </DocsAndViews>
<pluginList> <pluginList>
<kdevdebugger> <kdevdebugger>

View File

@@ -29,6 +29,7 @@ ExpDoubleSpinBox::ExpDoubleSpinBox()
: QDoubleSpinBox() { : QDoubleSpinBox() {
setPositiveExp(4); setPositiveExp(4);
setNegativeExp(3); setNegativeExp(3);
setDisplayDecimals(decimals());
} }
@@ -44,14 +45,14 @@ QString ExpDoubleSpinBox::textFromValue ( double val ) const {
//qDebug() << val; //qDebug() << val;
if((val < pow(10,getPositiveExp()) && val > 1) || (val > -pow(10,getPositiveExp()) && val < -1) || val == 0) { if((val < pow(10,getPositiveExp()) && val > 1) || (val > -pow(10,getPositiveExp()) && val < -1) || val == 0) {
//return QDoubleSpinBox::textFromValue ( val ); //return QDoubleSpinBox::textFromValue ( val );
return QString("%L1").arg(val,0,'f',decimals()); return QString("%L1").arg(val,0,'f',getDisplayDecimals());
} }
else if ( (val >= pow(10, -getNegativeExp()) && val <= 1 ) || (val <= -pow(10, -getNegativeExp()) && val >= -1 ) ){ else if ( (val >= pow(10, -getNegativeExp()) && val <= 1 ) || (val <= -pow(10, -getNegativeExp()) && val >= -1 ) ){
//return QDoubleSpinBox::textFromValue ( val ); //return QDoubleSpinBox::textFromValue ( val );
return QString("%L1").arg(val,0,'f',decimals()); return QString("%L1").arg(val,0,'f',getDisplayDecimals());
} }
else { else {
return QString("%L1").arg(val,0,'e',decimals()); return QString("%L1").arg(val,0,'e',getDisplayDecimals());
} }
//return QDoubleSpinBox::textFromValue ( val ); //return QDoubleSpinBox::textFromValue ( val );
} }
@@ -97,3 +98,16 @@ void ExpDoubleSpinBox::stepBy ( int steps ) {
} }
int ExpDoubleSpinBox::getDisplayDecimals() const {
return displayDecimals;
}
void ExpDoubleSpinBox::setDisplayDecimals ( int theValue ) {
if (displayDecimals == theValue) return;
//Nicht mehr anzeigen, als die gneauigkeit zulaesst
if (theValue > decimals()) theValue = decimals();
displayDecimals = theValue;
}

View File

@@ -40,21 +40,25 @@ class ExpDoubleSpinBox : public QDoubleSpinBox {
virtual QValidator::State validate ( QString & input, int & pos ) const; virtual QValidator::State validate ( QString & input, int & pos ) const;
virtual void stepBy ( int steps ); virtual void stepBy ( int steps );
///welche kommastelle soll noch ohne exponentialdarstellungen dargestellt werden
void setNegativeExp (int exponent); void setNegativeExp (int exponent);
///welche kommastelle soll noch ohne exponentialdarstellungen dargestellt werden
const int getNegativeExp () const; const int getNegativeExp () const;
///ab welchem positiven exponenten soll exponentialdarstellung benutzt werden
void setPositiveExp (int exponent); void setPositiveExp (int exponent);
///ab welchem positiven exponenten soll exponentialdarstellung benutzt werden
const int getPositiveExp () const; const int getPositiveExp () const;
void setDisplayDecimals ( int theValue );
int getDisplayDecimals() const;
protected: protected:
virtual QDoubleSpinBox::StepEnabled stepEnabled () const; virtual QDoubleSpinBox::StepEnabled stepEnabled () const;
private: private:
///welche kommastelle soll noch ohne exponentialdarstellungen dargestellt werden
int negativeExp; int negativeExp;
///ab welchem positiven exponenten soll exponentialdarstellung benutzt werden
int positiveExp; int positiveExp;
///Wie viele Decimals sollen angezeigt werden (default: displayDecimals=decimals default)
int displayDecimals;
}; };
#endif #endif

View File

@@ -20,6 +20,7 @@
#include "fielditem.h" #include "fielditem.h"
#include "homoefielditem.h" #include "homoefielditem.h"
#include "homobfielditem.h" #include "homobfielditem.h"
#include <QGraphicsSceneWheelEvent>
#include <QDebug> #include <QDebug>
FieldItem::FieldItem() FieldItem::FieldItem()
@@ -122,6 +123,14 @@ QRectF FieldItem::rect() const {
return getRectF(); return getRectF();
} }
void FieldItem::wheelEvent(QGraphicsSceneWheelEvent * event) {
if (event->modifiers() == Qt::ShiftModifier) {
setRotation(getRotation()+( (event->delta()/abs(event->delta()))) );
}
else if (event->modifiers() == Qt::ControlModifier) {
setRotation(getRotation()+( (event->delta()/abs(event->delta()))*5 ));
}
}
/*! /*!
\fn FieldItem::getRotation() \fn FieldItem::getRotation()

View File

@@ -28,6 +28,7 @@
@author Peter Dahlberg <pdahlberg@gmail.com> @author Peter Dahlberg <pdahlberg@gmail.com>
*/ */
class QPointF; class QPointF;
class QGraphicsSceneWheelEvent;
class FieldItem :public QObject, public QGraphicsItem { class FieldItem :public QObject, public QGraphicsItem {
Q_OBJECT Q_OBJECT
public: public:
@@ -55,7 +56,7 @@ class FieldItem :public QObject, public QGraphicsItem {
int getRotation(); int getRotation();
protected: protected:
virtual void wheelEvent(QGraphicsSceneWheelEvent * event);
QPointF myScenePos; QPointF myScenePos;
int myRotation; int myRotation;
QRectF sizeRect; QRectF sizeRect;

View File

@@ -128,10 +128,11 @@ double GraphicsEllipseItem::getMasse(double speed) {
void GraphicsEllipseItem::setMasse ( const double& theValue ) { void GraphicsEllipseItem::setMasse ( const double& theValue ) {
if (masse == theValue) return; if (masse == theValue) return;
masse = theValue; masse = theValue;
emit masseChanged(theValue);
} }
long double GraphicsEllipseItem::getCharge() const { double GraphicsEllipseItem::getCharge() const {
return charge; return charge;
} }
@@ -139,6 +140,7 @@ long double GraphicsEllipseItem::getCharge() const {
void GraphicsEllipseItem::setCharge ( const long double& theValue ) { void GraphicsEllipseItem::setCharge ( const long double& theValue ) {
if (charge == theValue) return; if (charge == theValue) return;
charge = theValue; charge = theValue;
emit chargeChanged(theValue);
} }
QWidget * GraphicsEllipseItem::getDockWidget() const QWidget * GraphicsEllipseItem::getDockWidget() const
@@ -149,3 +151,26 @@ QWidget * GraphicsEllipseItem::getDockWidget() const
QList<QPointF> * GraphicsEllipseItem::getCurrProbePath() { QList<QPointF> * GraphicsEllipseItem::getCurrProbePath() {
return currProbePath; return currProbePath;
} }
double GraphicsEllipseItem::getStartSpeedX() const {
return startSpeedX;
}
void GraphicsEllipseItem::setStartSpeedX ( double theValue ) {
if (startSpeedX == theValue) return;
startSpeedX = theValue;
emit startSpeedXChanged(theValue);
}
double GraphicsEllipseItem::getStartSpeedY() const {
return startSpeedY;
}
void GraphicsEllipseItem::setStartSpeedY ( double theValue ) {
if (startSpeedY == theValue) return;
startSpeedY = theValue;
emit startSpeedYChanged(theValue);
}

View File

@@ -21,12 +21,15 @@
#define GRAPHICSELLIPSEITEM_H #define GRAPHICSELLIPSEITEM_H
#include <QGraphicsEllipseItem> #include <QGraphicsEllipseItem>
#include <QObject>
class ProbeChargeWidget; class ProbeChargeWidget;
/** /**
@author Peter Dahlberg <pdahlberg@gmail.com> @author Peter Dahlberg <pdahlberg@gmail.com>
*/ */
class GraphicsEllipseItem : public QObject , public QGraphicsEllipseItem { class GraphicsEllipseItem : public QObject , public QGraphicsEllipseItem {
Q_OBJECT
public: public:
GraphicsEllipseItem(); GraphicsEllipseItem();
QWidget* getDockWidget() const; QWidget* getDockWidget() const;
@@ -34,6 +37,16 @@ class GraphicsEllipseItem : public QObject , public QGraphicsEllipseItem {
~GraphicsEllipseItem(); ~GraphicsEllipseItem();
QList<QPointF> * getCurrProbePath(); QList<QPointF> * getCurrProbePath();
double getCharge() const;
double getStartSpeedX() const;
double getStartSpeedY() const;
//! Gibt die Masse zur&uuml;ck
/*!
\param speed alles != 0 relativistisch
*/
double getMasse(double speed);
@@ -53,6 +66,10 @@ class GraphicsEllipseItem : public QObject , public QGraphicsEllipseItem {
double charge; double charge;
///Zugeordnetes Probe Charge Widget ///Zugeordnetes Probe Charge Widget
ProbeChargeWidget* myProbeChargeWidget; ProbeChargeWidget* myProbeChargeWidget;
///Startgeschwindigkeit des teilchens in x-Richtung
double startSpeedX;
///Startgeschwindigkeit des teilchens in y-Richtung
double startSpeedY;
public slots: public slots:
@@ -64,16 +81,20 @@ class GraphicsEllipseItem : public QObject , public QGraphicsEllipseItem {
void setMasse ( const double& theValue ); void setMasse ( const double& theValue );
//! Gibt die Masse zur&uuml;ck
/*!
\param speed alles != 0 relativistisch
*/
double getMasse(double speed);
void setCharge ( const long double& theValue ); void setCharge ( const long double& theValue );
void setStartSpeedX ( double theValue );
void setStartSpeedY ( double theValue );
signals:
void startSpeedXChanged(double speed);
void startSpeedYChanged(double speed);
void masseChanged(double masse);
void chargeChanged(double Charge);
long double getCharge() const;
}; };

View File

@@ -23,6 +23,7 @@
#include <QPainter> #include <QPainter>
#include <QWidget> #include <QWidget>
#include <QtDebug> #include <QtDebug>
#include <QGraphicsSceneWheelEvent>
HomoBFieldItem::HomoBFieldItem(QRectF sizeRect): FieldItem() { HomoBFieldItem::HomoBFieldItem(QRectF sizeRect): FieldItem() {
setRectF(sizeRect); setRectF(sizeRect);
@@ -189,3 +190,13 @@ void HomoBFieldItem::setFluxDensity ( double theValue ) {
fluxDensity = theValue; fluxDensity = theValue;
emit fluxDensityChanged(theValue); emit fluxDensityChanged(theValue);
} }
/*!
\fn HomoBFieldItem::wheelEvent ( QGraphicsSceneWheelEvent * event )
*/
void HomoBFieldItem::wheelEvent ( QGraphicsSceneWheelEvent * event )
{
event->ignore();
}

View File

@@ -76,6 +76,8 @@ class HomoBFieldItem : public FieldItem {
protected:
void wheelEvent ( QGraphicsSceneWheelEvent * event );
}; };
#endif #endif

View File

@@ -37,11 +37,13 @@ void HomoBFieldWidget::createWidget() {
QDoubleSpinBox *heightBox = new QDoubleSpinBox; QDoubleSpinBox *heightBox = new QDoubleSpinBox;
heightBox->setRange(HomoBFieldItem::MinimumHeight, 5000); heightBox->setRange(HomoBFieldItem::MinimumHeight, 5000);
heightBox->setKeyboardTracking(false);
connect(homoBField ,SIGNAL(heightChanged(double)), heightBox, SLOT(setValue(double)) ); connect(homoBField ,SIGNAL(heightChanged(double)), heightBox, SLOT(setValue(double)) );
connect(heightBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setRectFHeight(double)) ); connect(heightBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setRectFHeight(double)) );
QDoubleSpinBox *widthBox = new QDoubleSpinBox; QDoubleSpinBox *widthBox = new QDoubleSpinBox;
widthBox->setRange(HomoBFieldItem::MinimumWidth, 5000); widthBox->setRange(HomoBFieldItem::MinimumWidth, 5000);
widthBox->setKeyboardTracking(false);
connect(homoBField ,SIGNAL(widthChanged(double)),widthBox, SLOT(setValue(double)) ); connect(homoBField ,SIGNAL(widthChanged(double)),widthBox, SLOT(setValue(double)) );
connect(widthBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setRectFWidth(double)) ); connect(widthBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setRectFWidth(double)) );
@@ -52,11 +54,13 @@ void HomoBFieldWidget::createWidget() {
QDoubleSpinBox *posXBox = new QDoubleSpinBox; QDoubleSpinBox *posXBox = new QDoubleSpinBox;
posXBox->setRange(-5000, 5000); posXBox->setRange(-5000, 5000);
posXBox->setKeyboardTracking(false);
connect(homoBField ,SIGNAL(ScenePosXChanged(double)),posXBox, SLOT(setValue(double)) ); connect(homoBField ,SIGNAL(ScenePosXChanged(double)),posXBox, SLOT(setValue(double)) );
connect(posXBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setScenePosX(double)) ); connect(posXBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setScenePosX(double)) );
QDoubleSpinBox *posYBox = new QDoubleSpinBox; QDoubleSpinBox *posYBox = new QDoubleSpinBox;
posYBox->setRange(-5000, 5000); posYBox->setRange(-5000, 5000);
posYBox->setKeyboardTracking(false);
connect(homoBField ,SIGNAL(ScenePosYChanged(double)),posYBox, SLOT(setValue(double)) ); connect(homoBField ,SIGNAL(ScenePosYChanged(double)),posYBox, SLOT(setValue(double)) );
connect(posYBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setScenePosY(double)) ); connect(posYBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setScenePosY(double)) );
@@ -82,6 +86,9 @@ void HomoBFieldWidget::createWidget() {
ExpDoubleSpinBox* fieldFluxDensityBox = new ExpDoubleSpinBox; ExpDoubleSpinBox* fieldFluxDensityBox = new ExpDoubleSpinBox;
fieldFluxDensityBox->setRange(-1e+200,1e+200); fieldFluxDensityBox->setRange(-1e+200,1e+200);
fieldFluxDensityBox->setDecimals(40);
fieldFluxDensityBox->setDisplayDecimals(2);
fieldFluxDensityBox->setKeyboardTracking(false);
connect(homoBField ,SIGNAL(fluxDensityChanged(double)),fieldFluxDensityBox, SLOT(setValue(double)) ); connect(homoBField ,SIGNAL(fluxDensityChanged(double)),fieldFluxDensityBox, SLOT(setValue(double)) );
connect(fieldFluxDensityBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setFluxDensity(double)) ); connect(fieldFluxDensityBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setFluxDensity(double)) );

View File

@@ -44,19 +44,16 @@ HomoEFieldWidget::~HomoEFieldWidget() {
*/ */
void HomoEFieldWidget::createWidget() void HomoEFieldWidget::createWidget()
{ {
QDial *rotationDial = new QDial;
rotationDial->setRange(0,359);
rotationDial->setNotchesVisible(true);
rotationDial->setWrapping(true);
QDoubleSpinBox *heightBox = new QDoubleSpinBox; QDoubleSpinBox *heightBox = new QDoubleSpinBox;
heightBox->setRange(HomoEFieldItem::MinimumHeight, 5000); heightBox->setRange(HomoEFieldItem::MinimumHeight, 5000);
heightBox->setKeyboardTracking(false);
connect(homoEField ,SIGNAL(heightChanged(double)), heightBox, SLOT(setValue(double)) ); connect(homoEField ,SIGNAL(heightChanged(double)), heightBox, SLOT(setValue(double)) );
connect(heightBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setRectFHeight(double)) ); connect(heightBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setRectFHeight(double)) );
QDoubleSpinBox *widthBox = new QDoubleSpinBox; QDoubleSpinBox *widthBox = new QDoubleSpinBox;
widthBox->setRange(HomoEFieldItem::MinimumWidth, 5000); widthBox->setRange(HomoEFieldItem::MinimumWidth, 5000);
widthBox->setKeyboardTracking(false);
connect(homoEField ,SIGNAL(widthChanged(double)),widthBox, SLOT(setValue(double)) ); connect(homoEField ,SIGNAL(widthChanged(double)),widthBox, SLOT(setValue(double)) );
connect(widthBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setRectFWidth(double)) ); connect(widthBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setRectFWidth(double)) );
@@ -68,11 +65,13 @@ void HomoEFieldWidget::createWidget()
QDoubleSpinBox *posXBox = new QDoubleSpinBox; QDoubleSpinBox *posXBox = new QDoubleSpinBox;
posXBox->setRange(-5000, 5000); posXBox->setRange(-5000, 5000);
posXBox->setKeyboardTracking(false);
connect(homoEField ,SIGNAL(ScenePosXChanged(double)),posXBox, SLOT(setValue(double)) ); connect(homoEField ,SIGNAL(ScenePosXChanged(double)),posXBox, SLOT(setValue(double)) );
connect(posXBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setScenePosX(double)) ); connect(posXBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setScenePosX(double)) );
QDoubleSpinBox *posYBox = new QDoubleSpinBox; QDoubleSpinBox *posYBox = new QDoubleSpinBox;
posYBox->setRange(-5000, 5000); posYBox->setRange(-5000, 5000);
posYBox->setKeyboardTracking(false);
connect(homoEField ,SIGNAL(ScenePosYChanged(double)),posYBox, SLOT(setValue(double)) ); connect(homoEField ,SIGNAL(ScenePosYChanged(double)),posYBox, SLOT(setValue(double)) );
connect(posYBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setScenePosY(double)) ); connect(posYBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setScenePosY(double)) );
@@ -80,10 +79,10 @@ void HomoEFieldWidget::createWidget()
rotationBox->setRange(0,359); rotationBox->setRange(0,359);
rotationBox->setSuffix("\260"); rotationBox->setSuffix("\260");
rotationBox->setWrapping(true); rotationBox->setWrapping(true);
connect(rotationDial, SIGNAL(valueChanged(int)),rotationBox ,SIGNAL(valueChanged(int)) ); rotationBox->setKeyboardTracking(false);
connect(rotationDial, SIGNAL(valueChanged(int)),rotationBox,SLOT(setValue(int)) );
connect(rotationBox, SIGNAL(valueChanged(int)),homoEField ,SLOT(setRotation(int)) ); connect(rotationBox, SIGNAL(valueChanged(int)),homoEField ,SLOT(setRotation(int)) );
connect(rotationBox, SIGNAL(valueChanged(int)),rotationDial ,SLOT(setValue(int)) ); connect(homoEField, SIGNAL(rotationChanged(int)),rotationBox ,SLOT(setValue(int)) );
QGridLayout* geomGridLayout = new QGridLayout; QGridLayout* geomGridLayout = new QGridLayout;
@@ -110,11 +109,17 @@ void HomoEFieldWidget::createWidget()
ExpDoubleSpinBox* fieldPowerBox = new ExpDoubleSpinBox; ExpDoubleSpinBox* fieldPowerBox = new ExpDoubleSpinBox;
fieldPowerBox->setRange(-1e+200,1e+200); fieldPowerBox->setRange(-1e+200,1e+200);
fieldPowerBox->setDecimals(35);
fieldPowerBox->setDisplayDecimals(3);
fieldPowerBox->setKeyboardTracking(false);
connect(homoEField ,SIGNAL(fieldPowerChanged(double)),fieldPowerBox, SLOT(setValue(double)) ); connect(homoEField ,SIGNAL(fieldPowerChanged(double)),fieldPowerBox, SLOT(setValue(double)) );
connect(fieldPowerBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setFieldPower(double)) ); connect(fieldPowerBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setFieldPower(double)) );
ExpDoubleSpinBox* voltageBox = new ExpDoubleSpinBox; ExpDoubleSpinBox* voltageBox = new ExpDoubleSpinBox;
voltageBox->setRange(-1e+200,1e+200); voltageBox->setRange(-1e+200,1e+200);
fieldPowerBox->setDecimals(35);
fieldPowerBox->setDisplayDecimals(3);
voltageBox->setKeyboardTracking(false);
QGridLayout* constGridLayout = new QGridLayout; QGridLayout* constGridLayout = new QGridLayout;
//constGridLayout->setSizeConstraint(QLayout::SetFixedSize); //constGridLayout->setSizeConstraint(QLayout::SetFixedSize);

View File

@@ -82,6 +82,10 @@ void lsim::createActions() {
acts.timerStart->setStatusTip (tr ("Timer starten")); acts.timerStart->setStatusTip (tr ("Timer starten"));
connect (acts.timerStart, SIGNAL (triggered()), simulscene, SLOT (startTimer())); connect (acts.timerStart, SIGNAL (triggered()), simulscene, SLOT (startTimer()));
acts.timerStop = new QAction (tr ("Timer Stop"), this);
acts.timerStop->setStatusTip (tr ("Timer stoppen"));
connect (acts.timerStop, SIGNAL (triggered()), simulscene, SLOT (stopTimer()));
acts.exitAct = new QAction (tr ("Beenden"), this); acts.exitAct = new QAction (tr ("Beenden"), this);
acts.exitAct->setStatusTip (tr ("Die Anwendung beenden")); acts.exitAct->setStatusTip (tr ("Die Anwendung beenden"));
connect (acts.exitAct, SIGNAL (triggered()), qApp, SLOT (quit())); connect (acts.exitAct, SIGNAL (triggered()), qApp, SLOT (quit()));
@@ -136,6 +140,7 @@ void lsim::createToolBars() {
editToolBar = addToolBar (tr ("Edit")); editToolBar = addToolBar (tr ("Edit"));
editToolBar->addAction(acts.timerStart); editToolBar->addAction(acts.timerStart);
editToolBar->addAction(acts.timerStop);
editToolBar->addSeparator(); editToolBar->addSeparator();
editToolBar->addAction(acts.itemEditModeAct); editToolBar->addAction(acts.itemEditModeAct);
editToolBar->addAction(acts.insertEFieldItemAct); editToolBar->addAction(acts.insertEFieldItemAct);
@@ -157,8 +162,9 @@ void lsim::createDocks() {
ExpDoubleSpinBox *time_step_box = new ExpDoubleSpinBox; ExpDoubleSpinBox *time_step_box = new ExpDoubleSpinBox;
time_step_box->setRange(-pow(10,33), pow(10,33)); time_step_box->setRange(-pow(10,66), pow(10,66));
time_step_box->setDecimals(30); time_step_box->setDecimals(30);
time_step_box->setDisplayDecimals(10);
time_step_box->setKeyboardTracking(false); time_step_box->setKeyboardTracking(false);
time_step_box->setValue(simulscene->getTimePerStep()); time_step_box->setValue(simulscene->getTimePerStep());
@@ -167,8 +173,9 @@ void lsim::createDocks() {
ExpDoubleSpinBox *meter_per_px_box = new ExpDoubleSpinBox; ExpDoubleSpinBox *meter_per_px_box = new ExpDoubleSpinBox;
meter_per_px_box->setRange(-pow(10,33), pow(10,33)); meter_per_px_box->setRange(-pow(10,66), pow(10,66));
meter_per_px_box->setDecimals(30); meter_per_px_box->setDecimals(30);
meter_per_px_box->setDisplayDecimals(10);
meter_per_px_box->setKeyboardTracking(false); meter_per_px_box->setKeyboardTracking(false);
meter_per_px_box->setValue(simulscene->getMeterPerPx()); meter_per_px_box->setValue(simulscene->getMeterPerPx());
connect(meter_per_px_box, SIGNAL(valueChanged(double)),simulscene, SLOT(setMeterPerPx(double))); connect(meter_per_px_box, SIGNAL(valueChanged(double)),simulscene, SLOT(setMeterPerPx(double)));

View File

@@ -79,6 +79,7 @@ class lsim: public QMainWindow {
QAction *oglEnable; QAction *oglEnable;
QAction *oglDisable; QAction *oglDisable;
QAction *timerStart; QAction *timerStart;
QAction *timerStop;
QAction *itemEditModeAct; QAction *itemEditModeAct;
QAction *insertEFieldItemAct; QAction *insertEFieldItemAct;

View File

@@ -93,6 +93,8 @@ SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) {
} }
void SimulScene::startTimer() { void SimulScene::startTimer() {
timer->setCurrentTime(0);
ani->clear();
for (int i=0; i<getSteps(); ++i) { for (int i=0; i<getSteps(); ++i) {
//ani->setPosAt(i/200.0, QPointF(x , 0.5 * ay * pow(( (x/1000) /vx),2) *1000 )); //ani->setPosAt(i/200.0, QPointF(x , 0.5 * ay * pow(( (x/1000) /vx),2) *1000 ));
ani->setPosAt(i/(double)getSteps(), ellipse1->getCurrProbePath()->at(i) ); ani->setPosAt(i/(double)getSteps(), ellipse1->getCurrProbePath()->at(i) );
@@ -100,6 +102,9 @@ void SimulScene::startTimer() {
} }
timer->start(); timer->start();
} }
void SimulScene::stopTimer() {
timer->stop();
}
void SimulScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) { void SimulScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) {
switch(myMode) { switch(myMode) {

View File

@@ -60,6 +60,7 @@ class SimulScene : public QGraphicsScene {
public slots: public slots:
void setSceneMode(SceneMode mode); void setSceneMode(SceneMode mode);
void startTimer(); void startTimer();
void stopTimer();
void deleteSelectedFieldItems(); void deleteSelectedFieldItems();
void setTimePerStep(double time); void setTimePerStep(double time);
///starte die Berechnung der teilchenbahn(en) ///starte die Berechnung der teilchenbahn(en)