ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
graphics
VP1
VP1Plugins
VP1BanksPlugin
src
VP1BanksChannel.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// //
7
// Implementation of class VP1BanksChannel //
8
// //
9
// Author: Thomas Kittelmann <Thomas.Kittelmann@cern.ch> //
10
// //
11
// Initial version: May 2007 //
12
// //
14
15
#include "
VP1BanksPlugin/VP1BanksChannel.h
"
16
#include "ui_bankschannelwidgetform.h"
17
#include "
VP1BanksSystems/VP1BanksSystem.h
"
18
#include <QLabel>
19
20
//_________________________________________________________
21
VP1BanksChannel::VP1BanksChannel
()
22
:
IVP1ChannelWidget
(
VP1CHANNELNAMEINPLUGIN
(
VP1BanksChannel
,
"Banks"
),
23
"This channel simply shows the banks list, provided by the VP1BanksSystem."
,
24
"Thomas.Kittelmann@cern.ch"
),
25
m_tableWidget
(0)
26
{
27
}
28
29
//_________________________________________________________
30
void
VP1BanksChannel::init
()
31
{
32
//Ownership transferred to IVP1ChannelWidget
33
//cppcheck-suppress publicAllocationError
34
m_bankssystem
=
new
VP1BanksSystem
();
35
registerSystem
(
m_bankssystem
);
36
37
connect(
m_bankssystem
,SIGNAL(
entriesChanged
(
const
QStringList&,
const
QStringList&,
const
QStringList&)),
38
this
, SLOT(
entriesChanged
(
const
QStringList&,
const
QStringList&,
const
QStringList&)) );
39
40
}
41
42
//_________________________________________________________
43
void
VP1BanksChannel::create
() {
44
45
//Setup this widget
46
Ui::BanksChannelWidgetForm ui;
47
ui.setupUi(
this
);
48
m_tableWidget
= ui.tableWidget;
49
m_tableWidget
->setColumnCount(2);
50
m_tableWidget
->setHorizontalHeaderLabels((QStringList()<<
"Type"
<<
"Key"
));
51
m_tableWidget
->setAlternatingRowColors (
true
);
52
m_tableWidget
->setEditTriggers(QAbstractItemView::NoEditTriggers);
53
registerController
(
m_bankssystem
->controllerWidget());
54
}
55
56
//_________________________________________________________
57
void
VP1BanksChannel::entriesChanged
(
const
QStringList& entry_key,
const
QStringList& entry_type,
const
QStringList& entry_id )
58
{
59
60
if
(entry_key.count()!=entry_type.count()||entry_key.count()!=entry_id.count()) {
61
message
(
"Error: Received data has wrong format!"
);
62
m_tableWidget
->setRowCount(0);
63
return
;
64
}
65
66
m_tableWidget
->setUpdatesEnabled(
false
);
67
68
//Turn sorting off while inserting (otherwise the correct row index to use will likely change in the middle of insertions):
69
m_tableWidget
->setSortingEnabled(
false
);
70
71
m_tableWidget
->setRowCount(entry_key.count());
72
for
(
int
irow = 0; irow<entry_key.count();++irow) {
73
QTableWidgetItem * item0 =
new
QTableWidgetItem(entry_type.at(irow));
74
QTableWidgetItem * item1 =
new
QTableWidgetItem(entry_key.at(irow));
75
item0->setToolTip(
"Class ID "
+entry_id.at(irow));
76
m_tableWidget
->setItem(irow, 0, item0);
77
m_tableWidget
->setItem(irow, 1, item1);
78
}
79
80
m_tableWidget
->setSortingEnabled(
true
);
81
m_tableWidget
->resizeColumnsToContents();
82
m_tableWidget
->setUpdatesEnabled(
true
);
83
}
VP1CHANNELNAMEINPLUGIN
#define VP1CHANNELNAMEINPLUGIN(cls, nme)
Definition
IVP1ChannelWidget.h:139
VP1BanksChannel.h
VP1BanksSystem.h
IVP1ChannelWidget::registerSystem
void registerSystem(IVP1System *)
Definition
IVP1ChannelWidget.cxx:221
IVP1ChannelWidget::registerController
void registerController(QWidget *)
Definition
IVP1ChannelWidget.cxx:210
IVP1ChannelWidget::message
void message(QString)
IVP1ChannelWidget::IVP1ChannelWidget
IVP1ChannelWidget(const QString &name, const QString &information, const QString &contact_info)
Definition
IVP1ChannelWidget.cxx:46
VP1BanksChannel::init
void init()
Definition
VP1BanksChannel.cxx:30
VP1BanksChannel::create
void create()
Definition
VP1BanksChannel.cxx:43
VP1BanksChannel::entriesChanged
void entriesChanged(const QStringList &entry_key, const QStringList &entry_type, const QStringList &entry_id)
Definition
VP1BanksChannel.cxx:57
VP1BanksChannel::m_tableWidget
QTableWidget * m_tableWidget
Definition
VP1BanksChannel.h:39
VP1BanksChannel::m_bankssystem
VP1BanksSystem * m_bankssystem
Definition
VP1BanksChannel.h:40
VP1BanksChannel::VP1BanksChannel
VP1BanksChannel()
Definition
VP1BanksChannel.cxx:21
VP1BanksSystem
Definition
VP1BanksSystem.h:21
Generated on
for ATLAS Offline Software by
1.17.0