添加界面切换模式

pull/23/head
大耳刮子 3 years ago
parent 0f4d911bb9
commit e4f867170f

@ -123,12 +123,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(SOURCES
src/include/qnode.hpp
src/include/joystick.h
src/main/main.cpp
src/main/mainwindow.cpp
src/main/qnode.cpp
src/main/joystick.cpp
src/ui/mainwindow.hpp
src/ui/mainwindow.ui

@ -168,6 +168,15 @@ void MainWindow::slot_rockKeyChange(int key){
}
void MainWindow::connections(){
QObject::connect(ui->btn_main, &QPushButton::clicked, this, [=](){
ui->stackedWidget_main->setCurrentIndex(0);
});
QObject::connect(ui->btn_uav, &QPushButton::clicked, this, [=](){
ui->stackedWidget_main->setCurrentIndex(1);
});
QObject::connect(ui->btn_ugv, &QPushButton::clicked, this, [=](){
ui->stackedWidget_main->setCurrentIndex(2);
});
/*
*
*/

@ -33,9 +33,9 @@ void QNode::SubAndPubTopic(){
void QNode::KeyboardMove(char key, float speed_linear, float speed_trun){
std::map<char, std::vector<float>> moveBindings {
// {'key', {x, y, z, th}}
{'7', {1, 1, 0, 0}}, {'8', {1, 0, 0, 0}}, {'9', {1, -1, 0, 0}},
{'7', {1, 1, 0, 1}}, {'8', {1, 0, 0, 0}}, {'9', {1, -1, 0, -1}},
{'4', {0, 0, 0, 1}}, {'5', {0, 0, 0, 0}}, {'6', {0, 0, 0, -1}},
{'1', {-1, 1, 0, 0}}, {'2', {-1, 0, 0, 0}}, {'3', {-1, -1, 0, 0}}
{'1', {-1, 1, 0, 1}}, {'2', {-1, 0, 0, 0}}, {'3', {-1, -1, 0, -1}}
};
float x = moveBindings[key][0];

@ -17,11 +17,48 @@
<string notr="true"/>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QStackedWidget" name="stackedWidget_main">
<property name="currentIndex">
<number>2</number>
</property>
<widget class="QWidget" name="mainWidget">
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>780</x>
<y>200</y>
<width>311</width>
<height>151</height>
</rect>
</property>
<property name="text">
<string>Main Widget</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="UAVWidget">
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>830</x>
<y>280</y>
<width>271</width>
<height>121</height>
</rect>
</property>
<property name="text">
<string>UAV Widget</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="UGVWidget">
<widget class="QWidget" name="layoutWidget_2">
<property name="geometry">
<rect>
<x>1045</x>
<y>160</y>
<x>1000</x>
<y>80</y>
<width>387</width>
<height>566</height>
</rect>
@ -492,17 +529,228 @@ QPushButton:pressed{border-image: url(://images/down_2.png);}</string>
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1440</width>
<height>22</height>
</rect>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_menu">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="btn_main">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QPushButton:hover{
background-color:rgb(186, 189, 182);
border-bottom:2px solid rgb(67, 154, 246);
}
QPushButton:checked{
background-color:cyan;
border-bottom:2px solid white
}
QPushButton:pressed{
background-color:rgb(67, 154, 246)
}
QPushButton{
background-color:rgb(238, 238, 236);
border:none;
padding:0px 0px 0px 0px;
margin:0px 0px 0px 0px;
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_uav">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QPushButton:hover{
background-color:rgb(186, 189, 182);
border-bottom:2px solid rgb(67, 154, 246);
}
QPushButton:checked{
background-color:cyan;
border-bottom:2px solid white
}
QPushButton:pressed{
background-color:rgb(67, 154, 246)
}
QPushButton{
background-color:rgb(238, 238, 236);
border:none;
padding:0px 0px 0px 0px;
margin:0px 0px 0px 0px;
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</item>
<item>
<widget class="QPushButton" name="btn_ugv">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">QPushButton:hover{
background-color:rgb(186, 189, 182);
border-bottom:2px solid rgb(67, 154, 246);
}
QPushButton:checked{
background-color:cyan;
border-bottom:2px solid white
}
QPushButton:pressed{
background-color:rgb(67, 154, 246)
}
QPushButton{
background-color:rgb(238, 238, 236);
border:none;
padding:0px 0px 0px 0px;
margin:0px 0px 0px 0px;
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="://images/toolbar_dash.png">
<normaloff>../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui</normaloff>../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_map">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">QPushButton:hover{
background-color:rgb(186, 189, 182);
border-bottom:2px solid rgb(67, 154, 246);
}
QPushButton:checked{
background-color:cyan;
border-bottom:2px solid white
}
QPushButton:pressed{
background-color:rgb(67, 154, 246)
}
QPushButton{
background-color:rgb(238, 238, 236);
border:none;
padding:0px 0px 0px 0px;
margin:0px 0px 0px 0px;
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="://images/toolbar_map.png">
<normaloff>../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui</normaloff>../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_other">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">QPushButton:hover{
background-color:rgb(186, 189, 182);
border-bottom:2px solid rgb(67, 154, 246);
}
QPushButton:checked{
background-color:cyan;
border-bottom:2px solid white
}
QPushButton:pressed{
background-color:rgb(67, 154, 246)
}
QPushButton{
background-color:rgb(238, 238, 236);
border:none;
padding:0px 0px 0px 0px;
margin:0px 0px 0px 0px;
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="://images/toolbar_other.png">
<normaloff>../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui</normaloff>../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>

Loading…
Cancel
Save