Details
-
Bug
-
Resolution: Cannot Reproduce
-
P4: Low
-
None
-
5.8.0
-
None
-
[{color:#007330}Q{color}|https://bugreports.qt.io/secure/qstring.html]{color:#007330}String{color} QDir::filePath(const [{color:#007330}QString{color}|https://bugreports.qt.io/secure/qstring.html] &fileName) const
Returns the path name of a file in the directory. Does not check if the file actually exists in the directory; but see [{color:#007330}exists{color}|https://bugreports.qt.io/secure/qdir.html#exists-1](). If the [{color:#007330}QDir{color}|https://bugreports.qt.io/secure/qdir.html] is relative the returned path name will also be relative. Redundant multiple separators or "." and ".." directories in fileName are not removed (see [{color:#007330}cleanPath{color}|https://bugreports.qt.io/secure/qdir.html#cleanPath]()).
Qdir::filePath()函数还具有将一个路径和一个文件名称合并的功能。如:
QDir dst;
QString s
dst=QDir({color:#008000}"f:/abf/1312"{color}); ,
s=dst.filePath({color:#008000}"e:/abc/file1.txt"{color});
s=dst.filePath({color:#008000}"e:/abc/file1.txt"{color});
那么s={color:#008000}"e:/abc/file1.txt"{color}
{color:#008000}而 {color}{color:#008000}s=dst.filePath("1.txt");{color}
{color:#008000}s="f:/abf/1312/1.txt"{color}
{color:#008000}完全不同的两种结果。而帮助文档上只给出了一种!!!!!!!{color}[{color:#007330}Q{color}| https://bugreports.qt.io/secure/qstring.html ]{color:#007330}String{color} QDir::filePath(const [{color:#007330}QString{color}| https://bugreports.qt.io/secure/qstring.html ] &fileName) const Returns the path name of a file in the directory. Does not check if the file actually exists in the directory; but see [{color:#007330}exists{color}| https://bugreports.qt.io/secure/qdir.html#exists-1 ](). If the [{color:#007330}QDir{color}| https://bugreports.qt.io/secure/qdir.html ] is relative the returned path name will also be relative. Redundant multiple separators or "." and ".." directories in fileName are not removed (see [{color:#007330}cleanPath{color}| https://bugreports.qt.io/secure/qdir.html#cleanPath ]()). Qdir::filePath()函数还具有将一个路径和一个文件名称合并的功能。如: QDir dst; QString s dst=QDir({color:#008000}"f:/abf/1312"{color}); , s=dst.filePath({color:#008000}"e:/abc/file1.txt"{color}); s=dst.filePath({color:#008000}"e:/abc/file1.txt"{color}); 那么s={color:#008000}"e:/abc/file1.txt"{color} {color:#008000}而 {color}{color:#008000}s=dst.filePath("1.txt");{color} {color:#008000}s="f:/abf/1312/1.txt"{color} {color:#008000}完全不同的两种结果。而帮助文档上只给出了一种!!!!!!!{color}
Description
QString QDir::filePath(const QString &fileName) const
Returns the path name of a file in the directory. Does not check if the file actually exists in the directory; but see exists(). If the QDir is relative the returned path name will also be relative. Redundant multiple separators or "." and ".." directories in fileName are not removed (see cleanPath()).
Qdir::filePath()函数还具有将一个路径和一个文件名称合并的功能。如:
QDir dst;
QString s
dst=QDir("f:/abf/1312"); ,
s=dst.filePath("e:/abc/file1.txt");
s=dst.filePath("e:/abc/file1.txt");
那么s="e:/abc/file1.txt"
而 s=dst.filePath("1.txt");
s="f:/abf/1312/1.txt"
完全不同的两种结果。而帮助文档上只给出了一种!!!!!!!