diff -r 12f9ea615cbc -r 314e12e23c3a src/editmodes/selectMode.cpp --- a/src/editmodes/selectMode.cpp Thu Jan 04 19:40:52 2018 +0200 +++ b/src/editmodes/selectMode.cpp Thu Jan 04 19:44:26 2018 +0200 @@ -23,16 +23,16 @@ #include "../mainwindow.h" #include "../glRenderer.h" -SelectMode::SelectMode (GLRenderer* renderer) : - Super (renderer), - m_rangepick (false) {} +SelectMode::SelectMode(GLRenderer* renderer) : + Super(renderer), + m_rangepick(false) {} EditModeType SelectMode::type() const { return EditModeType::Select; } -void SelectMode::render (QPainter& painter) const +void SelectMode::render(QPainter& painter) const { // If we're range-picking, draw a rectangle encompassing the selection area. if (m_rangepick) @@ -42,18 +42,18 @@ x1 = renderer()->mousePosition().x(), y1 = renderer()->mousePosition().y(); - QRect rect (x0, y0, x1 - x0, y1 - y0); + QRect rect(x0, y0, x1 - x0, y1 - y0); QColor fillColor = (m_addpick ? "#40FF00" : "#00CCFF"); - fillColor.setAlphaF (0.2f); - painter.setPen (QPen (QColor (0, 0, 0, 208), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); - painter.setBrush (QBrush (fillColor)); - painter.drawRect (rect); + fillColor.setAlphaF(0.2f); + painter.setPen(QPen(QColor(0, 0, 0, 208), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + painter.setBrush(QBrush(fillColor)); + painter.drawRect(rect); } } -bool SelectMode::mouseReleased (MouseEventData const& data) +bool SelectMode::mouseReleased(MouseEventData const& data) { - if (Super::mouseReleased (data)) + if (Super::mouseReleased(data)) return true; if (data.releasedButtons & Qt::LeftButton) @@ -72,18 +72,18 @@ if (not m_rangepick) { - area = QRect (mx, my, 1, 1); + area = QRect(mx, my, 1, 1); } else { - int const x = qMin (m_rangeStart.x(), mx); - int const y = qMin (m_rangeStart.y(), my); - int const width = qAbs (m_rangeStart.x() - mx); - int const height = qAbs (m_rangeStart.y() - my); - area = QRect (x, y, width, height); + int const x = qMin(m_rangeStart.x(), mx); + int const y = qMin(m_rangeStart.y(), my); + int const width = qAbs(m_rangeStart.x() - mx); + int const height = qAbs(m_rangeStart.y() - my); + area = QRect(x, y, width, height); } - renderer()->pick (area, m_addpick); + renderer()->pick(area, m_addpick); } m_rangepick = false; @@ -93,16 +93,16 @@ return false; } -bool SelectMode::mousePressed (QMouseEvent* ev) +bool SelectMode::mousePressed(QMouseEvent* ev) { - if (Super::mousePressed (ev)) + if (Super::mousePressed(ev)) return true; if (ev->modifiers() & Qt::ControlModifier) { m_rangepick = true; - m_rangeStart.setX (ev->x()); - m_rangeStart.setY (ev->y()); + m_rangeStart.setX(ev->x()); + m_rangeStart.setY(ev->y()); m_addpick = (ev->modifiers() & Qt::AltModifier); return true; } @@ -110,19 +110,19 @@ return false; } -bool SelectMode::mouseDoubleClicked (QMouseEvent* ev) +bool SelectMode::mouseDoubleClicked(QMouseEvent* ev) { - if (Super::mouseDoubleClicked (ev)) + if (Super::mouseDoubleClicked(ev)) return true; if (ev->buttons() & Qt::LeftButton) { renderer()->document()->clearSelection(); - LDObject* obj = renderer()->pickOneObject (ev->x(), ev->y()); + LDObject* obj = renderer()->pickOneObject(ev->x(), ev->y()); if (obj) { - AddObjectDialog::staticDialog (obj->type(), obj); + AddObjectDialog::staticDialog(obj->type(), obj); m_window->endAction(); return true; } @@ -131,7 +131,7 @@ return false; } -bool SelectMode::mouseMoved (QMouseEvent*) +bool SelectMode::mouseMoved(QMouseEvent*) { return m_rangepick; }