| 172 | } |
| 173 | |
| 174 | void Header::mousePressEvent(QMouseEvent *event) |
| 175 | { |
| 176 | assert(event); |
| 177 | |
| 178 | _mouse_is_down = true; |
| 179 | |
| 180 | std::vector<Trace*> traces; |
| 181 | _view.get_traces(ALL_VIEW, traces); |
| 182 | int action; |
| 183 | |
| 184 | const bool instant = _view.session().is_instant(); |
| 185 | if (instant && _view.session().is_running_status()) { |
| 186 | return; |
| 187 | } |
| 188 | |
| 189 | if (event->button() & Qt::LeftButton) { |
| 190 | _mouse_down_point = event->pos(); |
| 191 | |
| 192 | // Save the offsets of any Traces which will be dragged |
| 193 | for(auto t : traces){ |
| 194 | if (t->selected()) |
| 195 | _drag_traces.push_back( |
| 196 | make_pair(t, t->get_v_offset())); |
| 197 | } |
| 198 | |
| 199 | // Select the Trace if it has been clicked |
| 200 | const auto mTrace = get_mTrace(action, event->pos()); |
| 201 | if (action == Trace::COLOR && mTrace) { |
| 202 | _colorFlag = true; |
| 203 | } |
| 204 | else if (action == Trace::NAME && mTrace) { |
| 205 | _nameFlag = true; |
| 206 | } |
| 207 | else if (action == Trace::LABEL && mTrace) { |
| 208 | mTrace->select(true); |
| 209 | |
| 210 | if (~QApplication::keyboardModifiers() & Qt::ControlModifier) |
| 211 | _drag_traces.clear(); |
| 212 | |
| 213 | _drag_traces.push_back(make_pair(mTrace, mTrace->get_zero_vpos())); |
| 214 | mTrace->set_old_v_offset(mTrace->get_v_offset()); |
| 215 | } |
| 216 | |
| 217 | for(auto t : traces){ |
| 218 | if (t->signal_type() == SR_CHANNEL_LOGIC && _view.session().is_working()){ |
| 219 | // Disable set trigger from left pannel when capturing. |
| 220 | break; |
| 221 | } |
| 222 | if (t->mouse_press(width(), event->pos())) |
| 223 | break; |
| 224 | } |
| 225 | |
| 226 | if (~QApplication::keyboardModifiers() & Qt::ControlModifier) { |
| 227 | // Unselect all other Traces because the Ctrl is not |
| 228 | // pressed |
| 229 | for(auto t : traces){ |
| 230 | if (t != mTrace) |
| 231 | t->select(false); |
nothing calls this directly
no test coverage detected