From ecd8512dc7984b20200ae188928ad78ac27018c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E8=80=B3=E5=88=AE=E5=AD=90?= <2433069615@qq.com> Date: Fri, 13 May 2022 23:07:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/mainwindow.cpp | 71 ++- src/ui/mainwindow.hpp | 1 + src/ui/mainwindow.ui | 980 +++++++++++++++++++++------------------- 3 files changed, 576 insertions(+), 476 deletions(-) diff --git a/src/main/mainwindow.cpp b/src/main/mainwindow.cpp index d1bcb35..2d32fd7 100644 --- a/src/main/mainwindow.cpp +++ b/src/main/mainwindow.cpp @@ -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(); - - } diff --git a/src/ui/mainwindow.hpp b/src/ui/mainwindow.hpp index 64e953f..99e7f4f 100644 --- a/src/ui/mainwindow.hpp +++ b/src/ui/mainwindow.hpp @@ -49,6 +49,7 @@ private: JoyStick *rock_widget; void initUis(); + void setBtnStyles(); void connections(); diff --git a/src/ui/mainwindow.ui b/src/ui/mainwindow.ui index ac45aed..7cc172a 100644 --- a/src/ui/mainwindow.ui +++ b/src/ui/mainwindow.ui @@ -54,273 +54,514 @@ - + 1000 - 80 - 387 - 566 + 30 + 407 + 680 - + - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - QPushButton{border-image: url(://images/up.png);} - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - - - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - - - - - - - - - 90 - 64 - - - - - 90 - 64 - - - - 全向模式(k) - - - K - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - - - - - - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - QPushButton{border-image: url(://images/down.png);} + + + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + QPushButton{border-image: url(://images/up.png);} + + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + + + + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + + + + + + + + + 90 + 64 + + + + + 90 + 64 + + + + 全向模式(k) + + + K + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + + + + + + + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + QPushButton{border-image: url(://images/down.png);} QPushButton{border:none;} QPushButton:pressed{border-image: url(://images/down_2.png);} - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - - - - - + + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 30 + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + + 线速度(cm/s): + + + + + + + 100 + + + 1 + + + 50 + + + Qt::Horizontal + + + + + + + 50 + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + 角速度(cm/s): + + + + + + + 100 + + + 100 + + + Qt::Horizontal + + + + + + + 100 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 30 + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + 200 + 200 + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 385 + 21 + + + + + + + + + + - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - + + + 0 - - - - - + Qt::Horizontal @@ -336,104 +577,33 @@ QPushButton:pressed{border-image: url(://images/down_2.png);} - - - - - 线速度(cm/s): - - - - - - - 100 - - - 1 - - - 50 - - - Qt::Horizontal - - - - - - - 50 - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - + + - 10 - 20 + 0 + 45 - - - - - 角速度(cm/s): + system - - - 100 - - - 100 - - - Qt::Horizontal + + + + 0 + 45 + - - - - - 100 + keyboard - + Qt::Horizontal @@ -450,82 +620,6 @@ QPushButton:pressed{border-image: url(://images/down_2.png);} - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 86 - 20 - - - - - - - - - 200 - 200 - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 385 - 21 - - - - @@ -545,23 +639,7 @@ QPushButton:pressed{border-image: url(://images/down_2.png);} - 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; -} + @@ -583,23 +661,7 @@ margin:0px 0px 0px 0px; - 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; -} + @@ -621,26 +683,10 @@ margin:0px 0px 0px 0px; - PointingHandCursor + ArrowCursor - 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; -} +