ATLAS Offline Software
Loading...
Searching...
No Matches
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
16#include "ui_bankschannelwidgetform.h"
18#include <QLabel>
19
20//_________________________________________________________
23 "This channel simply shows the banks list, provided by the VP1BanksSystem.",
24 "Thomas.Kittelmann@cern.ch"),
26{
27}
28
29//_________________________________________________________
31{
32 //Ownership transferred to IVP1ChannelWidget
33 //cppcheck-suppress publicAllocationError
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//_________________________________________________________
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//_________________________________________________________
57void 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}
#define VP1CHANNELNAMEINPLUGIN(cls, nme)
void registerSystem(IVP1System *)
void registerController(QWidget *)
void message(QString)
IVP1ChannelWidget(const QString &name, const QString &information, const QString &contact_info)
void entriesChanged(const QStringList &entry_key, const QStringList &entry_type, const QStringList &entry_id)
QTableWidget * m_tableWidget
VP1BanksSystem * m_bankssystem