2008-10-15 18:25:06 +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 "homobfieldwidget.h"
|
|
|
|
|
#include "homobfielditem.h"
|
2008-11-16 22:18:15 +00:00
|
|
|
#include "simulscene.h"
|
2008-10-15 18:25:06 +00:00
|
|
|
#include "expdoublespinbox.h"
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
#include <QtDebug>
|
|
|
|
|
#include <QDial>
|
|
|
|
|
#include <QGroupBox>
|
|
|
|
|
#include <QLabel>
|
2008-10-15 20:23:41 +00:00
|
|
|
#include <QRadioButton>
|
|
|
|
|
#include <QButtonGroup>
|
2008-11-16 22:18:15 +00:00
|
|
|
#include <QPushButton>
|
2008-10-15 18:25:06 +00:00
|
|
|
HomoBFieldWidget::HomoBFieldWidget(QWidget* parent, Qt::WindowFlags f, HomoBFieldItem* bField):QWidget(parent, f) {
|
|
|
|
|
|
|
|
|
|
homoBField = bField;
|
|
|
|
|
createWidget();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void HomoBFieldWidget::createWidget() {
|
|
|
|
|
|
|
|
|
|
QDoubleSpinBox *heightBox = new QDoubleSpinBox;
|
|
|
|
|
heightBox->setRange(HomoBFieldItem::MinimumHeight, 5000);
|
2008-11-02 20:34:58 +00:00
|
|
|
heightBox->setKeyboardTracking(false);
|
2008-10-15 18:25:06 +00:00
|
|
|
connect(homoBField ,SIGNAL(heightChanged(double)), heightBox, SLOT(setValue(double)) );
|
|
|
|
|
connect(heightBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setRectFHeight(double)) );
|
|
|
|
|
|
|
|
|
|
QDoubleSpinBox *widthBox = new QDoubleSpinBox;
|
|
|
|
|
widthBox->setRange(HomoBFieldItem::MinimumWidth, 5000);
|
2008-11-02 20:34:58 +00:00
|
|
|
widthBox->setKeyboardTracking(false);
|
2008-10-15 18:25:06 +00:00
|
|
|
connect(homoBField ,SIGNAL(widthChanged(double)),widthBox, SLOT(setValue(double)) );
|
|
|
|
|
connect(widthBox, SIGNAL(valueChanged(double)),homoBField ,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):"));
|
|
|
|
|
|
|
|
|
|
QDoubleSpinBox *posXBox = new QDoubleSpinBox;
|
|
|
|
|
posXBox->setRange(-5000, 5000);
|
2008-11-02 20:34:58 +00:00
|
|
|
posXBox->setKeyboardTracking(false);
|
2008-10-15 18:25:06 +00:00
|
|
|
connect(homoBField ,SIGNAL(ScenePosXChanged(double)),posXBox, SLOT(setValue(double)) );
|
|
|
|
|
connect(posXBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setScenePosX(double)) );
|
|
|
|
|
|
|
|
|
|
QDoubleSpinBox *posYBox = new QDoubleSpinBox;
|
|
|
|
|
posYBox->setRange(-5000, 5000);
|
2008-11-02 20:34:58 +00:00
|
|
|
posYBox->setKeyboardTracking(false);
|
2008-10-15 18:25:06 +00:00
|
|
|
connect(homoBField ,SIGNAL(ScenePosYChanged(double)),posYBox, SLOT(setValue(double)) );
|
|
|
|
|
connect(posYBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setScenePosY(double)) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGridLayout* geomGridLayout = new QGridLayout;
|
|
|
|
|
//geomGridLayout->setSizeConstraint(QLayout::SetFixedSize);
|
2008-10-15 20:23:41 +00:00
|
|
|
geomGridLayout->addWidget(heightBox,3,1);
|
|
|
|
|
geomGridLayout->addWidget(posYBox,1,1);
|
|
|
|
|
geomGridLayout->addWidget(posXBox,0,1);
|
|
|
|
|
geomGridLayout->addWidget(xLabel,0,0,Qt::AlignRight);
|
|
|
|
|
geomGridLayout->addWidget(yLabel,1,0,Qt::AlignRight);
|
|
|
|
|
geomGridLayout->addWidget(heightLabel,3,0,Qt::AlignRight);
|
|
|
|
|
geomGridLayout->addWidget(widthLabel,2,0,Qt::AlignRight);
|
|
|
|
|
geomGridLayout->addWidget(widthBox,2,1);
|
|
|
|
|
|
2008-10-15 18:25:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
QGroupBox* geometryBox = new QGroupBox(tr("Geometrie"));
|
|
|
|
|
geometryBox->setLayout(geomGridLayout);
|
|
|
|
|
|
|
|
|
|
|
2008-10-15 20:23:41 +00:00
|
|
|
QLabel* fieldFluxDensityLabel = new QLabel(tr("Flussdichte(B):"));
|
2008-10-15 18:25:06 +00:00
|
|
|
|
2008-10-15 20:23:41 +00:00
|
|
|
ExpDoubleSpinBox* fieldFluxDensityBox = new ExpDoubleSpinBox;
|
2008-11-11 20:31:04 +00:00
|
|
|
fieldFluxDensityBox->setRange(0,1e+200);
|
2008-11-02 20:34:58 +00:00
|
|
|
fieldFluxDensityBox->setDecimals(40);
|
2008-11-06 21:05:13 +00:00
|
|
|
fieldFluxDensityBox->setDisplayDecimals(3);
|
2008-11-02 20:34:58 +00:00
|
|
|
fieldFluxDensityBox->setKeyboardTracking(false);
|
2008-11-06 21:05:13 +00:00
|
|
|
fieldFluxDensityBox->setSuffix(" T");
|
2008-10-15 20:23:41 +00:00
|
|
|
connect(homoBField ,SIGNAL(fluxDensityChanged(double)),fieldFluxDensityBox, SLOT(setValue(double)) );
|
|
|
|
|
connect(fieldFluxDensityBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setFluxDensity(double)) );
|
2008-10-15 18:25:06 +00:00
|
|
|
|
|
|
|
|
QGridLayout* constGridLayout = new QGridLayout;
|
|
|
|
|
//constGridLayout->setSizeConstraint(QLayout::SetFixedSize);
|
2008-10-15 20:23:41 +00:00
|
|
|
constGridLayout->addWidget(fieldFluxDensityBox,0,1);
|
|
|
|
|
constGridLayout->addWidget(fieldFluxDensityLabel,0,0,Qt::AlignRight);
|
2008-10-15 18:25:06 +00:00
|
|
|
|
|
|
|
|
QGroupBox* fieldConstantsBox = new QGroupBox(tr("Feldkonstanten"));
|
|
|
|
|
fieldConstantsBox->setLayout(constGridLayout);
|
|
|
|
|
|
|
|
|
|
|
2008-10-15 20:23:41 +00:00
|
|
|
|
|
|
|
|
QRadioButton* intoPlaneButton = new QRadioButton(tr("in die Ebene hinein"));
|
|
|
|
|
QRadioButton* outOfPlaneButton = new QRadioButton(tr("aus der Ebene heraus"));
|
|
|
|
|
connect(homoBField ,SIGNAL(directionChanged(bool)),intoPlaneButton, SLOT(setChecked(bool)) );
|
|
|
|
|
connect(intoPlaneButton, SIGNAL(toggled(bool)),homoBField ,SLOT(setIsDirectionIntoPlane(bool)) );
|
|
|
|
|
|
2008-11-16 22:18:15 +00:00
|
|
|
|
2008-10-15 20:23:41 +00:00
|
|
|
QButtonGroup* directionGroup = new QButtonGroup();
|
|
|
|
|
directionGroup->addButton(intoPlaneButton);
|
|
|
|
|
directionGroup->addButton(outOfPlaneButton);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGridLayout* directionGridLayout = new QGridLayout;
|
|
|
|
|
directionGridLayout->addWidget(intoPlaneButton,0,0);
|
|
|
|
|
directionGridLayout->addWidget(outOfPlaneButton,1,0);
|
|
|
|
|
|
|
|
|
|
QGroupBox* fieldDirectionBox = new QGroupBox(tr("Feldrichtung"));
|
|
|
|
|
fieldDirectionBox->setLayout(directionGridLayout);
|
|
|
|
|
|
2008-11-16 22:18:15 +00:00
|
|
|
//SimulScene* theScene = dynamic_cast<SimulScene*>(homoBField->scene());
|
|
|
|
|
//qDebug()<<theScene;
|
|
|
|
|
//QPushButton* downButton = new QPushButton("down");
|
|
|
|
|
//connect( downButton,SIGNAL(clicked()),theScene, SLOT(moveSelectedFieldItemDown()) );
|
2008-10-15 20:23:41 +00:00
|
|
|
|
2008-10-15 18:25:06 +00:00
|
|
|
QVBoxLayout * mainLayout = new QVBoxLayout(this);
|
|
|
|
|
mainLayout -> addWidget(geometryBox);
|
2008-10-15 20:23:41 +00:00
|
|
|
mainLayout -> addWidget(fieldDirectionBox);
|
2008-10-15 18:25:06 +00:00
|
|
|
mainLayout -> addWidget(fieldConstantsBox);
|
2008-11-16 22:18:15 +00:00
|
|
|
//mainLayout -> addWidget(downButton);
|
2008-10-15 18:25:06 +00:00
|
|
|
mainLayout -> addStretch();
|
|
|
|
|
|
|
|
|
|
QWidget::setTabOrder (posXBox, posYBox);
|
|
|
|
|
QWidget::setTabOrder (posYBox, widthBox);
|
|
|
|
|
QWidget::setTabOrder (widthBox, heightBox);
|
|
|
|
|
|
|
|
|
|
this -> setLayout(mainLayout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HomoBFieldWidget::~HomoBFieldWidget() {
|
|
|
|
|
}
|
|
|
|
|
|