forked from qt-creator/qt-creator
Utils: Remove FilePath::isChildOf(QDir) overload
After replacing its use in the two remaining places. Change-Id: I6900ccdaf4ba4cf035e59b1222f06b037e7da512 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -1011,12 +1011,6 @@ bool FilePath::isChildOf(const FilePath &s) const
|
||||
return m_data.at(s.m_data.size()) == QLatin1Char('/');
|
||||
}
|
||||
|
||||
/// \overload
|
||||
bool FilePath::isChildOf(const QDir &dir) const
|
||||
{
|
||||
return isChildOf(FilePath::fromString(dir.absolutePath()));
|
||||
}
|
||||
|
||||
/// \returns whether FilePath startsWith \a s
|
||||
bool FilePath::startsWith(const QString &s) const
|
||||
{
|
||||
|
@@ -180,7 +180,6 @@ public:
|
||||
[[nodiscard]] QDir toDir() const; // Avoid.
|
||||
[[nodiscard]] FilePath absolutePath() const; // Avoid. Use resolvePath(...)[.parent()] with proper base.
|
||||
[[nodiscard]] FilePath absoluteFilePath() const; // Avoid. Use resolvePath(...) with proper base.
|
||||
[[nodiscard]] bool isChildOf(const QDir &dir) const; // Avoid. Use isChildOf(FilePath).
|
||||
|
||||
private:
|
||||
friend class ::tst_fileutils;
|
||||
|
@@ -51,10 +51,6 @@
|
||||
using namespace ResourceEditor;
|
||||
using namespace ResourceEditor::Internal;
|
||||
|
||||
/******************************************************************************
|
||||
** File
|
||||
*/
|
||||
|
||||
File::File(Prefix *prefix, const QString &_name, const QString &_alias)
|
||||
: Node(this, prefix)
|
||||
, name(_name)
|
||||
@@ -843,7 +839,7 @@ bool ResourceModel::setData(const QModelIndex &index, const QVariant &value, int
|
||||
if (newFileName.isEmpty())
|
||||
return false;
|
||||
|
||||
if (!newFileName.isChildOf(baseDir))
|
||||
if (!newFileName.isChildOf(filePath().absolutePath()))
|
||||
return false;
|
||||
|
||||
return renameFile(file(index), newFileName.toString());
|
||||
|
Reference in New Issue
Block a user