| 213 | } |
| 214 | |
| 215 | void TitleBar::mousePressEvent(QMouseEvent* event) |
| 216 | { |
| 217 | bool ableMove = !ParentIsMaxsized(); |
| 218 | |
| 219 | if(event->button() == Qt::LeftButton && ableMove && _is_able_drag) |
| 220 | { |
| 221 | int x = event->pos().x(); |
| 222 | int y = event->pos().y(); |
| 223 | |
| 224 | bool bTopWidow = AppControl::Instance()->GetTopWindow() == _parent; |
| 225 | bool bClick = (x >= 6 && y >= 5 && x <= width() - 6); //top window need resize hit check |
| 226 | |
| 227 | if (!bTopWidow || bClick ){ |
| 228 | _is_draging = true; |
| 229 | |
| 230 | _clickPos = event->globalPos(); |
| 231 | |
| 232 | if (_titleParent != NULL){ |
| 233 | _oldPos = _titleParent->GetParentPos(); |
| 234 | } |
| 235 | else{ |
| 236 | _oldPos = _parent->pos(); |
| 237 | } |
| 238 | |
| 239 | _is_done_moved = false; |
| 240 | |
| 241 | event->accept(); |
| 242 | return; |
| 243 | } |
| 244 | } |
| 245 | QWidget::mousePressEvent(event); |
| 246 | } |
| 247 | |
| 248 | void TitleBar::mouseMoveEvent(QMouseEvent *event) |
| 249 | { |
nothing calls this directly
no test coverage detected