| 54 | } |
| 55 | |
| 56 | void FloatController::mouseReleaseEvent(QMouseEvent *event) { |
| 57 | pressed_ = false; |
| 58 | event->accept(); |
| 59 | repaint(); |
| 60 | |
| 61 | QRect parent_rect = parentWidget()->geometry(); |
| 62 | float x_pos_ratio = this->pos().x() * 1.0f / parent_rect.width(); |
| 63 | float y_pos_ratio = this->pos().y() * 1.0f / parent_rect.height(); |
| 64 | context_->SaveKeyValue(kPosX, std::to_string(x_pos_ratio)); |
| 65 | context_->SaveKeyValue(kPosY, std::to_string(y_pos_ratio)); |
| 66 | |
| 67 | if (click_listener_) { |
| 68 | click_listener_(); |
| 69 | } |
| 70 | |
| 71 | has_moved_ = false; |
| 72 | } |
| 73 | |
| 74 | void FloatController::mouseMoveEvent(QMouseEvent *event) { |
| 75 | if (pressed_) { |
nothing calls this directly
no test coverage detected