diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5fbf8b1..30cdc30 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -132,7 +132,10 @@ set(SOURCES
src/ui/mainwindow.hpp
src/ui/mainwindow.ui
+
)
+
+QT5_add_resources(qrc_Files src/resources/images.qrc)
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
@@ -141,7 +144,7 @@ include_directories(
${OpenCV_INCLUDE_DIRS}
)
-add_executable(Air_Ground_CEC ${SOURCES})
+add_executable(Air_Ground_CEC ${SOURCES} ${qrc_Files})
target_link_libraries(Air_Ground_CEC
Qt5::Widgets
${catkin_LIBRARIES}
diff --git a/src/main/main.cpp b/src/main/main.cpp
index a983b77..e31bc33 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -22,3 +22,6 @@ int main(int argc, char** argv)
+/*
+ * find . "(" -name "*.cpp" -or -name "*.h" -or -name "*.hpp" -or -name "*.qrc" ")" -print | xargs wc -l
+ */
diff --git a/src/main/mainwindow.cpp b/src/main/mainwindow.cpp
index 7a22062..a68296e 100644
--- a/src/main/mainwindow.cpp
+++ b/src/main/mainwindow.cpp
@@ -9,6 +9,7 @@ MainWindow::MainWindow(int argc, char **argv, QWidget *parent) :
{
qnode.init();
ui->setupUi(this);
+ setBtnStates();
connections();
}
@@ -52,36 +53,75 @@ void MainWindow::slot_keyboard_control(){
}
+void MainWindow::setBtnStates(){
+ ui->pushButton_Forward->setShortcut(Qt::Key_8);
+ ui->pushButton_Forward->setStyleSheet(
+ "QPushButton{border-image: url(://images/up.png)}"
+ "QPushButton{border:none}"
+ "QPushButton:pressed{border-image: url(://images/up_2.png)}");
+ ui->pushButton_Forward->setFlat(true);
+
+
+ ui->pushButton_Back->setShortcut(Qt::Key_2);
+ ui->pushButton_Back->setStyleSheet(
+ "QPushButton{border-image: url(://images/up.png)}"
+ "QPushButton{border:none}"
+ "QPushButton:pressed{border-image: url(://images/up_2.png)}");
+ ui->pushButton_Back->setFlat(true);
+
+ ui->pushButton_Left->setShortcut(Qt::Key_4);
+ ui->pushButton_Left->setStyleSheet("border:none");
+ ui->pushButton_Left->setFlat(true);
+
+ ui->pushButton_Right->setShortcut(Qt::Key_6);
+ ui->pushButton_Right->setStyleSheet("border:none");
+ ui->pushButton_Right->setFlat(true);
+
+ ui->pushButton_Left_Forward->setShortcut(Qt::Key_7);
+ ui->pushButton_Left_Forward->setStyleSheet("border:none");
+ ui->pushButton_Left_Forward->setFlat(true);
+
+ ui->pushButton_Right_Forward->setShortcut(Qt::Key_9);
+ ui->pushButton_Right_Forward->setStyleSheet("border:none");
+ ui->pushButton_Right_Forward->setFlat(true);
+
+ ui->pushButton_Left_Back->setShortcut(Qt::Key_1);
+ ui->pushButton_Left_Back->setStyleSheet("border:none");
+ ui->pushButton_Left_Back->setFlat(true);
+
+ ui->pushButton_Right_Back->setShortcut(Qt::Key_3);
+ ui->pushButton_Right_Back->setStyleSheet("border:none");
+ ui->pushButton_Right_Back->setFlat(true);
+}
+
+
void MainWindow::connections(){
//绑定速度控制按钮
// 8 -> Forward:↑
- ui->pushButton_Forward->setShortcut(Qt::Key_8);
+
connect(ui->pushButton_Forward, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
- ui->pushButton_Back->setShortcut(Qt::Key_2);
+
connect(ui->pushButton_Back, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
- ui->pushButton_Left->setShortcut(Qt::Key_4);
+
connect(ui->pushButton_Left, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
- ui->pushButton_Right->setShortcut(Qt::Key_6);
+
connect(ui->pushButton_Right, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
- ui->pushButton_Left_Forward->setShortcut(Qt::Key_7);
+
connect(ui->pushButton_Left_Forward, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
- ui->pushButton_Right_Forward->setShortcut(Qt::Key_9);
+
connect(ui->pushButton_Right_Forward, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
- ui->pushButton_Left_Back->setShortcut(Qt::Key_1);
+
connect(ui->pushButton_Left_Back, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
- ui->pushButton_Right_Back->setShortcut(Qt::Key_3);
- connect(ui->pushButton_Right_Back, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
+ connect(ui->pushButton_Right_Back, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
- ui->pushButton_shift->setShortcut(Qt::ShiftModifier);
- connect(ui->pushButton_shift, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
//绑定slider的函数
connect(ui->horizontalSlider_raw, SIGNAL(valueChanged(int)), this,
diff --git a/src/resources/images.qrc b/src/resources/images.qrc
new file mode 100644
index 0000000..5b4cff0
--- /dev/null
+++ b/src/resources/images.qrc
@@ -0,0 +1,20 @@
+
+
+ images/down.png
+ images/down_2.png
+ images/down_left.png
+ images/down_left_2.png
+ images/down_right.png
+ images/down_right_2.png
+ images/left.png
+ images/left_2.png
+ images/right.png
+ images/right_2.png
+ images/up.png
+ images/up_2.png
+ images/up_left.png
+ images/up_left_2.png
+ images/up_right.png
+ images/up_right_2.png
+
+
diff --git a/src/resources/images/down.png b/src/resources/images/down.png
new file mode 100644
index 0000000..1fdba49
Binary files /dev/null and b/src/resources/images/down.png differ
diff --git a/src/resources/images/down_2.png b/src/resources/images/down_2.png
new file mode 100644
index 0000000..b0f2433
Binary files /dev/null and b/src/resources/images/down_2.png differ
diff --git a/src/resources/images/down_left.png b/src/resources/images/down_left.png
new file mode 100644
index 0000000..d29e9dc
Binary files /dev/null and b/src/resources/images/down_left.png differ
diff --git a/src/resources/images/down_left_2.png b/src/resources/images/down_left_2.png
new file mode 100644
index 0000000..dd21fc2
Binary files /dev/null and b/src/resources/images/down_left_2.png differ
diff --git a/src/resources/images/down_right.png b/src/resources/images/down_right.png
new file mode 100644
index 0000000..f65187d
Binary files /dev/null and b/src/resources/images/down_right.png differ
diff --git a/src/resources/images/down_right_2.png b/src/resources/images/down_right_2.png
new file mode 100644
index 0000000..408b905
Binary files /dev/null and b/src/resources/images/down_right_2.png differ
diff --git a/src/resources/images/left.png b/src/resources/images/left.png
new file mode 100644
index 0000000..2b60f08
Binary files /dev/null and b/src/resources/images/left.png differ
diff --git a/src/resources/images/left_2.png b/src/resources/images/left_2.png
new file mode 100644
index 0000000..26ea2cc
Binary files /dev/null and b/src/resources/images/left_2.png differ
diff --git a/src/resources/images/right.png b/src/resources/images/right.png
new file mode 100644
index 0000000..0a6ca1d
Binary files /dev/null and b/src/resources/images/right.png differ
diff --git a/src/resources/images/right_2.png b/src/resources/images/right_2.png
new file mode 100644
index 0000000..581bbe8
Binary files /dev/null and b/src/resources/images/right_2.png differ
diff --git a/src/resources/images/up.png b/src/resources/images/up.png
new file mode 100644
index 0000000..5a5717f
Binary files /dev/null and b/src/resources/images/up.png differ
diff --git a/src/resources/images/up_2.png b/src/resources/images/up_2.png
new file mode 100644
index 0000000..200be6e
Binary files /dev/null and b/src/resources/images/up_2.png differ
diff --git a/src/resources/images/up_left.png b/src/resources/images/up_left.png
new file mode 100644
index 0000000..53d47cb
Binary files /dev/null and b/src/resources/images/up_left.png differ
diff --git a/src/resources/images/up_left_2.png b/src/resources/images/up_left_2.png
new file mode 100644
index 0000000..b8824ba
Binary files /dev/null and b/src/resources/images/up_left_2.png differ
diff --git a/src/resources/images/up_right.png b/src/resources/images/up_right.png
new file mode 100644
index 0000000..21c37f5
Binary files /dev/null and b/src/resources/images/up_right.png differ
diff --git a/src/resources/images/up_right_2.png b/src/resources/images/up_right_2.png
new file mode 100644
index 0000000..1fa93ac
Binary files /dev/null and b/src/resources/images/up_right_2.png differ
diff --git a/src/ui/mainwindow.hpp b/src/ui/mainwindow.hpp
index 9f5189d..f0cdf8c 100644
--- a/src/ui/mainwindow.hpp
+++ b/src/ui/mainwindow.hpp
@@ -20,6 +20,8 @@ public:
explicit MainWindow(int argc, char **argv, QWidget *parent = 0);
~MainWindow();
+
+
public slots:
void slot_keyboard_control();
//void slot_command_control(int linear, int angular);
@@ -30,6 +32,7 @@ public slots:
private:
Ui::MainWindow *ui;
+ void setBtnStates();
void connections();
QNode qnode;
diff --git a/src/ui/mainwindow.ui b/src/ui/mainwindow.ui
index 5460ecb..6be3366 100644
--- a/src/ui/mainwindow.ui
+++ b/src/ui/mainwindow.ui
@@ -6,140 +6,41 @@
0
0
- 1600
- 900
+ 1440
+ 810
MainWindow
+
+
+
-
+
- 60
- 30
- 502
- 654
+ 510
+ 40
+ 446
+ 543
-
- -
-
-
-
- 500
- 300
-
-
-
-
- 500
- 300
-
-
-
- false
-
-
-
-
-
- UAV_VEDIO
-
-
- false
-
-
-
+
-
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
-
- 500
- 300
-
-
-
-
- 500
- 300
-
-
-
- PATH
-
-
-
-
-
-
-
-
- 760
- 70
- 100
- 50
-
-
-
-
- 100
- 50
-
-
-
-
- 100
- 50
-
-
-
-
- 15
-
-
-
- 加速
-
-
-
-
-
- 1020
- 271
- 316
- 172
-
-
-
- -
-
-
-
-
+
+
-
+
- 100
- 32
+ 64
+ 64
- 100
- 32
+ 64
+ 64
@@ -148,22 +49,22 @@
- ↑
+ ↖
- -
-
+
-
+
- 100
- 32
+ 64
+ 64
- 100
- 32
+ 64
+ 64
@@ -171,23 +72,26 @@
15
+
+ QPushButton{border-image: url(://images/up.png);}
+
- →
+ ↑
- -
-
+
-
+
- 100
- 32
+ 64
+ 64
- 100
- 32
+ 64
+ 64
@@ -196,22 +100,26 @@
- ←
+ ↗
- -
-
+
+
+ -
+
+
-
+
- 100
- 32
+ 64
+ 64
- 100
- 32
+ 64
+ 64
@@ -220,46 +128,44 @@
- ↓
+ ←
- -
-
+
-
+
- 100
- 32
+ 90
+ 64
- 100
- 32
+ 90
+ 64
-
-
- 15
-
-
- ↖
+ 全向模式(k)
+
+
+ K
- -
-
+
-
+
- 100
- 32
+ 64
+ 64
- 100
- 32
+ 64
+ 64
@@ -267,23 +173,30 @@
15
+
+
+
- ↗
+ →
- -
+
+
+ -
+
+
-
- 100
- 32
+ 64
+ 64
- 100
- 32
+ 64
+ 64
@@ -296,18 +209,18 @@
- -
-
+
-
+
- 100
- 32
+ 64
+ 64
- 100
- 32
+ 64
+ 64
@@ -315,32 +228,37 @@
15
+
+ QPushButton{border-image: url(://images/down.png);}
+QPushButton{border:none;}
+QPushButton:pressed{border-image: url(://images/down_2.png);}
+
- ↘
+ ↓
- -
-
+
-
+
- 100
- 32
+ 64
+ 64
- 100
- 32
+ 64
+ 64
- 12
+ 15
- 狂暴模式
+ ↘
@@ -411,15 +329,109 @@
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 200
+ 200
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 385
+ 21
+
+
+
+
+ -
+
+
+ 🔗断开
+
+
+
+
+
+
+ 210
+ 430
+ 64
+ 64
+
+
+
+
+ 64
+ 64
+
+
+
+
+ 64
+ 64
+
+
+
+ QPushButton{border-image: url(://images/down.png);}
+QPushButton{border:none;}
+QPushButton:pressed{border-image: url(://images/down_2.png);}
+
+
+ ,
+
+
+ ,
+
+