@@ -275,16 +275,16 @@ void MainWindow::slot_hide_table_widget(){
275
275
}
276
276
}
277
277
void MainWindow::initOthers (){
278
- line = new QSplineSeries (this );
279
- chart = new QChart ();
280
- chart->addSeries (line);
281
- axisX = new QValueAxis (this );
282
- axisY = new QValueAxis (this );
283
-
284
- chartView = new QChartView (ui.widget_chart );
285
- chartView->setFixedWidth (ui.widget_chart ->width ());
286
- chartView->setFixedHeight (ui.widget_chart ->height ());
287
- chartView->setRenderHint (QPainter::Antialiasing);
278
+ // line = new QSplineSeries(this);
279
+ // chart = new QChart();
280
+ // chart->addSeries(line);
281
+ // axisX = new QValueAxis(this);
282
+ // axisY = new QValueAxis(this);
283
+
284
+ // chartView = new QChartView(ui.widget_chart);
285
+ // chartView->setFixedWidth(ui.widget_chart->width());
286
+ // chartView->setFixedHeight(ui.widget_chart->height());
287
+ // chartView->setRenderHint(QPainter::Antialiasing);
288
288
m_timerChart=new QTimer;
289
289
m_timerPubImageMap=new QTimer;
290
290
m_timerPubImageMap->setInterval (100 );
@@ -295,51 +295,51 @@ void MainWindow::initOthers(){
295
295
m_timerChart->start ();
296
296
}
297
297
void MainWindow::slot_chartTimerTimeout (){
298
- QVector<QPointF> list;
299
- QVector<QPointF> newlist;
300
- list = line->pointsVector ();// 获取现在图中列表
301
- if (list.size () < line_max)
302
- {
303
- // 保持原来
304
- newlist = list;
305
- }
306
- else
307
- {
308
- // 错位移动
309
- for (int i =1 ; i< list.size ();i++)
310
- {
311
- newlist.append (QPointF (i-1 ,list.at (i).y ()));
312
- }
313
- }
314
- newlist.append (QPointF (newlist.size (),rand ()));// 最后补上新的数据
315
- line->replace (newlist);// 替换更新
316
-
317
-
318
- line->setName (" send" );// 设置曲线名称
319
- line->setPen (QColor (255 , 0 , 0 ));// 设置曲线颜色
320
- line->setUseOpenGL (true );// openGl 加速
321
-
322
- chart->setTitle (" Pressure Data" );// 设置图标标题
323
- chart->removeSeries (line);
324
- chart->addSeries (line);
325
- chart->createDefaultAxes ();// 设置坐标轴
326
-
327
- // axisX->setRange(0,line_max);//范围
328
- // axisX->setTitleText("times(secs)");//标题
329
- axisX->setTickCount (10 );// 分隔个数
330
- axisX->setLineVisible (true );// 可视化
331
- axisX->setLinePenColor (Qt::blue);// 颜色
332
-
333
- // axisY->setRange(-200,1200);
334
- // axisY->setTitleText("value");
335
- // axisY->setTickCount(6);
336
- // axisY->setLineVisible(true);
337
- // axisY->setLinePenColor(Qt::blue);
338
-
339
- // chart->setAxisX(axisX,line);
340
- // chart->setAxisY(axisY,line);
341
-
342
- chartView->setChart (chart);
298
+ // QVector<QPointF> list;
299
+ // QVector<QPointF> newlist;
300
+ // list = line->pointsVector();//获取现在图中列表
301
+ // if (list.size() < line_max)
302
+ // {
303
+ // //保持原来
304
+ // newlist = list;
305
+ // }
306
+ // else
307
+ // {
308
+ // //错位移动
309
+ // for(int i =1 ; i< list.size();i++)
310
+ // {
311
+ // newlist.append(QPointF(i-1,list.at(i).y()));
312
+ // }
313
+ // }
314
+ // newlist.append(QPointF(newlist.size(),rand()));//最后补上新的数据
315
+ // line->replace(newlist);//替换更新
316
+
317
+
318
+ // line->setName("send");//设置曲线名称
319
+ // line->setPen(QColor(255, 0, 0));//设置曲线颜色
320
+ // line->setUseOpenGL(true);//openGl 加速
321
+
322
+ // chart->setTitle("Pressure Data");//设置图标标题
323
+ // chart->removeSeries(line);
324
+ // chart->addSeries(line);
325
+ // chart->createDefaultAxes();//设置坐标轴
326
+
327
+ // // axisX->setRange(0,line_max);//范围
328
+ // // axisX->setTitleText("times(secs)");//标题
329
+ // axisX->setTickCount(10);//分隔个数
330
+ // axisX->setLineVisible(true);//可视化
331
+ // axisX->setLinePenColor(Qt::blue);//颜色
332
+
333
+ // // axisY->setRange(-200,1200);
334
+ // // axisY->setTitleText("value");
335
+ // // axisY->setTickCount(6);
336
+ // // axisY->setLineVisible(true);
337
+ // // axisY->setLinePenColor(Qt::blue);
338
+
339
+ // // chart->setAxisX(axisX,line);
340
+ // // chart->setAxisY(axisY,line);
341
+
342
+ // chartView->setChart(chart);
343
343
}
344
344
void MainWindow::slot_pubImageMapTimeOut (){
345
345
QImage image (600 ,600 ,QImage::Format_RGB888);
@@ -559,60 +559,60 @@ void MainWindow::quick_cmd_remove()
559
559
// 快捷指令添加按钮
560
560
void MainWindow::quick_cmd_add ()
561
561
{
562
- QWidget *w=new QWidget;
563
- // 阻塞其他窗体
564
- w->setWindowModality (Qt::ApplicationModal);
565
- QLabel *name=new QLabel;
566
- name->setText (" 名称:" );
567
- QLabel *content=new QLabel;
568
- content->setText (" 脚本:" );
569
- QLineEdit *name_val=new QLineEdit;
570
- QTextEdit *shell_val=new QTextEdit;
571
- QPushButton *ok_btn=new QPushButton;
572
- ok_btn->setText (" ok" );
573
- ok_btn->setIcon (QIcon (" ://images/ok.png" ));
574
- QPushButton *cancel_btn=new QPushButton;
575
- cancel_btn->setText (" cancel" );
576
- cancel_btn->setIcon (QIcon (" ://images/false.png" ));
577
- QHBoxLayout *lay1=new QHBoxLayout;
578
- lay1->addWidget (name);
579
- lay1->addWidget (name_val);
580
- QHBoxLayout *lay2=new QHBoxLayout;
581
- lay2->addWidget (content);
582
- lay2->addWidget (shell_val);
583
- QHBoxLayout *lay3=new QHBoxLayout;
584
- lay3->addWidget (ok_btn);
585
- lay3->addWidget (cancel_btn);
586
- QVBoxLayout *v1=new QVBoxLayout;
587
- v1->addLayout (lay1);
588
- v1->addLayout (lay2);
589
- v1->addLayout (lay3);
590
-
591
- w->setLayout (v1);
592
- w->show ();
593
-
594
- connect (ok_btn,&QPushButton::clicked,[this ,w,name_val,shell_val]
595
- {
596
- this ->add_quick_cmd (name_val->text (),shell_val->toPlainText ());
597
- w->close ();
598
- });
562
+ // QWidget *w=new QWidget;
563
+ // //阻塞其他窗体
564
+ // w->setWindowModality(Qt::ApplicationModal);
565
+ // QLabel *name=new QLabel;
566
+ // name->setText("名称:");
567
+ // QLabel *content=new QLabel;
568
+ // content->setText("脚本:");
569
+ // QLineEdit *name_val=new QLineEdit;
570
+ // QTextEdit *shell_val=new QTextEdit;
571
+ // QPushButton *ok_btn=new QPushButton;
572
+ // ok_btn->setText("ok");
573
+ // ok_btn->setIcon(QIcon("://images/ok.png"));
574
+ // QPushButton *cancel_btn=new QPushButton;
575
+ // cancel_btn->setText("cancel");
576
+ // cancel_btn->setIcon(QIcon("://images/false.png"));
577
+ // QHBoxLayout *lay1=new QHBoxLayout;
578
+ // lay1->addWidget(name);
579
+ // lay1->addWidget(name_val);
580
+ // QHBoxLayout *lay2=new QHBoxLayout;
581
+ // lay2->addWidget(content);
582
+ // lay2->addWidget(shell_val);
583
+ // QHBoxLayout *lay3=new QHBoxLayout;
584
+ // lay3->addWidget(ok_btn);
585
+ // lay3->addWidget(cancel_btn);
586
+ // QVBoxLayout *v1=new QVBoxLayout;
587
+ // v1->addLayout(lay1);
588
+ // v1->addLayout(lay2);
589
+ // v1->addLayout(lay3);
590
+
591
+ // w->setLayout(v1);
592
+ // w->show();
593
+
594
+ // connect(ok_btn,&QPushButton::clicked,[this,w,name_val,shell_val]
595
+ // {
596
+ // this->add_quick_cmd(name_val->text(),shell_val->toPlainText());
597
+ // w->close();
598
+ // });
599
599
}
600
600
// 向treeWidget添加快捷指令
601
601
void MainWindow::add_quick_cmd (QString name,QString val)
602
602
{
603
- if (name==" " ) return ;
604
- QTreeWidgetItem *head=new QTreeWidgetItem (QStringList ()<<name);
605
- QCheckBox *check=new QCheckBox;
606
- // 记录父子关系
607
- this ->widget_to_parentItem_map [check]=head;
608
- // 连接checkbox选中的槽函数
609
- connect (check,SIGNAL (stateChanged (int )),this ,SLOT (quick_cmds_check_change (int )));
610
- QTreeWidgetItem *shell_content=new QTreeWidgetItem (QStringList ()<<" shell" );
611
- QTextEdit *shell_val=new QTextEdit;
612
- shell_val->setMaximumWidth (150 );
613
- shell_val->setMaximumHeight (40 );
614
- head->addChild (shell_content);
615
- shell_val->setText (val);
603
+ // if(name=="") return;
604
+ // QTreeWidgetItem *head=new QTreeWidgetItem(QStringList()<<name);
605
+ // QCheckBox *check=new QCheckBox;
606
+ // //记录父子关系
607
+ // this->widget_to_parentItem_map[check]=head;
608
+ // //连接checkbox选中的槽函数
609
+ // connect(check,SIGNAL(stateChanged(int)),this,SLOT(quick_cmds_check_change(int)));
610
+ // QTreeWidgetItem *shell_content=new QTreeWidgetItem(QStringList()<<"shell");
611
+ // QTextEdit *shell_val=new QTextEdit;
612
+ // shell_val->setMaximumWidth(150);
613
+ // shell_val->setMaximumHeight(40);
614
+ // head->addChild(shell_content);
615
+ // shell_val->setText(val);
616
616
}
617
617
// 快捷指令按钮处理的函数
618
618
void MainWindow::quick_cmds_check_change (int state)
0 commit comments