2008-10-08 22:11:27 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
* Copyright (C) 2008 by Peter Dahlberg *
|
|
|
|
|
* pdahlberg@gmail.com *
|
|
|
|
|
* *
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
|
* (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
#include "probechargewidget.h"
|
|
|
|
|
#include "graphicsellipseitem.h"
|
|
|
|
|
#include "expdoublespinbox.h"
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
#include <QtDebug>
|
|
|
|
|
#include <QDial>
|
|
|
|
|
#include <QGroupBox>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
|
|
|
|
|
ProbeChargeWidget::ProbeChargeWidget ( QWidget* parent, Qt::WindowFlags f, GraphicsEllipseItem* ellipse ) : QWidget (parent, f ) {
|
2008-11-06 21:05:13 +00:00
|
|
|
ellipseItem = ellipse;
|
2008-10-08 22:11:27 +00:00
|
|
|
createWidget();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ProbeChargeWidget::~ProbeChargeWidget() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ProbeChargeWidget::createWidget()
|
|
|
|
|
{
|
|
|
|
|
QDial *rotationDial = new QDial;
|
|
|
|
|
rotationDial->setRange(0,359);
|
|
|
|
|
rotationDial->setNotchesVisible(true);
|
|
|
|
|
rotationDial->setWrapping(true);
|
|
|
|
|
|
|
|
|
|
|
2008-11-06 21:05:13 +00:00
|
|
|
ExpDoubleSpinBox *startSpeedYBox = new ExpDoubleSpinBox;
|
|
|
|
|
startSpeedYBox->setDecimals(50);
|
|
|
|
|
startSpeedYBox->setDisplayDecimals(3);
|
|
|
|
|
startSpeedYBox->setRange(-3e+8, 3e+8);
|
|
|
|
|
startSpeedYBox->setKeyboardTracking(false);
|
|
|
|
|
connect(startSpeedYBox, SIGNAL(valueChanged(double)), ellipseItem, SLOT(setStartSpeedY(double)) );
|
|
|
|
|
connect(ellipseItem, SIGNAL(startSpeedYChanged(double)), startSpeedYBox, SLOT(setValue(double)) );
|
2008-10-08 22:11:27 +00:00
|
|
|
|
2008-11-06 21:05:13 +00:00
|
|
|
ExpDoubleSpinBox *startSpeedXBox = new ExpDoubleSpinBox;
|
|
|
|
|
startSpeedXBox->setDecimals(50);
|
|
|
|
|
startSpeedXBox->setDisplayDecimals(3);
|
|
|
|
|
startSpeedXBox->setRange(-3e+8, 3e+8);
|
|
|
|
|
startSpeedXBox->setKeyboardTracking(false);
|
|
|
|
|
connect(startSpeedXBox, SIGNAL(valueChanged(double)), ellipseItem, SLOT(setStartSpeedX(double)) );
|
|
|
|
|
connect(ellipseItem, SIGNAL(startSpeedXChanged(double)), startSpeedXBox, SLOT(setValue(double)) );
|
2008-10-08 22:11:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QLabel* xLabel = new QLabel(tr("x:"));
|
|
|
|
|
QLabel* yLabel = new QLabel(tr("y:"));
|
2008-11-06 21:05:13 +00:00
|
|
|
QLabel* startSpeedYLabel = new QLabel(tr("Startgeschwindigkeit y:"));
|
|
|
|
|
QLabel* startSpeedXLabel = new QLabel(tr("Startgeschwindigkeit x:"));
|
2008-10-08 22:11:27 +00:00
|
|
|
|
|
|
|
|
QDoubleSpinBox *posXBox = new QDoubleSpinBox;
|
|
|
|
|
posXBox->setRange(-5000, 5000);
|
2008-11-06 21:05:13 +00:00
|
|
|
posXBox->setKeyboardTracking(false);
|
|
|
|
|
connect(posXBox, SIGNAL(valueChanged(double)), ellipseItem, SLOT(setScenePosX(double)) );
|
|
|
|
|
connect(ellipseItem, SIGNAL(ScenePosXChanged(double)), posXBox, SLOT(setValue(double)) );
|
2008-10-08 22:11:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
QDoubleSpinBox *posYBox = new QDoubleSpinBox;
|
|
|
|
|
posYBox->setRange(-5000, 5000);
|
2008-11-06 21:05:13 +00:00
|
|
|
posYBox->setKeyboardTracking(false);
|
|
|
|
|
connect(posYBox, SIGNAL(valueChanged(double)), ellipseItem, SLOT(setScenePosY(double)) );
|
|
|
|
|
connect(ellipseItem, SIGNAL(ScenePosYChanged(double)), posYBox, SLOT(setValue(double)) );
|
2008-10-08 22:11:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
QGridLayout* geomGridLayout = new QGridLayout;
|
|
|
|
|
//geomGridLayout->setSizeConstraint(QLayout::SetFixedSize);
|
|
|
|
|
|
2008-11-06 21:05:13 +00:00
|
|
|
geomGridLayout->addWidget(startSpeedYBox,4,1);
|
2008-10-08 22:11:27 +00:00
|
|
|
geomGridLayout->addWidget(posYBox,2,1);
|
|
|
|
|
geomGridLayout->addWidget(posXBox,1,1);
|
|
|
|
|
geomGridLayout->addWidget(xLabel,1,0,Qt::AlignRight);
|
|
|
|
|
geomGridLayout->addWidget(yLabel,2,0,Qt::AlignRight);
|
2008-11-06 21:05:13 +00:00
|
|
|
geomGridLayout->addWidget(startSpeedYLabel,4,0,Qt::AlignRight);
|
|
|
|
|
geomGridLayout->addWidget(startSpeedXLabel,3,0,Qt::AlignRight);
|
|
|
|
|
geomGridLayout->addWidget(startSpeedXBox,3,1);
|
2008-10-08 22:11:27 +00:00
|
|
|
//geomGridLayout->addWidget(rotationDial, 1,0,2,2);
|
|
|
|
|
|
|
|
|
|
QGroupBox* geometryBox = new QGroupBox(tr("Geometrie"));
|
|
|
|
|
geometryBox->setLayout(geomGridLayout);
|
|
|
|
|
|
|
|
|
|
|
2008-11-06 21:05:13 +00:00
|
|
|
QLabel* chargeLabel = new QLabel(tr("Ladung:"));
|
|
|
|
|
QLabel* masseLabel = new QLabel(tr("Masse:"));
|
2008-10-08 22:11:27 +00:00
|
|
|
|
2008-11-06 21:05:13 +00:00
|
|
|
ExpDoubleSpinBox* chargeBox = new ExpDoubleSpinBox;
|
|
|
|
|
chargeBox->setRange(-1e+200,1e+200);
|
|
|
|
|
chargeBox->setDecimals(50);
|
|
|
|
|
chargeBox->setDisplayDecimals(3);
|
|
|
|
|
chargeBox->setKeyboardTracking(false);
|
|
|
|
|
chargeBox->setSuffix(" As");
|
|
|
|
|
connect(chargeBox, SIGNAL(valueChanged(double)), ellipseItem, SLOT(setCharge(double)) );
|
|
|
|
|
connect(ellipseItem, SIGNAL(chargeChanged(double)), chargeBox, SLOT(setValue(double)) );
|
2008-10-08 22:11:27 +00:00
|
|
|
|
|
|
|
|
|
2008-11-06 21:05:13 +00:00
|
|
|
ExpDoubleSpinBox* masseBox = new ExpDoubleSpinBox;
|
2008-11-11 20:31:04 +00:00
|
|
|
masseBox->setRange(0,1e+200);
|
2008-11-06 21:05:13 +00:00
|
|
|
masseBox->setDecimals(50);
|
|
|
|
|
masseBox->setDisplayDecimals(3);
|
|
|
|
|
masseBox->setKeyboardTracking(false);
|
|
|
|
|
masseBox->setSuffix(" kg");
|
|
|
|
|
connect(masseBox, SIGNAL(valueChanged(double)), ellipseItem, SLOT(setMasse(double)) );
|
|
|
|
|
connect(ellipseItem, SIGNAL(masseChanged(double)), masseBox, SLOT(setValue(double)) );
|
2008-10-08 22:11:27 +00:00
|
|
|
|
|
|
|
|
QGridLayout* constGridLayout = new QGridLayout;
|
|
|
|
|
//constGridLayout->setSizeConstraint(QLayout::SetFixedSize);
|
2008-11-06 21:05:13 +00:00
|
|
|
constGridLayout->addWidget(chargeBox,0,1);
|
|
|
|
|
constGridLayout->addWidget(masseBox,1,1);
|
|
|
|
|
constGridLayout->addWidget(chargeLabel,0,0,Qt::AlignRight);
|
|
|
|
|
constGridLayout->addWidget(masseLabel,1,0,Qt::AlignRight);
|
2008-10-08 22:11:27 +00:00
|
|
|
|
2008-11-06 21:05:13 +00:00
|
|
|
QGroupBox* fieldConstantsBox = new QGroupBox(tr("Konstanten"));
|
2008-10-08 22:11:27 +00:00
|
|
|
fieldConstantsBox->setLayout(constGridLayout);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QVBoxLayout * mainLayout = new QVBoxLayout(this);
|
|
|
|
|
mainLayout -> addWidget(geometryBox);
|
|
|
|
|
mainLayout -> addWidget(fieldConstantsBox);
|
|
|
|
|
mainLayout -> addStretch();
|
|
|
|
|
|
|
|
|
|
QWidget::setTabOrder (posXBox, posYBox);
|
2008-11-06 21:05:13 +00:00
|
|
|
QWidget::setTabOrder (posYBox, startSpeedYBox);
|
|
|
|
|
QWidget::setTabOrder (startSpeedYBox, startSpeedXBox);
|
2008-10-08 22:11:27 +00:00
|
|
|
|
|
|
|
|
this -> setLayout(mainLayout);
|
|
|
|
|
}
|