Qt HUD(平显)演示程序绿色版

举报
DreamLife 发表于 2022/04/14 23:31:10 2022/04/14
【摘要】 把一个黑底白字的程序改成黑底绿字 上对比图,左侧是原本,右侧是仿造,有些地方比例还是有问题 其实这个程序没有啥技术含量,就是画   #include "mainwindow.h"#include "ui_mainwindow.h"#include <QLayout>#include <QDebug...

把一个黑底白字的程序改成黑底绿字

上对比图,左侧是原本,右侧是仿造,有些地方比例还是有问题

其实这个程序没有啥技术含量,就是画

 


  
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3. #include <QLayout>
  4. #include <QDebug>
  5. int painter_x =800,
  6. painter_y =580;
  7. int temp_temp_1 = 4408;
  8. float temp_temp_2 = 10;
  9. int temp_temp = 4408;
  10. int angle = 0;
  11. MainWindow::MainWindow(QWidget *parent) :
  12. QMainWindow(parent),
  13. ui(new Ui::MainWindow)
  14. {
  15. ui->setupUi(this);
  16. this->setWindowTitle("HUG_G");
  17. pixmap1.load(":/images/0001.png");
  18. pixmap2.load(":/images/0002.png");
  19. pixmap3.load(":/images/0003.png");
  20. pixmap4.load(":/images/0004.png");
  21. ui->label->installEventFilter(this);
  22. this->centralWidget()->layout()->setMargin(0);
  23. painter(painter_x,painter_y);
  24. timer = new QTimer;
  25. timer1 = new QTimer;
  26. connect(timer,SIGNAL(timeout()),this,SLOT(timer_out()));
  27. connect(timer1,SIGNAL(timeout()),this,SLOT(timer_out1()));
  28. timer->start(200);
  29. timer1->start(50);
  30. about_d = new about(this);
  31. }
  32. MainWindow::~MainWindow()
  33. {
  34. timer->stop();
  35. timer1->stop();
  36. delete ui;
  37. }
  38. // show Full SCreen
  39. void MainWindow::on_action_triggered()
  40. {
  41. this->showFullScreen();
  42. this->menuBar()->hide();
  43. }
  44. // ESC quit FullScreen
  45. void MainWindow::keyPressEvent(QKeyEvent *event)
  46. {
  47. if(event->key() == Qt::Key_Escape)
  48. {
  49. this->showNormal();
  50. this->menuBar()->show();
  51. }
  52. else if (event->key() == Qt::Key_Enter||event->key() == Qt::Key_Return)
  53. {
  54. this->showFullScreen();
  55. this->menuBar()->hide();
  56. }
  57. else
  58. {
  59. }
  60. }
  61. bool MainWindow::eventFilter(QObject *watched, QEvent *event)
  62. {
  63. if((watched == ui->label) && (event->type() == QEvent::Paint))
  64. {
  65. painter(painter_x,painter_y);
  66. return true;
  67. }
  68. else
  69. {
  70. }
  71. return false;
  72. }
  73. void MainWindow::timer_out()
  74. {
  75. if(temp_temp<99999)
  76. {
  77. temp_temp++;
  78. }
  79. else
  80. {
  81. temp_temp = 1000;
  82. }
  83. if(angle>=-360)
  84. {
  85. angle--;
  86. }
  87. else
  88. {
  89. angle = 0;
  90. }
  91. }
  92. void MainWindow::timer_out1()
  93. {
  94. if(temp_temp_1<99999)
  95. {
  96. temp_temp_1++;
  97. }
  98. else
  99. {
  100. temp_temp_1=1000;
  101. }
  102. if(temp_temp_2<99999)
  103. {
  104. temp_temp_2=temp_temp_2+0.1;
  105. }
  106. else
  107. {
  108. temp_temp_2=10.0;
  109. }
  110. this->update();
  111. }
  112. void MainWindow::resizeEvent(QResizeEvent *event)
  113. {
  114. Q_UNUSED(event);
  115. painter_x = ui->label->width();
  116. painter_y = ui->label->height();
  117. // painter(painter_x,painter_y);
  118. }
  119. //4:3
  120. void MainWindow::painter(int x, int y)
  121. {
  122. QPainter painter(ui->label);
  123. painter.setPen(QPen(Qt::green,2.0));
  124. painter.setFont(QFont("等线",12,QFont::Bold));
  125. if(x>=(y/3*4))
  126. {
  127. float temp_x = y/3*4;
  128. float flag_1 = y*175/1080.0;
  129. float flag_2 = flag_1+40;
  130. float flag_3 = y*110/1080.0;
  131. painter.drawText(QRect((x-y)/2,flag_1,100,20),Qt::AlignLeft,"A 0.2");
  132. painter.drawText(QRect((x-y)/2,flag_1+20,100,20),Qt::AlignLeft,"G 5.00");
  133. painter.drawText(QRect((x-y)/2,flag_1+40,100,20),Qt::AlignLeft,"GM 4.2");
  134. painter.drawText(QRect((x-y)/2,flag_1+60,100,20),Qt::AlignLeft," 0.0");
  135. painter.drawText(QRect((x-y)/2,y-(y*120/580.0)+20,100,20),Qt::AlignLeft,"IEOS");
  136. painter.drawText(QRect((x-y)/2,y-(y*120/580.0)+40,100,20),Qt::AlignLeft,"RΘ");
  137. painter.drawText(QRect((x-y)/2,y-(y*120/580.0)+60,100,20),Qt::AlignLeft,"DGFT");
  138. painter.drawText(QRect((x-y)/2,y-(y*120/580.0)+80,100,20),Qt::AlignLeft,"LOAL");
  139. painter.drawText(QRect((x-y)/2+(y*60/580),y-(y*120/580.0)+60*(y/580.0),100,20),Qt::AlignLeft,"MRM");
  140. painter.drawText(QRect((x-y)/2+(y*60/580),y-(y*120/580.0)+80*(y/580.0),100,20),Qt::AlignLeft,"T:40");
  141. painter.drawText(QRect((x-y)/2+(y*60/580),y-(y*120/580.0)+100*(y/580.0),100,20),Qt::AlignLeft,"2/4");
  142. painter.drawText(QRect(x-(x-y)/2-100,flag_1-5,100,20),Qt::AlignRight,"00 0.0");
  143. painter.drawText(QRect(x-(x-y)/2-100,flag_1+25,100,20),Qt::AlignRight,"Time=0.00");
  144. painter.drawText(QRect(x-(x-y)/2-100,flag_1+40,100,20),Qt::AlignRight,"1500.0 Kg");
  145. painter.drawText(QRect(x-(x-y)/2-100,y-(y*120/580.0)+20,100,20),Qt::AlignRight,"0.0");
  146. painter.drawText(QRect(x-(x-y)/2-100,y-(y*120/580.0)+40,100,20),Qt::AlignRight," 0R");
  147. painter.drawText(QRect(x-(x-y)/2-100,y-(y*120/580.0)+60,100,20),Qt::AlignRight,"+0");
  148. painter.drawText(QRect(x-(x-y)/2-100,y-(y*120/580.0)+80,100,20),Qt::AlignRight,"IRM");
  149. painter.drawLine(x/2-1,flag_2,x/2-1,flag_2+flag_3);
  150. painter.drawLine(x/2-1-(temp_x*54/1920)/2,(flag_2+flag_3)-flag_3*2/11,x/2-1+(temp_x*54/1920)/2,(flag_2+flag_3)-flag_3*2/11);
  151. int flag_r = (temp_x*54/1920*23/54);
  152. painter.drawArc((x/2-1)-flag_r/2,(flag_2+flag_3)-flag_3*2/11-flag_r/2,flag_r,flag_r,0,16*360);
  153. float line_temp = y*30/1080.0;
  154. float line_temp_1 = y*3/1080.0;
  155. float line_y = flag_1+80;
  156. float line_x = (x-y)/2+50;
  157. int line_temp_2 = temp_temp+100;
  158. float line_y_1 = (float)(line_y+line_temp_1*(line_temp_2%10));
  159. for(int i = 1;i<=200;i++)
  160. {
  161. if(line_temp_2%50 ==0)
  162. {
  163. painter.drawLine(line_x,line_y_1,line_x-x*30/1920.0,line_y_1);
  164. painter.drawText(QRect(line_x-105-x*30/1920.0,line_y_1-10,100,20),Qt::AlignRight,QString::number(line_temp_2/10,10));
  165. line_y_1=line_y_1+line_temp;
  166. }
  167. else
  168. {
  169. painter.drawLine(line_x,line_y_1,line_x-x*19/1920.0,line_y_1);
  170. if(line_temp_2%10 ==0)
  171. {
  172. line_y_1=line_y_1+line_temp;
  173. }
  174. }
  175. line_temp_2--;
  176. }
  177. painter.setBrush(Qt::black);
  178. painter.drawRect(line_x-55-x*30/1920.0,(line_y+line_temp*10),50,20);
  179. painter.drawText(QRect(line_x-105-x*30/1920.0,(line_y+line_temp*10),100,20),Qt::AlignRight,QString::number(temp_temp,10));
  180. line_temp = y*30/1080.0;
  181. line_temp_1 = y*3/1080.0;
  182. line_y = flag_1+80;
  183. line_x = x-(x-y)/2-50;
  184. int line_temp_3 = temp_temp_1+100;
  185. line_y_1 = (float)(line_y+line_temp_1*(line_temp_3%10));
  186. for(int j = 1;j<=200;j++)
  187. {
  188. if(line_temp_3%50 ==0)
  189. {
  190. painter.drawLine(line_x,line_y_1,line_x+x*30/1920.0,line_y_1);
  191. painter.drawText(QRect(line_x-70+x*30/1920.0,line_y_1-10,100,20),Qt::AlignRight,QString::number(line_temp_3/100.0,10.0,1));
  192. line_y_1=line_y_1+line_temp;
  193. }
  194. else
  195. {
  196. painter.drawLine(line_x,line_y_1,line_x+x*19/1920.0,line_y_1);
  197. if(line_temp_3%10 ==0)
  198. {
  199. line_y_1=line_y_1+line_temp;
  200. }
  201. }
  202. line_temp_3--;
  203. }
  204. painter.setBrush(Qt::black);
  205. painter.drawRect(line_x+3+x*30/1920.0,(line_y+line_temp*10),50,20);
  206. painter.drawLine(line_x-70*(y/800.0)+x*30/1920.0,(line_y+line_temp*10)+10,line_x-20*(y/800.0)+x*30/1920.0,(line_y+line_temp*10)+10);
  207. painter.drawText(QRect(line_x+3+x*30/1920.0,(line_y+line_temp*10),50,20),Qt::AlignLeft,QString::number(temp_temp_1,10));
  208. painter.drawText(QRect(line_x-90*(y/800.0)+x*30/1920.0,(line_y+line_temp*10)-10,50,20),Qt::AlignRight,"+0.0");
  209. painter.drawText(QRect(line_x-90*(y/800.0)+x*30/1920.0,(line_y+line_temp*10)+10,50,20),Qt::AlignRight,"'H");
  210. float line_temp_H = y*134/1080.0;
  211. float line_H_x = x-(x-y)/2.0-line_temp_H*2*(int(temp_temp_2*10)%10/10.0);
  212. float lint_temp_d = y*20/1080;
  213. float line_H_y = flag_1-10;
  214. for(int k =1;k<=7;k++)
  215. {
  216. if(k%2!=0)
  217. {
  218. painter.drawLine(line_H_x,line_H_y,line_H_x,line_H_y-lint_temp_d);
  219. painter.drawText(QRect(line_H_x-25,(line_H_y-lint_temp_d-20),50,20),Qt::AlignCenter,QString::number(temp_temp_2,10.0,1));
  220. }
  221. else
  222. {
  223. painter.drawLine(line_H_x,line_H_y,line_H_x,line_H_y-lint_temp_d/2.0);
  224. }
  225. line_H_x = line_H_x-line_temp_H;
  226. }
  227. // painter.drawArc((x-y)/2,(y/2.0-40),80,80,180*16,16*270);
  228. painter.drawPixmap((x-y)/2+112*(y/1080.0),y/2,112*(y/1080.0),124*(y/1080.0),pixmap1);
  229. painter.drawPixmap((x-y)/2+217*(y/1080.0),y-58*(y/1080.0),434*(y/1080.0),38*(y/1080.0),pixmap2);
  230. painter.translate((x/2-1),(y/2));
  231. painter.rotate(angle);
  232. painter.save();
  233. painter.drawLine(-220,0,-30,0);
  234. painter.drawLine(30,0,220,0);
  235. painter.drawLine(-180*(y/800.0),-150*(y/580.0),-30*(y/800.0),-150*(y/580.0));
  236. painter.drawLine(-180*(y/800.0),-150*(y/580.0),-180*(y/800.0),-150*(y/580.0)+20);
  237. painter.drawText(QRect(-230*(y/800.0),-150*(y/580.0),50,20),Qt::AlignCenter,"05");
  238. painter.drawLine(30*(y/800.0),-150*(y/580.0),180*(y/800.0),-150*(y/580.0));
  239. painter.drawLine(180*(y/800.0),-150*(y/580.0),180*(y/800.0),-150*(y/580.0)+20);
  240. painter.drawText(QRect(180*(y/800.0),-150*(y/580.0),50,20),Qt::AlignCenter,"05");
  241. painter.drawLine(-180*(y/800.0),-300*(y/580.0),-30*(y/800.0),-300*(y/580.0));
  242. painter.drawLine(-180*(y/800.0),-300*(y/580.0),-180*(y/800.0),-300*(y/580.0)+20);
  243. painter.drawText(QRect(-230*(y/800.0),-300*(y/580.0),50,20),Qt::AlignCenter,"10");
  244. painter.drawLine(30*(y/800.0),-300*(y/580.0),180*(y/800.0),-300*(y/580.0));
  245. painter.drawLine(180*(y/800.0),-300*(y/580.0),180*(y/800.0),-300*(y/580.0)+20);
  246. painter.drawText(QRect(180*(y/800.0),-300*(y/580.0),50,20),Qt::AlignCenter,"10");
  247. // painter.setPen(QPen(Qt::green,2.0,Qt::DotLine));
  248. painter.drawLine(-180*(y/800.0),150*(y/580.0),-30*(y/800.0),150*(y/580.0));
  249. painter.drawLine(-180*(y/800.0),150*(y/580.0),-180*(y/800.0),150*(y/580.0)-20);
  250. painter.drawText(QRect(-230*(y/800.0),150*(y/580.0),50,20),Qt::AlignCenter,"-05");
  251. painter.drawLine(30*(y/800.0),150*(y/580.0),180*(y/800.0),150*(y/580.0));
  252. painter.drawLine(180*(y/800.0),150*(y/580.0),180*(y/800.0),150*(y/580.0)-20);
  253. painter.drawText(QRect(180*(y/800.0),150*(y/580.0),50,20),Qt::AlignCenter,"-05");
  254. painter.drawLine(-180*(y/800.0),300*(y/580.0),-30*(y/800.0),300*(y/580.0));
  255. painter.drawLine(-180*(y/800.0),300*(y/580.0),-180*(y/800.0),300*(y/580.0)-20);
  256. painter.drawText(QRect(-230*(y/800.0),300*(y/580.0),50,20),Qt::AlignCenter,"-10");
  257. painter.drawLine(30*(y/800.0),300*(y/580.0),180*(y/800.0),300*(y/580.0));
  258. painter.drawLine(180*(y/800.0),300*(y/580.0),180*(y/800.0),300*(y/580.0)-20);
  259. painter.drawText(QRect(180*(y/800.0),300*(y/580.0),50,20),Qt::AlignCenter,"-10");
  260. painter.restore();
  261. }
  262. else
  263. {
  264. y = x*3/4;
  265. int temp_x = x;
  266. int flag_1 = y*175/1080;
  267. int flag_2 = flag_1+40;
  268. int flag_3 = y*110/1080;
  269. painter.drawText(QRect((x-y)/2,flag_1,100,20),Qt::AlignLeft,"A 0.2");
  270. painter.drawText(QRect((x-y)/2,flag_1+20,100,20),Qt::AlignLeft,"G 5.00");
  271. painter.drawText(QRect((x-y)/2,flag_1+40,100,20),Qt::AlignLeft,"GM 4.2");
  272. painter.drawText(QRect((x-y)/2,y-(y*120/580.0)+20,100,20),Qt::AlignLeft,"IEOS");
  273. painter.drawText(QRect((x-y)/2,y-(y*120/580.0)+40,100,20),Qt::AlignLeft,"RΘ");
  274. painter.drawText(QRect((x-y)/2,y-(y*120/580.0)+60,100,20),Qt::AlignLeft,"DGFT");
  275. painter.drawText(QRect((x-y)/2,y-(y*120/580.0)+80,100,20),Qt::AlignLeft,"LOAL");
  276. painter.drawText(QRect((x-y)/2+(y*60/580),y-(y*120/580.0)+60*(y/580.0),100,20),Qt::AlignLeft,"MRM");
  277. painter.drawText(QRect((x-y)/2+(y*60/580),y-(y*120/580.0)+80*(y/580.0),100,20),Qt::AlignLeft,"T:40");
  278. painter.drawText(QRect((x-y)/2+(y*60/580),y-(y*120/580.0)+100*(y/580.0),100,20),Qt::AlignLeft,"2/4");
  279. painter.drawText(QRect(x-(x-y)/2-100,flag_1-5,100,20),Qt::AlignRight,"00 0.0");
  280. painter.drawText(QRect(x-(x-y)/2-100,flag_1+25,100,20),Qt::AlignRight,"Time=0.00");
  281. painter.drawText(QRect(x-(x-y)/2-100,flag_1+40,100,20),Qt::AlignRight,"1500.0 Kg");
  282. painter.drawText(QRect(x-(x-y)/2-100,y-(y*120/580.0)+20,100,20),Qt::AlignRight,"0.0");
  283. painter.drawText(QRect(x-(x-y)/2-100,y-(y*120/580.0)+40,100,20),Qt::AlignRight," 0R");
  284. painter.drawText(QRect(x-(x-y)/2-100,y-(y*120/580.0)+60,100,20),Qt::AlignRight,"+0");
  285. painter.drawText(QRect(x-(x-y)/2-100,y-(y*120/580.0)+80,100,20),Qt::AlignRight,"IRM");
  286. painter.drawLine(x/2-1,flag_2,x/2-1,flag_2+flag_3);
  287. painter.drawLine(x/2-1-(temp_x*54/1920)/2,(flag_2+flag_3)-flag_3*2/11,x/2-1+(temp_x*54/1920)/2,(flag_2+flag_3)-flag_3*2/11);
  288. int flag_r = (temp_x*54/1920*23/54);
  289. painter.drawArc((x/2-1)-flag_r/2,(flag_2+flag_3)-flag_3*2/11-flag_r/2,flag_r,flag_r,0,16*360);
  290. float line_temp = y*30/1080.0;
  291. float line_temp_1 = y*3/1080.0;
  292. float line_y = flag_1+80;
  293. float line_x = (x-y)/2+50;
  294. int line_temp_2 = temp_temp+100;
  295. float line_y_1 = (float)(line_y+line_temp_1*(line_temp_2%10));
  296. for(int i = 1;i<=200;i++)
  297. {
  298. if(line_temp_2%50 ==0)
  299. {
  300. painter.drawLine(line_x,line_y_1,line_x-x*30/1920.0,line_y_1);
  301. painter.drawText(QRect(line_x-105-x*30/1920.0,line_y_1-10,100,20),Qt::AlignRight,QString::number(line_temp_2/10,10));
  302. line_y_1=line_y_1+line_temp;
  303. }
  304. else
  305. {
  306. painter.drawLine(line_x,line_y_1,line_x-x*19/1920.0,line_y_1);
  307. if(line_temp_2%10 ==0)
  308. {
  309. line_y_1=line_y_1+line_temp;
  310. }
  311. }
  312. line_temp_2--;
  313. }
  314. painter.setBrush(Qt::black);
  315. painter.drawRect(line_x-55-x*30/1920.0,(line_y+line_temp*10),50,20);
  316. painter.drawText(QRect(line_x-105-x*30/1920.0,(line_y+line_temp*10),100,20),Qt::AlignRight,QString::number(temp_temp,10));
  317. line_temp = y*30/1080.0;
  318. line_temp_1 = y*3/1080.0;
  319. line_y = flag_1+80;
  320. line_x = x-(x-y)/2-50;
  321. int line_temp_3 = temp_temp_1+100;
  322. line_y_1 = (float)(line_y+line_temp_1*(line_temp_3%10));
  323. for(int j = 1;j<=200;j++)
  324. {
  325. if(line_temp_3%50 ==0)
  326. {
  327. painter.drawLine(line_x,line_y_1,line_x+x*30/1920.0,line_y_1);
  328. painter.drawText(QRect(line_x-70+x*30/1920.0,line_y_1-10,100,20),Qt::AlignRight,QString::number(line_temp_3/10,10));
  329. line_y_1=line_y_1+line_temp;
  330. }
  331. else
  332. {
  333. painter.drawLine(line_x,line_y_1,line_x+x*19/1920.0,line_y_1);
  334. if(line_temp_3%10 ==0)
  335. {
  336. line_y_1=line_y_1+line_temp;
  337. }
  338. }
  339. line_temp_3--;
  340. }
  341. painter.setBrush(Qt::black);
  342. painter.drawRect(line_x+3+x*30/1920.0,(line_y+line_temp*10),50,20);
  343. painter.drawText(QRect(line_x+3+x*30/1920.0,(line_y+line_temp*10),50,20),Qt::AlignLeft,QString::number(temp_temp_1,10));
  344. float line_temp_H = y*134/1080.0;
  345. float line_H_x = x-(x-y)/2.0-line_temp_H*2*(int(temp_temp_2*10)%10/10.0);
  346. float lint_temp_d = y*20/1080;
  347. float line_H_y = flag_1-10;
  348. for(int k =1;k<=7;k++)
  349. {
  350. if(k%2!=0)
  351. {
  352. painter.drawLine(line_H_x,line_H_y,line_H_x,line_H_y-lint_temp_d);
  353. painter.drawText(QRect(line_H_x-25,(line_H_y-lint_temp_d-20),50,20),Qt::AlignCenter,QString::number(temp_temp_2,10.0,1));
  354. }
  355. else
  356. {
  357. painter.drawLine(line_H_x,line_H_y,line_H_x,line_H_y-lint_temp_d/2.0);
  358. }
  359. line_H_x = line_H_x-line_temp_H;
  360. }
  361. painter.drawPixmap((x-y)/2+112*(y/1080.0),y/2,112*(y/1080.0),124*(y/1080.0),pixmap1);
  362. painter.drawPixmap((x-y)/2+217*(y/1080.0),y-58*(y/1080.0),434*(y/1080.0),38*(y/1080.0),pixmap2);
  363. painter.translate((x/2-1),(y/2));
  364. painter.rotate(angle);
  365. painter.save();
  366. painter.drawLine(-220,0,-30,0);
  367. painter.drawLine(30,0,220,0);
  368. painter.drawLine(-180*(y/800.0),-150*(y/580.0),-30*(y/800.0),-150*(y/580.0));
  369. painter.drawLine(-180*(y/800.0),-150*(y/580.0),-180*(y/800.0),-150*(y/580.0)+20);
  370. painter.drawText(QRect(-230*(y/800.0),-150*(y/580.0),50,20),Qt::AlignCenter,"05");
  371. painter.drawLine(30*(y/800.0),-150*(y/580.0),180*(y/800.0),-150*(y/580.0));
  372. painter.drawLine(180*(y/800.0),-150*(y/580.0),180*(y/800.0),-150*(y/580.0)+20);
  373. painter.drawText(QRect(180*(y/800.0),-150*(y/580.0),50,20),Qt::AlignCenter,"05");
  374. painter.drawLine(-180*(y/800.0),-300*(y/580.0),-30*(y/800.0),-300*(y/580.0));
  375. painter.drawLine(-180*(y/800.0),-300*(y/580.0),-180*(y/800.0),-300*(y/580.0)+20);
  376. painter.drawText(QRect(-230*(y/800.0),-300*(y/580.0),50,20),Qt::AlignCenter,"10");
  377. painter.drawLine(30*(y/800.0),-300*(y/580.0),180*(y/800.0),-300*(y/580.0));
  378. painter.drawLine(180*(y/800.0),-300*(y/580.0),180*(y/800.0),-300*(y/580.0)+20);
  379. painter.drawText(QRect(180*(y/800.0),-300*(y/580.0),50,20),Qt::AlignCenter,"10");
  380. // painter.setPen(QPen(Qt::green,2.0,Qt::DotLine));
  381. painter.drawLine(-180*(y/800.0),150*(y/580.0),-30*(y/800.0),150*(y/580.0));
  382. painter.drawLine(-180*(y/800.0),150*(y/580.0),-180*(y/800.0),150*(y/580.0)-20);
  383. painter.drawText(QRect(-230*(y/800.0),150*(y/580.0),50,20),Qt::AlignCenter,"-05");
  384. painter.drawLine(30*(y/800.0),150*(y/580.0),180*(y/800.0),150*(y/580.0));
  385. painter.drawLine(180*(y/800.0),150*(y/580.0),180*(y/800.0),150*(y/580.0)-20);
  386. painter.drawText(QRect(180*(y/800.0),150*(y/580.0),50,20),Qt::AlignCenter,"-05");
  387. painter.drawLine(-180*(y/800.0),300*(y/580.0),-30*(y/800.0),300*(y/580.0));
  388. painter.drawLine(-180*(y/800.0),300*(y/580.0),-180*(y/800.0),300*(y/580.0)-20);
  389. painter.drawText(QRect(-230*(y/800.0),300*(y/580.0),50,20),Qt::AlignCenter,"-10");
  390. painter.drawLine(30*(y/800.0),300*(y/580.0),180*(y/800.0),300*(y/580.0));
  391. painter.drawLine(180*(y/800.0),300*(y/580.0),180*(y/800.0),300*(y/580.0)-20);
  392. painter.drawText(QRect(180*(y/800.0),300*(y/580.0),50,20),Qt::AlignCenter,"-10");
  393. painter.restore();
  394. }
  395. }
  396. void MainWindow::on_action_HUD_G_triggered()
  397. {
  398. about_d->show();
  399. }

都在这里了,这代码估计是我这辈子写的最次的代码了,感觉第二次都看不懂自己写的啥了
 

 

文章来源: dreamlife.blog.csdn.net,作者:DreamLife.,版权归原作者所有,如需转载,请联系作者。

原文链接:dreamlife.blog.csdn.net/article/details/52956515

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。