ControlOperationPage.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. #include "ControlOperationPage.h"
  2. #include "ui_ControlOperationPage.h"
  3. #include "JoystickPage.h"
  4. ControlOperationPage::ControlOperationPage(QWidget* parent)
  5. : QWidget(parent)
  6. , ui(new Ui::ControlOperationPage)
  7. {
  8. ui->setupUi(this);
  9. m_isEnable = false;
  10. InitWnd();
  11. initForm();
  12. }
  13. ControlOperationPage::~ControlOperationPage()
  14. {
  15. delete ui;
  16. }
  17. void ControlOperationPage::updateOperateWidget(const QPixmap& pixmap) {
  18. QSize size = ui->Operatewidget->size();
  19. QPixmap scaledPixmap = pixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
  20. clearLayout();
  21. ImageView* customView = new ImageView(ui->Operatewidget);
  22. customView->setPixmap(scaledPixmap);
  23. QVBoxLayout* layout = new QVBoxLayout(ui->Operatewidget);
  24. layout->setContentsMargins(0, 0, 0, 0);
  25. layout->addWidget(customView);
  26. ui->Operatewidget->setLayout(layout);
  27. m_currentPixmap = scaledPixmap;
  28. m_scaleFactor = 1.0;
  29. m_previousScaleFactor = 1.0;
  30. ui->label_Percentage->setText("100%");
  31. m_currentMode = ModeImage;
  32. m_currentImageView = customView;
  33. applyScale();
  34. }
  35. void ControlOperationPage::initImage() {
  36. clearLayout();
  37. ImageView* customView = new ImageView(ui->Operatewidget);
  38. QVBoxLayout* layout = new QVBoxLayout(ui->Operatewidget);
  39. layout->setContentsMargins(0, 0, 0, 0);
  40. layout->addWidget(customView);
  41. ui->Operatewidget->setLayout(layout);
  42. m_scaleFactor = 1.0;
  43. m_previousScaleFactor = 1.0;
  44. ui->label_Percentage->setText("100%");
  45. m_currentMode = ModeImage;
  46. m_currentImageView = customView;
  47. applyScale();
  48. }
  49. void ControlOperationPage::setDataSources(const QStringList& textList) {
  50. ui->DataSources->clear();
  51. ui->DataSources->addItems(textList);
  52. }
  53. // 清除大窗口上当前的布局
  54. void ControlOperationPage::clearLayout() {
  55. // 获取当前布局
  56. QLayout* layout = ui->Operatewidget->layout();
  57. if (layout) {
  58. QLayoutItem* child;
  59. while ((child = layout->takeAt(0)) != nullptr) {
  60. if (child->widget() != nullptr) {
  61. delete child->widget(); // 删除控件
  62. }
  63. delete child; // 删除布局项
  64. }
  65. delete layout; // 删除布局本身
  66. }
  67. }
  68. void ControlOperationPage::on_ZoomUpButton_clicked()
  69. {
  70. m_mousePos = ui->Operatewidget->geometry().center();
  71. updateScale(m_scaleFactor * 1.1);
  72. }
  73. void ControlOperationPage::on_ZoomOutButton_clicked()
  74. {
  75. m_mousePos = ui->Operatewidget->geometry().center();
  76. updateScale(m_scaleFactor * 0.9);
  77. }
  78. // 更新缩放比例
  79. void ControlOperationPage::updateScale(double newScaleFactor)
  80. {
  81. if (newScaleFactor >= 1.0)
  82. {
  83. m_scaleFactor = newScaleFactor;
  84. }
  85. else {
  86. m_scaleFactor = 1.0; // 最小缩放比例为 1.0
  87. }
  88. applyScale(); // 应用缩放
  89. }
  90. // 应用缩放
  91. void ControlOperationPage::applyScale()
  92. {
  93. if (m_currentMode == ModeImage && m_currentImageView)
  94. {
  95. // 图片模式:缩放图片
  96. QTransform transform;
  97. transform.scale(m_scaleFactor, m_scaleFactor);
  98. m_currentImageView->setTransform(transform);
  99. }
  100. else if (m_currentMode == ModeView && m_currentView)
  101. {
  102. // View 模式:缩放 view
  103. QTransform transform;
  104. transform.scale(m_scaleFactor, m_scaleFactor);
  105. m_currentView->setTransform(transform);
  106. }
  107. // 更新百分比显示
  108. double percentage = m_scaleFactor * 100;
  109. QString percentageStr = QString::number((int)percentage);
  110. ui->label_Percentage->setText(QString("%1%").arg(percentageStr));
  111. }
  112. void ControlOperationPage::handleDoubleClick() {
  113. if (m_currentMode == ModeImage && m_currentImageView)
  114. {
  115. QTransform transform;
  116. transform.scale(1, 1);
  117. m_currentImageView->setTransform(transform);
  118. }
  119. else if (m_currentMode == ModeView && m_currentView)
  120. {
  121. QTransform transform;
  122. transform.scale(1, 1);
  123. m_currentView->setTransform(transform);
  124. }
  125. m_scaleFactor = 1.0;
  126. m_previousScaleFactor = 1.0;
  127. ui->label_Percentage->setText("100%");
  128. }
  129. void ControlOperationPage::updateMaterialWidget(kinds materialWndType)
  130. {
  131. clearLayout();
  132. switch (materialWndType)
  133. {
  134. case wafer_kind: KindsofWidget(wafer_kind); break;
  135. case waffle_kind: KindsofWidget(waffle_kind); break;
  136. case materialbox_kind: KindsofWidget(materialbox_kind); break;
  137. case bond_kind:KindsofWidget(bond_kind); break;
  138. }
  139. }
  140. void ControlOperationPage::KindsofWidget(kinds kind)
  141. {
  142. bool isRun = false;
  143. ui->Operatewidget->clearPixmap();
  144. QVBoxLayout* layout = new QVBoxLayout(ui->Operatewidget);
  145. layout->setContentsMargins(0, 0, 0, 0);
  146. m_currentMode = ModeView;
  147. if (kind == wafer_kind)
  148. {
  149. if (m_wafer)
  150. {
  151. isRun = true;
  152. m_wafer->initFrom(ui->Operatewidget);
  153. layout->addWidget(m_wafer->view);
  154. m_currentView = m_wafer->view;
  155. }
  156. }
  157. else if (kind == waffle_kind)
  158. {
  159. if (m_waffle)
  160. {
  161. isRun = true;
  162. m_waffle->initFrom(ui->Operatewidget);
  163. layout->addWidget(m_waffle->view);
  164. m_currentView = m_waffle->view;
  165. }
  166. }
  167. else if (kind == materialbox_kind)
  168. {
  169. if (m_materialbox)
  170. {
  171. isRun = true;
  172. m_materialbox->initFrom(ui->Operatewidget);
  173. layout->addWidget(m_materialbox->view);
  174. m_currentView = m_materialbox->view;
  175. }
  176. }
  177. else if (kind == bond_kind)
  178. {
  179. if (m_bond)
  180. {
  181. isRun = true;
  182. m_bond->initFrom(ui->Operatewidget);
  183. layout->addWidget(m_bond->m_pView);
  184. m_currentView = m_bond->m_pView;
  185. }
  186. }
  187. if (isRun)
  188. {
  189. ui->Operatewidget->setLayout(layout);
  190. m_currentMode = ModeView;
  191. m_scaleFactor = 1.0;
  192. applyScale();
  193. }
  194. }
  195. void ControlOperationPage::setWafer(Wafer* wafer) {
  196. m_wafer = wafer;
  197. updateMaterialWidget(wafer_kind);
  198. }
  199. void ControlOperationPage::setWaffle(Waffle* waffle) {
  200. m_waffle = waffle;
  201. updateMaterialWidget(waffle_kind);
  202. }
  203. void ControlOperationPage::setMaterialBox(MaterialBox* materialbox) {
  204. m_materialbox = materialbox;
  205. updateMaterialWidget(materialbox_kind);
  206. }
  207. void ControlOperationPage::setBond(Bond* bond) {
  208. m_bond = bond;
  209. updateMaterialWidget(bond_kind);
  210. }
  211. void ControlOperationPage::initForm()
  212. {
  213. connect(ui->Operatewidget, &ImageWidget::sendDoubleClicksignal, this, &ControlOperationPage::handleDoubleClick);
  214. ui->Operatewidget->setMouseTracking(true);
  215. }
  216. ImageWidget* ControlOperationPage::getOperatewidget()
  217. {
  218. return ui->Operatewidget;
  219. }
  220. void ControlOperationPage::resizeSingleUI(bool bMax /*= false*/)
  221. {
  222. ui->DataSources->setGeometry(QRect(20, 20, 400, 32));
  223. ui->Operatewidget->setGeometry(QRect(20, 72, 786, 786));
  224. //ui->line_2->setGeometry(QRect(826, 20, 1, 953));
  225. ui->LiveButton->setGeometry(QRect(436, 20, 60, 32));
  226. ui->horizontalLayout_2->setGeometry(QRect(12, 882, 786, 32));
  227. ui->layoutWidget->setGeometry(QRect(10, 882, 790, 31));
  228. ui->ZoomUpButton->setGeometry(QRect(25, 882, 120, 32));
  229. ui->ZoomOutButton->setGeometry(QRect(155, 882, 100, 32));
  230. ui->label_Percentage->setGeometry(QRect(265, 882, 120, 32));
  231. ui->RulerButton->setGeometry(QRect(400, 882, 110, 32));
  232. ui->PenButton->setGeometry(QRect(530, 882, 100, 32));
  233. // ui->switchJoystickBut
  234. ui->horizontalLayout->setGeometry(QRect(12, 882, 786, 32));
  235. ui->BackGround->setGeometry(QRect(16, 68, 794, 794));
  236. if (bMax)
  237. {
  238. ui->Operatewidget->m_nSingleCameraOperationWnd = true;
  239. }
  240. }
  241. void ControlOperationPage::resizeChartsAndCamerasUI() {
  242. }
  243. qreal ControlOperationPage::getScaleFactorValue() {
  244. return m_scaleFactor;
  245. }
  246. void ControlOperationPage::setScaleFactorSize(QPixmap scaledImage) {
  247. //int newWidth = scaledImage.width() * m_scaleFactor;
  248. //int newHeight = scaledImage.height() * m_scaleFactor;
  249. //QPixmap curr_scaledImage = scaledImage.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
  250. // ui->Operatewidget->setPixmapAndPoint(curr_scaledImage, m_previousScaleFactor, m_scaleFactor, m_mousePos);
  251. // ui->Operatewidget->setPixmap(curr_scaledImage);
  252. if (m_currentImageView == nullptr || m_currentMode == ModeView) {
  253. updateOperateWidget(scaledImage);
  254. }
  255. else
  256. {
  257. QSize size = ui->Operatewidget->size();
  258. QPixmap scaledPixmap = scaledImage.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
  259. m_currentImageView->setCurPixmap(scaledPixmap);
  260. }
  261. }
  262. void ControlOperationPage::UpDateCameraBind(CameraBind* pCameraBind)
  263. {
  264. m_pCameraBindCopy = pCameraBind;
  265. m_isAdd = true;
  266. // 有指针了在去刷新
  267. if (m_pCameraBindCopy != nullptr)
  268. {
  269. DeduplicationBox(ui->moduleTypeComboBox, m_pCameraBindCopy->m_vecCAxis, 0);
  270. DeduplicationBox(ui->axisTypeComboBox, m_pCameraBindCopy->m_vecCAxis, 1);
  271. }
  272. m_isAdd = false;
  273. setSwitchJoystickButEnable(true);
  274. }
  275. void ControlOperationPage::setSwitchJoystickButEnable(bool isEnable)
  276. {
  277. ui->switchJoystickBut->setEnabled(isEnable);
  278. if (isEnable == false)
  279. {
  280. ResetIdleTimer(false);
  281. m_isUserOnclick = false;
  282. }
  283. }
  284. void ControlOperationPage::on_switchJoystickBut_clicked()
  285. {
  286. m_isUserOnclick = true;
  287. ResetIdleTimer(true);
  288. UpdataModuleType("aaa", 3);
  289. ui->switchJoystickBut->setEnabled(false);
  290. }
  291. void ControlOperationPage::MouseMovedSlots(const QPoint& delta)
  292. {
  293. //qDebug() << "MouseMovedSlots:" << delta;
  294. if (m_pCameraBindCopy)
  295. {
  296. m_pCameraBindCopy->JCameraMove(0, delta.x(), delta.y());
  297. }
  298. }
  299. void ControlOperationPage::RequestCursorMoveSlots(const QPoint& pos)
  300. {
  301. QCursor::setPos(pos);
  302. }
  303. void ControlOperationPage::on_moduleTypeComboBox_currentIndexChanged(int index)
  304. {
  305. m_isAdd = true;
  306. QString strMod = ui->moduleTypeComboBox->itemText(index);
  307. ui->axisTypeComboBox->clear();
  308. for (auto a: m_pCameraBindCopy->m_vecCAxis)
  309. {
  310. // 如果2个相等说明当前模组,与轴匹配
  311. if (strMod == a->GetModuleType().c_str())
  312. {
  313. ui->axisTypeComboBox->addItem(a->GetStringAxisType().c_str());
  314. }
  315. }
  316. m_isAdd = false;
  317. UpdataModuleType(strMod, 1);
  318. }
  319. void ControlOperationPage::on_axisTypeComboBox_currentIndexChanged(int index)
  320. {
  321. if (!m_isAdd)
  322. {
  323. UpdataModuleType(ui->axisTypeComboBox->itemText(index), 2);
  324. }
  325. }
  326. void ControlOperationPage::timerEvent(QTimerEvent* event)
  327. {
  328. int nID = event->timerId();
  329. if (nID == m_idleTimer)
  330. {
  331. ResetIdleTimer(false);
  332. m_isUserOnclick = false;
  333. ui->switchJoystickBut->setEnabled(true);
  334. }
  335. }
  336. //void ControlOperationPage::mousePressEvent(QMouseEvent* event)
  337. //{
  338. // if (event->button() == Qt::LeftButton)
  339. // {
  340. // LockMouse(true);
  341. // }
  342. // else if (event->button() == Qt::RightButton)
  343. // {
  344. // LockMouse(false);
  345. // }
  346. //}
  347. //
  348. //void ControlOperationPage::mouseMoveEvent(QMouseEvent* event)
  349. //{
  350. // int a = 10;
  351. //}
  352. //
  353. //bool ControlOperationPage::eventFilter(QObject* obj, QEvent* event)
  354. //{
  355. // switch (event->type())
  356. // {
  357. // case QEvent::KeyPress:
  358. // case QEvent::MouseMove:
  359. // case QEvent::MouseButtonPress:
  360. // case QEvent::MouseButtonDblClick:
  361. // case QEvent::Wheel:
  362. // {
  363. // if (m_isUserOnclick)
  364. // {
  365. // ResetIdleTimer(false);
  366. // ResetIdleTimer(true);
  367. // }
  368. // }
  369. // break;
  370. // default:
  371. // break;
  372. // }
  373. //
  374. // return QWidget::eventFilter(obj, event);
  375. //}
  376. void ControlOperationPage::wheelEvent(QWheelEvent* event) {
  377. if (ui->Operatewidget->rect().contains(ui->Operatewidget->mapFromGlobal(event->globalPos()))) {
  378. m_mousePos = ui->Operatewidget->mapFromGlobal(event->globalPos());
  379. if (event->angleDelta().y() > 0) {
  380. updateScale(m_scaleFactor * 1.1); // 放大
  381. }
  382. else {
  383. updateScale(m_scaleFactor * 0.9); // 缩小
  384. }
  385. }
  386. }
  387. void ControlOperationPage::HideLayout(bool bShow)
  388. {
  389. for (int i = 0; i < ui->horizontalLayout->count(); ++i)
  390. {
  391. QWidget* widget = ui->horizontalLayout->itemAt(i)->widget();
  392. if (widget)
  393. {
  394. if (bShow)
  395. {
  396. widget->show();
  397. }
  398. else
  399. {
  400. widget->hide();
  401. }
  402. }
  403. }
  404. }
  405. void ControlOperationPage::ResetIdleTimer(bool bStart /*= false*/)
  406. {
  407. if (bStart)
  408. {
  409. if (isActiveWindow())
  410. {
  411. m_idleTimer = startTimer(g_unnSuspensionWaitingTime);
  412. }
  413. }
  414. else
  415. {
  416. killTimer(m_idleTimer);
  417. m_idleTimer = -1;
  418. }
  419. HideLayout(bStart);
  420. }
  421. void ControlOperationPage::InitWnd()
  422. {
  423. HideLayout(false);
  424. /* connect(ui->widgetPage, &JoystickPage::PositionChangedSignals, [&](qreal x, qreal y) {
  425. ui->showLabel->setText(QString("摇杆位置: (%1, %2)").arg(x, 0, 'f', 2).arg(y, 0, 'f', 2));
  426. });*/
  427. this->setMouseTracking(true);
  428. this->installEventFilter(this);
  429. }
  430. void ControlOperationPage::CreateMouseMonitor(bool isStart)
  431. {
  432. if (isStart)
  433. {
  434. m_pMousethread = new JMouseMonitorThread(this);
  435. connect(m_pMousethread, &JMouseMonitorThread::MouseMovedSlg, this, &ControlOperationPage::MouseMovedSlots);
  436. connect(m_pMousethread, &JMouseMonitorThread::RequestCursorMoveSlg, this, &ControlOperationPage::RequestCursorMoveSlots);
  437. m_pMousethread->start();
  438. }
  439. else
  440. {
  441. m_pMousethread->stop();
  442. m_pMousethread->wait();
  443. delete m_pMousethread;
  444. m_pMousethread = nullptr;
  445. }
  446. }
  447. void ControlOperationPage::LockMouse(bool islockMouse)
  448. {
  449. if (m_pCameraBindCopy)
  450. {
  451. if (islockMouse)
  452. {
  453. if (!m_bMouseRun)
  454. {
  455. CreateMouseMonitor(true);
  456. QPoint center = rect().center();
  457. QPoint globalCenter = mapToGlobal(center);
  458. m_pMousethread->setLockCenter(globalCenter);
  459. QCursor::setPos(globalCenter);
  460. setCursor(Qt::BlankCursor);
  461. grabMouse();
  462. m_bMouseRun = true;
  463. }
  464. }
  465. else
  466. {
  467. if (m_bMouseRun)
  468. {
  469. if (m_pMousethread)
  470. {
  471. m_pMousethread->unlock();
  472. releaseMouse();
  473. unsetCursor();
  474. QCursor::setPos(mapToGlobal(rect().center()));
  475. CreateMouseMonitor(false);
  476. }
  477. m_bMouseRun = false;
  478. }
  479. }
  480. }
  481. }
  482. void ControlOperationPage::UpdataModuleType(const QString& strMode, int nIndex)
  483. {
  484. //if (nIndex == 1)
  485. //{
  486. // m_currentSelectRunAxis.ModuleType = strMode.toStdString();
  487. //}
  488. //else if (nIndex == 2)
  489. //{
  490. // m_currentSelectRunAxis.AxisType = strMode.toStdString();
  491. //}
  492. m_currentSelectRunAxis.ModuleType = ui->moduleTypeComboBox->currentText().toStdString();
  493. m_currentSelectRunAxis.AxisType = ui->axisTypeComboBox->currentText().toStdString();
  494. if (m_isAdd == false)
  495. {
  496. m_currentSelectRunAxis.isSwitch = true;
  497. emit SendModuleTypeSignals(m_currentSelectRunAxis);
  498. m_currentSelectRunAxis.isSwitch = false;
  499. }
  500. }
  501. template<class T>
  502. void ControlOperationPage::DeduplicationBox(QComboBox* pCom, const T& veTemp, int nIndex)
  503. {
  504. for (auto& a : veTemp)
  505. {
  506. QString strName;
  507. if (nIndex == 0)
  508. {
  509. strName = a->GetModuleType().c_str();
  510. }
  511. else if (nIndex == 1)
  512. {
  513. strName = a->GetStringAxisType().c_str();
  514. }
  515. QStringList items;
  516. for (int i = 0; i < pCom->count(); ++i)
  517. {
  518. items << pCom->itemText(i);
  519. }
  520. bool bMa = false; // 是否匹配
  521. for (auto b : items)
  522. {
  523. if (b == strName)
  524. {
  525. bMa = true;
  526. break;
  527. }
  528. }
  529. if (!bMa)
  530. {
  531. pCom->addItem(strName);
  532. }
  533. }
  534. }
  535. void ControlOperationPage::setEnableControls(bool enable) {
  536. ui->LiveButton->setEnabled(enable);
  537. ui->DataSources->setEnabled(enable);
  538. if (enable == true) {
  539. ui->LiveButton->setStyleSheet(
  540. "QPushButton:hover {"
  541. " background-color: #45a049;"
  542. "}"
  543. "QPushButton:pressed {"
  544. " background-color: #3e8e41;"
  545. "}"
  546. );
  547. }
  548. else {
  549. ui->LiveButton->setStyleSheet("background-color: lightgray;");
  550. }
  551. }
  552. void ControlOperationPage::setBlueBord() {
  553. ui->BackGround->setStyleSheet(QString::fromUtf8("border: 4px solid blue;"));
  554. }
  555. void ControlOperationPage::on_RulerButton_clicked()
  556. {
  557. if (m_currentMode == ModeImage) {
  558. if (m_currentImageView->rulerVisibale()) {
  559. m_currentImageView->endRuler();
  560. }
  561. else {
  562. m_currentImageView->startRuler();
  563. }
  564. }
  565. }
  566. void ControlOperationPage::on_PenButton_clicked() {
  567. m_isEnable = !m_isEnable;
  568. if (m_isEnable) {
  569. //ui->Operatewidget->setIsDrawing(true);
  570. m_currentImageView->setIsDrawing(true);
  571. ui->PenButton->setStyleSheet("QPushButton { background-color: #808FFF; }");
  572. }
  573. else {
  574. //ui->Operatewidget->setIsDrawing(false);
  575. m_currentImageView->setIsDrawing(false);
  576. ui->PenButton->setStyleSheet("QPushButton { background-color: none; }");
  577. }
  578. }
  579. void ControlOperationPage::SaveNewImage()
  580. {
  581. //// 捕获 ui->Operatewidget 的当前显示内容
  582. //QPixmap pixmap = ui->Operatewidget->grab();
  583. //// 使用当前时间生成默认文件名
  584. //QString defaultFileName = QDateTime::currentDateTime().toString("yyyy-MM-dd_HH-mm-ss") + ".png";
  585. //// 弹出文件对话框,让用户选择保存路径和文件名
  586. //QString filePath = QFileDialog::getSaveFileName(
  587. // this,
  588. // tr("保存图片"),
  589. // QDir::homePath() + "/" + defaultFileName, // 默认路径为用户目录,文件名为当前时间
  590. // tr("PNG 文件 (*.png);;JPEG 文件 (*.jpg);;所有文件 (*)")
  591. //);
  592. //// 如果用户取消保存,则退出函数
  593. //if (filePath.isEmpty()) {
  594. // return;
  595. //}
  596. //if (!pixmap.save(filePath)) {
  597. // QMessageBox::warning(this, tr("保存失败"), tr("无法保存图片到指定路径。"));
  598. //}
  599. //else {
  600. // QMessageBox::information(this, tr("保存成功"), tr("图片已成功保存到:") + filePath);
  601. //}
  602. }