initial HomoBFieldWidget created
git-svn-id: http://svn.lsim.tuxzone.org/trunk@7 4bec179b-ab65-46ed-a5f8-55b8b5c735d0
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "homobfielditem.h"
|
#include "homobfielditem.h"
|
||||||
|
#include "homobfieldwidget.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
@@ -31,6 +32,7 @@ HomoBFieldItem::HomoBFieldItem(QRectF sizeRect): FieldItem() {
|
|||||||
setFlag(ItemIsFocusable);
|
setFlag(ItemIsFocusable);
|
||||||
setOuterPenWidth (2);
|
setOuterPenWidth (2);
|
||||||
setIsDirectionIntoPlane(true);
|
setIsDirectionIntoPlane(true);
|
||||||
|
dockWidget = new HomoBFieldWidget(0,0,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -159,7 +161,7 @@ void HomoBFieldItem::setOuterPenWidth ( double theValue ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QWidget* HomoBFieldItem::getDockWidget() const {
|
QWidget* HomoBFieldItem::getDockWidget() const {
|
||||||
return new QWidget();
|
return dockWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
/**
|
/**
|
||||||
@author Peter Dahlberg <pdahlberg@gmail.com>
|
@author Peter Dahlberg <pdahlberg@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
class HomoBFieldWidget;
|
||||||
class QWidget;
|
class QWidget;
|
||||||
class HomoBFieldItem : public FieldItem {
|
class HomoBFieldItem : public FieldItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -63,6 +64,8 @@ class HomoBFieldItem : public FieldItem {
|
|||||||
//! Gibt an, ob das Feld in die Ebene Zeigt oder heraus (true == in die Ebene)
|
//! Gibt an, ob das Feld in die Ebene Zeigt oder heraus (true == in die Ebene)
|
||||||
bool isDirectionIntoPlane;
|
bool isDirectionIntoPlane;
|
||||||
|
|
||||||
|
HomoBFieldWidget* dockWidget;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
132
src/homobfieldwidget.cpp
Normal file
132
src/homobfieldwidget.cpp
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
57
src/homobfieldwidget.h
Normal file
57
src/homobfieldwidget.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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. *
|
||||||
|
***************************************************************************/
|
||||||
|
#ifndef HOMOBFIELDWIDGET_H
|
||||||
|
#define HOMOBFIELDWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "homobfielditem.h"
|
||||||
|
|
||||||
|
//! Dock Widget fuer die Eigenschaften von HomoBFieldItem
|
||||||
|
/**
|
||||||
|
auf diesem Widget befinden sich Steuerelemente, mit denen man
|
||||||
|
die Eigenschaften von einem HomoBFieldItem manipulieren kann.
|
||||||
|
|
||||||
|
@author Peter Dahlberg <pdahlberg@gmail.com>
|
||||||
|
*/
|
||||||
|
class HomoBFieldWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
//! Erzeugt ein neues HomoBFieldWidget
|
||||||
|
/*!
|
||||||
|
\param parent Parent Widget, see Qt Documentaion
|
||||||
|
\param f Window Flags, see Qt Documentaion
|
||||||
|
\param eField HomoBFieldItem, zu dem das HomoBFieldWidget zugeordnet werden soll
|
||||||
|
*/
|
||||||
|
HomoBFieldWidget(QWidget* parent, Qt::WindowFlags f, HomoBFieldItem* bField);
|
||||||
|
|
||||||
|
~HomoBFieldWidget();
|
||||||
|
|
||||||
|
private:
|
||||||
|
//!enthält einen Zeiger auf das zugeordnete HomoBFieldItem
|
||||||
|
HomoBFieldItem* homoBField;
|
||||||
|
//! Erstellt die Steuerelemente
|
||||||
|
/*!
|
||||||
|
Wird von Konstruktor aufgerufen, um die Steuerelemente zu erzeugen
|
||||||
|
*/
|
||||||
|
void createWidget();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -8,7 +8,8 @@ SOURCES += lsim.cpp \
|
|||||||
expdoublespinbox.cpp \
|
expdoublespinbox.cpp \
|
||||||
homoefieldwidget.cpp \
|
homoefieldwidget.cpp \
|
||||||
probechargewidget.cpp \
|
probechargewidget.cpp \
|
||||||
homobfielditem.cpp
|
homobfielditem.cpp \
|
||||||
|
homobfieldwidget.cpp
|
||||||
HEADERS += lsim.h \
|
HEADERS += lsim.h \
|
||||||
graphicsview.h \
|
graphicsview.h \
|
||||||
graphicsellipseitem.h \
|
graphicsellipseitem.h \
|
||||||
@@ -19,7 +20,8 @@ HEADERS += lsim.h \
|
|||||||
homoefieldwidget.h \
|
homoefieldwidget.h \
|
||||||
constants.h \
|
constants.h \
|
||||||
probechargewidget.h \
|
probechargewidget.h \
|
||||||
homobfielditem.h
|
homobfielditem.h \
|
||||||
|
homobfieldwidget.h
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
CONFIG += warn_on \
|
CONFIG += warn_on \
|
||||||
thread \
|
thread \
|
||||||
|
|||||||
Reference in New Issue
Block a user