From 0d7908fd2e48c8b9185a4925fd6f6f19874f8d5f Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sun, 5 Jun 2005 21:13:58 +0000 Subject: [PATCH] Updating the selected element in the PSE when changing element from the detail dialog. svn path=/trunk/KDE/kdeedu/kalzium/src/element.cpp; revision=422590 --- kalzium/src/element.cpp | 20 ++++++++++++++++++++ kalzium/src/element.h | 11 +++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/kalzium/src/element.cpp b/kalzium/src/element.cpp index 7912289..4dd0fa2 100644 --- a/kalzium/src/element.cpp +++ b/kalzium/src/element.cpp @@ -526,6 +526,26 @@ double Element::radius( RADIUSTYPE type ) return 0.0; } +int Element::xPos() const +{ + return ( x-1 )*ELEMENTSIZE; +} + +int Element::yPos() const +{ + return ( y-1 )*ELEMENTSIZE + ELEMENTSIZE; +} + +QPoint Element::pos() const +{ + return QPoint( xPos(), yPos() ); +} + +QPoint Element::coords() const +{ + return QPoint( x, y ); +} + KalziumDataObject::KalziumDataObject() { QDomDocument doc( "datadocument" ); diff --git a/kalzium/src/element.h b/kalzium/src/element.h index 1690814..b75e11d 100644 --- a/kalzium/src/element.h +++ b/kalzium/src/element.h @@ -28,6 +28,7 @@ class Element; class QDomDocument; class QPainter; +class QPoint; struct coordinate; @@ -349,6 +350,8 @@ class Element{ */ static double strippedValue( double w ); + QPoint pos() const; + QPoint coords() const; /** * accessor for the element's color @@ -367,12 +370,8 @@ class Element{ QColor m_Color; - inline int xPos() const{ - return ( x-1 )*ELEMENTSIZE; - } - inline int yPos() const{ - return ( y-1 )*ELEMENTSIZE + ELEMENTSIZE; - } + int xPos() const; + int yPos() const; double m_mass, m_MP, -- 2.47.3