viele viele sachen
git-svn-id: http://svn.lsim.tuxzone.org/trunk@29 4bec179b-ab65-46ed-a5f8-55b8b5c735d0
This commit is contained in:
@@ -161,7 +161,7 @@
|
||||
<lsim>/mnt/sdb1/c++/lsim</lsim>
|
||||
</cwd>
|
||||
<debugarguments>
|
||||
<lsim></lsim>
|
||||
<lsim/>
|
||||
</debugarguments>
|
||||
</run>
|
||||
<general>
|
||||
|
||||
Binary file not shown.
27
lsim.kdevses
27
lsim.kdevses
@@ -1,12 +1,12 @@
|
||||
<?xml version = '1.0' encoding = 'UTF-8'?>
|
||||
<!DOCTYPE KDevPrjSession>
|
||||
<KDevPrjSession>
|
||||
<DocsAndViews NumberOfDocuments="15" >
|
||||
<DocsAndViews NumberOfDocuments="18" >
|
||||
<Doc0 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.h" >
|
||||
<View0 Encoding="" line="139" Type="Source" />
|
||||
<View0 Encoding="" line="201" Type="Source" />
|
||||
</Doc0>
|
||||
<Doc1 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/simulscene.cpp" >
|
||||
<View0 Encoding="" line="110" Type="Source" />
|
||||
<View0 Encoding="" line="106" Type="Source" />
|
||||
</Doc1>
|
||||
<Doc2 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/graphicsellipseitem.h" >
|
||||
<View0 Encoding="" line="66" Type="Source" />
|
||||
@@ -15,10 +15,10 @@
|
||||
<View0 Encoding="" line="207" Type="Source" />
|
||||
</Doc3>
|
||||
<Doc4 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/lsim.h" >
|
||||
<View0 Encoding="" line="73" Type="Source" />
|
||||
<View0 Encoding="" line="91" Type="Source" />
|
||||
</Doc4>
|
||||
<Doc5 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/lsim.cpp" >
|
||||
<View0 Encoding="" line="52" Type="Source" />
|
||||
<View0 Encoding="" line="293" Type="Source" />
|
||||
</Doc5>
|
||||
<Doc6 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/probechargewidget.cpp" >
|
||||
<View0 Encoding="" Type="Source" />
|
||||
@@ -33,20 +33,29 @@
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc9>
|
||||
<Doc10 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homobfieldwidget.h" >
|
||||
<View0 Encoding="" line="25" Type="Source" />
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc10>
|
||||
<Doc11 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/main.cpp" >
|
||||
<View0 Encoding="" line="31" Type="Source" />
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc11>
|
||||
<Doc12 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/application.qrc" >
|
||||
<View0 Encoding="" line="17" Type="Source" />
|
||||
<View0 Encoding="" line="19" Type="Source" />
|
||||
</Doc12>
|
||||
<Doc13 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/expdoublespinbox.h" >
|
||||
<View0 Encoding="" line="44" Type="Source" />
|
||||
<View0 Encoding="" Type="Source" />
|
||||
</Doc13>
|
||||
<Doc14 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/fielditem.cpp" >
|
||||
<View0 Encoding="" line="122" Type="Source" />
|
||||
</Doc14>
|
||||
<Doc15 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/graphicsview.h" >
|
||||
<View0 Encoding="" line="42" Type="Source" />
|
||||
</Doc15>
|
||||
<Doc16 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/graphicsview.cpp" >
|
||||
<View0 Encoding="" line="101" Type="Source" />
|
||||
</Doc16>
|
||||
<Doc17 NumberOfViews="1" URL="file:///mnt/sdb1/c%2B%2B/lsim/src/homoefielditem.cpp" >
|
||||
<View0 Encoding="" line="17" Type="Source" />
|
||||
</Doc17>
|
||||
</DocsAndViews>
|
||||
<pluginList>
|
||||
<kdevdebugger>
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
<file>icons/window-simulmode.svg</file>
|
||||
<file>icons/application-exit.svg</file>
|
||||
<file>icons/lsim.svg</file>
|
||||
<file>icons/view-fullscreen.svg</file>
|
||||
<file>icons/view-restore.svg</file>
|
||||
|
||||
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -20,12 +20,21 @@
|
||||
#include "graphicsview.h"
|
||||
//#include <QGLWidget>
|
||||
#include <QGraphicsItem>
|
||||
#include <QDebug>
|
||||
#include <cmath>
|
||||
#include <QMouseEvent>
|
||||
#include <QStatusBar>
|
||||
#include "simulscene.h"
|
||||
#include <QLocale>
|
||||
|
||||
|
||||
GraphicsView::GraphicsView(): QGraphicsView() {
|
||||
GraphicsView::GraphicsView(QWidget * parent, QStatusBar* statusbar): QGraphicsView(parent) {
|
||||
mainWindowStatusBar = statusbar;
|
||||
//setMinimumSize(900,700);
|
||||
//setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
//setRenderHint (QPainter::QPainter::Antialiasing,true);
|
||||
//setCacheMode(QGraphicsView::CacheBackground);
|
||||
//setTransformationAnchor (QGraphicsView::AnchorUnderMouse);
|
||||
|
||||
|
||||
//scale(2,2);
|
||||
@@ -34,6 +43,56 @@ GraphicsView::GraphicsView(): QGraphicsView() {
|
||||
|
||||
}
|
||||
|
||||
void GraphicsView::drawBackground ( QPainter * painter, const QRectF & rect ) {
|
||||
int lineDistance = 20;
|
||||
|
||||
double startX = rect.x();
|
||||
double startY = rect.y();
|
||||
double endX = rect.x() + rect.width();
|
||||
double endY = rect.y() + rect.height();
|
||||
|
||||
QPainterPath currPath;
|
||||
int startPaintX = floor(startX/(double)lineDistance)*lineDistance;
|
||||
int endPaintX = ceil(endX/(double)lineDistance)*lineDistance;
|
||||
for (double i = startPaintX; i<endPaintX; i= i+lineDistance) {
|
||||
if (i==0 )continue;
|
||||
QPolygonF polygon;
|
||||
polygon << QPointF(i,startY) << QPointF(i,endY);
|
||||
currPath.addPolygon(polygon);
|
||||
}
|
||||
int startPaintY = floor(startY/(double)lineDistance)*lineDistance;
|
||||
int endPaintY = ceil(endY/(double)lineDistance)*lineDistance;
|
||||
for (double i = startPaintY ; i<endPaintY; i= i+lineDistance) {
|
||||
if (i==0 )continue;
|
||||
QPolygonF polygon;
|
||||
polygon << QPointF(startX,i) << QPointF(endX,i);
|
||||
currPath.addPolygon(polygon);
|
||||
}
|
||||
painter->setPen(QPen(Qt::lightGray, 1, Qt::SolidLine));
|
||||
painter->drawPath(currPath);
|
||||
|
||||
painter->setPen(QPen(Qt::green, 1, Qt::SolidLine));
|
||||
painter->drawLine(startX,0,endX,0);
|
||||
painter->drawLine(0,startY,0,endY);
|
||||
|
||||
}
|
||||
|
||||
void GraphicsView::mouseMoveEvent ( QMouseEvent * e ) {
|
||||
QGraphicsView::mouseMoveEvent(e);
|
||||
SimulScene* simulScene = dynamic_cast<SimulScene*> (scene());
|
||||
if (simulScene != 0 && mainWindowStatusBar !=0) {
|
||||
QPointF scenePos = mapToScene(e->pos());
|
||||
QString posString;
|
||||
posString += "Mausposition: ";
|
||||
posString += "x: " + QLocale().toString(scenePos.x(),'g') + " px"+QChar(8793);
|
||||
posString += QLocale().toString(scenePos.x()*simulScene->getMeterPerPx(),'g') + " m";
|
||||
posString += " y: " + QLocale().toString(scenePos.y(),'g') + " px"+QChar(8793);
|
||||
posString += QLocale().toString(scenePos.y()*simulScene->getMeterPerPx(),'g') + " m";
|
||||
mainWindowStatusBar->showMessage(posString);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GraphicsView::enableOGLViewport() {
|
||||
//setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
||||
}
|
||||
|
||||
@@ -24,13 +24,14 @@
|
||||
|
||||
class HomoEFieldItem;
|
||||
class QTimeLine;
|
||||
class QStatusBar;
|
||||
/**
|
||||
@author Peter Dahlberg <pdahlberg@gmail.com>
|
||||
*/
|
||||
class GraphicsView : public QGraphicsView {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GraphicsView();
|
||||
GraphicsView(QWidget * parent = 0, QStatusBar* statusbar = 0);
|
||||
|
||||
~GraphicsView();
|
||||
|
||||
@@ -38,6 +39,11 @@ class GraphicsView : public QGraphicsView {
|
||||
void enableOGLViewport();
|
||||
void disableOGLViewport();
|
||||
private:
|
||||
QStatusBar * mainWindowStatusBar;
|
||||
|
||||
protected:
|
||||
void drawBackground ( QPainter * painter, const QRectF & rect );
|
||||
void mouseMoveEvent ( QMouseEvent * e );
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ HomoEFieldItem::HomoEFieldItem(QRectF sizeRect)
|
||||
setRectF(sizeRect);
|
||||
dockWidget = new HomoEFieldWidget(0,0,this);
|
||||
setFieldPower(10);
|
||||
setFieldLineDistance(10);
|
||||
setFieldLineDistance(12);
|
||||
setFlag(ItemIsMovable);
|
||||
setFlag(ItemIsSelectable);
|
||||
setFlag(ItemIsFocusable);
|
||||
@@ -38,6 +38,7 @@ 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()));
|
||||
|
||||
|
||||
|
||||
@@ -124,6 +125,16 @@ 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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -58,12 +58,15 @@ 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
|
||||
|
||||
@@ -117,11 +117,13 @@ void HomoEFieldWidget::createWidget()
|
||||
connect(fieldPowerBox, SIGNAL(valueChanged(double)),homoEField ,SLOT(setFieldPower(double)) );
|
||||
|
||||
ExpDoubleSpinBox* voltageBox = new ExpDoubleSpinBox;
|
||||
voltageBox->setRange(-1e+200,1e+200);
|
||||
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);
|
||||
|
||||
7402
src/icons/view-fullscreen.svg
Normal file
7402
src/icons/view-fullscreen.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 258 KiB |
7402
src/icons/view-restore.svg
Normal file
7402
src/icons/view-restore.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 258 KiB |
60
src/lsim.cpp
60
src/lsim.cpp
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
lsim::lsim() {
|
||||
gview = new GraphicsView();
|
||||
gview = new GraphicsView(this,statusBar());
|
||||
setCentralWidget (gview);
|
||||
createScene();
|
||||
createActions();
|
||||
@@ -66,6 +66,19 @@ void lsim::about() {
|
||||
|
||||
|
||||
void lsim::createActions() {
|
||||
QIcon fullScreenIcon = QIcon(":icons/view-fullscreen.svg");
|
||||
fullScreenIcon.addFile(":icons/view-restore.svg", QSize(),QIcon::Normal,QIcon::On);
|
||||
fullScreenIcon.addFile(":icons/view-restore.svg", QSize(),QIcon::Disabled,QIcon::On);
|
||||
fullScreenIcon.addFile(":icons/view-restore.svg", QSize(),QIcon::Active,QIcon::On);
|
||||
fullScreenIcon.addFile(":icons/view-restore.svg", QSize(),QIcon::Selected,QIcon::On);
|
||||
acts.fullScreenAct = new QAction (tr ("&Vollbild"), this);
|
||||
acts.fullScreenAct->setStatusTip (tr ("In den Vollbildmodus Wechseln"));
|
||||
acts.fullScreenAct->setIcon(fullScreenIcon);
|
||||
acts.fullScreenAct->setCheckable(true);
|
||||
acts.fullScreenAct->setShortcut(QKeySequence(Qt::Key_F11));
|
||||
connect (acts.fullScreenAct, SIGNAL (toggled(bool)), this, SLOT (goToFullscreen(bool)));
|
||||
connect (this, SIGNAL (fullScreenModeChanged(bool)), acts.fullScreenAct, SLOT (setChecked(bool)));
|
||||
|
||||
acts.aboutAct = new QAction (tr ("&About"), this);
|
||||
acts.aboutAct->setStatusTip (tr ("Show the application's About box"));
|
||||
connect (acts.aboutAct, SIGNAL (triggered()), this, SLOT (about()));
|
||||
@@ -115,6 +128,7 @@ void lsim::createActions() {
|
||||
|
||||
acts.exitAct = new QAction (tr ("Beenden"), this);
|
||||
acts.exitAct->setStatusTip (tr ("lsim beenden"));
|
||||
acts.exitAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
|
||||
acts.exitAct->setIcon(QIcon(":icons/application-exit.svg"));
|
||||
connect (acts.exitAct, SIGNAL (triggered()), qApp, SLOT (quit()));
|
||||
|
||||
@@ -152,13 +166,13 @@ void lsim::createActions() {
|
||||
|
||||
//Edit, insert, Modechange
|
||||
|
||||
acts.itemEditModeAct = new QAction (tr ("Bearbeiten"), this);
|
||||
acts.itemEditModeAct = new QAction (tr ("Felder Bearbeiten"), this);
|
||||
acts.itemEditModeAct->setStatusTip (tr ("Die Anordnung ver\344ndern"));
|
||||
acts.itemEditModeAct->setIcon(QIcon(":icons/edit-scene.svg"));
|
||||
acts.itemEditModeAct->setCheckable(true);
|
||||
acts.itemEditModeAct->setData(QVariant(SimulScene::FieldItemEdit));
|
||||
|
||||
acts.insertEFieldItemAct = new QAction (tr ("elektrisches Feld hizuf\374gen"), this);
|
||||
acts.insertEFieldItemAct = new QAction (tr ("Elektrisches Feld hizuf\374gen"), this);
|
||||
acts.insertEFieldItemAct->setStatusTip (tr ("Ein elekrisches Feld hizuf\374gen"));
|
||||
acts.insertEFieldItemAct->setIcon(QIcon(":icons/insert-efield.svg"));
|
||||
acts.insertEFieldItemAct->setCheckable(true);
|
||||
@@ -194,16 +208,18 @@ void lsim::createActions() {
|
||||
|
||||
|
||||
//Window Mode
|
||||
acts.editModeAct = new QAction (tr ("in den Bearbeitungsmodus wechseln"), this);
|
||||
acts.editModeAct = new QAction (tr ("&Bearbeitungsmodus"), this);
|
||||
acts.editModeAct->setStatusTip (tr ("erm\366glicht das Bearbeiten der Anordnung"));
|
||||
acts.editModeAct->setIcon(QIcon(":icons/window-editmode.svg"));
|
||||
acts.editModeAct->setCheckable(true);
|
||||
acts.editModeAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));
|
||||
acts.editModeAct->setData(QVariant(lsim::EditMode));
|
||||
|
||||
acts.simulationModeAct = new QAction (tr ("in den Simulation wechseln"), this);
|
||||
acts.simulationModeAct = new QAction (tr ("&Simulationsmodus"), this);
|
||||
acts.simulationModeAct->setStatusTip (tr ("Berechnet die Flugbahn und wechselt in den Simulationsmodus"));
|
||||
acts.simulationModeAct->setIcon(QIcon(":icons/window-simulmode.svg"));
|
||||
acts.simulationModeAct->setCheckable(true);
|
||||
acts.simulationModeAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
|
||||
acts.simulationModeAct->setData(QVariant(lsim::SimulationMode));
|
||||
|
||||
windowModeActGroup = new QActionGroup(this);
|
||||
@@ -215,15 +231,21 @@ void lsim::createActions() {
|
||||
}
|
||||
|
||||
void lsim::createMenus() {
|
||||
fileMenu = menuBar()->addMenu(tr("Datei"));
|
||||
fileMenu = menuBar()->addMenu(tr("&Datei"));
|
||||
|
||||
fileMenu->addAction(acts.resetAct);
|
||||
fileMenu->addAction(acts.exitAct);
|
||||
menuBar()->addMenu(tr("Bearbeiten"));
|
||||
|
||||
viewMenu = menuBar()->addMenu(tr("Ansicht"));
|
||||
viewMenu->addAction(acts.resetAct);
|
||||
editMenu = menuBar()->addMenu(tr("&Bearbeiten"));
|
||||
|
||||
menuBar()->addMenu(tr("Einstellungen"));
|
||||
|
||||
viewMenu = menuBar()->addMenu(tr("&Ansicht"));
|
||||
viewMenu->addAction(acts.editModeAct);
|
||||
viewMenu->addAction(acts.simulationModeAct);
|
||||
viewMenu->addSeparator();
|
||||
viewMenu->addAction(acts.fullScreenAct);
|
||||
|
||||
menuBar()->addMenu(tr("&Einstellungen"));
|
||||
|
||||
|
||||
helpMenu = menuBar()->addMenu (tr ("&Help"));
|
||||
@@ -271,6 +293,7 @@ void lsim::initWindowMode(WindowMode newMode) {
|
||||
removeDockWidget(simulOptDock);
|
||||
gview->setDragMode(QGraphicsView::NoDrag);
|
||||
gview->setInteractive(true);
|
||||
|
||||
if (newMode == lsim::EditMode) {
|
||||
simulscene->clearFlightPath();
|
||||
acts.timerStop->trigger();
|
||||
@@ -280,8 +303,9 @@ void lsim::initWindowMode(WindowMode newMode) {
|
||||
addDockWidget(Qt::LeftDockWidgetArea,fieldItemEditDock);
|
||||
addDockWidget(Qt::LeftDockWidgetArea,probeItemDock);
|
||||
addDockWidget(Qt::LeftDockWidgetArea,sceneDock);
|
||||
tabifyDockWidget(probeItemDock,fieldItemEditDock);
|
||||
tabifyDockWidget(fieldItemEditDock, sceneDock);
|
||||
tabifyDockWidget(probeItemDock,sceneDock);
|
||||
tabifyDockWidget(sceneDock,fieldItemEditDock);
|
||||
sceneDock->show();
|
||||
sceneModeBar->setVisible(true);
|
||||
upDownBar->setVisible(true);
|
||||
fieldItemEditDock->setVisible(true);
|
||||
@@ -303,11 +327,11 @@ void lsim::initWindowMode(WindowMode newMode) {
|
||||
acts.itemEditModeAct->trigger();
|
||||
simulscene->clearSelection();
|
||||
acts.calculate->trigger();
|
||||
//gview->setScene(simulscene); //ueberfluessige scrollbars entfernen
|
||||
gview->centerOn(simulscene->getProbeChargeItem());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -318,6 +342,7 @@ void lsim::createStatusBar() {
|
||||
void lsim::createScene() {
|
||||
simulscene = new SimulScene();
|
||||
gview->setScene(simulscene);
|
||||
simulscene->addRect(-qApp->desktop()->screenGeometry().width(),-qApp->desktop()->screenGeometry().height(), qApp->desktop()->screenGeometry().width()*2, qApp->desktop()->screenGeometry().height()*2)->setVisible(false);
|
||||
}
|
||||
|
||||
void lsim::createDocks() {
|
||||
@@ -615,3 +640,12 @@ void lsim::resetAll() {
|
||||
gview->centerOn(0,0);
|
||||
|
||||
}
|
||||
|
||||
void lsim::goToFullscreen(bool yesno) {
|
||||
if (yesno && windowState() == Qt::WindowFullScreen) return;
|
||||
if (!yesno && windowState() != Qt::WindowFullScreen) return;
|
||||
|
||||
setWindowState(windowState() ^ Qt::WindowFullScreen);
|
||||
//qDebug()<< (windowState() == Qt::WindowFullScreen);
|
||||
emit fullScreenModeChanged(windowState() == Qt::WindowFullScreen);
|
||||
}
|
||||
@@ -55,6 +55,8 @@ class lsim: public QMainWindow {
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent *event);
|
||||
public slots:
|
||||
void goToFullscreen(bool yesno);
|
||||
|
||||
private slots:
|
||||
void about();
|
||||
@@ -119,6 +121,7 @@ class lsim: public QMainWindow {
|
||||
QAction *probeChargeItemPlaceAct;
|
||||
|
||||
QAction *resetAct;
|
||||
QAction *fullScreenAct;
|
||||
};
|
||||
Actions acts;
|
||||
|
||||
@@ -138,6 +141,7 @@ class lsim: public QMainWindow {
|
||||
signals:
|
||||
void windowModeChanged(WindowMode mode);
|
||||
void timeLineDurationChangedSec(double duration);
|
||||
void fullScreenModeChanged(bool mode);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
18
src/main.cpp
18
src/main.cpp
@@ -22,14 +22,30 @@
|
||||
#include <QApplication>
|
||||
#include <QIcon>
|
||||
#include "lsim.h"
|
||||
#include <QDesktopWidget>
|
||||
#include <QDebug>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Q_INIT_RESOURCE(application);
|
||||
QApplication app(argc, argv);
|
||||
app.setWindowIcon(QIcon(":icons/lsim.svg"));
|
||||
|
||||
lsim * mw = new lsim();
|
||||
mw->show();
|
||||
int dWidth = app.desktop()->availableGeometry(mw).width();
|
||||
int dHeight = app.desktop()->availableGeometry(mw).height();
|
||||
int frWidth = mw->frameGeometry().width() - mw->geometry().width();
|
||||
int frHeight = mw->frameGeometry().height() - mw->geometry().height();
|
||||
mw->resize(0.9*dWidth-frWidth, 0.9 *dHeight-frHeight);
|
||||
int midX = (dWidth - mw->frameGeometry().width()) / 2.0;
|
||||
int midY = (dHeight - mw->frameGeometry().height()) / 2.0;
|
||||
mw->move(midX,midY);
|
||||
if (dWidth <= 1024) {
|
||||
mw->showMaximized();
|
||||
}
|
||||
else {
|
||||
mw->show();
|
||||
}
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <QPainterPath>
|
||||
#include <QGraphicsPathItem>
|
||||
#include <QListWidget>
|
||||
#include <QPainter>
|
||||
|
||||
|
||||
SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) {
|
||||
@@ -60,7 +61,7 @@ SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) {
|
||||
|
||||
setFlightPathVisible();
|
||||
|
||||
addLine(0,-298,0,298,QPen(Qt::green, 1, Qt::SolidLine) )->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
/*addLine(0,-298,0,298,QPen(Qt::green, 1, Qt::SolidLine) )->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
addLine(-398,0,398,0,QPen(Qt::green, 1, Qt::SolidLine) )->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
|
||||
for (int i = -39; i< 39; ++i) {
|
||||
@@ -76,7 +77,7 @@ SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) {
|
||||
line ->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
line->setZValue(-1);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
ellipse1 = new GraphicsEllipseItem();
|
||||
ellipse1->setRect(-2,-2,5,5);
|
||||
@@ -102,6 +103,11 @@ SimulScene::SimulScene ( QObject* parent ) : QGraphicsScene ( parent ) {
|
||||
|
||||
}
|
||||
|
||||
void SimulScene::drawBackground ( QPainter * painter, const QRectF & rect ) {
|
||||
QGraphicsScene::drawBackground(painter,rect);
|
||||
}
|
||||
|
||||
|
||||
void SimulScene::setupVars() {
|
||||
//variablen initialisieren
|
||||
setTimePerStep(1e-10);
|
||||
@@ -111,7 +117,7 @@ void SimulScene::setupVars() {
|
||||
setPxPerSec(90.0);
|
||||
|
||||
timer->setFrameRange(0,100);
|
||||
timer->setUpdateInterval(30);
|
||||
//timer->setUpdateInterval(30);
|
||||
timer->setCurveShape(QTimeLine::LinearCurve);
|
||||
|
||||
setTimeLineDuration(30000);
|
||||
@@ -457,7 +463,7 @@ void SimulScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) {
|
||||
}
|
||||
|
||||
void SimulScene::keyPressEvent (QKeyEvent *keyevent) {
|
||||
if(keyevent->key() == Qt::Key_Delete) {
|
||||
if(keyevent->matches(QKeySequence::Delete)) {
|
||||
deleteSelectedFieldItems();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,6 +199,7 @@ class SimulScene : public QGraphicsScene {
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
void keyPressEvent ( QKeyEvent * keyEvent );
|
||||
void drawBackground ( QPainter * painter, const QRectF & rect );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user