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

mcallegari / qlcplus / 8961243534

05 May 2024 09:23PM UTC coverage: 32.068% (+4.0%) from 28.094%
8961243534

push

github

mcallegari
Merge branch 'master' into qmltoqt6

902 of 2557 new or added lines in 140 files covered. (35.28%)

166 existing lines in 76 files now uncovered.

15395 of 48008 relevant lines covered (32.07%)

22949.67 hits per line

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

0.0
/ui/src/remapwidget.cpp
1
/*
2
  Q Light Controller Plus
3
  remapwidget.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 <QTreeWidgetItem>
21
#include <QPainter>
22
#include <QDebug>
23

24
#include "fixtureremap.h"
25
#include "remapwidget.h"
26

27
RemapWidget::RemapWidget(QTreeWidget *src, QTreeWidget *target, QWidget *parent)
×
28
    : QWidget(parent)
29
    , m_sourceTree(src)
30
    , m_targetTree(target)
×
31
{
32
    setMaximumWidth(100);
×
33
}
×
34

35
RemapWidget::~RemapWidget()
×
36
{
37
}
×
38

39
void RemapWidget::setRemapList(QList<RemapInfo> list)
×
40
{
41
    m_list = list;
×
42
    update();
×
43
}
×
44

45
void RemapWidget::resizeEvent(QResizeEvent *e)
×
46
{
47
    QWidget::resizeEvent(e);
×
48
}
×
49

50
void RemapWidget::paintEvent(QPaintEvent *e)
×
51
{
52
    Q_UNUSED(e)
53

54
    QPainter painter(this);
×
55
    painter.setBrush(QBrush(Qt::white));
×
56
    painter.drawRect(0, 0, width(), height());
×
57
    painter.setPen(QPen(Qt::black));
×
58

59
    int yOffset = m_sourceTree->header()->height() + 10;
×
60

NEW
61
    foreach (RemapInfo info, m_list)
×
62
    {
63
        QRect srcRect = m_sourceTree->visualItemRect(info.source);
×
64
        QRect tgtRect = m_targetTree->visualItemRect(info.target);
×
65

66
        if (srcRect.isEmpty())
×
67
            srcRect = m_sourceTree->visualItemRect(info.source->parent());
×
68

69
        if (tgtRect.isEmpty())
×
70
            tgtRect = m_targetTree->visualItemRect(info.target->parent());
×
71

72
        //qDebug() << "Source rect:" << srcRect << ", target rect:" << tgtRect;
73

74
        painter.drawLine(0, srcRect.y() + yOffset, 10, srcRect.y() + yOffset);
×
75
        painter.drawLine(10, srcRect.y() + yOffset, 90, tgtRect.y() + yOffset);
×
76
        painter.drawLine(90, tgtRect.y() + yOffset, 100, tgtRect.y() + yOffset);
×
77
    }
78
}
×
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