133 lines
5.5 KiB
C++
133 lines
5.5 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 "homobfieldwidget.h"
|
||
|
|
#include "homobfielditem.h"
|
||
|
|
#include "expdoublespinbox.h"
|
||
|
|
#include <QVBoxLayout>
|
||
|
|
#include <QtDebug>
|
||
|
|
#include <QDial>
|
||
|
|
#include <QGroupBox>
|
||
|
|
#include <QLabel>
|
||
|
|
|
||
|
|
HomoBFieldWidget::HomoBFieldWidget(QWidget* parent, Qt::WindowFlags f, HomoBFieldItem* bField):QWidget(parent, f) {
|
||
|
|
|
||
|
|
homoBField = bField;
|
||
|
|
createWidget();
|
||
|
|
|
||
|
|
}
|
||
|
|
void HomoBFieldWidget::createWidget() {
|
||
|
|
QDial *rotationDial = new QDial;
|
||
|
|
rotationDial->setRange(0,359);
|
||
|
|
rotationDial->setNotchesVisible(true);
|
||
|
|
rotationDial->setWrapping(true);
|
||
|
|
|
||
|
|
|
||
|
|
QDoubleSpinBox *heightBox = new QDoubleSpinBox;
|
||
|
|
heightBox->setRange(HomoBFieldItem::MinimumHeight, 5000);
|
||
|
|
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);
|
||
|
|
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):"));
|
||
|
|
QLabel* rotationLabel = new QLabel(tr("Rotation:"));
|
||
|
|
|
||
|
|
QDoubleSpinBox *posXBox = new QDoubleSpinBox;
|
||
|
|
posXBox->setRange(-5000, 5000);
|
||
|
|
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);
|
||
|
|
connect(homoBField ,SIGNAL(ScenePosYChanged(double)),posYBox, SLOT(setValue(double)) );
|
||
|
|
connect(posYBox, SIGNAL(valueChanged(double)),homoBField ,SLOT(setScenePosY(double)) );
|
||
|
|
|
||
|
|
QSpinBox* rotationBox = new QSpinBox;
|
||
|
|
rotationBox->setRange(0,359);
|
||
|
|
rotationBox->setSuffix("\260");
|
||
|
|
rotationBox->setWrapping(true);
|
||
|
|
//connect(rotationDial, SIGNAL(valueChanged(int)),rotationBox ,SIGNAL(valueChanged(int)) );
|
||
|
|
//connect(rotationDial, SIGNAL(valueChanged(int)),rotationBox,SLOT(setValue(int)) );
|
||
|
|
//connect(rotationBox, SIGNAL(valueChanged(int)),homoEField ,SLOT(setRotation(int)) );
|
||
|
|
//connect(rotationBox, SIGNAL(valueChanged(int)),rotationDial ,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:"));
|
||
|
|
QLabel* voltageLabel = new QLabel(tr("Spannung:"));
|
||
|
|
|
||
|
|
ExpDoubleSpinBox* fieldPowerBox = new ExpDoubleSpinBox;
|
||
|
|
fieldPowerBox->setRange(-1e+200,1e+200);
|
||
|
|
connect(homoBField ,SIGNAL(fieldPowerChanged(double)),fieldPowerBox, SLOT(setValue(double)) );
|
||
|
|
connect(fieldPowerBox, SIGNAL(valueChanged(double)),homoBField ,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);
|
||
|
|
}
|
||
|
|
|
||
|
|
HomoBFieldWidget::~HomoBFieldWidget() {
|
||
|
|
}
|
||
|
|
|
||
|
|
|