MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / mousePressEvent

Method mousePressEvent

DSView/pv/view/header.cpp:174–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174void 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);

Callers

nothing calls this directly

Calls 13

get_tracesMethod · 0.80
is_instantMethod · 0.80
sessionMethod · 0.80
is_running_statusMethod · 0.80
selectedMethod · 0.80
get_v_offsetMethod · 0.80
selectMethod · 0.80
set_old_v_offsetMethod · 0.80
signal_typeMethod · 0.80
is_workingMethod · 0.80
clearMethod · 0.45
get_zero_vposMethod · 0.45

Tested by

no test coverage detected