diff --git a/retroshare-gui/src/util/MouseEventFilter.cpp b/retroshare-gui/src/util/MouseEventFilter.cpp index 2220dbefa..10240cbfd 100644 --- a/retroshare-gui/src/util/MouseEventFilter.cpp +++ b/retroshare-gui/src/util/MouseEventFilter.cpp @@ -17,90 +17,90 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include - -#include -#include - -#include -#include - -MouseMoveEventFilter::MouseMoveEventFilter(QObject * receiver, const char * member) - : EventFilter(receiver, member) { -} - -bool MouseMoveEventFilter::eventFilter(QObject * watched, QEvent * event) { - if (event->type() == QEvent::MouseMove) { - filter(event); - return false; - } - return EventFilter::eventFilter(watched, event); -} - -MousePressEventFilter::MousePressEventFilter(QObject * receiver, const char * member, Qt::MouseButton button) - : EventFilter(receiver, member), - _button(button) { -} - -bool MousePressEventFilter::eventFilter(QObject * watched, QEvent * event) { - if (event->type() == QEvent::MouseButtonPress) { - try { - QMouseEvent * mouseEvent = dynamic_cast(event); - - if ((_button == Qt::NoButton) || (mouseEvent->button() == _button)) { - filter(event); - return false; - } - } catch (std::bad_cast) { - //LOG_FATAL("exception when casting a QEvent to a QMouseEvent"); - } - } - return EventFilter::eventFilter(watched, event); -} - -MouseReleaseEventFilter::MouseReleaseEventFilter(QObject * receiver, const char * member, Qt::MouseButton button) - : EventFilter(receiver, member), - _button(button) { -} - -bool MouseReleaseEventFilter::eventFilter(QObject * watched, QEvent * event) { - if (event->type() == QEvent::MouseButtonRelease) { - try { - QMouseEvent * mouseEvent = dynamic_cast(event); - - if ((_button == Qt::NoButton) || (mouseEvent->button() == _button)) { - filter(event); - return false; - } - } catch (std::bad_cast) { - //LOG_FATAL("exception when casting a QEvent to a QMouseEvent"); - } - } - return EventFilter::eventFilter(watched, event); -} - -MouseHoverEnterEventFilter::MouseHoverEnterEventFilter(QObject * receiver, const char * member) - : EventFilter(receiver, member) { -} - -bool MouseHoverEnterEventFilter::eventFilter(QObject * watched, QEvent * event) { - if (event->type() == QEvent::HoverEnter) { - filter(event); - return false; - } - return EventFilter::eventFilter(watched, event); -} - -MouseHoverLeaveEventFilter::MouseHoverLeaveEventFilter(QObject * receiver, const char * member) - : EventFilter(receiver, member) { -} - -bool MouseHoverLeaveEventFilter::eventFilter(QObject * watched, QEvent * event) { - if (event->type() == QEvent::HoverLeave) { - filter(event); - return false; - } - return EventFilter::eventFilter(watched, event); -} + ****************************************************************/ + +#include + +#include +#include + +#include +#include + +MouseMoveEventFilter::MouseMoveEventFilter(QObject * receiver, const char * member) + : EventFilter(receiver, member) { +} + +bool MouseMoveEventFilter::eventFilter(QObject * watched, QEvent * event) { + if (event->type() == QEvent::MouseMove) { + filter(event); + return false; + } + return EventFilter::eventFilter(watched, event); +} + +MousePressEventFilter::MousePressEventFilter(QObject * receiver, const char * member, Qt::MouseButton button) + : EventFilter(receiver, member), + _button(button) { +} + +bool MousePressEventFilter::eventFilter(QObject * watched, QEvent * event) { + if (event->type() == QEvent::MouseButtonPress) { + try { + QMouseEvent * mouseEvent = dynamic_cast(event); + + if ((_button == Qt::NoButton) || (mouseEvent->button() == _button)) { + filter(event); + return false; + } + } catch (const std::bad_cast&) { + //LOG_FATAL("exception when casting a QEvent to a QMouseEvent"); + } + } + return EventFilter::eventFilter(watched, event); +} + +MouseReleaseEventFilter::MouseReleaseEventFilter(QObject * receiver, const char * member, Qt::MouseButton button) + : EventFilter(receiver, member), + _button(button) { +} + +bool MouseReleaseEventFilter::eventFilter(QObject * watched, QEvent * event) { + if (event->type() == QEvent::MouseButtonRelease) { + try { + QMouseEvent * mouseEvent = dynamic_cast(event); + + if ((_button == Qt::NoButton) || (mouseEvent->button() == _button)) { + filter(event); + return false; + } + } catch (const std::bad_cast&) { + //LOG_FATAL("exception when casting a QEvent to a QMouseEvent"); + } + } + return EventFilter::eventFilter(watched, event); +} + +MouseHoverEnterEventFilter::MouseHoverEnterEventFilter(QObject * receiver, const char * member) + : EventFilter(receiver, member) { +} + +bool MouseHoverEnterEventFilter::eventFilter(QObject * watched, QEvent * event) { + if (event->type() == QEvent::HoverEnter) { + filter(event); + return false; + } + return EventFilter::eventFilter(watched, event); +} + +MouseHoverLeaveEventFilter::MouseHoverLeaveEventFilter(QObject * receiver, const char * member) + : EventFilter(receiver, member) { +} + +bool MouseHoverLeaveEventFilter::eventFilter(QObject * watched, QEvent * event) { + if (event->type() == QEvent::HoverLeave) { + filter(event); + return false; + } + return EventFilter::eventFilter(watched, event); +}