trikRuntime
sensorSettingsWidget.h
Go to the documentation of this file.
1 /* Copyright 2016 Mikhail Kita
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License. */
14 
15 #pragma once
16 
17 #include <QtCore/qglobal.h>
18 
19 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
20  #include <QtGui/QWidget>
21  #include <QtGui/QLabel>
22  #include <QtGui/QVBoxLayout>
23  #include <QtGui/QListWidget>
24 #else
25  #include <QtWidgets/QWidget>
26  #include <QtWidgets/QLabel>
27  #include <QtWidgets/QVBoxLayout>
28  #include <QtWidgets/QListWidget>
29 #endif
30 
31 #include <QtCore/QString>
32 
34 
35 #include "trikGuiDialog.h"
36 
37 namespace trikGui {
38 
39 class SensorLever;
40 class ConnectButton;
41 
44 {
45  Q_OBJECT
46 
47 public:
52  explicit SensorSettingsWidget(const QString &port, bool isEncoder, QWidget *parent = 0);
53 
55 
57  static QString menuEntry();
58 
59  void renewFocus() override;
60 
62  QString createScript();
63 
64 protected:
65  void keyPressEvent(QKeyEvent *event) override;
66 
67 private slots:
69  void focus();
70 
71 private:
72  QEventLoop mEventLoop;
73  QVBoxLayout mLayout;
74  QString mPort;
75  bool mIsEncoder;
76  QLabel mPowerLabel;
77 
78  QScopedPointer<SensorLever> mLever;
79 
81  QScopedPointer<ConnectButton> mContinueButton;
82 };
83 
84 }
static QString menuEntry()
Returns menu entry for this widget.
Definition: sensorSettingsWidget.cpp:62
static const int port
Definition: trikCommunicatorTest.cpp:24
Base class for all trikGui dialog widgets.
Definition: trikGuiDialog.h:24
Definition: abstractIndicator.h:21
SensorSettingsWidget(const QString &port, bool isEncoder, QWidget *parent=0)
Constructor.
Definition: sensorSettingsWidget.cpp:33
~SensorSettingsWidget()
Definition: sensorSettingsWidget.cpp:58
void renewFocus() override
Set focus properly on this widget or one of its children.
Definition: sensorSettingsWidget.cpp:67
Widget which allows to change settings of the robot sensors.
Definition: sensorSettingsWidget.h:43
void keyPressEvent(QKeyEvent *event) override
Definition: sensorSettingsWidget.cpp:71
QString createScript()
Generates new command for script and returns it.
Definition: sensorSettingsWidget.cpp:99