diff --git a/src/app/valentina/dialogs/dialogaddbackgroundimage.cpp b/src/app/valentina/dialogs/dialogaddbackgroundimage.cpp index 406349c75..7cd1e8dce 100644 --- a/src/app/valentina/dialogs/dialogaddbackgroundimage.cpp +++ b/src/app/valentina/dialogs/dialogaddbackgroundimage.cpp @@ -26,14 +26,16 @@ ** *************************************************************************/ #include "dialogaddbackgroundimage.h" +#include "qfileinfo.h" #include "ui_dialogaddbackgroundimage.h" //--------------------------------------------------------------------------------------------------------------------- -DialogAddBackgroundImage::DialogAddBackgroundImage(QWidget *parent) : +DialogAddBackgroundImage::DialogAddBackgroundImage(const QString &fileName, QWidget *parent) : QDialog(parent), ui(new Ui::DialogAddBackgroundImage) { ui->setupUi(this); + ui->lineEditName->setText(QFileInfo(fileName).baseName()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/dialogs/dialogaddbackgroundimage.h b/src/app/valentina/dialogs/dialogaddbackgroundimage.h index 2fc3914e4..35cdaefc8 100644 --- a/src/app/valentina/dialogs/dialogaddbackgroundimage.h +++ b/src/app/valentina/dialogs/dialogaddbackgroundimage.h @@ -44,7 +44,7 @@ class DialogAddBackgroundImage : public QDialog Q_OBJECT public: - explicit DialogAddBackgroundImage(QWidget *parent = nullptr); + explicit DialogAddBackgroundImage(const QString &fileName, QWidget *parent = nullptr); ~DialogAddBackgroundImage() override; auto Name() const -> QString; diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 937f69f97..f560136e3 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1382,7 +1382,7 @@ void MainWindow::ZoomFitBestCurrent() //--------------------------------------------------------------------------------------------------------------------- void MainWindow::PlaceBackgroundImage(const QPointF &pos, const QString &fileName) { - DialogAddBackgroundImage dialog(this); + DialogAddBackgroundImage dialog(fileName, this); if (dialog.exec() == QDialog::Rejected) { qCritical() << tr("Unable to add background image");