Files
lsim/src/homoefieldwidget.cpp
catdog2 83c70690e0 so aenderungen
git-svn-id: http://svn.lsim.tuxzone.org/trunk@30 4bec179b-ab65-46ed-a5f8-55b8b5c735d0
2008-12-10 14:02:51 +00:00

140 lines
5.6 KiB
C++

/***************************************************************************
* 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 "homoefieldwidget.h"
#include "homoefielditem.h"
#include "expdoublespinbox.h"
#include <QVBoxLayout>
#include <QtDebug>
#include <QDial>
#include <QGroupBox>
#include <QLabel>
HomoEFieldWidget::HomoEFieldWidget ( QWidget* parent, Qt::WindowFlags f, HomoEFieldItem* eField ) : QWidget ( parent, f ) {
homoEField = eField;
createWidget();
}
HomoEFieldWidget::~HomoEFieldWidget() {
}
/*!
\fn HomoEFieldWidget::createWidget()
*/
void HomoEFieldWidget::createWidget()
{
QDoubleSpinBox *heightBox = new QDoubleSpinBox;
heightBox->setRange(HomoEFieldItem::MinimumHeight, 5000);
heightBox->setKeyboardTracking(false);
connect(homoEField ,SIGNAL(heightChanged(double)), heightBox, SLOT(setValue(double)) );
connect(heightBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setRectFHeight(double)) );
QDoubleSpinBox *widthBox = new QDoubleSpinBox;
widthBox->setRange(HomoEFieldItem::MinimumWidth, 5000);
widthBox->setKeyboardTracking(false);
connect(homoEField ,SIGNAL(widthChanged(double)),widthBox, SLOT(setValue(double)) );
connect(widthBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setRectFWidth(double)) );
QLabel* xLabel = new QLabel(tr("x:"));
QLabel* yLabel = new QLabel(tr("y:"));
QLabel* widthLabel = new QLabel(tr("Breite(l):"));
QLabel* heightLabel = new QLabel(tr("H\366he(d):"));
QLabel* rotationLabel = new QLabel(tr("Rotation:"));
QDoubleSpinBox *posXBox = new QDoubleSpinBox;
posXBox->setRange(-5000, 5000);
posXBox->setKeyboardTracking(false);
connect(homoEField ,SIGNAL(ScenePosXChanged(double)),posXBox, SLOT(setValue(double)) );
connect(posXBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setScenePosX(double)) );
QDoubleSpinBox *posYBox = new QDoubleSpinBox;
posYBox->setRange(-5000, 5000);
posYBox->setKeyboardTracking(false);
connect(homoEField ,SIGNAL(ScenePosYChanged(double)),posYBox, SLOT(setValue(double)) );
connect(posYBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setScenePosY(double)) );
QSpinBox* rotationBox = new QSpinBox;
rotationBox->setRange(0,359);
rotationBox->setSuffix("\260");
rotationBox->setWrapping(true);
rotationBox->setKeyboardTracking(false);
connect(rotationBox, SIGNAL(valueChanged(int)),homoEField ,SLOT(setRotation(int)) );
connect(homoEField, SIGNAL(rotationChanged(int)),rotationBox ,SLOT(setValue(int)) );
QGridLayout* geomGridLayout = new QGridLayout;
//geomGridLayout->setSizeConstraint(QLayout::SetFixedSize);
geomGridLayout->addWidget(heightBox,4,1);
geomGridLayout->addWidget(rotationBox,0,1);
geomGridLayout->addWidget(posYBox,2,1);
geomGridLayout->addWidget(posXBox,1,1);
geomGridLayout->addWidget(xLabel,1,0,Qt::AlignRight);
geomGridLayout->addWidget(yLabel,2,0,Qt::AlignRight);
geomGridLayout->addWidget(heightLabel,4,0,Qt::AlignRight);
geomGridLayout->addWidget(widthLabel,3,0,Qt::AlignRight);
geomGridLayout->addWidget(rotationLabel,0,0,Qt::AlignRight);
geomGridLayout->addWidget(widthBox,3,1);
//geomGridLayout->addWidget(rotationDial, 1,0,2,2);
QGroupBox* geometryBox = new QGroupBox(tr("Geometrie"));
geometryBox->setLayout(geomGridLayout);
QLabel* fieldPowerLabel = new QLabel(tr("Feldst\344rke(E):"));
ExpDoubleSpinBox* fieldPowerBox = new ExpDoubleSpinBox;
fieldPowerBox->setRange(0,1e+200);
fieldPowerBox->setDecimals(35);
fieldPowerBox->setDisplayDecimals(3);
fieldPowerBox->setKeyboardTracking(false);
fieldPowerBox->setSuffix(" V/m");
connect(homoEField ,SIGNAL(fieldPowerChanged(double)),fieldPowerBox, SLOT(setValue(double)) );
connect(fieldPowerBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setFieldPower(double)) );
QGridLayout* constGridLayout = new QGridLayout;
//constGridLayout->setSizeConstraint(QLayout::SetFixedSize);
constGridLayout->addWidget(fieldPowerBox,0,1);
constGridLayout->addWidget(fieldPowerLabel,0,0,Qt::AlignRight);
QGroupBox* fieldConstantsBox = new QGroupBox(tr("Feldkonstanten"));
fieldConstantsBox->setLayout(constGridLayout);
QVBoxLayout * mainLayout = new QVBoxLayout(this);
mainLayout -> addWidget(geometryBox);
mainLayout -> addWidget(fieldConstantsBox);
mainLayout -> addStretch();
QWidget::setTabOrder (rotationBox, posXBox);
QWidget::setTabOrder (posXBox, posYBox);
QWidget::setTabOrder (posYBox, widthBox);
QWidget::setTabOrder (widthBox, heightBox);
this -> setLayout(mainLayout);
}