so aenderungen
git-svn-id: http://svn.lsim.tuxzone.org/trunk@30 4bec179b-ab65-46ed-a5f8-55b8b5c735d0
This commit is contained in:
@@ -138,6 +138,16 @@ void FieldItem::wheelEvent(QGraphicsSceneWheelEvent * event) {
|
||||
}
|
||||
void FieldItem::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ){
|
||||
|
||||
QMenu menu;
|
||||
QAction *removeAction = menu.addAction(tr("L\366schen"));
|
||||
connect(removeAction, SIGNAL(triggered()),this, SLOT(deleteMe()));
|
||||
|
||||
QString selectString;
|
||||
if(isSelected()) selectString = tr("Abw\344hlen");
|
||||
else selectString = tr("Ausw\344hlen");
|
||||
QAction *selectAction = menu.addAction(selectString);
|
||||
connect(selectAction, SIGNAL(triggered()),this, SLOT(toggleSelection()));
|
||||
QAction *selectedAction = menu.exec(event->screenPos());
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -145,4 +155,12 @@ void FieldItem::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ){
|
||||
*/
|
||||
int FieldItem::getRotation() {
|
||||
return myRotation;
|
||||
}
|
||||
|
||||
void FieldItem::deleteMe() {
|
||||
delete this;
|
||||
}
|
||||
|
||||
void FieldItem::toggleSelection() {
|
||||
setSelected(!isSelected());
|
||||
}
|
||||
@@ -69,6 +69,8 @@ class FieldItem :public QObject, public QGraphicsItem {
|
||||
virtual void setScenePosX(double newXPos);
|
||||
virtual void setScenePosY(double newYPos);
|
||||
virtual void setRotation(int angle);
|
||||
void deleteMe();
|
||||
void toggleSelection();
|
||||
|
||||
public slots:
|
||||
//! setzt das rechteck des Widgets
|
||||
|
||||
@@ -84,9 +84,9 @@ void GraphicsView::mouseMoveEvent ( QMouseEvent * e ) {
|
||||
QPointF scenePos = mapToScene(e->pos());
|
||||
QString posString;
|
||||
posString += "Mausposition: ";
|
||||
posString += "x: " + QLocale().toString(scenePos.x(),'g') + " px"+QChar(8793);
|
||||
posString += "x: " + QLocale().toString(scenePos.x(),'g') + " px"+"/";
|
||||
posString += QLocale().toString(scenePos.x()*simulScene->getMeterPerPx(),'g') + " m";
|
||||
posString += " y: " + QLocale().toString(scenePos.y(),'g') + " px"+QChar(8793);
|
||||
posString += " y: " + QLocale().toString(scenePos.y(),'g') + " px"+"/";
|
||||
posString += QLocale().toString(scenePos.y()*simulScene->getMeterPerPx(),'g') + " m";
|
||||
mainWindowStatusBar->showMessage(posString);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <cmath>
|
||||
#include <QtDebug>
|
||||
#include <QRectF>
|
||||
#include "simulscene.h"
|
||||
|
||||
HomoEFieldItem::HomoEFieldItem(QRectF sizeRect)
|
||||
: FieldItem() {
|
||||
@@ -38,9 +39,6 @@ HomoEFieldItem::HomoEFieldItem(QRectF sizeRect)
|
||||
|
||||
//QGraphicsRectItem * testItem = new QGraphicsRectItem(QRectF(-10,-10,6,6), this);
|
||||
//testItem->setBrush(Qt::SolidPattern);
|
||||
connect(this, SIGNAL(heightChanged(double)), this, SLOT(handleVoltageChange()));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -125,17 +123,11 @@ void HomoEFieldItem::setFieldPower (double fieldPower ) {
|
||||
//if (this->fieldPower == fieldPower) return;
|
||||
this->fieldPower = fieldPower;
|
||||
emit fieldPowerChanged(fieldPower);
|
||||
handleVoltageChange ();
|
||||
}
|
||||
|
||||
void HomoEFieldItem::setVoltage (double voltage ) {
|
||||
setFieldPower( voltage/getRectF().height());
|
||||
|
||||
}
|
||||
|
||||
void HomoEFieldItem::handleVoltageChange () {
|
||||
emit voltageChanged(getFieldPower()*getRectF().height());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
double HomoEFieldItem::getOuterPenWidth() const {
|
||||
|
||||
@@ -58,15 +58,13 @@ class HomoEFieldItem : public FieldItem {
|
||||
|
||||
public slots:
|
||||
void setFieldPower (double fieldPower );
|
||||
void setVoltage (double voltage );
|
||||
void setOuterPenWidth ( double theValue );
|
||||
|
||||
|
||||
private slots:
|
||||
void handleVoltageChange();
|
||||
|
||||
signals:
|
||||
void fieldPowerChanged(double fieldPower);
|
||||
void voltageChanged(double voltage);
|
||||
|
||||
private:
|
||||
//! Abstand der Feldlinien in der Zeichnung
|
||||
|
||||
@@ -105,7 +105,6 @@ void HomoEFieldWidget::createWidget()
|
||||
|
||||
|
||||
QLabel* fieldPowerLabel = new QLabel(tr("Feldst\344rke(E):"));
|
||||
QLabel* voltageLabel = new QLabel(tr("Spannung:"));
|
||||
|
||||
ExpDoubleSpinBox* fieldPowerBox = new ExpDoubleSpinBox;
|
||||
fieldPowerBox->setRange(0,1e+200);
|
||||
@@ -116,21 +115,11 @@ void HomoEFieldWidget::createWidget()
|
||||
connect(homoEField ,SIGNAL(fieldPowerChanged(double)),fieldPowerBox, SLOT(setValue(double)) );
|
||||
connect(fieldPowerBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setFieldPower(double)) );
|
||||
|
||||
ExpDoubleSpinBox* voltageBox = new ExpDoubleSpinBox;
|
||||
voltageBox->setRange(0,1e+200);
|
||||
voltageBox->setDecimals(35);
|
||||
voltageBox->setDisplayDecimals(3);
|
||||
voltageBox->setKeyboardTracking(false);
|
||||
voltageBox->setSuffix(" V");
|
||||
connect(homoEField ,SIGNAL(voltageChanged(double)),voltageBox, SLOT(setValue(double)) );
|
||||
connect(voltageBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setVoltage(double)) );
|
||||
|
||||
QGridLayout* constGridLayout = new QGridLayout;
|
||||
//constGridLayout->setSizeConstraint(QLayout::SetFixedSize);
|
||||
constGridLayout->addWidget(fieldPowerBox,0,1);
|
||||
constGridLayout->addWidget(voltageBox,1,1);
|
||||
constGridLayout->addWidget(fieldPowerLabel,0,0,Qt::AlignRight);
|
||||
constGridLayout->addWidget(voltageLabel,1,0,Qt::AlignRight);
|
||||
|
||||
QGroupBox* fieldConstantsBox = new QGroupBox(tr("Feldkonstanten"));
|
||||
fieldConstantsBox->setLayout(constGridLayout);
|
||||
|
||||
@@ -439,7 +439,7 @@ void lsim::createDocks() {
|
||||
|
||||
//description labels
|
||||
QLabel *flight_path_label = new QLabel(tr("Flugbahn anzeigen:"));
|
||||
QLabel *timer_label = new QLabel(tr("L\344nge der Animation:"));
|
||||
QLabel *timer_label = new QLabel(tr("Dauer der Animation:"));
|
||||
QLabel *real_simul_time_label = new QLabel(tr("\"Reale\" Simulationsdauer:"));
|
||||
|
||||
//grid layout
|
||||
|
||||
@@ -360,6 +360,7 @@ void SimulScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) {
|
||||
connect( currHomoEfieldInsertItem, SIGNAL(ScenePosChanged(QPointF)), this, SLOT(moveResizeRects()));
|
||||
//item ueber sceneChange informieren
|
||||
connect(this,SIGNAL(changed(QList<QRectF>)),currHomoEfieldInsertItem,SLOT(handleSceneChange(QList<QRectF>)));
|
||||
|
||||
}
|
||||
update(); //moegliche darstellungsprobleme beseitigen
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
Reference in New Issue
Block a user