StatusWidget.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (C) 2015 by Ralf Kaestner *
3  * ralf.kaestner@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the Lesser GNU General Public License as published by*
7  * the Free Software Foundation; either version 3 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * Lesser GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the Lesser GNU General Public License *
16  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17  ******************************************************************************/
18 
19 #ifndef RQT_MULTIPLOT_STATUS_WIDGET_H
20 #define RQT_MULTIPLOT_STATUS_WIDGET_H
21 
22 #include <QGridLayout>
23 #include <QImage>
24 #include <QLabel>
25 #include <QList>
26 #include <QMap>
27 #include <QPixmap>
28 #include <QTimer>
29 #include <QWidget>
30 
31 namespace rqt_multiplot {
32  class StatusWidget :
33  public QWidget {
34  Q_OBJECT
35  public:
36  enum Role {
40  };
41 
42  StatusWidget(QWidget* parent = 0, Role role = Okay);
43  virtual ~StatusWidget();
44 
45  void setIcon(Role role, const QPixmap& icon);
46  const QPixmap& getIcon(Role role) const;
47  void setFrames(Role role, const QPixmap& frames, size_t numFrames,
48  double frameRate = 10.0);
49  void setFrames(Role role, const QList<QPixmap>& frameList, double
50  frameRate = 10.0);
51  const QList<QPixmap>& getFrames(Role role) const;
52  void setFrameRate(Role role, double frameRate);
53  double getFrameRate(Role role) const;
54  void setCurrentRole(Role role, const QString& toolTip = QString());
55  Role getCurrentRole() const;
56 
57  void pushCurrentRole();
58  bool popCurrentRole();
59 
60  signals:
61  void currentRoleChanged(Role role);
62 
63  private:
64  QGridLayout* layout_;
65  QLabel* labelIcon_;
66  QTimer* timer_;
67 
68  QMap<Role, QList<QPixmap> > frames_;
69  QMap<Role, double> frameRates_;
70  QList<Role> roleStack_;
71  QList<QString> toolTipStack_;
72 
74  size_t currentFrame_;
75 
76  void start();
77  void step();
78  void stop();
79 
80  private slots:
81  void timerTimeout();
82  };
83 };
84 
85 #endif
void setIcon(Role role, const QPixmap &icon)
void currentRoleChanged(Role role)
QMap< Role, QList< QPixmap > > frames_
Definition: StatusWidget.h:68
double getFrameRate(Role role) const
StatusWidget(QWidget *parent=0, Role role=Okay)
void setFrameRate(Role role, double frameRate)
void setFrames(Role role, const QPixmap &frames, size_t numFrames, double frameRate=10.0)
const QPixmap & getIcon(Role role) const
QMap< Role, double > frameRates_
Definition: StatusWidget.h:69
QList< QString > toolTipStack_
Definition: StatusWidget.h:71
void setCurrentRole(Role role, const QString &toolTip=QString())
const QList< QPixmap > & getFrames(Role role) const


rqt_multiplot_plugin
Author(s): Ralf Kaestner
autogenerated on Fri Jan 15 2021 03:47:53