支持批量导入svg
parent
ee0bc1094e
commit
9f90622c6b
|
@ -170,16 +170,19 @@ void ElementPoolWidget::popMenu(const QPoint& pos)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
menu->addAction(QString::fromLocal8Bit("Ìí¼ÓÔªËØ£¨´Ósvgµ¼È룩"), this, [this]() {
|
menu->addAction(QString::fromLocal8Bit("Ìí¼ÓÔªËØ£¨´Ósvgµ¼È룩"), this, [this]() {
|
||||||
QString filePath = QFileDialog::getOpenFileName(this, QString::fromLocal8Bit("打开文件"), "", "SVG Files (*.svg)");
|
auto filePaths = QFileDialog::getOpenFileNames(this, QString::fromLocal8Bit("打开文件"), "", "SVG Files (*.svg)");
|
||||||
filePath = filePath.trimmed();
|
if (filePaths.empty())
|
||||||
QFileInfo fileInfo(filePath);
|
{
|
||||||
if (!fileInfo.exists() || !fileInfo.isFile()) {
|
//QMessageBox::warning(this, tr("Error"), QString::fromLocal8Bit("请选择Svg文件"));
|
||||||
QMessageBox::warning(this, tr("Error"), QString::fromLocal8Bit("请选择Svg文件"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString fileName = fileInfo.fileName();
|
|
||||||
qDebug() << fileName << " " << filePath;
|
for (auto& filePath : filePaths)
|
||||||
this->elementManager->createSimpleElement(fileName, filePath);
|
{
|
||||||
|
QFileInfo fileInfo(filePath);
|
||||||
|
QString fileName = fileInfo.fileName();
|
||||||
|
this->elementManager->createSimpleElement(fileName, filePath);
|
||||||
|
}
|
||||||
this->refresh();
|
this->refresh();
|
||||||
emit triggerCentralRefresh();
|
emit triggerCentralRefresh();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue