GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/gui/action-search-bar.hh Lines: 0 1 0.0 %
Date: 2024-04-14 11:13:22 Branches: 0 0 - %

Line Branch Exec Source
1
// Copyright (c) 2015-2018, LAAS-CNRS
2
// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3
//
4
// This file is part of gepetto-viewer.
5
// gepetto-viewer is free software: you can redistribute it
6
// and/or modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation, either version
8
// 3 of the License, or (at your option) any later version.
9
//
10
// gepetto-viewer is distributed in the hope that it will be
11
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// General Lesser Public License for more details. You should have
14
// received a copy of the GNU Lesser General Public License along with
15
// gepetto-viewer. If not, see <http://www.gnu.org/licenses/>.
16
17
#ifndef GEPETTO_GUI_ACTION_SEARCH_BAR_HH
18
#define GEPETTO_GUI_ACTION_SEARCH_BAR_HH
19
20
#include <gepetto/gui/fwd.hh>
21
// This include must be include before any other Qt include for GLDEBUGPROC
22
#include <QLineEdit>
23
#include <QMap>
24
#include <QString>
25
#include <QStringListModel>
26
27
namespace gepetto {
28
namespace gui {
29
class ActionSearchBar : public QLineEdit {
30
  Q_OBJECT
31
32
 public:
33
  ActionSearchBar(QWidget* parent);
34
35
  void addAction(QAction* action);
36
37
  QAction* showAction() const { return showAction_; }
38
39
 protected:
40
  virtual void keyPressEvent(QKeyEvent* event);
41
  virtual void showEvent(QShowEvent* event);
42
43
 private slots:
44
  bool trigger(const QString& s);
45
  void handleReturnPressed();
46
47
 private:
48
  QStringListModel* model_;
49
  QCompleter* completer_;
50
  QMap<QString, QAction*> actions_;
51
  QAction* showAction_;
52
};
53
}  // namespace gui
54
}  // namespace gepetto
55
56
#endif  // GEPETTO_GUI_ACTION_SEARCH_BAR_HH