--User changes

-Add the ability to drag the rotation of the current palette via the palette preview table.
This commit is contained in:
Person
2018-03-29 16:10:22 -07:00
parent ed74fd6a83
commit cd1749fe5f
5 changed files with 111 additions and 23 deletions

View File

@ -37,9 +37,16 @@ public:
viewport()->installEventFilter(this);
}
signals:
void MouseDragged(const QPointF& local, const QPoint& global);
void MouseReleased();
protected:
/// <summary>
/// Event filter to ignore mouse wheel events.
/// Event filter to ignore mouse wheel events and also handle others such as mouse move and mouse button release.
/// Sadly, QTableWidget makes these hard to get to, so we must handle them here.
/// </summary>
/// <param name="obj">The object sending the event</param>
/// <param name="e">The event</param>
@ -51,6 +58,17 @@ protected:
e->ignore();
return true;
}
else if (e->type() == QEvent::MouseMove)
{
if (auto me = dynamic_cast<QMouseEvent*>(e))
{
emit MouseDragged(me->localPos(), me->globalPos());
}
}
else if (e->type() == QEvent::MouseButtonRelease)
{
emit MouseReleased();
}
return QTableWidget::eventFilter(obj, e);
}