ModelEditor: Avoid a use of PathChooser::pathChanged

Change-Id: I3fa563d46c7dcd4d02b2452e0b233586b431282c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2022-06-29 16:11:12 +02:00
parent e2c8866f2a
commit 13d2516355
2 changed files with 9 additions and 5 deletions

View File

@@ -67,7 +67,7 @@ void ExtPropertiesMView::visitMPackage(const qmt::MPackage *package)
m_configPath->setInitialBrowsePathBackup(
Utils::FilePath::fromString(project->fileName()).absolutePath());
addRow(tr("Config path:"), m_configPath, "configpath");
connect(m_configPath, &Utils::PathChooser::pathChanged,
connect(m_configPath, &Utils::PathChooser::filePathChanged,
this, &ExtPropertiesMView::onConfigPathChanged);
}
if (!m_configPath->hasFocus()) {
@@ -86,7 +86,7 @@ void ExtPropertiesMView::visitMPackage(const qmt::MPackage *package)
}
}
void ExtPropertiesMView::onConfigPathChanged(const QString &path)
void ExtPropertiesMView::onConfigPathChanged(const Utils::FilePath &path)
{
bool modified = false;
qmt::Project *project = m_projectController->project();
@@ -98,7 +98,7 @@ void ExtPropertiesMView::onConfigPathChanged(const QString &path)
}
} else {
// make path relative to current project's directory
QFileInfo absConfigPath(path);
QFileInfo absConfigPath = path.toFileInfo();
absConfigPath.makeAbsolute();
QDir projectDir = QFileInfo(project->fileName()).dir();
QString configPath = projectDir.relativeFilePath(absConfigPath.filePath());

View File

@@ -28,7 +28,11 @@
#include "qmt/model_widgets_ui/propertiesviewmview.h"
namespace qmt { class ProjectController; }
namespace Utils { class PathChooser; }
namespace Utils {
class FilePath;
class PathChooser;
} // Utils
namespace ModelEditor {
namespace Internal {
@@ -46,7 +50,7 @@ public:
void visitMPackage(const qmt::MPackage *package) override;
private:
void onConfigPathChanged(const QString &path);
void onConfigPathChanged(const Utils::FilePath &path);
private:
qmt::ProjectController *m_projectController = nullptr;