支持批量导入svg
parent
ee0bc1094e
commit
9f90622c6b
|
@ -170,16 +170,19 @@ void ElementPoolWidget::popMenu(const QPoint& pos)
|
|||
else
|
||||
{
|
||||
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文件"));
|
||||
auto filePaths = QFileDialog::getOpenFileNames(this, QString::fromLocal8Bit("打开文件"), "", "SVG Files (*.svg)");
|
||||
if (filePaths.empty())
|
||||
{
|
||||
//QMessageBox::warning(this, tr("Error"), QString::fromLocal8Bit("请选择Svg文件"));
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& filePath : filePaths)
|
||||
{
|
||||
QFileInfo fileInfo(filePath);
|
||||
QString fileName = fileInfo.fileName();
|
||||
qDebug() << fileName << " " << filePath;
|
||||
this->elementManager->createSimpleElement(fileName, filePath);
|
||||
}
|
||||
this->refresh();
|
||||
emit triggerCentralRefresh();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue