ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
graphics
VP1
VP1Gui
src
VP1SelectEvent.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// //
7
// Source file for class VP1SelectEvent //
8
// //
9
// Description: Dialog for the selection of a specific event in a file //
10
// //
11
// Author: Sebastian Andreas Merkt (sebastian.andreas.merkt@cern.ch) //
12
// Initial version: August 2018 //
13
// //
15
16
#include "
VP1Gui/VP1SelectEvent.h
"
17
18
#include <QPushButton>
19
#include <QGridLayout>
20
21
#if __GNUC__ >= 14
22
// suppress warning seen in qfutureinterface.h
23
# pragma GCC diagnostic push
24
# pragma GCC diagnostic ignored "-Wtemplate-id-cdtor"
25
#endif
26
#include <QtWidgets>
27
#if __GNUC__ >= 14
28
# pragma GCC diagnostic pop
29
#endif
30
#include <QString>
31
32
VP1SelectEvent::VP1SelectEvent
(
int
totEvtNr,
int
evtNr, QWidget *parent) : QDialog(parent)
33
{
34
//Set default dialog size
35
int
nWidth = 400;
36
int
nHeight = 200;
37
if
(parent != NULL)
38
setGeometry(parent->x() + parent->width()/2 - nWidth/2,
39
parent->y() + parent->height()/2 - nHeight/2,
40
nWidth, nHeight);
41
else
42
resize(nWidth, nHeight);
43
44
//Buttonbox to set Open, Cancel buttons
45
m_buttonBox
=
new
QDialogButtonBox(
this
);
46
m_openButton
=
m_buttonBox
->addButton(tr(
"&Select"
), QDialogButtonBox::AcceptRole);
47
m_cancelButton
=
m_buttonBox
->addButton(tr(
"&Cancel"
),QDialogButtonBox::RejectRole);
48
connect(
m_openButton
, &QPushButton::clicked,
this
, &
VP1SelectEvent::passEvtNr
);
49
connect(
m_cancelButton
, &QPushButton::clicked,
this
, &
VP1SelectEvent::reject
);
50
51
52
m_spinBox
=
new
QSpinBox();
53
m_spinBox
->setRange(1, totEvtNr);
54
m_spinBox
->setSingleStep(1);
55
m_spinBox
->setValue(evtNr+1);
56
57
const
QString line2 = QString::number(totEvtNr) +
" events in file."
;
58
59
//Create the main layout
60
QGridLayout *mainLayout =
new
QGridLayout(
this
);
61
mainLayout->addWidget(
new
QLabel(tr(
"Select event:"
)), 0, 0);
62
mainLayout->addWidget(
m_spinBox
, 0, 1);
63
mainLayout->addWidget(
new
QLabel(line2), 1, 0);
64
mainLayout->addWidget(
m_buttonBox
, 2, 1);
65
66
}
67
68
void
VP1SelectEvent::passEvtNr
(){
69
if
(
m_spinBox
->value() != 0 ) {
70
VP1SelectEvent::done(
m_spinBox
->value());
71
}
72
}
73
74
void
VP1SelectEvent::reject
(){
75
VP1SelectEvent::done(-1);
76
}
VP1SelectEvent.h
VP1SelectEvent::m_openButton
QPushButton * m_openButton
Definition
VP1SelectEvent.h:37
VP1SelectEvent::VP1SelectEvent
VP1SelectEvent(int totEvtNr, int evtNr, QWidget *parent=0)
Definition
VP1SelectEvent.cxx:32
VP1SelectEvent::m_buttonBox
QDialogButtonBox * m_buttonBox
Definition
VP1SelectEvent.h:38
VP1SelectEvent::reject
void reject()
Definition
VP1SelectEvent.cxx:74
VP1SelectEvent::m_cancelButton
QPushButton * m_cancelButton
Definition
VP1SelectEvent.h:36
VP1SelectEvent::passEvtNr
void passEvtNr()
Definition
VP1SelectEvent.cxx:68
VP1SelectEvent::m_spinBox
QSpinBox * m_spinBox
Definition
VP1SelectEvent.h:39
Generated on
for ATLAS Offline Software by
1.17.0