优化布局

pull/24/head
大耳刮子 3 years ago
parent e4f867170f
commit ecd8512dc7

@ -20,10 +20,72 @@ MainWindow::~MainWindow()
void MainWindow::initUis(){
setBtnStyles();
/*
* init
*/
rock_widget = new JoyStick(ui->JoyStick_widget);
rock_widget->show();
}
void MainWindow::setBtnStyles(){
/*
* set PushButton state
*/
ui->btn_main->setIcon(QIcon("://images/up.png"));
ui->btn_main->setText("mainWidget");
ui->btn_main->setStyleSheet(
"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;}");
ui->btn_uav->setStyleSheet(
"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;}");
ui->btn_ugv->setStyleSheet(
"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;}");
// 8 -> Forward: ↑
ui->pushButton_Forward->setShortcut(Qt::Key_8);
ui->pushButton_Forward->setStyleSheet(
@ -88,15 +150,6 @@ void MainWindow::initUis(){
"QPushButton:pressed{border-image: url(://images/down_right_2.png)}");
ui->pushButton_Right_Back->setFlat(true);
/*
* init
*/
rock_widget = new JoyStick(ui->JoyStick_widget);
rock_widget->show();
}

@ -49,6 +49,7 @@ private:
JoyStick *rock_widget;
void initUis();
void setBtnStyles();
void connections();

@ -54,16 +54,38 @@
</widget>
</widget>
<widget class="QWidget" name="UGVWidget">
<widget class="QWidget" name="layoutWidget_2">
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>1000</x>
<y>80</y>
<width>387</width>
<height>566</height>
<y>30</y>
<width>407</width>
<height>680</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QStackedWidget" name="stackedWidget_ros_control">
<widget class="QWidget" name="keyboard_control">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@ -312,7 +334,7 @@ QPushButton:pressed{border-image: url(://images/down_2.png);}</string>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
<height>30</height>
</size>
</property>
</spacer>
@ -461,7 +483,7 @@ QPushButton:pressed{border-image: url(://images/down_2.png);}</string>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
<height>30</height>
</size>
</property>
</spacer>
@ -474,11 +496,11 @@ QPushButton:pressed{border-image: url(://images/down_2.png);}</string>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>86</width>
<width>40</width>
<height>20</height>
</size>
</property>
@ -501,7 +523,7 @@ QPushButton:pressed{border-image: url(://images/down_2.png);}</string>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -527,6 +549,78 @@ QPushButton:pressed{border-image: url(://images/down_2.png);}</string>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="system_control"/>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_menu_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>45</height>
</size>
</property>
<property name="text">
<string>system</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>45</height>
</size>
</property>
<property name="text">
<string>keyboard</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</widget>
@ -545,23 +639,7 @@ QPushButton:pressed{border-image: url(://images/down_2.png);}</string>
</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>
<string notr="true"/>
</property>
<property name="text">
<string/>
@ -583,23 +661,7 @@ margin:0px 0px 0px 0px;
</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>
<string notr="true"/>
</property>
<property name="text">
<string/>
@ -621,26 +683,10 @@ margin:0px 0px 0px 0px;
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
<cursorShape>ArrowCursor</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>
<string notr="true"/>
</property>
<property name="text">
<string/>

Loading…
Cancel
Save