• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mcallegari / qlcplus / 13633248611

03 Mar 2025 02:31PM UTC coverage: 31.871% (+0.4%) from 31.5%
13633248611

push

github

web-flow
actions: add chrpath to profile

14689 of 46089 relevant lines covered (31.87%)

26426.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

49.47
/ui/src/monitor/monitorfixtureitem.cpp
1
/*
2
  Q Light Controller Plus
3
  monitorfixtureitem.cpp
4

5
  Copyright (C) Massimo Callegari
6

7
  Licensed under the Apache License, Version 2.0 (the "License");
8
  you may not use this file except in compliance with the License.
9
  You may obtain a copy of the License at
10

11
      http://www.apache.org/licenses/LICENSE-2.0.txt
12

13
  Unless required by applicable law or agreed to in writing, software
14
  distributed under the License is distributed on an "AS IS" BASIS,
15
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
  See the License for the specific language governing permissions and
17
  limitations under the License.
18
*/
19

20
#include <QGraphicsSceneMouseEvent>
21
#include <QApplication>
22
#include <QPainter>
23
#include <qmath.h>
24
#include <QCursor>
25
#include <QDebug>
26
#include <QTimer>
27

28
#include "monitorfixtureitem.h"
29
#include "qlcfixturehead.h"
30
#include "qlcfixturemode.h"
31
#include "qlccapability.h"
32
#include "fixture.h"
33
#include "doc.h"
34

35
#define MOVEMENT_THICKNESS    3
36
#define STROBE_PERIOD 500 // 0.5s
37

38
MonitorFixtureItem::MonitorFixtureItem(Doc *doc, quint32 fid)
6✔
39
    : m_doc(doc)
6✔
40
    , m_fid(fid)
6✔
41
    , m_gelColor(QColor())
42
    , m_labelVisibility(false)
6✔
43
{
44
    Q_ASSERT(doc != NULL);
45

46
    setCursor(Qt::OpenHandCursor);
6✔
47
    setFlag(QGraphicsItem::ItemIsMovable, true);
6✔
48
    setFlag(QGraphicsItem::ItemIsSelectable, true);
6✔
49

50
    Fixture *fxi = m_doc->fixture(fid);
6✔
51
    Q_ASSERT(fxi != NULL);
52

53
    m_name = fxi->name();
6✔
54

55
    setToolTip(m_name);
6✔
56

57
    m_font = qApp->font();
6✔
58
    m_font.setPixelSize(8);
6✔
59

60
    for (int i = 0; i < fxi->heads(); i++)
30✔
61
    {
62
        FixtureHead *fxiItem = new FixtureHead;
24✔
63
        fxiItem->m_item = new QGraphicsEllipseItem(this);
24✔
64
        fxiItem->m_item->setPen(QPen(Qt::white, 1));
24✔
65
        fxiItem->m_item->setBrush(QBrush(Qt::black));
24✔
66

67
        QLCFixtureHead head = fxi->head(i);
24✔
68
        foreach (quint32 rgbComp, head.rgbChannels())
93✔
69
        {
70
            fxiItem->m_rgb.append(rgbComp);
45✔
71
            //qDebug() << "Add RGB comp at address:" << rgbComp;
72
        }
73
        foreach (quint32 cmyComp, head.cmyChannels())
48✔
74
        {
75
            fxiItem->m_cmy.append(cmyComp);
×
76
            //qDebug() << "Add CMY comp at address:" << cmyComp;
77
        }
78

79
        fxiItem->m_dimmer = head.channelNumber(QLCChannel::Intensity, QLCChannel::MSB);
24✔
80
        if (fxiItem->m_dimmer != QLCChannel::invalid())
24✔
81
        {
82
            qDebug() << "Set dimmer to:" << fxiItem->m_dimmer;
83
        }
84

85
        fxiItem->m_masterDimmer = fxi->masterIntensityChannel();
24✔
86
        if (fxiItem->m_masterDimmer != QLCChannel::invalid())
24✔
87
        {
88
            qDebug() << "Set master dimmer to:" << fxiItem->m_masterDimmer;
89
        }
90

91
        if ((fxiItem->m_dimmer != QLCChannel::invalid()) || (fxiItem->m_masterDimmer != QLCChannel::invalid()))
24✔
92
        {
93
            fxiItem->m_back = new QGraphicsEllipseItem(this);
20✔
94
            fxiItem->m_back->setPen(QPen(Qt::white, 1));
20✔
95
            fxiItem->m_back->setBrush(QBrush(Qt::black));
20✔
96
        }
97
        else
98
        {
99
            fxiItem->m_back = NULL;
4✔
100
        }
101

102
        fxiItem->m_panChannel = head.channelNumber(QLCChannel::Pan, QLCChannel::MSB);
24✔
103
        if (fxiItem->m_panChannel != QLCChannel::invalid())
24✔
104
        {
105
            // retrieve the PAN max degrees from the fixture mode
106
            fxiItem->m_panMaxDegrees = 360; // fallback. Very unprecise
8✔
107
            QLCFixtureMode *mode = fxi->fixtureMode();
8✔
108
            if (mode != NULL)
8✔
109
            {
110
                if (mode->physical().focusPanMax() != 0)
8✔
111
                    fxiItem->m_panMaxDegrees = mode->physical().focusPanMax();
8✔
112
            }
113
            fxiItem->m_panDegrees = 0;
8✔
114
            qDebug() << "Pan channel on" << fxiItem->m_panChannel << "max degrees:" << fxiItem->m_panMaxDegrees;
115
        }
116

117
        fxiItem->m_tiltChannel = head.channelNumber(QLCChannel::Tilt, QLCChannel::MSB);
24✔
118
        if (fxiItem->m_tiltChannel != QLCChannel::invalid())
24✔
119
        {
120
            // retrieve the TILT max degrees from the fixture mode
121
            fxiItem->m_tiltMaxDegrees = 270; // fallback. Very unprecise
8✔
122
            QLCFixtureMode *mode = fxi->fixtureMode();
8✔
123
            if (mode != NULL)
8✔
124
            {
125
                if (mode->physical().focusTiltMax() != 0)
8✔
126
                    fxiItem->m_tiltMaxDegrees = mode->physical().focusTiltMax();
8✔
127
            }
128
            fxiItem->m_tiltDegrees = 0;
8✔
129
            qDebug() << "Tilt channel on" << fxiItem->m_tiltChannel << "max degrees:" << fxiItem->m_tiltMaxDegrees;
130
        }
131

132
        QLCFixtureMode *mode = fxi->fixtureMode();
24✔
133
        if (mode != NULL)
24✔
134
        {
135
            foreach (quint32 wheel, head.colorWheels())
52✔
136
            {
137
               QList<QColor> values;
138
               QLCChannel *ch = mode->channel(wheel);
4✔
139
               if (ch == NULL)
4✔
140
                   continue;
141

142
               bool containsColor = false;
143
               for (quint32 v = 0; v < 256; ++v)
1,028✔
144
               {
145
                   QLCCapability *cap = ch->searchCapability(v);
1,024✔
146
                   if (cap != NULL && cap->resource(0).isValid())
1,024✔
147
                   {
148
                       values << cap->resource(0).value<QColor>();
×
149
                       containsColor = true;
150
                   }
151
                   else
152
                   {
153
                       values << QColor();
1,024✔
154
                   }
155
               }
156

157
               if (containsColor)
4✔
158
               {
159
                   fxiItem->m_colorValues[wheel] = values;
×
160
                   fxiItem->m_colorWheels << wheel;
×
161
               }
162
            }
4✔
163

164
            foreach (quint32 shutter, head.shutterChannels())
52✔
165
            {
166
               QList<FixtureHead::ShutterState> values;
167
               QLCChannel *ch = mode->channel(shutter);
4✔
168
               if (ch == NULL)
4✔
169
                   continue;
170

171
               bool containsShutter = false;
172

173
               switch (ch->preset())
4✔
174
               {
175
                   case QLCChannel::ShutterStrobeFastSlow:
×
176
                   case QLCChannel::ShutterStrobeSlowFast:
177
                   {
178
                       // handle case when the channel has only one capability 0-255 strobe:
179
                       // make 0 Open to avoid blinking
180
                       values << FixtureHead::Open;
×
181
                       for (int v = 1; v < 256; v++)
×
182
                           values << FixtureHead::Strobe;
×
183
                       containsShutter = true;
184
                   }
185
                   break;
186
                   case QLCChannel::Custom:
4✔
187
                   {
188
                       foreach (QLCCapability *cap, ch->capabilities())
44✔
189
                       {
190
                           for (int v = cap->min(); v <= cap->max(); v++)
1,060✔
191
                           {
192
                               switch (cap->preset())
1,024✔
193
                               {
194
                                   case QLCCapability::Custom:
508✔
195
                                       values << FixtureHead::Open;
508✔
196
                                   break;
508✔
197
                                   case QLCCapability::ShutterOpen:
123✔
198
                                       values << FixtureHead::Open;
123✔
199
                                       containsShutter = true;
200
                                   break;
123✔
201
                                   case QLCCapability::ShutterClose:
×
202
                                       values << FixtureHead::Closed;
×
203
                                       containsShutter = true;
204
                                   break;
×
205
                                   default:
393✔
206
                                       values << FixtureHead::Strobe;
393✔
207
                                       containsShutter = true;
208
                                   break;
393✔
209
                               }
210
                           }
211
                       }
212
                   }
213
                   break;
4✔
214
                   default:
215
                   break;
216
               }
217

218
               if (containsShutter)
4✔
219
               {
220
                   fxiItem->m_shutterValues[shutter] = values;
3✔
221
                   fxiItem->m_shutterChannels << shutter;
3✔
222
               }
223
            }
4✔
224
        }
225

226
        if (!fxiItem->m_shutterChannels.isEmpty())
24✔
227
        {
228
            fxiItem->m_strobeTimer = new QTimer(this);
3✔
229
            connect(fxiItem->m_strobeTimer, SIGNAL(timeout()), this, SLOT(slotStrobeTimer()));
3✔
230
        }
231
        else
232
        {
233
            fxiItem->m_strobeTimer = 0;
21✔
234
        }
235

236
        m_heads.append(fxiItem);
24✔
237
    }
24✔
238
    slotUpdateValues();
6✔
239
    connect(fxi, SIGNAL(valuesChanged()), this, SLOT(slotUpdateValues()));
6✔
240
}
6✔
241

242
MonitorFixtureItem::~MonitorFixtureItem()
×
243
{
244
    if (m_fid != Fixture::invalidId())
×
245
    {
246
        Fixture* fxi = m_doc->fixture(m_fid);
×
247
        if (fxi != NULL)
×
248
            disconnect(fxi, SIGNAL(valuesChanged()), this, SLOT(slotUpdateValues()));
×
249
    }
250

251
    foreach (FixtureHead *head, m_heads)
×
252
    {
253
        if (head->m_strobeTimer != 0)
×
254
        {
255
            disconnect(head->m_strobeTimer, SIGNAL(timeout()), this, SLOT(slotStrobeTimer()));
×
256
            delete head->m_strobeTimer;
×
257
        }
258
        delete head;
×
259
    }
260
    m_heads.clear();
×
261
}
×
262

263
void MonitorFixtureItem::setSize(QSize size)
×
264
{
265
    prepareGeometryChange();
×
266
    m_width = size.width();
×
267
    m_height = size.height();
×
268

269
    if (m_width < 5 || m_height < 5)
×
270
        return;
×
271

272
    // if this fixture has a pan or tilt channel,
273
    // the head area has to be reduced to
274
    // leave space to movements representation
275
    int headsWidth = m_width;
276
    int headsHeight = m_height;
277

278
    // calculate the diameter of every single head
279
    double headArea = (headsWidth * headsHeight) / m_heads.count();
×
280
    double headSide = sqrt(headArea);
×
281
    int columns = (headsWidth / headSide) + 0.5;
×
282
    int rows = (headsHeight / headSide) + 0.5;
×
283

284
    // dirty workaround to correctly display right columns on one row
285
    if (rows == 1)
×
286
        columns = m_heads.count();
287
    if (columns == 1)
×
288
        rows = m_heads.count();
289

290
    //qDebug() << "Fixture columns:" << columns;
291

292
    if (columns > m_heads.count())
293
        columns = m_heads.count();
294

295
    if (rows < 1)
296
        rows = 1;
297
    if (columns < 1)
298
        columns = 1;
299

300
    double cellWidth = headsWidth / columns;
×
301
    double cellHeight = headsHeight / rows;
×
302
    double headDiam = (cellWidth < cellHeight) ? cellWidth : cellHeight;
×
303

304
    int ypos = (cellHeight - headDiam) / 2;
×
305
    for (int i = 0; i < rows; i++)
×
306
    {
307
        int xpos = (cellWidth - headDiam) / 2;
×
308
        for (int j = 0; j < columns; j++)
×
309
        {
310
            int index = i * columns + j;
×
311
            if (index < m_heads.size())
×
312
            {
313
                FixtureHead * h = m_heads.at(index);
×
314
                QGraphicsEllipseItem *head = h->m_item;
×
315
                head->setRect(xpos, ypos, headDiam, headDiam);
×
316

317
                if (h->m_panChannel != QLCChannel::invalid())
×
318
                {
319
                    head->setRect(head->rect().adjusted(MOVEMENT_THICKNESS + 1, MOVEMENT_THICKNESS + 1,
×
320
                                                        -MOVEMENT_THICKNESS - 1, -MOVEMENT_THICKNESS - 1));
321
                }
322
                if (h->m_tiltChannel != QLCChannel::invalid())
×
323
                {
324
                    head->setRect(head->rect().adjusted(MOVEMENT_THICKNESS + 1, MOVEMENT_THICKNESS + 1,
×
325
                                                        -MOVEMENT_THICKNESS - 1, -MOVEMENT_THICKNESS - 1));
326
                }
327

328
                head->setZValue(2);
×
329
                QGraphicsEllipseItem *back = m_heads.at(index)->m_back;
×
330
                if (back != NULL)
×
331
                {
332
                    back->setRect(head->rect());
×
333
                    back->setZValue(1);
×
334
                }
335
            }
336
            xpos += cellWidth;
×
337
        }
338
        ypos += cellHeight;
×
339
    }
340

341
    QFontMetrics fm(m_font);
×
342
    m_labelRect = fm.boundingRect(QRect(-10, m_height + 2, m_width + 20, 30),
×
343
                                  Qt::AlignHCenter | Qt::TextWrapAnywhere, m_name);
×
344

345
    setTransformOriginPoint(m_width / 2, m_height / 2);
×
346
    update();
×
347
}
×
348

349
QColor MonitorFixtureItem::computeColor(const FixtureHead *head, const QByteArray & values)
24✔
350
{
351
    foreach (quint32 c, head->m_colorWheels)
24✔
352
    {
353
        const uchar val = static_cast<uchar>(values.at(c));
×
354
        QColor col = head->m_colorValues[c].at(val);
×
355
        if (col.isValid() && col != Qt::black)
×
356
            return col;
×
357
    }
358

359
    if (head->m_rgb.count() > 0)
24✔
360
    {
361
        uchar r = 0, g = 0, b = 0;
362
        r = values.at(head->m_rgb.at(0));
15✔
363
        g = values.at(head->m_rgb.at(1));
15✔
364
        b = values.at(head->m_rgb.at(2));
15✔
365
        return QColor(r, g, b);
15✔
366
    }
367

368
    if (head->m_cmy.count() > 0)
9✔
369
    {
370
        uchar c = 0, m = 0, y = 0;
371
        c = values.at(head->m_cmy.at(0));
×
372
        m = values.at(head->m_cmy.at(1));
×
373
        y = values.at(head->m_cmy.at(2));
×
374
        return QColor::fromCmyk(c, m, y, 0);
×
375
    }
376

377
    if (m_gelColor.isValid())
9✔
378
    {
379
        return m_gelColor;
380
    }
381

382
    return QColor(255,255,255);
383
}
384
uchar MonitorFixtureItem::computeAlpha(const FixtureHead *head, const QByteArray & values)
76✔
385
{
386
    // postpone division as late as possible to improve accuracy
387
    unsigned mul = 255U;
388
    unsigned div = 1U;
389

390
    if (head->m_masterDimmer != UINT_MAX /*QLCChannel::invalid()*/)
76✔
391
    {
392
        mul *= static_cast<uchar>(values.at(head->m_masterDimmer));
45✔
393
        div *= 255U;
394
    }
395

396
    if (head->m_dimmer != UINT_MAX /*QLCChannel::invalid()*/)
76✔
397
    {
398
        mul *= static_cast<uchar>(values.at(head->m_dimmer));
57✔
399
        div *= 255U;
57✔
400
    }
401

402
    //qDebug() << mul << "/" << div << "=" << (mul /div);
403
    return mul / div;
76✔
404
}
405

406
FixtureHead::ShutterState MonitorFixtureItem::computeShutter(const FixtureHead *head, const QByteArray & values)
24✔
407
{
408
    FixtureHead::ShutterState result = FixtureHead::Open;
409

410
    foreach (quint32 c, head->m_shutterChannels)
27✔
411
    {
412
        const uchar val = static_cast<uchar>(values.at(c));
3✔
413
        FixtureHead::ShutterState state = head->m_shutterValues[c].at(val);
3✔
414
        if (state == FixtureHead::Closed)
3✔
415
        {
416
            return state;
×
417
        }
418
        else if (state == FixtureHead::Strobe)
3✔
419
        {
420
            result = state;
421
        }
422
    }
423

424
    return result;
24✔
425
}
426

427
void MonitorFixtureItem::slotUpdateValues()
6✔
428
{
429
    /* Check that this MonitorFixture represents a fixture */
430
    if (m_fid == Fixture::invalidId())
6✔
431
        return;
×
432

433
    /* Check that this MonitorFixture's fixture really exists */
434
    Fixture* fxi = m_doc->fixture(m_fid);
6✔
435
    if (fxi == NULL)
6✔
436
        return;
437

438
    QByteArray fxValues = fxi->channelValues();
6✔
439

440
    bool needUpdate = false;
441

442
    foreach (FixtureHead *head, m_heads)
30✔
443
    {
444
        head->m_color = computeColor(head, fxValues);
24✔
445
        head->m_dimmerValue = computeAlpha(head, fxValues);
24✔
446
        head->m_shutterState = computeShutter(head, fxValues);
24✔
447

448
        QColor col = head->m_color;
449
        col.setAlpha(head->m_dimmerValue);
24✔
450

451
        if (head->m_dimmerValue > 0)
24✔
452
        {
453
            if (head->m_shutterState == FixtureHead::Closed)
4✔
454
            {
455
                col.setAlpha(0);
×
456
            }
457

458
            if (head->m_shutterState == FixtureHead::Strobe)
4✔
459
            {
460
                if (head->m_strobeTimer != 0 && !head->m_strobeTimer->isActive())
×
461
                {
462
                    head->m_strobePhase = 0;
×
463
                    head->m_strobeTimer->start(STROBE_PERIOD);
×
464
                }
465
                else if (head->m_strobePhase != 0)
×
466
                {
467
                    col.setAlpha(0);
×
468
                }
469
            }
470
            else if (head->m_strobeTimer != 0)
4✔
471
            {
472
                head->m_strobeTimer->stop();
×
473
            }
474
        }
475
        else if (head->m_strobeTimer != 0)
20✔
476
        {
477
            head->m_strobeTimer->stop();
3✔
478
        }
479

480
        head->m_item->setBrush(QBrush(col));
24✔
481

482
        if (head->m_panChannel != UINT_MAX /*QLCChannel::invalid()*/)
24✔
483
        {
484
            computePanPosition(head, fxValues.at(head->m_panChannel));
8✔
485
            needUpdate = true;
486
        }
487

488
        if (head->m_tiltChannel != UINT_MAX /*QLCChannel::invalid()*/)
24✔
489
        {
490
            computeTiltPosition(head, fxValues.at(head->m_tiltChannel));
8✔
491
            needUpdate = true;
492
        }
493
    }
494
    if (needUpdate)
6✔
495
        update();
2✔
496
}
6✔
497

498
void MonitorFixtureItem::slotStrobeTimer()
×
499
{
500
    QTimer* timer = qobject_cast<QTimer*>(sender());
×
501
    foreach (FixtureHead *head, m_heads)
×
502
    {
503
        if (head->m_strobeTimer != timer)
×
504
            continue;
×
505

506
        if (head->m_dimmerValue == 0 || head->m_shutterState != FixtureHead::Strobe)
×
507
            return;
×
508

509
        head->m_strobePhase = (head->m_strobePhase + 1) % 2;
×
510

511
        QColor col = head->m_color;
512
        col.setAlpha(head->m_dimmerValue);
×
513
        if (head->m_strobePhase != 0)
×
514
            col.setAlpha(0);
×
515
        head->m_item->setBrush(QBrush(col));
×
516
        update();
×
517
        return;
×
518
    }
519
}
520

521
void MonitorFixtureItem::showLabel(bool visible)
×
522
{
523
    prepareGeometryChange();
×
524
    m_labelVisibility = visible;
×
525
    update();
×
526
}
×
527

528
QRectF MonitorFixtureItem::boundingRect() const
×
529
{
530
    if (m_labelVisibility)
×
531
        return QRectF(-10, 0, m_width + 20, m_height + m_labelRect.height() + 2);
×
532
    else
533
        return QRectF(0, 0, m_width, m_height);
×
534
}
535

536
void MonitorFixtureItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
×
537
{
538
    Q_UNUSED(option);
539
    Q_UNUSED(widget);
540
    QColor defColor = Qt::darkGray;
×
541

542
    if (this->isSelected() == true)
×
543
        defColor = Qt::yellow;
×
544

545
    painter->setPen(QPen(defColor, 1));
×
546

547
    // draw item background
548
    painter->setBrush(QBrush(QColor(33, 33, 33)));
×
549
    painter->drawRect(0, 0, m_width, m_height);
×
550
    foreach (FixtureHead *head, m_heads)
×
551
    {
552
        QRectF rect = head->m_item->rect();
×
553

554
        if (head->m_tiltChannel != UINT_MAX /*QLCChannel::invalid()*/)
×
555
        {
556
            rect.adjust(-MOVEMENT_THICKNESS, -MOVEMENT_THICKNESS, MOVEMENT_THICKNESS, MOVEMENT_THICKNESS);
557

558
            painter->setPen(QPen(defColor, MOVEMENT_THICKNESS));
×
559
            painter->drawArc(rect, 270 * 16 - head->m_tiltMaxDegrees * 16 / 2 - 8, 16);
×
560
            painter->drawArc(rect, 270 * 16 + head->m_tiltMaxDegrees * 16 / 2 - 8, 16);
×
561
            painter->setPen(QPen(QColor("turquoise"), MOVEMENT_THICKNESS));
×
562
            painter->drawArc(rect, 270 * 16, - head->m_tiltDegrees * 16);
×
563
        }
564

565
        if (head->m_panChannel != UINT_MAX /*QLCChannel::invalid()*/)
×
566
        {
567
            rect.adjust(-MOVEMENT_THICKNESS, -MOVEMENT_THICKNESS, MOVEMENT_THICKNESS, MOVEMENT_THICKNESS);
568

569
            painter->setPen(QPen(defColor, MOVEMENT_THICKNESS));
×
570
            painter->drawArc(rect, 270 * 16 - head->m_panMaxDegrees * 16 / 2 - 8, 16);
×
571
            painter->drawArc(rect, 270 * 16 + head->m_panMaxDegrees * 16 / 2 - 8, 16);
×
572
            painter->setPen(QPen(QColor("purple"), MOVEMENT_THICKNESS));
×
573
            painter->drawArc(rect, 270 * 16, - head->m_panDegrees * 16);
×
574
        }
575
    }
576

577
    if (m_labelVisibility)
×
578
    {
579
        painter->setFont(m_font);
×
580
        painter->setPen(QPen(Qt::NoPen));
×
581
        painter->setBrush(QBrush(QColor(33, 33, 33)));
×
582
        painter->drawRoundedRect(m_labelRect, 2, 2);
×
583
        painter->setPen(QPen(Qt::white, 1));
×
584
        painter->drawText(m_labelRect, Qt::AlignHCenter | Qt::TextWrapAnywhere, m_name);
×
585
    }
586
}
×
587

588
void MonitorFixtureItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
×
589
{
590
    QGraphicsItem::mousePressEvent(event);
×
591
    this->setSelected(true);
×
592
}
×
593

594
void MonitorFixtureItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
×
595
{
596
    QGraphicsItem::mouseReleaseEvent(event);
×
597
    qDebug() << Q_FUNC_INFO << "mouse RELEASE event - <" << event->pos().toPoint().x() << "> - <" << event->pos().toPoint().y() << ">";
598
    setCursor(Qt::OpenHandCursor);
×
599
    emit itemDropped(this);
×
600
}
×
601

602
void MonitorFixtureItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *)
×
603
{
604
}
×
605

606
void MonitorFixtureItem::computeTiltPosition(FixtureHead *h, uchar value)
8✔
607
{
608
    // find the TILT degrees based on value
609
    h->m_tiltDegrees = ((double)value * h->m_tiltMaxDegrees) / (256.0 - 1/256) - (h->m_tiltMaxDegrees / 2);
8✔
610
    //qDebug() << "TILT degrees:" << h->m_tiltDegrees;
611
}
8✔
612

613
void MonitorFixtureItem::computePanPosition(FixtureHead *h, uchar value)
8✔
614
{
615
    // find the PAN degrees based on value
616
    h->m_panDegrees = ((double)value * h->m_panMaxDegrees) / (256.0 - 1/256) - (h->m_panMaxDegrees / 2);
8✔
617
    //qDebug() << "PAN degrees:" << h->m_panDegrees;
618
}
8✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc