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

mcallegari / qlcplus / 15805077468

22 Jun 2025 08:36AM UTC coverage: 31.876% (-0.01%) from 31.89%
15805077468

push

github

mcallegari
plugins/dmxusb: fix RDM discovery and commands while DMX is running

0 of 1 new or added line in 1 file covered. (0.0%)

3722 existing lines in 175 files now uncovered.

16438 of 51569 relevant lines covered (31.88%)

19266.08 hits per line

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

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

24
#include "vcwidgetselection.h"
25
#include "virtualconsole.h"
26
#include "vcframe.h"
27

28
#define KColumnName         0
29
#define KColumnType         1
30

31
#define SETTINGS_GEOMETRY "vcwidgetselection/geometry"
32

33
VCWidgetSelection::VCWidgetSelection(QList<int> filters, QWidget *parent)
×
34
    : QDialog(parent)
35
    , m_filters(filters)
×
36
{
37
    setupUi(this);
×
38

39
    m_tree->setRootIsDecorated(false);
×
40
    m_tree->setSelectionMode(QAbstractItemView::SingleSelection);
×
41
    m_tree->setAllColumnsShowFocus(true);
×
42

43
    QSettings settings;
×
44
    QVariant geometrySettings = settings.value(SETTINGS_GEOMETRY);
×
45
    if (geometrySettings.isValid() == true)
×
46
        restoreGeometry(geometrySettings.toByteArray());
×
47

48
    connect(m_tree, SIGNAL(itemSelectionChanged()),
×
49
            this, SLOT(slotItemSelectionChanged()));
50
    connect(m_tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
×
51
            this, SLOT(slotItemDoubleClicked(QTreeWidgetItem*)));
52

53
    updateWidgetsTree();
×
54

55
    slotItemSelectionChanged();
×
56
}
×
57

58
VCWidgetSelection::~VCWidgetSelection()
×
59
{
60
    QSettings settings;
×
61
    settings.setValue(SETTINGS_GEOMETRY, saveGeometry());
×
62
}
×
63

64
VCWidget *VCWidgetSelection::getSelectedWidget()
×
65
{
66
    int selIdx = m_tree->currentIndex().row();
×
67
    if (selIdx >= 0)
×
68
        return m_widgetsList.at(selIdx);
×
UNCOV
69
    return NULL;
×
70
}
71

72
QList<VCWidget *> VCWidgetSelection::getChildren(VCWidget *obj)
×
73
{
74
    QList<VCWidget *> list;
×
75
    if (obj == NULL)
×
UNCOV
76
        return list;
×
77
    QListIterator <VCWidget*> it(obj->findChildren<VCWidget*>());
×
78
    while (it.hasNext() == true)
×
79
    {
80
        VCWidget* child = it.next();
×
81
        qDebug() << Q_FUNC_INFO << "append: " << child->caption();
×
82
        if (m_filters.isEmpty() || m_filters.contains(child->type()))
×
83
            list.append(child);
×
84
    }
UNCOV
85
    return list;
×
UNCOV
86
}
×
87

88
void VCWidgetSelection::updateWidgetsTree()
×
89
{
90
    VCFrame *contents = VirtualConsole::instance()->contents();
×
91
    m_widgetsList = getChildren(contents);
×
92

93
    foreach (QObject *object, m_widgetsList)
×
94
    {
UNCOV
95
        VCWidget *widget = qobject_cast<VCWidget *>(object);
×
96

97
        QTreeWidgetItem *item = new QTreeWidgetItem(m_tree);
×
98
        item->setText(KColumnName, widget->caption());
×
99
        item->setIcon(KColumnName, VCWidget::typeToIcon(widget->type()));
×
100
        item->setText(KColumnType, VCWidget::typeToString(widget->type()));
×
UNCOV
101
    }
×
102
}
×
103

104
void VCWidgetSelection::slotItemSelectionChanged()
×
105
{
106
    if (m_tree->currentIndex().row() < 0)
×
107
    {
108
        // No widget selected
109
        m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
×
110
    }
111
    else
112
        m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
×
113
}
×
114

115
void VCWidgetSelection::slotItemDoubleClicked(QTreeWidgetItem* item)
×
116
{
117
    if (item == NULL)
×
UNCOV
118
        return;
×
119

120
    accept();
×
121
}
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

© 2026 Coveralls, Inc