phoenix/qt/mouse.cpp
raw| 1 | namespace phoenix { |
| 2 | |
| 3 | Position pMouse::position() { |
| 4 | QPoint point = QCursor::pos(); |
| 5 | return {point.x(), point.y()}; |
| 6 | } |
| 7 | |
| 8 | bool pMouse::pressed(Mouse::Button button) { |
| 9 | Qt::MouseButtons buttons = QApplication::mouseButtons(); |
| 10 | switch(button) { |
| 11 | case Mouse::Button::Left: return buttons & Qt::LeftButton; |
| 12 | case Mouse::Button::Middle: return buttons & Qt::MidButton; |
| 13 | case Mouse::Button::Right: return buttons & Qt::RightButton; |
| 14 | } |
| 15 | return false; |
| 16 | } |
| 17 | |
| 18 | } |