Bug Summary

File:librecad/src/ui/components/creators/lc_menuactivator.cpp
Warning:line 275, 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 -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-18/lib/clang/18 -D _REENTRANT -D DWGSUPPORT -D MUPARSER_STATIC -D QC_APPDIR="librecad" -D LC_VERSION=2.2.2_alpha1-607-g330d41cec -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/jwwlib/src -I ../../libraries/shapelib/src -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/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/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/x86_64-linux-gnu/c++/14 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/backward -internal-isystem /usr/lib/llvm-18/lib/clang/18/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -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-08-04-154929-5069-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
28LC_MenuActivator::LC_MenuActivator()
29 : m_button{RIGHT}{
30 update();
31}
32
33LC_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)
34 : m_eventType{type}, m_requiresEntity{entityRequired}, m_entityType{entityType}, m_button{button}, m_shortcutString{shortcutString}{
35 setKeys(ctrl, alt, shift);
36}
37
38LC_MenuActivator::LC_MenuActivator(const LC_MenuActivator& other) {
39 m_shortcutString = other.m_shortcutString;
40 m_button = other.m_button;
41 m_eventType = other.m_eventType;
42 m_keyModifiers = other.m_keyModifiers;
43 m_requiresEntity = other.m_requiresEntity;
44 m_menuName = other.m_menuName;
45}
46
47LC_MenuActivator* LC_MenuActivator::getCopy() const {
48 return new LC_MenuActivator(*this);
49}
50
51void LC_MenuActivator::copyTo(LC_MenuActivator& other) const {
52 other.m_shortcutString = m_shortcutString;
53 other.m_button = m_button;
54 other.m_eventType = m_eventType;
55 other.m_keyModifiers = m_keyModifiers;
56 other.m_requiresEntity = m_requiresEntity;
57}
58
59bool LC_MenuActivator::isEventApplicable(const QMouseEvent* event) const {
60 const auto type = event->type();
61
62 switch (type) {
63 case QEvent::MouseButtonRelease: {
64 if (m_eventType != CLICK_RELEASE) {
65 return false;
66 }
67 break;
68 }
69 case QEvent::MouseButtonDblClick: {
70 if (m_eventType != DBL_CLICK) {
71 return false;
72 }
73 break;
74 }
75 default:
76 return false;
77 }
78
79 const auto modifiers = event->modifiers();
80
81 const bool eventShift = modifiers & Qt::ShiftModifier;
82 const bool ownShift = m_keyModifiers & SHIFT;
83 if (eventShift != ownShift) {
84 return false;
85 }
86
87 const bool eventCtrl = modifiers & Qt::ControlModifier;
88 const bool ownCtrl = m_keyModifiers & CTRL;
89 if (eventCtrl != ownCtrl) {
90 return false;
91 }
92
93 const bool eventAlt = modifiers & Qt::AltModifier;
94 const bool ownAlt = m_keyModifiers & ALT;
95 if (eventAlt != ownAlt) {
96 return false;
97 }
98
99 const auto button = event->button();
100 switch (button) {
101 case Qt::LeftButton: {
102 if (m_button != LEFT) {
103 return false;
104 }
105 break;
106 }
107 case Qt::RightButton: {
108 if (m_button != RIGHT) {
109 return false;
110 }
111 break;
112 }
113 case Qt::MiddleButton: {
114 if (m_button != MIDDLE) {
115 return false;
116 }
117 break;
118 }
119 case Qt::BackButton: {
120 if (m_button != BACK) {
121 return false;
122 }
123 break;
124 }
125 case Qt::ForwardButton: {
126 if (m_button != FORWARD) {
127 return false;
128 }
129 break;
130 }
131 case Qt::TaskButton: {
132 if (m_button != TASK) {
133 return false;
134 }
135 break;
136 }
137 default:
138 return false;
139 }
140
141 return true;
142}
143
144bool LC_MenuActivator::isSameAs(const LC_MenuActivator* other) const {
145 if (other != nullptr) {
146 return other->getShortcut() == m_shortcutString;
147 }
148 return false;
149}
150
151void LC_MenuActivator::parseEntityType(const QString& entityTypeStr, bool& requiresEntity, RS2::EntityType& entityType) {
152 requiresEntity = true;
153 if ("NE" == entityTypeStr) {
7
Taking true branch
154 requiresEntity = false;
155 }
156 else if ("EE" == entityTypeStr) {
157 entityType = RS2::EntityGraphic;
158 }
159 else if ("AE" == entityTypeStr) {
160 entityType = RS2::EntityUnknown;
161 }
162 else if ("LI" == entityTypeStr) {
163 entityType = RS2::EntityLine;
164 }
165 else if ("CI" == entityTypeStr) {
166 entityType = RS2::EntityCircle;
167 }
168 else if ("AR" == entityTypeStr) {
169 entityType = RS2::EntityArc;
170 }
171 else if ("PL" == entityTypeStr) {
172 entityType = RS2::EntityPolyline;
173 }
174 else if ("SL" == entityTypeStr) {
175 entityType = RS2::EntitySpline;
176 }
177 else if ("SP" == entityTypeStr) {
178 entityType = RS2::EntitySplinePoints;
179 }
180 else if ("EL" == entityTypeStr) {
181 entityType = RS2::EntityEllipse;
182 }
183 else if ("PO" == entityTypeStr) {
184 entityType = RS2::EntityPoint;
185 }
186 else if ("PA" == entityTypeStr) {
187 entityType = RS2::EntityParabola;
188 }
189 else if ("IM" == entityTypeStr) {
190 entityType = RS2::EntityImage;
191 }
192 else if ("HA" == entityTypeStr) {
193 entityType = RS2::EntityHatch;
194 }
195 else if ("IN" == entityTypeStr) {
196 entityType = RS2::EntityInsert;
197 }
198 else if ("DL" == entityTypeStr) {
199 entityType = RS2::EntityDimLinear;
200 }
201 else if ("DA" == entityTypeStr) {
202 entityType = RS2::EntityDimAligned;
203 }
204 else if ("DD" == entityTypeStr) {
205 entityType = RS2::EntityDimDiametric;
206 }
207 else if ("DR" == entityTypeStr) {
208 entityType = RS2::EntityDimRadial;
209 }
210 else if ("DC" == entityTypeStr) {
211 entityType = RS2::EntityDimArc;
212 }
213 else if ("DO" == entityTypeStr) {
214 entityType = RS2::EntityDimOrdinate;
215 }
216 else if ("LD" == entityTypeStr) {
217 entityType = RS2::EntityDimLeader;
218 }
219 else {
220 requiresEntity = false;
221 }
222}
8
Returning without writing to 'entityType'
223
224LC_MenuActivator* LC_MenuActivator::fromShortcut(const QString& shortcut){
225 auto str = shortcut.trimmed().toUpper();
226 const int size = str.length();
227 if (size != 7) {
1
Assuming 'size' is equal to 7
2
Taking false branch
228 return nullptr;
229 }
230 const bool shift = str[0] == 'S';
231 const bool ctrl = str[1] == 'C';
232 const bool alt = str[2] == 'A';
233
234 const auto buttonName = str[3];
235 Button button;
236 if (buttonName == 'L') {
3
Taking true branch
237 button = LEFT;
238 }
239 else if (buttonName == 'R') {
240 button = RIGHT;
241 }
242 else if (buttonName == 'M') {
243 button = MIDDLE;
244 }
245 else if (buttonName == 'B') {
246 button = BACK;
247 }
248 else if (buttonName == 'F') {
249 button = FORWARD;
250 }
251 else if (buttonName == 'T') {
252 button = TASK;
253 }
254 else {
255 return nullptr;
256 }
257
258 Type type;
259 if (str[4] == 'D') {
4
Taking true branch
260 type = DBL_CLICK;
261 }
262 else if (str[4] == 'C') {
263 type = CLICK_RELEASE;
264 }
265 else {
266 return nullptr;
267 }
268
269 bool requiresEntity = true;
270 RS2::EntityType entityType;
5
'entityType' declared without an initial value
271 QString entityTypeStr;
272 entityTypeStr.append(str[5]).append(str[6]);
273 parseEntityType(entityTypeStr, requiresEntity, entityType);
6
Calling 'LC_MenuActivator::parseEntityType'
9
Returning from 'LC_MenuActivator::parseEntityType'
274
275 auto* result = new LC_MenuActivator(str, ctrl, alt, shift, button, type, requiresEntity, entityType);
10
8th function call argument is an uninitialized value
276 return result;
277}
278
279QString LC_MenuActivator::getEntityTypeStr() const {
280 if (m_requiresEntity) {
281 switch (m_entityType) {
282 case RS2::EntityUnknown: {
283 return "AE";
284 }
285 case RS2::EntityGraphic: {
286 return "EE";
287 }
288 case RS2::EntityLine: {
289 return "LI";
290 }
291 case RS2::EntityCircle: {
292 return "CI";
293 }
294 case RS2::EntityArc: {
295 return "AR";
296 }
297 case RS2::EntityPolyline: {
298 return "PL";
299 }
300 case RS2::EntitySpline: {
301 return "SL";
302 }
303 case RS2::EntitySplinePoints: {
304 return "SP";
305 }
306 case RS2::EntityEllipse: {
307 return "EL";
308 }
309 case RS2::EntityPoint: {
310 return "PO";
311 }
312 case RS2::EntityParabola: {
313 return "PA";
314 }
315 case RS2::EntityImage: {
316 return "IM";
317 }
318 case RS2::EntityHatch: {
319 return "HA";
320 }
321 case RS2::EntityInsert: {
322 return "IN";
323 }
324 case RS2::EntityDimLinear: {
325 return "DL";
326 }
327 case RS2::EntityDimAligned: {
328 return "DA";
329 }
330 case RS2::EntityDimDiametric: {
331 return "DD";
332 }
333 case RS2::EntityDimRadial: {
334 return "DR";
335 }
336 case RS2::EntityDimArc: {
337 return "DC";
338 }
339 case RS2::EntityDimOrdinate: {
340 return "DO";
341 }
342 case RS2::EntityDimLeader: {
343 return "LD";
344 }
345 default:
346 return "AE";
347 }
348 }
349 return "NE";
350}
351
352void LC_MenuActivator::update() {
353 m_shortcutString.clear();
354 if (m_keyModifiers & SHIFT) {
355 m_shortcutString.append("S");
356 }
357 else {
358 m_shortcutString.append("N");
359 }
360 if (m_keyModifiers & CTRL) {
361 m_shortcutString.append("C");
362 }
363 else {
364 m_shortcutString.append("N");
365 }
366 if (m_keyModifiers & ALT) {
367 m_shortcutString.append("A");
368 }
369 else {
370 m_shortcutString.append("N");
371 }
372
373 if (m_button == LEFT) {
374 m_shortcutString.append("L");
375 }
376 if (m_button == MIDDLE) {
377 m_shortcutString.append("M");
378 }
379 if (m_button == RIGHT) {
380 m_shortcutString.append("R");
381 }
382 if (m_button == FORWARD) {
383 m_shortcutString.append("F");
384 }
385 if (m_button == BACK) {
386 m_shortcutString.append("B");
387 }
388 if (m_button == TASK) {
389 m_shortcutString.append("T");
390 }
391
392 if (m_eventType == CLICK_RELEASE) {
393 m_shortcutString.append("C");
394 }
395 else {
396 m_shortcutString.append("D");
397 }
398
399 const QString entityTypeStr = getEntityTypeStr();
400 m_shortcutString.append(entityTypeStr);
401}
402
403void LC_MenuActivator::setKeys(const bool ctrl, const bool alt, const bool shift) {
404 m_keyModifiers = NONE;
405 if (ctrl) {
406 m_keyModifiers |= CTRL;
407 }
408 if (alt) {
409 m_keyModifiers |= ALT;
410 }
411 if (shift) {
412 m_keyModifiers |= SHIFT;
413 }
414}
415
416QString LC_MenuActivator::getShortcut() const {
417 return m_shortcutString;
418}
419
420QString LC_MenuActivator::getEventView() const {
421 QString result;
422 if (m_keyModifiers & CTRL) {
423 result.append("CTRL+");
424 }
425 if (m_keyModifiers & ALT) {
426 result.append("ALT+");
427 }
428 if (m_keyModifiers & SHIFT) {
429 result.append("SHIFT+");
430 }
431 if (m_button == LEFT) {
432 result.append(QObject::tr("Left-"));
433 }
434 if (m_button == MIDDLE) {
435 result.append(QObject::tr("Middle-"));
436 }
437 if (m_button == RIGHT) {
438 result.append(QObject::tr("Right-"));
439 }
440 if (m_button == FORWARD) {
441 result.append(QObject::tr("Forward-"));
442 }
443 if (m_button == BACK) {
444 result.append(QObject::tr("Back-"));
445 }
446 if (m_button == TASK) {
447 result.append(QObject::tr("Task-"));
448 }
449 if (m_eventType == CLICK_RELEASE) {
450 result.append(QObject::tr("Click"));
451 }
452 else {
453 result.append(QObject::tr("Double-Click"));
454 }
455 return result;
456}
457
458QString LC_MenuActivator::getShortcutView() const {
459 QString result = getEventView();
460 result.append(" | ");
461 if (m_requiresEntity) {
462 switch (m_entityType) {
463 case RS2::EntityUnknown: {
464 result.append(QObject::tr("Any"));
465 break;
466 }
467 case RS2::EntityGraphic: {
468 result.append(QObject::tr("Either"));
469 break;
470 }
471 case RS2::EntityLine: {
472 result.append(QObject::tr("Line"));
473 break;
474 }
475 case RS2::EntityCircle: {
476 result.append(QObject::tr("Circle"));
477 break;
478 }
479 case RS2::EntityArc: {
480 result.append(QObject::tr("Arc"));
481 break;
482 }
483 case RS2::EntityPolyline: {
484 result.append(QObject::tr("Polyline"));
485 break;
486 }
487 case RS2::EntitySpline: {
488 result.append(QObject::tr("Spline"));
489 break;
490 }
491 case RS2::EntitySplinePoints: {
492 result.append(QObject::tr("Spline by Points"));
493 break;
494 }
495 case RS2::EntityEllipse: {
496 result.append(QObject::tr("Ellipse"));
497 break;
498 }
499 case RS2::EntityPoint: {
500 result.append(QObject::tr("Point"));
501 break;
502 }
503 case RS2::EntityParabola: {
504 result.append(QObject::tr("Parabola"));
505 break;
506 }
507 case RS2::EntityImage: {
508 result.append(QObject::tr("Image"));
509 break;
510 }
511 case RS2::EntityHatch: {
512 result.append(QObject::tr("Hatch"));
513 break;
514 }
515 case RS2::EntityInsert: {
516 result.append(QObject::tr("Insert"));
517 break;
518 }
519 case RS2::EntityDimLinear: {
520 result.append(QObject::tr("Dim. Linear"));
521 break;
522 }
523 case RS2::EntityDimAligned: {
524 result.append(QObject::tr("Dim. Aligned"));
525 break;
526 }
527 case RS2::EntityDimDiametric: {
528 result.append(QObject::tr("Dim. Diametric"));
529 break;
530 }
531 case RS2::EntityDimRadial: {
532 result.append(QObject::tr("Dim. Radial"));
533 break;
534 }
535 case RS2::EntityDimArc: {
536 result.append(QObject::tr("Dim. Arc"));
537 break;
538 }
539 case RS2::EntityDimOrdinate: {
540 result.append(QObject::tr("Dim. Ordinate"));
541 break;
542 }
543 case RS2::EntityDimLeader: {
544 result.append(QObject::tr("Leader"));
545 break;
546 }
547 default:
548 result.append(QObject::tr("Any"));
549 }
550 }
551 else {
552 result.append(QObject::tr("None"));
553 }
554 return result;
555}
556
557void LC_MenuActivator::setButtonType(const Button type) {
558 m_button = type;
559}
560
561void LC_MenuActivator::setEventType(const Type event) {
562 m_eventType = event;
563}
564
565LC_MenuActivator::Type LC_MenuActivator::getEventType() const {
566 return m_eventType;
567}
568
569void LC_MenuActivator::getKeysState(bool& ctrl, bool& alt, bool& shift) const {
570 ctrl = m_keyModifiers & CTRL;
571 alt = m_keyModifiers & ALT;
572 shift = m_keyModifiers & SHIFT;
573}
574
575bool LC_MenuActivator::hasKeys() const {
576 return m_keyModifiers != NONE;
577}
578
579LC_MenuActivator::Button LC_MenuActivator::getButtonType() const {
580 return m_button;
581}
582
583void LC_MenuActivator::setMenuName(const QString& menuName) {
584 m_menuName = menuName;
585}
586
587QString LC_MenuActivator::getMenuName() const {
588 return m_menuName;
589}
590
591bool LC_MenuActivator::isEntityRequired() const {
592 return m_requiresEntity;
593}
594
595void LC_MenuActivator::setEntityRequired(const bool value) {
596 m_requiresEntity = value;
597}
598
599RS2::EntityType LC_MenuActivator::getEntityType() const {
600 return m_entityType;
601}
602
603void LC_MenuActivator::setEntityType(const RS2::EntityType entityType) {
604 m_entityType = entityType;
605}
606
607LC_MenuActivator& LC_MenuActivator::operator=(const LC_MenuActivator& src) {
608 src.copyTo(*this);
609 return *this;
610}