75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
|
|
#include "P01_MianPage.h"
|
||
|
|
#include "ui_P01_MianPage.h"
|
||
|
|
#include <QDebug>
|
||
|
|
#include <QMovie>
|
||
|
|
#include <QDir>
|
||
|
|
int TransportPosMaxX = 0;
|
||
|
|
int TransportPosMaxY = 0;\
|
||
|
|
|
||
|
|
P01_MianPage::P01_MianPage(QWidget *parent) :
|
||
|
|
QWidget(parent),
|
||
|
|
ui(new Ui::P01_MianPage)
|
||
|
|
{
|
||
|
|
ui->setupUi(this);
|
||
|
|
|
||
|
|
|
||
|
|
PageInit();
|
||
|
|
uiSetHaulSpeed(-200,135);
|
||
|
|
uiSetMining(1823);
|
||
|
|
uiSetTransportPos(0,0);
|
||
|
|
}
|
||
|
|
void P01_MianPage::PageInit()
|
||
|
|
{
|
||
|
|
QPixmap pix(":/Icos/Icos/Sursor.png");
|
||
|
|
QCursor custom(pix, pix.width()/2, pix.height()/2);
|
||
|
|
setCursor(custom);
|
||
|
|
setWindowFlag(Qt::FramelessWindowHint); // 设置窗口无边框,设置后窗口无法移动
|
||
|
|
uiInitHaulSpeed(255);
|
||
|
|
uiInitMining(-1000,10000);
|
||
|
|
uiInitTransportPos(85,85);
|
||
|
|
|
||
|
|
|
||
|
|
QMovie *MLoading = new QMovie("./Gif/Radar.gif");
|
||
|
|
//qDebug() << "当前工作文件夹:" << QDir::currentPath();
|
||
|
|
ui->Gif_Radar->setMovie(MLoading); // 1. 设置要显示的 GIF 动画图片
|
||
|
|
ui->Gif_Radar->setScaledContents(true);
|
||
|
|
MLoading->start(); // 2. 启动动画
|
||
|
|
ui->Gif_Radar->show();
|
||
|
|
}
|
||
|
|
P01_MianPage::~P01_MianPage()
|
||
|
|
{
|
||
|
|
delete ui;
|
||
|
|
}
|
||
|
|
|
||
|
|
void P01_MianPage::uiInitHaulSpeed(int Max){
|
||
|
|
ui->Slider_Haul_L->setMinimum(0-Max);
|
||
|
|
ui->Slider_Haul_L->setMaximum(Max);
|
||
|
|
ui->Slider_Haul_R->setMinimum(0-Max);
|
||
|
|
ui->Slider_Haul_R->setMaximum(Max);
|
||
|
|
}
|
||
|
|
void P01_MianPage::uiInitMining(int Max,int Min){
|
||
|
|
ui->Slider_Mining1->setMinimum(Min);
|
||
|
|
ui->Slider_Mining1->setMaximum(Max);
|
||
|
|
}
|
||
|
|
void P01_MianPage::uiInitTransportPos(int MaxX,int MaxY){
|
||
|
|
TransportPosMaxX = MaxX;
|
||
|
|
TransportPosMaxY = MaxY;
|
||
|
|
}
|
||
|
|
void P01_MianPage::uiSetHaulSpeed(int SpeedL,int SpeedR){
|
||
|
|
ui->Slider_Haul_L->setValue(SpeedL);
|
||
|
|
ui->LCD_MainHaul_L->display(QString::number(SpeedL));
|
||
|
|
ui->Slider_Haul_R->setValue(SpeedR);
|
||
|
|
ui->LCD_MainHaul_R->display(QString::number(SpeedR));
|
||
|
|
}
|
||
|
|
void P01_MianPage::uiSetMining(int Value){
|
||
|
|
ui->Slider_Mining1->setValue(Value);
|
||
|
|
ui->LCD_MiningT1->display(QString::number(Value/1000.0,'f',2));
|
||
|
|
ui->LCD_MiningB1->display(QString::number(Value/1000.0,'f',2));
|
||
|
|
}
|
||
|
|
void P01_MianPage::uiSetTransportPos(int rx,int ry){
|
||
|
|
int NewRX = 850+(130/2)+rx-10;
|
||
|
|
int NewRY = 10+(130/2)+ry-7;
|
||
|
|
//qDebug()<<NewRX<<NewRY;
|
||
|
|
ui->Label_TransportPos->move(NewRX,NewRY);
|
||
|
|
}
|