Compare commits
2 Commits
d3cf84f479
...
182284c60f
Author | SHA1 | Date |
---|---|---|
yang.yongquan | 182284c60f | |
yang.yongquan | 93537954a9 |
|
@ -3,6 +3,7 @@
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
#include <QMessagebox>
|
||||||
|
|
||||||
ElementPoolWidget::ElementPoolWidget(QWidget* parent)
|
ElementPoolWidget::ElementPoolWidget(QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
@ -125,7 +126,12 @@ void ElementPoolWidget::popMenu(const QPoint& pos)
|
||||||
{
|
{
|
||||||
menu->addAction(QString::fromLocal8Bit("添加元素(从svg导入)"), this, [this]() {
|
menu->addAction(QString::fromLocal8Bit("添加元素(从svg导入)"), this, [this]() {
|
||||||
QString filePath = QFileDialog::getOpenFileName(this, QString::fromLocal8Bit("打开文件"), "", "SVG Files (*.svg)");
|
QString filePath = QFileDialog::getOpenFileName(this, QString::fromLocal8Bit("打开文件"), "", "SVG Files (*.svg)");
|
||||||
|
filePath = filePath.trimmed();
|
||||||
QFileInfo fileInfo(filePath);
|
QFileInfo fileInfo(filePath);
|
||||||
|
if (!fileInfo.exists() || !fileInfo.isFile()) {
|
||||||
|
QMessageBox::warning(this, tr("Error"), QString::fromLocal8Bit("请选择Svg文件"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
QString fileName = fileInfo.fileName();
|
QString fileName = fileInfo.fileName();
|
||||||
qDebug() << fileName << " " << filePath;
|
qDebug() << fileName << " " << filePath;
|
||||||
this->elementManager->createSimpleElement(fileName, filePath);
|
this->elementManager->createSimpleElement(fileName, filePath);
|
||||||
|
|
Loading…
Reference in New Issue