Compare commits

...

2 Commits

1 changed files with 6 additions and 0 deletions

View File

@ -3,6 +3,7 @@
#include <QInputDialog>
#include <QFileDialog>
#include <QDialogButtonBox>
#include <QMessagebox>
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);