Bug Summary

File:librecad/src/ui/components/creators/lc_menuactivator.cpp
Warning:line 277, column 24
8th function call argument is an uninitialized value

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -O2 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name lc_menuactivator.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/runner/work/LibreCAD/LibreCAD/librecad/src -fcoverage-compilation-dir=/home/runner/work/LibreCAD/LibreCAD/librecad/src -resource-dir /usr/lib/llvm-21/lib/clang/21 -D _REENTRANT -D DWGSUPPORT -D MUPARSER_STATIC -D LC_WITH_OPENTYPE=0 -D QC_APPDIR=librecad -D LC_VERSION=2.2.2_alpha1-853-ge2a8c2931 -D LC_PRERELEASE=true; -D QT_NO_DEBUG -D QT_SVG_LIB -D QT_PRINTSUPPORT_LIB -D QT_WIDGETS_LIB -D QT_GUI_LIB -D QT_NETWORK_LIB -D QT_CORE_LIB -I . -I /usr/include -I ../../libraries/lciconengine -I ../../libraries/libdxfrw/src -I ../../libraries/libdxfrw/src/intern -I ../../libraries/jwwlib/src -I ../../libraries/shapelib/src -I ../../libraries/qtbidi -I cmd -I lib/actions -I lib/actions/visual_snap -I lib/actions/options -I lib/creation -I lib/debug -I lib/engine -I lib/engine/document -I lib/engine/document/blocks -I lib/engine/document/container -I lib/engine/document/dimstyles -I lib/engine/document/entities -I lib/engine/document/entities/support -I lib/engine/document/fonts -I lib/engine/document/io -I lib/engine/document/layers -I lib/engine/document/linetypes -I lib/engine/document/patterns -I lib/engine/document/selection -I lib/engine/document/textstyles -I lib/engine/document/ucs -I lib/engine/document/variables -I lib/engine/document/views -I lib/engine/clipboard -I lib/engine/overlays -I lib/engine/overlays/angles_base -I lib/engine/overlays/highlight -I lib/engine/overlays/preview -I lib/engine/overlays/references -I lib/engine/overlays/crosshair -I lib/engine/overlays/info_cursor -I lib/engine/overlays/overlay_box -I lib/engine/overlays/ucs_mark -I lib/engine/undo -I lib/engine/utils -I lib/engine/settings -I lib/fileio -I lib/filters -I lib/generators -I lib/generators/makercamsvg -I lib/generators/layers -I lib/generators/image -I lib/gui -I lib/gui/grid -I lib/gui/render -I lib/gui/render/headless -I lib/gui/render/widget -I lib/information -I lib/math -I lib/modification -I lib/selection -I lib/selection/metaentity -I lib/selection/metaentity/entities -I lib/printing -I lib/properties -I actions -I actions/dock_widgets -I actions/dock_widgets/block -I actions/dock_widgets/entity_info -I actions/dock_widgets/layer -I actions/dock_widgets/library -I actions/dock_widgets/ucs_list -I actions/drawing -I actions/drawing/draw -I actions/drawing/draw/arc -I actions/drawing/draw/circle -I actions/drawing/draw/curve -I actions/drawing/draw/spline -I actions/drawing/draw/dimensions -I actions/drawing/draw/ellipse -I actions/drawing/draw/hatch -I actions/drawing/draw/image -I actions/drawing/draw/line -I actions/drawing/draw/point -I actions/drawing/draw/rect -I actions/drawing/draw/polygon -I actions/drawing/draw/misc -I actions/drawing/draw/line/shapes -I actions/drawing/draw/line/misc -I actions/drawing/draw/line/shapes/rect -I actions/drawing/draw/line/shapes/polygon -I actions/drawing/draw/polyline -I actions/drawing/draw/text -I actions/drawing/edit -I actions/drawing/info -I actions/drawing/pick -I actions/drawing/modify -I actions/drawing/pen -I actions/drawing/rel_zero -I actions/drawing/selection -I actions/drawing/snap -I actions/drawing/zoom -I actions/file -I actions/options -I actions/print_preview -I ui -I ui/action_options -I ui/action_options/circle -I ui/action_options/curve -I ui/action_options/spline -I ui/action_options/dimensions -I ui/action_options/edit -I ui/action_options/image -I ui/action_options/info -I ui/action_options/insert -I ui/action_options/line -I ui/action_options/rect -I ui/action_options/polygon -I ui/action_options/misc -I ui/action_options/modify -I ui/action_options/ellipse -I ui/action_options/other -I ui/action_options/polyline -I ui/action_options/point -I ui/action_options/print_preview -I ui/action_options/selection -I ui/action_options/snap -I ui/action_options/text -I ui/actions -I ui/components -I ui/components/relative_position_assistant -I ui/components/comboboxes -I ui/components/containers -I ui/components/creators -I ui/components/layouts -I ui/components/pen -I ui/components/status_bar -I ui/components/toolbars -I ui/components/utils -I ui/dialogs -I ui/dialogs/actions -I ui/dialogs/actions/modify -I ui/dialogs/actions/quick_selection -I ui/dialogs/modify -I ui/dialogs/entity -I ui/dialogs/creators -I ui/dialogs/file -I ui/dialogs/file/export -I ui/dialogs/file/export/layers -I ui/dialogs/file/export/image -I ui/dialogs/file/export/makercam -I ui/dialogs/main -I ui/dialogs/settings -I ui/dialogs/settings/dimstyles -I ui/dialogs/settings/dimstyles/dimstyle_manager -I ui/dialogs/settings/dimstyles/dimstyle_manager/support -I ui/dialogs/settings/options_device -I ui/dialogs/settings/options_drawing -I ui/dialogs/settings/options_general -I ui/dialogs/settings/options_widget -I ui/dialogs/settings/shortcuts -I ui/dock_widgets -I ui/dock_widgets/block_widget -I ui/dock_widgets/command_line -I ui/dock_widgets/entity_info -I ui/dock_widgets/layer_widget -I ui/dock_widgets/layers_tree -I ui/dock_widgets/library_widget -I ui/dock_widgets/pen_palette -I ui/dock_widgets/pen_wizard -I ui/dock_widgets/property_sheet -I ui/dock_widgets/property_sheet/lib -I ui/dock_widgets/property_sheet/lib/properties -I ui/dock_widgets/property_sheet/lib/view -I ui/dock_widgets/property_sheet/lib/view/edit -I ui/dock_widgets/property_sheet/lib/widgets -I ui/dock_widgets/property_sheet/lib/widgets/sheet -I ui/dock_widgets/property_sheet/metaentity -I ui/dock_widgets/property_sheet/metaentity/entities -I ui/dock_widgets/property_sheet/metaentity/entities/document -I ui/dock_widgets/property_sheet/properties -I ui/dock_widgets/property_sheet/properties/action -I ui/dock_widgets/property_sheet/properties/bool -I ui/dock_widgets/property_sheet/properties/color -I ui/dock_widgets/property_sheet/properties/double -I ui/dock_widgets/property_sheet/properties/enum -I ui/dock_widgets/property_sheet/properties/int -I ui/dock_widgets/property_sheet/properties/layer -I ui/dock_widgets/property_sheet/properties/linetype -I ui/dock_widgets/property_sheet/properties/linewidth -I ui/dock_widgets/property_sheet/properties/rect -I ui/dock_widgets/property_sheet/properties/rsvector -I ui/dock_widgets/property_sheet/properties/string -I ui/dock_widgets/views_list -I ui/dock_widgets/ucs_list -I ui/dock_widgets/workspaces -I ui/dock_widgets/cad -I ui/main -I ui/main/init -I ui/main/persistence -I ui/main/release_check -I ui/main/support -I ui/main/fontviewer -I ui/main/workspaces -I ui/view -I main -I main/console_dxf2pdf -I test -I plugins -I ../res -I ../res/arrows -I ../res/controls -I ../res/dxf -I ../res/gdt -I ../res/icons -I ../res/images -I ../../../Qt/6.9.0/gcc_64/include -I ../../../Qt/6.9.0/gcc_64/include/QtSvg -I ../../../Qt/6.9.0/gcc_64/include/QtPrintSupport -I ../../../Qt/6.9.0/gcc_64/include/QtWidgets -I ../../../Qt/6.9.0/gcc_64/include/QtGui -I ../../../Qt/6.9.0/gcc_64/include/QtNetwork -I ../../../Qt/6.9.0/gcc_64/include/QtCore -I ../../generated/librecad/moc -I ../../generated/librecad/ui -I ../../../Qt/6.9.0/gcc_64/mkspecs/linux-g++ -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/x86_64-linux-gnu/c++/15 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/backward -internal-isystem /usr/lib/llvm-21/lib/clang/21/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/15/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=gnu++1z -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/runner/work/LibreCAD/LibreCAD/out/2026-11-06-031751-4837-1 -x c++ ui/components/creators/lc_menuactivator.cpp
1/*
2 * ********************************************************************************
3 * This file is part of the LibreCAD project, a 2D CAD program
4 *
5 * Copyright (C) 2025 LibreCAD.org
6 * Copyright (C) 2025 sand1024
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * ********************************************************************************
22 */
23
24#include "lc_menuactivator.h"
25
26#include <QMouseEvent>
27
28#include "lc_modifiersinfo.h"
29
30LC_MenuActivator::LC_MenuActivator()
31 : m_button{RIGHT}{
32 update();
33}
34
35LC_MenuActivator::LC_MenuActivator(const QString& shortcutString, const bool ctrl, const bool alt, const bool shift, const Button button, const Type type, const bool entityRequired, const RS2::EntityType entityType)
36 : m_eventType{type}, m_requiresEntity{entityRequired}, m_entityType{entityType}, m_button{button}, m_shortcutString{shortcutString}{
37 setKeys(ctrl, alt, shift);
38}
39
40LC_MenuActivator::LC_MenuActivator(const LC_MenuActivator& other) {
41 m_shortcutString = other.m_shortcutString;
42 m_button = other.m_button;
43 m_eventType = other.m_eventType;
44 m_keyModifiers = other.m_keyModifiers;
45 m_requiresEntity = other.m_requiresEntity;
46 m_menuName = other.m_menuName;
47}
48
49LC_MenuActivator* LC_MenuActivator::getCopy() const {
50 return new LC_MenuActivator(*this);
51}
52
53void LC_MenuActivator::copyTo(LC_MenuActivator& other) const {
54 other.m_shortcutString = m_shortcutString;
55 other.m_button = m_button;
56 other.m_eventType = m_eventType;
57 other.m_keyModifiers = m_keyModifiers;
58 other.m_requiresEntity = m_requiresEntity;
59}
60
61bool LC_MenuActivator::isEventApplicable(const QMouseEvent* event) const {
62 const auto type = event->type();
63
64 switch (type) {
65 case QEvent::MouseButtonRelease: {
66 if (m_eventType != CLICK_RELEASE) {
67 return false;
68 }
69 break;
70 }
71 case QEvent::MouseButtonDblClick: {
72 if (m_eventType != DBL_CLICK) {
73 return false;
74 }
75 break;
76 }
77 default:
78 return false;
79 }
80
81 const auto modifiers = event->modifiers();
82
83 const bool eventShift = modifiers & Qt::ShiftModifier;
84 const bool ownShift = m_keyModifiers & SHIFT;
85 if (eventShift != ownShift) {
86 return false;
87 }
88
89 const bool eventCtrl = modifiers & Qt::ControlModifier;
90 const bool ownCtrl = m_keyModifiers & CTRL;
91 if (eventCtrl != ownCtrl) {
92 return false;
93 }
94
95 const bool eventAlt = modifiers & Qt::AltModifier;
96 const bool ownAlt = m_keyModifiers & ALT;
97 if (eventAlt != ownAlt) {
98 return false;
99 }
100
101 const auto button = event->button();
102 switch (button) {
103 case Qt::LeftButton: {
104 if (m_button != LEFT) {
105 return false;
106 }
107 break;
108 }
109 case Qt::RightButton: {
110 if (m_button != RIGHT) {
111 return false;
112 }
113 break;
114 }
115 case Qt::MiddleButton: {
116 if (m_button != MIDDLE) {
117 return false;
118 }
119 break;
120 }
121 case Qt::BackButton: {
122 if (m_button != BACK) {
123 return false;
124 }
125 break;
126 }
127 case Qt::ForwardButton: {
128 if (m_button != FORWARD) {
129 return false;
130 }
131 break;
132 }
133 case Qt::TaskButton: {
134 if (m_button != TASK) {
135 return false;
136 }
137 break;
138 }
139 default:
140 return false;
141 }
142
143 return true;
144}
145
146bool LC_MenuActivator::isSameAs(const LC_MenuActivator* other) const {
147 if (other != nullptr) {
148 return other->getShortcut() == m_shortcutString;
149 }
150 return false;
151}
152
153void LC_MenuActivator::parseEntityType(const QString& entityTypeStr, bool& requiresEntity, RS2::EntityType& entityType) {
154 requiresEntity = true;
155 if ("NE" == entityTypeStr) {
7
Taking true branch
156 requiresEntity = false;
157 }
158 else if ("EE" == entityTypeStr) {
159 entityType = RS2::EntityGraphic;
160 }
161 else if ("AE" == entityTypeStr) {
162 entityType = RS2::EntityUnknown;
163 }
164 else if ("LI" == entityTypeStr) {
165 entityType = RS2::EntityLine;
166 }
167 else if ("CI" == entityTypeStr) {
168 entityType = RS2::EntityCircle;
169 }
170 else if ("AR" == entityTypeStr) {
171 entityType = RS2::EntityArc;
172 }
173 else if ("PL" == entityTypeStr) {
174 entityType = RS2::EntityPolyline;
175 }
176 else if ("SL" == entityTypeStr) {
177 entityType = RS2::EntitySpline;
178 }
179 else if ("SP" == entityTypeStr) {
180 entityType = RS2::EntitySplinePoints;
181 }
182 else if ("EL" == entityTypeStr) {
183 entityType = RS2::EntityEllipse;
184 }
185 else if ("PO" == entityTypeStr) {
186 entityType = RS2::EntityPoint;
187 }
188 else if ("PA" == entityTypeStr) {
189 entityType = RS2::EntityParabola;
190 }
191 else if ("IM" == entityTypeStr) {
192 entityType = RS2::EntityImage;
193 }
194 else if ("HA" == entityTypeStr) {
195 entityType = RS2::EntityHatch;
196 }
197 else if ("IN" == entityTypeStr) {
198 entityType = RS2::EntityInsert;
199 }
200 else if ("DL" == entityTypeStr) {
201 entityType = RS2::EntityDimLinear;
202 }
203 else if ("DA" == entityTypeStr) {
204 entityType = RS2::EntityDimAligned;
205 }
206 else if ("DD" == entityTypeStr) {
207 entityType = RS2::EntityDimDiametric;
208 }
209 else if ("DR" == entityTypeStr) {
210 entityType = RS2::EntityDimRadial;
211 }
212 else if ("DC" == entityTypeStr) {
213 entityType = RS2::EntityDimArc;
214 }
215 else if ("DO" == entityTypeStr) {
216 entityType = RS2::EntityDimOrdinate;
217 }
218 else if ("LD" == entityTypeStr) {
219 entityType = RS2::EntityDimLeader;
220 }
221 else {
222 requiresEntity = false;
223 }
224}
8
Returning without writing to 'entityType'
225
226LC_MenuActivator* LC_MenuActivator::fromShortcut(const QString& shortcut){
227 auto str = shortcut.trimmed().toUpper();
228 const int size = str.length();
229 if (size != 7) {
1
Assuming 'size' is equal to 7
2
Taking false branch
230 return nullptr;
231 }
232 const bool shift = str[0] == 'S';
233 const bool ctrl = str[1] == 'C';
234 const bool alt = str[2] == 'A';
235
236 const auto buttonName = str[3];
237 Button button;
238 if (buttonName == 'L') {
3
Taking true branch
239 button = LEFT;
240 }
241 else if (buttonName == 'R') {
242 button = RIGHT;
243 }
244 else if (buttonName == 'M') {
245 button = MIDDLE;
246 }
247 else if (buttonName == 'B') {
248 button = BACK;
249 }
250 else if (buttonName == 'F') {
251 button = FORWARD;
252 }
253 else if (buttonName == 'T') {
254 button = TASK;
255 }
256 else {
257 return nullptr;
258 }
259
260 Type type;
261 if (str[4] == 'D') {
4
Taking true branch
262 type = DBL_CLICK;
263 }
264 else if (str[4] == 'C') {
265 type = CLICK_RELEASE;
266 }
267 else {
268 return nullptr;
269 }
270
271 bool requiresEntity = true;
272 RS2::EntityType entityType;
5
'entityType' declared without an initial value
273 QString entityTypeStr;
274 entityTypeStr.append(str[5]).append(str[6]);
275 parseEntityType(entityTypeStr, requiresEntity, entityType);
6
Calling 'LC_MenuActivator::parseEntityType'
9
Returning from 'LC_MenuActivator::parseEntityType'
276
277 auto* result = new LC_MenuActivator(str, ctrl, alt, shift, button, type, requiresEntity, entityType);
10
8th function call argument is an uninitialized value
278 return result;
279}
280
281QString LC_MenuActivator::getEntityTypeStr() const {
282 if (m_requiresEntity) {
283 switch (m_entityType) {
284 case RS2::EntityUnknown: {
285 return "AE";
286 }
287 case RS2::EntityGraphic: {
288 return "EE";
289 }
290 case RS2::EntityLine: {
291 return "LI";
292 }
293 case RS2::EntityCircle: {
294 return "CI";
295 }
296 case RS2::EntityArc: {
297 return "AR";
298 }
299 case RS2::EntityPolyline: {
300 return "PL";
301 }
302 case RS2::EntitySpline: {
303 return "SL";
304 }
305 case RS2::EntitySplinePoints: {
306 return "SP";
307 }
308 case RS2::EntityEllipse: {
309 return "EL";
310 }
311 case RS2::EntityPoint: {
312 return "PO";
313 }
314 case RS2::EntityParabola: {
315 return "PA";
316 }
317 case RS2::EntityImage: {
318 return "IM";
319 }
320 case RS2::EntityHatch: {
321 return "HA";
322 }
323 case RS2::EntityInsert: {
324 return "IN";
325 }
326 case RS2::EntityDimLinear: {
327 return "DL";
328 }
329 case RS2::EntityDimAligned: {
330 return "DA";
331 }
332 case RS2::EntityDimDiametric: {
333 return "DD";
334 }
335 case RS2::EntityDimRadial: {
336 return "DR";
337 }
338 case RS2::EntityDimArc: {
339 return "DC";
340 }
341 case RS2::EntityDimOrdinate: {
342 return "DO";
343 }
344 case RS2::EntityDimLeader: {
345 return "LD";
346 }
347 default:
348 return "AE";
349 }
350 }
351 return "NE";
352}
353
354void LC_MenuActivator::update() {
355 m_shortcutString.clear();
356 if (m_keyModifiers & SHIFT) {
357 m_shortcutString.append("S");
358 }
359 else {
360 m_shortcutString.append("N");
361 }
362 if (m_keyModifiers & CTRL) {
363 m_shortcutString.append("C");
364 }
365 else {
366 m_shortcutString.append("N");
367 }
368 if (m_keyModifiers & ALT) {
369 m_shortcutString.append("A");
370 }
371 else {
372 m_shortcutString.append("N");
373 }
374
375 if (m_button == LEFT) {
376 m_shortcutString.append("L");
377 }
378 if (m_button == MIDDLE) {
379 m_shortcutString.append("M");
380 }
381 if (m_button == RIGHT) {
382 m_shortcutString.append("R");
383 }
384 if (m_button == FORWARD) {
385 m_shortcutString.append("F");
386 }
387 if (m_button == BACK) {
388 m_shortcutString.append("B");
389 }
390 if (m_button == TASK) {
391 m_shortcutString.append("T");
392 }
393
394 if (m_eventType == CLICK_RELEASE) {
395 m_shortcutString.append("C");
396 }
397 else {
398 m_shortcutString.append("D");
399 }
400
401 const QString entityTypeStr = getEntityTypeStr();
402 m_shortcutString.append(entityTypeStr);
403}
404
405void LC_MenuActivator::setKeys(const bool ctrl, const bool alt, const bool shift) {
406 m_keyModifiers = NONE;
407 if (ctrl) {
408 m_keyModifiers |= CTRL;
409 }
410 if (alt) {
411 m_keyModifiers |= ALT;
412 }
413 if (shift) {
414 m_keyModifiers |= SHIFT;
415 }
416}
417
418QString LC_MenuActivator::getShortcut() const {
419 return m_shortcutString;
420}
421
422QString LC_MenuActivator::getEventView() const {
423 QString result;
424 if (m_keyModifiers & CTRL) {
425 result.append(LC_ModifiersInfo::withNativeCtrlKey("CTRL+"));
426 }
427 if (m_keyModifiers & ALT) {
428 result.append("ALT+");
429 }
430 if (m_keyModifiers & SHIFT) {
431 result.append("SHIFT+");
432 }
433 if (m_button == LEFT) {
434 result.append(QObject::tr("Left-"));
435 }
436 if (m_button == MIDDLE) {
437 result.append(QObject::tr("Middle-"));
438 }
439 if (m_button == RIGHT) {
440 result.append(QObject::tr("Right-"));
441 }
442 if (m_button == FORWARD) {
443 result.append(QObject::tr("Forward-"));
444 }
445 if (m_button == BACK) {
446 result.append(QObject::tr("Back-"));
447 }
448 if (m_button == TASK) {
449 result.append(QObject::tr("Task-"));
450 }
451 if (m_eventType == CLICK_RELEASE) {
452 result.append(QObject::tr("Click"));
453 }
454 else {
455 result.append(QObject::tr("Double-Click"));
456 }
457 return result;
458}
459
460QString LC_MenuActivator::getShortcutView() const {
461 QString result = getEventView();
462 result.append(" | ");
463 if (m_requiresEntity) {
464 switch (m_entityType) {
465 case RS2::EntityUnknown: {
466 result.append(QObject::tr("Any"));
467 break;
468 }
469 case RS2::EntityGraphic: {
470 result.append(QObject::tr("Either"));
471 break;
472 }
473 case RS2::EntityLine: {
474 result.append(QObject::tr("Line"));
475 break;
476 }
477 case RS2::EntityCircle: {
478 result.append(QObject::tr("Circle"));
479 break;
480 }
481 case RS2::EntityArc: {
482 result.append(QObject::tr("Arc"));
483 break;
484 }
485 case RS2::EntityPolyline: {
486 result.append(QObject::tr("Polyline"));
487 break;
488 }
489 case RS2::EntitySpline: {
490 result.append(QObject::tr("Spline"));
491 break;
492 }
493 case RS2::EntitySplinePoints: {
494 result.append(QObject::tr("Spline by Points"));
495 break;
496 }
497 case RS2::EntityEllipse: {
498 result.append(QObject::tr("Ellipse"));
499 break;
500 }
501 case RS2::EntityPoint: {
502 result.append(QObject::tr("Point"));
503 break;
504 }
505 case RS2::EntityParabola: {
506 result.append(QObject::tr("Parabola"));
507 break;
508 }
509 case RS2::EntityImage: {
510 result.append(QObject::tr("Image"));
511 break;
512 }
513 case RS2::EntityHatch: {
514 result.append(QObject::tr("Hatch"));
515 break;
516 }
517 case RS2::EntityInsert: {
518 result.append(QObject::tr("Insert"));
519 break;
520 }
521 case RS2::EntityDimLinear: {
522 result.append(QObject::tr("Dim. Linear"));
523 break;
524 }
525 case RS2::EntityDimAligned: {
526 result.append(QObject::tr("Dim. Aligned"));
527 break;
528 }
529 case RS2::EntityDimDiametric: {
530 result.append(QObject::tr("Dim. Diametric"));
531 break;
532 }
533 case RS2::EntityDimRadial: {
534 result.append(QObject::tr("Dim. Radial"));
535 break;
536 }
537 case RS2::EntityDimArc: {
538 result.append(QObject::tr("Dim. Arc"));
539 break;
540 }
541 case RS2::EntityDimOrdinate: {
542 result.append(QObject::tr("Dim. Ordinate"));
543 break;
544 }
545 case RS2::EntityDimLeader: {
546 result.append(QObject::tr("Leader"));
547 break;
548 }
549 default:
550 result.append(QObject::tr("Any"));
551 }
552 }
553 else {
554 result.append(QObject::tr("None"));
555 }
556 return result;
557}
558
559void LC_MenuActivator::setButtonType(const Button type) {
560 m_button = type;
561}
562
563void LC_MenuActivator::setEventType(const Type event) {
564 m_eventType = event;
565}
566
567LC_MenuActivator::Type LC_MenuActivator::getEventType() const {
568 return m_eventType;
569}
570
571void LC_MenuActivator::getKeysState(bool& ctrl, bool& alt, bool& shift) const {
572 ctrl = m_keyModifiers & CTRL;
573 alt = m_keyModifiers & ALT;
574 shift = m_keyModifiers & SHIFT;
575}
576
577bool LC_MenuActivator::hasKeys() const {
578 return m_keyModifiers != NONE;
579}
580
581LC_MenuActivator::Button LC_MenuActivator::getButtonType() const {
582 return m_button;
583}
584
585void LC_MenuActivator::setMenuName(const QString& menuName) {
586 m_menuName = menuName;
587}
588
589QString LC_MenuActivator::getMenuName() const {
590 return m_menuName;
591}
592
593bool LC_MenuActivator::isEntityRequired() const {
594 return m_requiresEntity;
595}
596
597void LC_MenuActivator::setEntityRequired(const bool value) {
598 m_requiresEntity = value;
599}
600
601RS2::EntityType LC_MenuActivator::getEntityType() const {
602 return m_entityType;
603}
604
605void LC_MenuActivator::setEntityType(const RS2::EntityType entityType) {
606 m_entityType = entityType;
607}
608
609LC_MenuActivator& LC_MenuActivator::operator=(const LC_MenuActivator& src) {
610 src.copyTo(*this);
611 return *this;
612}