ATLAS Offline Software
VP1BanksChannel.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 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"),
25  m_tableWidget(0)
26 {
27 }
28 
29 //_________________________________________________________
31 {
34 
35  connect(m_bankssystem,SIGNAL(entriesChanged(const QStringList&,const QStringList&,const QStringList&)),
36  this, SLOT( entriesChanged(const QStringList&,const QStringList&,const QStringList&)) );
37 
38 }
39 
40 //_________________________________________________________
42 
43  //Setup this widget
44  Ui::BanksChannelWidgetForm ui;
45  ui.setupUi(this);
46  m_tableWidget = ui.tableWidget;
47  m_tableWidget->setColumnCount(2);
48  m_tableWidget->setHorizontalHeaderLabels((QStringList()<<"Type"<<"Key"));
49  m_tableWidget->setAlternatingRowColors ( true );
50  m_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
52 }
53 
54 //_________________________________________________________
55 void VP1BanksChannel::entriesChanged( const QStringList& entry_key,const QStringList& entry_type,const QStringList& entry_id )
56 {
57 
58  if (entry_key.count()!=entry_type.count()||entry_key.count()!=entry_id.count()) {
59  message("Error: Received data has wrong format!");
60  m_tableWidget->setRowCount(0);
61  return;
62  }
63 
64  m_tableWidget->setUpdatesEnabled(false);
65 
66  //Turn sorting off while inserting (otherwise the correct row index to use will likely change in the middle of insertions):
67  m_tableWidget->setSortingEnabled(false);
68 
69  m_tableWidget->setRowCount(entry_key.count());
70  for (int irow = 0; irow<entry_key.count();++irow) {
71  QTableWidgetItem * item0 = new QTableWidgetItem(entry_type.at(irow));
72  QTableWidgetItem * item1 = new QTableWidgetItem(entry_key.at(irow));
73  item0->setToolTip("Class ID "+entry_id.at(irow));
74  m_tableWidget->setItem(irow, 0, item0);
75  m_tableWidget->setItem(irow, 1, item1);
76  }
77 
78  m_tableWidget->setSortingEnabled(true);
79  m_tableWidget->resizeColumnsToContents();
80  m_tableWidget->setUpdatesEnabled(true);
81 }
IVP1ChannelWidget::registerSystem
void registerSystem(IVP1System *)
Definition: IVP1ChannelWidget.cxx:221
VP1BanksChannel::init
void init()
Definition: VP1BanksChannel.cxx:30
VP1BanksChannel::VP1BanksChannel
VP1BanksChannel()
Definition: VP1BanksChannel.cxx:21
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
IVP1ChannelWidget::registerController
void registerController(QWidget *)
Definition: IVP1ChannelWidget.cxx:210
VP1BanksChannel::m_tableWidget
QTableWidget * m_tableWidget
Definition: VP1BanksChannel.h:39
VP1CHANNELNAMEINPLUGIN
#define VP1CHANNELNAMEINPLUGIN(cls, nme)
Definition: IVP1ChannelWidget.h:139
VP1BanksChannel::m_bankssystem
VP1BanksSystem * m_bankssystem
Definition: VP1BanksChannel.h:40
VP1BanksChannel.h
IVP1ChannelWidget::message
void message(QString)
VP1BanksChannel::create
void create()
Definition: VP1BanksChannel.cxx:41
IVP1ChannelWidget
Definition: IVP1ChannelWidget.h:34
VP1BanksSystem.h
VP1BanksChannel
Definition: VP1BanksChannel.h:23
VP1BanksChannel::entriesChanged
void entriesChanged(const QStringList &entry_key, const QStringList &entry_type, const QStringList &entry_id)
Definition: VP1BanksChannel.cxx:55
IVP1System::controllerWidget
QWidget * controllerWidget()
Definition: IVP1System.cxx:202
VP1BanksSystem
Definition: VP1BanksSystem.h:21