Commit 4cff1f49 authored by Leander Schulten's avatar Leander Schulten
Browse files

Add Events

parent 7141226f
......@@ -87,6 +87,9 @@ ModelView{
}
}
}
onRightClick:{
console.log(x + " "+y)
}
}
......
......@@ -385,6 +385,7 @@ void ChannelProgrammEditor::mousePressEvent(QMouseEvent *event){
lastMousePosition = event->pos();
forceActiveFocus(Qt::MouseFocusReason);
event->accept();
mousePressTimestamp = event->timestamp();
if(!channelProgramm)
return;
......@@ -638,7 +639,13 @@ void ChannelProgrammEditor::mouseReleaseEvent(QMouseEvent *event){
event->accept();
lastMousePosition = INVALID_POS;
qDebug()<<event->globalPos()<<'\n';
if(event->timestamp()-mousePressTimestamp < 300){
if(event->button()==Qt::LeftButton){
emit click(event->x(),event->y());
}else if(event->button()==Qt::RightButton){
emit rightClick(event->x(),event->y());
}
}
}
TimePoint * ChannelProgrammEditor::getCurrentTimePoint(){
......
......@@ -57,6 +57,7 @@ private:
QFlags<Modifier> modifier;
#define INVALID_POS QPoint(std::numeric_limits<int>::max(),std::numeric_limits<int>::max())
QPoint lastMousePosition = INVALID_POS;
ulong mousePressTimestamp;
decltype(ChannelProgramm::timeline)::iterator getTimePointForPosition(int x, int y);
/**
* @brief mapToVisualX maps from values/mouse Position to the visual Position of the graph
......@@ -113,6 +114,8 @@ signals:
void clickRadiusChanged();
void graphColorChanged();
void channelProgrammChanged();
void click(int x, int y);
void rightClick(int x, int y);
};
#endif // CHANNELPROGRAMMEDITOR_H
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment