From 93537954a968634b7c19974937b036d220aa175f Mon Sep 17 00:00:00 2001 From: "yang.yongquan" <3395816735@qq.com> Date: Tue, 21 Mar 2023 13:57:16 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E9=80=89=E6=8B=A9=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=97=B6=E6=9C=AA=E5=AF=B9=E2=80=9C=E6=9C=AA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E2=80=9D=E7=9A=84=E6=83=85=E5=86=B5=E5=81=9A=E5=A4=84=E7=90=86?= =?UTF-8?q?=20|=20#19?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Editor/ElementPoolWidget.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ArchitectureColoredPainting/src/Editor/ElementPoolWidget.cpp b/ArchitectureColoredPainting/src/Editor/ElementPoolWidget.cpp index 74453d0..95825e1 100644 --- a/ArchitectureColoredPainting/src/Editor/ElementPoolWidget.cpp +++ b/ArchitectureColoredPainting/src/Editor/ElementPoolWidget.cpp @@ -3,6 +3,7 @@ #include #include #include +#include ElementPoolWidget::ElementPoolWidget(QWidget* parent) : QWidget(parent) @@ -125,7 +126,12 @@ void ElementPoolWidget::popMenu(const QPoint& pos) { menu->addAction(QString::fromLocal8Bit("添加元素(从svg导入)"), this, [this]() { QString filePath = QFileDialog::getOpenFileName(this, QString::fromLocal8Bit("打开文件"), "", "SVG Files (*.svg)"); + filePath = filePath.trimmed(); QFileInfo fileInfo(filePath); + if (!fileInfo.exists() || !fileInfo.isFile()) { + QMessageBox::warning(this, tr("Error"), QString::fromLocal8Bit("请选择Svg文件")); + return; + } QString fileName = fileInfo.fileName(); qDebug() << fileName << " " << filePath; this->elementManager->createSimpleElement(fileName, filePath);