VPTissue Reference Manual
MyFindDialog.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "MyFindDialog.h"
21 
22 #include <QVBoxLayout>
23 #include <QHBoxLayout>
24 
25 namespace SimShell {
26 namespace Gui {
27 MyFindDialog::MyFindDialog(QWidget* parent)
28  : QDialog(parent)
29 {
30  m_label = new QLabel("Search for:", this);
31  m_input = new QLineEdit;
32  m_label->setBuddy(m_input);
33 
34  m_match_case = new QCheckBox("Match case");
35 
36  m_close_button = new QPushButton("Close");
37  m_find_button = new QPushButton("Find");
38  m_find_button->setDefault(true);
39  m_find_button->setAutoDefault(true);
40 
41  QHBoxLayout* input_layout = new QHBoxLayout;
42  input_layout->addWidget(m_label);
43  input_layout->addWidget(m_input);
44 
45  QHBoxLayout* button_layout = new QHBoxLayout;
46  button_layout->addWidget(m_close_button);
47  button_layout->addWidget(m_find_button);
48 
49  QVBoxLayout* layout = new QVBoxLayout;
50  layout->addLayout(input_layout);
51  layout->addWidget(m_match_case);
52  layout->addLayout(button_layout);
53 
54  setLayout(layout);
55  setWindowTitle("Find");
56  setModal(false);
57 
58  connect(m_close_button, SIGNAL(clicked()), this, SLOT(close()));
59  connect(m_find_button, SIGNAL(clicked()), this, SLOT(Find()));
60 }
61 
63 {
64  m_input->setFocus();
65  m_find_button->setDefault(true);
66 }
67 
68 void MyFindDialog::Find()
69 {
70  emit FindNext(m_input->text(), m_match_case->isChecked());
71 }
72 
73 } // namespace Gui
74 } // namespace SimShell
void CorrectFocus()
Sets focus to the text input box so the user can start typing right away.
Interface for MyFindDialog.
see the online Qt documentation
void FindNext(QString const &text, bool match_case)
Emitted when user performs a search query by clicking 'Search' or pressing the Enter button...
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32
see the online Qt documentation