summaryrefslogtreecommitdiffhomepage
path: root/bin
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2011-01-05 18:56:23 +0000
committerWim Vriend <facetracknoir@gmail.com>2011-01-05 18:56:23 +0000
commit40faae3082187a5da496bcc39099ea72b9b79d0f (patch)
tree55945dbc2c02f38252c22483dcfb2f6de2739e74 /bin
parent63c58dae4073e4c1e2f2866aa54ade953aae24ed (diff)
Added forgotten file QBezierConfigurator.h in bin folder
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@36 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'bin')
-rw-r--r--bin/qbezierconfigurator.h130
1 files changed, 130 insertions, 0 deletions
diff --git a/bin/qbezierconfigurator.h b/bin/qbezierconfigurator.h
new file mode 100644
index 00000000..81ce013a
--- /dev/null
+++ b/bin/qbezierconfigurator.h
@@ -0,0 +1,130 @@
+#ifndef QBEZIERCONFIGURATOR_H
+#define QBEZIERCONFIGURATOR_H
+
+#include <QtGui>
+#include <QtDesigner/QDesignerExportWidget>
+#include <QPointF>
+
+class QDESIGNER_WIDGET_EXPORT QBezierConfigurator : public QWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(int maxInputEGU READ maxInputEGU WRITE setmaxInputEGU);
+ Q_PROPERTY(int maxOutputEGU READ maxOutputEGU WRITE setmaxOutputEGU);
+ Q_PROPERTY(int pixPerEGU READ pixPerEGU WRITE setpixPerEGU);
+
+ Q_PROPERTY(QColor colorBezier READ colorBezier WRITE setColorBezier);
+ Q_PROPERTY(QColor colorBackground READ colorBackground WRITE setColorBackground);
+ Q_PROPERTY(QString stringInputEGU READ stringInputEGU WRITE setInputEGU);
+ Q_PROPERTY(QString stringOutputEGU READ stringOutputEGU WRITE setOutputEGU);
+ Q_PROPERTY(QString stringCaption READ stringCaption WRITE setCaption);
+
+ // Return the current value to Designer
+ int maxInputEGU() const
+ {
+ return MaxInput;
+ }
+ int maxOutputEGU() const
+ {
+ return MaxOutput;
+ }
+ int pixPerEGU() const
+ {
+ return pPerEGU;
+ }
+
+ // Return the current color to Designer
+ QColor colorBezier() const
+ {
+ return colBezier;
+ }
+ // Return the current color to Designer
+ QColor colorBackground() const
+ {
+ return colBackground;
+ }
+ // Return the current string to Designer
+ QString stringInputEGU() const
+ {
+ return strInputEGU;
+ }
+ // Return the current string to Designer
+ QString stringOutputEGU() const
+ {
+ return strOutputEGU;
+ }
+ // Return the current string to Designer
+ QString stringCaption() const
+ {
+ return strCaption;
+ }
+
+public:
+ QBezierConfigurator(QWidget *parent = 0);
+ ~QBezierConfigurator();
+
+signals:
+ void valueNeutralZoneChanged(int);
+ void BezierCurveChanged(bool);
+
+public slots:
+ void setmaxInputEGU(int);
+ void setmaxOutputEGU(int);
+ void setpixPerEGU(int);
+
+ QPointF getPointOne();
+ QPointF getPointTwo();
+ QPointF getPointThree();
+ QPointF getPointFour();
+
+ void setPointOne(QPointF);
+ void setPointTwo(QPointF);
+ void setPointThree(QPointF);
+ void setPointFour(QPointF);
+
+ void setNeutralZone(int zone);
+
+ void setColorBezier(QColor);
+ void setColorBackground(QColor);
+ void setInputEGU(QString);
+ void setOutputEGU(QString);
+ void setCaption(QString);
+
+protected slots:
+ void paintEvent(QPaintEvent *e);
+ void mousePressEvent(QMouseEvent *e);
+ void mouseMoveEvent(QMouseEvent *e);
+ void mouseReleaseEvent(QMouseEvent *e);
+
+protected:
+ void drawBackground(QPainter *painter, const QRectF &rect);
+ void drawPoint(QPainter *painter, const QPointF &pt);
+ void drawLine(QPainter *painter, const QPointF &start, const QPointF &end, QPen pen);
+ bool markContains(const QPointF &pt, const QPointF &coord) const;
+ bool withinRange( const QPointF &coord ) const;
+
+protected:
+ virtual void resizeEvent(QResizeEvent *);
+
+private:
+ QRectF range; // The actual rectangle for the Bezier-curve
+ QPointF one, two, three, four; // The four points, that define the curve
+ QPointF normalizePoint (QPointF point) const; // Convert the graphical Point to a real-life Point
+ QPointF graphicalizePoint (QPointF point) const; // Convert the Point to a graphical Point
+
+ QPointF mouseStart;
+ QPointF *moving;
+ int movingPoint;
+
+ int MaxInput; // Maximum input limit
+ int MaxOutput; // Maximum output limit
+ int pPerEGU; // Number of pixels, per EGU
+
+ QColor colBezier; // Color of Bezier curve
+ QColor colBackground; // Color of widget background
+ QString strInputEGU; // Engineering Units input (vertical axis)
+ QString strOutputEGU; // Engineering Units output (horizontal axis)
+ QString strCaption; // Caption of the graph
+
+};
+
+#endif // QBEZIERCONFIGURATOR_H