ATLAS Offline Software
Loading...
Searching...
No Matches
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 &)
VP1ControllerHelper & operator= (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 29 of file VP1ControllerHelper.cxx.

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

◆ operator=()

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

The documentation for this class was generated from the following files: