[Kst] branches/work/kst/portto4/kst/src/libkstapp
Mike Fenton
mike at staikos.net
Fri Jan 23 20:28:53 CET 2009
SVN commit 915790 by fenton:
Add reference point 'c' mode.
M +25 -1 plotrenderitem.cpp
M +3 -0 plotrenderitem.h
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #915789:915790
@@ -33,7 +33,7 @@
namespace Kst {
PlotRenderItem::PlotRenderItem(PlotItem *parentItem)
- : ViewItem(parentItem->parentView()) {
+ : ViewItem(parentItem->parentView()), _referencePointMode(false) {
setName(tr("Plot Render"));
setZValue(PLOTRENDER_ZVALUE);
@@ -206,6 +206,8 @@
painter->restore();
+ paintReferencePoint(painter);
+
if (!parentView()->isPrinting()) {
if (_selectionRect.isValid()) {
painter->setPen(QPen(QBrush(Qt::black), 1.0, Qt::DotLine));
@@ -243,6 +245,17 @@
}
+void PlotRenderItem::paintReferencePoint(QPainter *painter) {
+ if (_referencePointMode && plotItem()->projectionRect().contains(_referencePoint)) {
+ QPointF point = plotItem()->mapToPlot(_referencePoint);
+ painter->save();
+ painter->setPen(QPen(QColor("gray"), 1));
+ CurvePointSymbol::draw(7, painter, point.x(), point.y(), 1);
+ painter->restore();
+ }
+}
+
+
QString PlotRenderItem::leftLabel() const {
// This will make sense once curves learn
// to return <Quantity> [<Units>]
@@ -296,6 +309,17 @@
_selectionRect.setFrom(QPointF(_lastPos.x(), rect().top()));
_selectionRect.setTo(QPointF(_lastPos.x(), rect().bottom()));
}
+
+ if (event->key() == Qt::Key_C) {
+ if (modifiers & Qt::ShiftModifier) {
+ _referencePointMode = false;
+ } else {
+ _referencePointMode = true;
+ _referencePoint = plotItem()->mapToProjection(_lastPos);
+ update();
+ }
+ }
+
ViewItem::keyPressEvent(event);
updateSelectionRect();
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.h #915789:915790
@@ -52,6 +52,7 @@
virtual void saveInPlot(QXmlStreamWriter &xml);
virtual void paint(QPainter *painter);
virtual void paintRelations(QPainter *painter) = 0;
+ void paintReferencePoint(QPainter *painter);
virtual bool configureFromXml(QXmlStreamReader &xml, ObjectStore *store);
@@ -116,6 +117,8 @@
private:
RenderType _type;
QPointF _lastPos;
+ bool _referencePointMode;
+ QPointF _referencePoint;
RelationList _relationList;
SelectionRect _selectionRect;
More information about the Kst
mailing list