| 246 | } |
| 247 | |
| 248 | void TitleBar::mouseMoveEvent(QMouseEvent *event) |
| 249 | { |
| 250 | if(_is_draging){ |
| 251 | |
| 252 | int datX = 0; |
| 253 | int datY = 0; |
| 254 | |
| 255 | datX = (event->globalPos().x() - _clickPos.x()); |
| 256 | datY = (event->globalPos().y() - _clickPos.y()); |
| 257 | |
| 258 | int x = _oldPos.x() + datX; |
| 259 | int y = _oldPos.y() + datY; |
| 260 | |
| 261 | if (!_moving){ |
| 262 | if (ABS_VAL(datX) >= 2 || ABS_VAL(datY) >= 2){ |
| 263 | _moving = true; |
| 264 | } |
| 265 | else{ |
| 266 | return; |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | if (_titleParent != NULL){ |
| 271 | |
| 272 | if (!_is_done_moved){ |
| 273 | _is_done_moved = true; |
| 274 | _titleParent->MoveBegin(); |
| 275 | } |
| 276 | |
| 277 | _titleParent->MoveWindow(x, y); |
| 278 | } |
| 279 | else{ |
| 280 | |
| 281 | #ifdef _WIN32 |
| 282 | |
| 283 | QRect screenRect = AppControl::Instance()->_screenRect; |
| 284 | |
| 285 | if (screenRect.width() > 0 && QGuiApplication::screens().size() > 1) |
| 286 | { |
| 287 | QRect rect = _parent->frameGeometry(); |
| 288 | |
| 289 | if (x < screenRect.left()){ |
| 290 | x = screenRect.left(); |
| 291 | } |
| 292 | if (x + _parent->frameGeometry().width() > screenRect.right()) |
| 293 | { |
| 294 | x = screenRect.right() - _parent->frameGeometry().width(); |
| 295 | } |
| 296 | } |
| 297 | #endif |
| 298 | |
| 299 | _parent->move(x, y); |
| 300 | } |
| 301 | |
| 302 | event->accept(); |
| 303 | return; |
| 304 | } |
| 305 | QWidget::mouseMoveEvent(event); |
nothing calls this directly
no test coverage detected