ATLAS Offline Software
Static Public Member Functions | Private Member Functions | List of all members
VP1ControllerHelper Class Reference

#include <VP1ControllerHelper.h>

Collaboration diagram for VP1ControllerHelper:

Static Public Member Functions

static QWidget * compositionController (const QList< IVP1System * > &systemsWithControllersAllowed, QMap< IVP1System *, QWidget * > &sys2tabpage, VP1TabWidget *&tabwidget, const QList< QPair< IVP1System *, bool > > &system2switchable, QMap< QCheckBox *, IVP1System * > &checkbox2system, VP1ColorSelectButton *&colorselectbutton, QWidget *extrawidget=0, bool nobgdcolorsel=false)
 

Private Member Functions

 VP1ControllerHelper ()
 
 ~VP1ControllerHelper ()
 
 VP1ControllerHelper (const VP1ControllerHelper &)
 
VP1ControllerHelperoperator= (const VP1ControllerHelper &)
 

Detailed Description

Definition at line 27 of file VP1ControllerHelper.h.

Constructor & Destructor Documentation

◆ VP1ControllerHelper() [1/2]

VP1ControllerHelper::VP1ControllerHelper ( )
private

◆ ~VP1ControllerHelper()

VP1ControllerHelper::~VP1ControllerHelper ( )
private

◆ VP1ControllerHelper() [2/2]

VP1ControllerHelper::VP1ControllerHelper ( const VP1ControllerHelper )
private

Member Function Documentation

◆ compositionController()

QWidget * VP1ControllerHelper::compositionController ( const QList< IVP1System * > &  systemsWithControllersAllowed,
QMap< IVP1System *, QWidget * > &  sys2tabpage,
VP1TabWidget *&  tabwidget,
const QList< QPair< IVP1System *, bool > > &  system2switchable,
QMap< QCheckBox *, IVP1System * > &  checkbox2system,
VP1ColorSelectButton *&  colorselectbutton,
QWidget *  extrawidget = 0,
bool  nobgdcolorsel = false 
)
static

Definition at line 28 of file VP1ControllerHelper.cxx.

35 {
36  tabWidget = 0;
37 
38  //First we figure out which system controllers we should add:
39  QList<QPair<QWidget*,QString> > controllerTabs;
40  for (IVP1System* s : systemsWithControllersAllowed) {
41  QWidget* w = s->controllerWidget();
42  if (w) {
43  controllerTabs << QPair<QWidget*,QString>(w,s->name());
44  sys2tabpage.insert(s,w);
45  }
46  }
47 
48  //Setup the general tab which switches controllers on and off.
49  QWidget * tab_general = new QWidget(0);
50  QVBoxLayout * vboxLayout1 = new QVBoxLayout(tab_general);
51  vboxLayout1->setSpacing(6);
52  vboxLayout1->setMargin(9);
53  QHBoxLayout * hboxLayout = new QHBoxLayout();
54  hboxLayout->setSpacing(6);
55  hboxLayout->setMargin(0);
56  QLabel * tab_general_label = new QLabel(tab_general);
57  tab_general_label->setText("No systems can be switched on/off in this channel.");
58  hboxLayout->addWidget(tab_general_label);
59  QSpacerItem * spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
60  hboxLayout->addItem(spacerItem);
61  vboxLayout1->addLayout(hboxLayout);
62  QHBoxLayout * hboxLayout1 = new QHBoxLayout();
63  hboxLayout1->setSpacing(0);
64  hboxLayout1->setMargin(0);
65  QSpacerItem * spacerItem1 = new QSpacerItem(25, 2, QSizePolicy::Fixed, QSizePolicy::Fixed);
66  hboxLayout1->addItem(spacerItem1);
67  QVBoxLayout *vboxLayout_checkboxes = new QVBoxLayout();
68  vboxLayout_checkboxes->setSpacing(6);
69  vboxLayout_checkboxes->setMargin(0);
70  hboxLayout1->addLayout(vboxLayout_checkboxes);
71  QSpacerItem * spacerItem2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
72  hboxLayout1->addItem(spacerItem2);
73  vboxLayout1->addLayout(hboxLayout1);
74 
75  //Add checkboxes for switching systems on/off
76  for (int i = 0; i < system2switchable.count(); ++i) {
77  QCheckBox * checkBox = new QCheckBox(tab_general);
78  checkBox->setText(system2switchable.at(i).first->name());
79  QString info(system2switchable.at(i).first->information());
80  if (!info.isEmpty())
81  checkBox->setToolTip(info);
82  checkBox->setChecked(true);
83  vboxLayout_checkboxes->addWidget(checkBox);
84  if (system2switchable.at(i).second) {
85  tab_general_label->setText("Select active systems:");
86  checkbox2system.insert(checkBox,system2switchable.at(i).first);
87  } else {
88  checkBox->setEnabled(false);
89  }
90  }
91 
92  //Add pushbutton for choosing background color:
93  if (!nobgdcolorsel) {
94  colorselectbutton = new VP1ColorSelectButton(tab_general,Qt::black);
95  QHBoxLayout * hboxLayout2 = new QHBoxLayout();
96  hboxLayout2->setSpacing(6);
97  hboxLayout2->setMargin(0);
98  hboxLayout2->addWidget(colorselectbutton);
99  hboxLayout2->addWidget(new QLabel("Set background"));
100  QSpacerItem * spacerItem4 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
101  hboxLayout2->addItem(spacerItem4);
102  QSpacerItem * spacerItem5 = new QSpacerItem(10, 10, QSizePolicy::Minimum,QSizePolicy::Fixed);
103  vboxLayout1->addItem(spacerItem5);
104  vboxLayout1->addLayout(hboxLayout2);
105  }
106 
107  //Maybe add another custom widget:
108  if (extrawidget) {
109  extrawidget->setParent(tab_general);
110  QHBoxLayout * hboxLayout_extra = new QHBoxLayout();
111  hboxLayout_extra->setSpacing(6);
112  hboxLayout_extra->setMargin(0);
113  hboxLayout_extra->addWidget(extrawidget);
114  QSpacerItem * spacerItem_extra1 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
115  hboxLayout_extra->addItem(spacerItem_extra1);
116  QSpacerItem * spacerItem_extra2 = new QSpacerItem(10, 10, QSizePolicy::Minimum,QSizePolicy::Fixed);
117  vboxLayout1->addItem(spacerItem_extra2);
118  vboxLayout1->addLayout(hboxLayout_extra);
119  QSpacerItem * spacerItem_extra3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
120  vboxLayout1->addItem(spacerItem_extra3);
121  }
122 
123  QSpacerItem * spacerItem3 = new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding);
124  vboxLayout1->addItem(spacerItem3);
125 
126  //If we dont have any system controllers to add, that tab is the whole controller:
127  if (controllerTabs.empty()) {
128  return tab_general;
129  }
130 
131  //Let us make an actual tab widget:
132  tabWidget = new VP1TabWidget(0);
133  tabWidget->addTab(tab_general, "General");
134 
135  //Add system tabs:
136  for (int i = 0; i<controllerTabs.count();++i) {
137  controllerTabs.at(i).first->setParent(tabWidget);//We assume ownership of the system controller.
138  tabWidget->addTab(controllerTabs.at(i).first,controllerTabs.at(i).second);
139  }
140 
141  //Show first tab:
142  tabWidget->setCurrentIndex(0);
143 
144  return tabWidget;
145 }

◆ operator=()

VP1ControllerHelper& VP1ControllerHelper::operator= ( const VP1ControllerHelper )
private

The documentation for this class was generated from the following files:
grepfile.info
info
Definition: grepfile.py:38
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
VP1ColorSelectButton
Definition: VP1ColorSelectButton.h:20
VP1TabWidget
Definition: VP1TabWidget.h:45
IVP1System
Definition: IVP1System.h:36
lumiFormat.i
int i
Definition: lumiFormat.py:85
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200