Take default name of a background image from a file path.
This commit is contained in:
parent
62ff405cc0
commit
111b7f356c
|
@ -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());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue
Block a user