27 setAcceptedMouseButtons(Qt::AllButtons);
65 painter->setPen(Qt::black);
66 painter->drawText(QPoint(11,21),
m_Title);
67 painter->setPen(Qt::white);
68 painter->drawText(QPoint(10,20),
m_Title);
73 QString qs_min = QString::number(
m_Min,
'g', 4 );
74 QString qs_max = QString::number(
m_Max,
'g', 4 );
76 QRect qr_min = painter->fontMetrics().boundingRect( qs_min );
77 QRect qr_max = painter->fontMetrics().boundingRect( qs_max );
81 y=this->boundingRect().height()-qr_min.height()+5;
102 painter->setPen(Qt::gray);
104 QRectF contentsRect = this->boundingRect();
112 painter->setPen(Qt::black);
116 std::pair<int,int> left;
117 std::pair<int,int> right;
127 right = this->
FunctionToCanvas(std::make_pair(dp[(i+1) * 2], dp[(i+1) * 2 + 1]));
129 painter->drawLine(left.first, left.second, right.first, right.second);
137 dp[i * 2], dp[i * 2 + 1]));
141 painter->setBrush(QBrush(Qt::red));
151 painter->setBrush(QBrush(Qt::green));
153 painter->drawEllipse(point.first - 4, point.second - 4, 8, 8);
156 painter->setBrush(Qt::NoBrush);
161 unsigned int maxSquaredDistance)
168 if ((
unsigned int) ((point.first - x) * (point.first - x) + (point.second
169 - y) * (point.second - y)) <= maxSquaredDistance)
179 std::pair<double,double> pos)
212 qmlRegisterType<QmlMitkPiecewiseFunctionCanvas>(
"Mitk.Views", 1, 0,
"PiecewiseItem");
vtkPiecewiseFunction * m_PiecewiseFunction
void mousePressEvent(QMouseEvent *mouseEvent) override
void mouseMoveEvent(QMouseEvent *mouseEvent) override
void mouseDoubleClickEvent(QMouseEvent *mouseEvent) override
double GetFunctionY(int index) override
void paint(QPainter *painter) override
void mouseDoubleClickEvent(QMouseEvent *mouseEvent) override
void PaintHistogram(QPainter *painter)
void setOpacity(double opacity)
void mouseMoveEvent(QMouseEvent *mouseEvent) override
void setGreyValue(double value)
static QmlMitkPiecewiseFunctionCanvas * instance
int GetNearHandle(int x, int y, unsigned int maxSquaredDistance=32) override
std::pair< int, int > FunctionToCanvas(std::pair< double, double >)
void mousePressEvent(QMouseEvent *mouseEvent) override
void MoveFunctionPoint(int index, std::pair< double, double > pos) override
void mouseReleaseEvent(QMouseEvent *mouseEvent) override
void mouseReleaseEvent(QMouseEvent *mouseEvent) override
static RenderingManager * GetInstance()
void SetTitle(const QString &title)
void keyPressEvent(QKeyEvent *event) override
void RemoveFunctionPoint(double x) override
void keyPressEvent(QKeyEvent *keyEvent) override
QmlMitkPiecewiseFunctionCanvas(QQuickPaintedItem *parent=nullptr)
int AddFunctionPoint(double x, double val) override
double GetFunctionX(int index) override
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)