[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Mon Dec 15 21:42:00 UTC 2003
CVS commit by okellogg:
mouseMoveEvent(): Only call adjustAssocs() at timed intervals to save
CPU resources.
M +6 -4 umlwidget.cpp 1.68
M +6 -0 umlwidget.h 1.24
--- kdesdk/umbrello/umbrello/umlwidget.cpp #1.67:1.68
@@ -271,6 +271,9 @@ void UMLWidget::mouseMoveEvent(QMouseEve
setX( newX );
setY( newY );
+ if (lastUpdate.elapsed() > 25) {
adjustAssocs(newX, newY);
m_pView->resizeCanvasToItems();
+ lastUpdate.restart();
+ }
}
}
@@ -358,5 +361,5 @@ void UMLWidget::mouseReleaseEvent(QMouse
/* if multiple elements were not moved with the left mouse button,
* deselect all and select only the current */
- if ((m_bMoved == false) && (count > 1) && (m_bShiftPressed == false))
+ if (!m_bMoved && count > 1 && !m_bShiftPressed)
{
m_pView -> clearSelected();
@@ -829,5 +832,4 @@ void UMLWidget::setName(QString strName)
m_pObject->setName(strName);
calculateSize();
- // adjustAssocs( getX(), getY() ); // no. Let the user do the adjustment, besides this causes screwly looking lines if done here
}
--- kdesdk/umbrello/umbrello/umlwidget.h #1.23:1.24
@@ -14,4 +14,5 @@
#include <qcanvas.h>
#include <qdom.h>
+#include <qdatetime.h>
#include "umlnamespace.h"
@@ -703,4 +704,9 @@ protected:
bool m_bIgnoreSnapComponentSizeToGrid;
+ /**
+ * Timer that prevents excessive updates (be easy on the CPU)
+ */
+ QTime lastUpdate;
+
public slots:
More information about the umbrello-devel
mailing list