| 124 | } |
| 125 | |
| 126 | bool Dialog::eventFilter(QObject* watched, QEvent* event) { |
| 127 | const QEvent::Type type = event->type(); |
| 128 | if (type != QEvent::MouseMove && type != QEvent::MouseButtonPress) { |
| 129 | return QDialog::eventFilter(watched, event); |
| 130 | } |
| 131 | auto* widget = qobject_cast<QWidget*>(watched); |
| 132 | if (widget == nullptr || widget->window() != this) { |
| 133 | return QDialog::eventFilter(watched, event); |
| 134 | } |
| 135 | if (isMaximized() || isFullScreen()) { |
| 136 | return QDialog::eventFilter(watched, event); |
| 137 | } |
| 138 | auto* mouse_event = static_cast<QMouseEvent*>(event); |
| 139 | const QPoint window_pos = mapFromGlobal(mouse_event->globalPosition().toPoint()); |
| 140 | const Qt::Edges edges = edgesAtPoint(window_pos); |
| 141 | |
| 142 | if (type == QEvent::MouseMove) { |
| 143 | if (edges != 0) { |
| 144 | setCursor(cursorForEdges(edges)); |
| 145 | } else { |
| 146 | unsetCursor(); |
| 147 | } |
| 148 | return false; |
| 149 | } |
| 150 | // MouseButtonPress |
| 151 | if (mouse_event->button() != Qt::LeftButton || edges == 0) { |
| 152 | return false; |
| 153 | } |
| 154 | if (auto* handle = windowHandle()) { |
| 155 | handle->startSystemResize(edges); |
| 156 | return true; |
| 157 | } |
| 158 | return false; |
| 159 | } |
| 160 | |
| 161 | } // namespace PJ |
nothing calls this directly
no test coverage detected