Line data Source code
1 : // DUNE DAQ modification notice:
2 : // This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
3 : // Fork baseline commit: dbe-02-12-17 (2022-05-12).
4 : // Renamed since fork: no.
5 :
6 : /// Including QT Headers
7 : #include <QKeyEvent>
8 : /// Including DBE
9 : #include "dbe/SearchComboBox.hpp"
10 :
11 0 : dbe::SearchComboBox::SearchComboBox(QWidget* parent)
12 : : QComboBox(parent)
13 0 : , UserText(QString(""))
14 : {
15 0 : connect(this, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(ChangeToolTip(const QString&)));
16 0 : }
17 :
18 : void
19 0 : dbe::SearchComboBox::focusInEvent(QFocusEvent* Event)
20 : {
21 0 : UserText = currentText();
22 0 : QComboBox::focusInEvent(Event);
23 0 : }
24 :
25 : void
26 0 : dbe::SearchComboBox::keyPressEvent(QKeyEvent* Event)
27 : {
28 0 : switch (Event->key()) {
29 0 : case Qt::Key_Return:
30 0 : emit ReturnPressed();
31 0 : return;
32 :
33 0 : default:
34 0 : break;
35 : }
36 :
37 0 : QComboBox::keyPressEvent(Event);
38 :
39 0 : if (currentText().compare(UserText) != 0) {
40 0 : UserText = currentText();
41 0 : emit TextModified(currentText());
42 : }
43 : }
44 :
45 : void
46 0 : dbe::SearchComboBox::ChangeToolTip(const QString& Text)
47 : {
48 0 : setToolTip(QString("Search mode: %1").arg(Text));
49 0 : }
|