久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Qt 相當(dāng)于 PathAppend?

Qt equivalent of PathAppend?(Qt 相當(dāng)于 PathAppend?)
本文介紹了Qt 相當(dāng)于 PathAppend?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

PathAppend 是一個(gè)有用的 winapi 函數(shù),可讓您將一個(gè)路徑附加到另一個(gè)路徑,同時(shí)處理任何尾隨反斜杠(或缺少反斜杠).

PathAppend is a useful winapi function that lets you append one path to another while taking care of any trailing backslashes (or lack of them).

表示將"/dir1"附加到"dir2",或?qū)?code>"/dir1"附加到"/dir2""/dir1/""/dir2" 將產(chǎn)生相同(正確)的結(jié)果 - "/dir1/dir2" (雖然簡(jiǎn)單地連接會(huì)分別產(chǎn)生"/dir1dir2""/dir1/dir2""/dir1//dir2").

Meaning that appending "/dir1" to "dir2", or "/dir1" to "/dir2", or "/dir1/" to "/dir2" would produce the same (correct) result - "/dir1/dir2" (while simply concatening would produce respectively "/dir1dir2", "/dir1/dir2", and "/dir1//dir2").

有沒有類似的 Qt 函數(shù)?

Is there any Qt function that does a similar thing?

推薦答案

沒有那個(gè)函數(shù),但是 QDir::cleanPath() 會(huì)處理你需要的一切,你只需要連接路徑:

There is not that function but QDir::cleanPath() will handle everything you need, you just have to concatenate paths:

QString appendPath(const QString& path1, const QString& path2)
{
    return QDir::cleanPath(path1 + QDir::separator() + path2);
}

我使用了 QDir::separator() 而不是原始的/",但這不是強(qiáng)制性的,因?yàn)?QT 在內(nèi)部將該分隔符轉(zhuǎn)換為原生分隔符(如果需要,請(qǐng)參閱 用Qt構(gòu)建FS路徑的跨平臺(tái)方式).

I used QDir::separator() instead of raw "/" but it's not mandatory because QT internally translate that separator to the native one (if needed, see Cross-platform way of constructing an FS path with Qt).

請(qǐng)注意(對(duì)于具有 .NET 背景的人)還有另一個(gè)類似的函數(shù):Path.Combine(),它的行為與 PathAppend() 但它是不同的.請(qǐng)參閱是否有 QPath::Combine()? 以了解其行為的 QT 仿真(以及稍微更詳細(xì)地概述它們的差異).

Note that (for whom with a .NET background) there is another similar function: Path.Combine(), it behaves somehow similar to PathAppend() but it's different. See Is there a QPath::Combine()? for a QT emulation of its behavior (and for a slightly more detailed outlining of their differences).

這篇關(guān)于Qt 相當(dāng)于 PathAppend?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數(shù)據(jù)?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環(huán): for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環(huán)?)
Reusing thread in loop c++(在循環(huán) C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環(huán)形?)
主站蜘蛛池模板: 日韩欧美在线不卡 | 一级毛片网 | 亚洲精品免费视频 | 亚洲精品专区 | 久草精品在线 | 午夜视频免费在线观看 | 精品视频99 | 久久久久久久久久久久久九 | 亚洲国产精品一区二区三区 | 亚洲精品一区二区三区四区高清 | 黑人巨大精品欧美一区二区免费 | 九九国产在线观看 | 欧美成人一区二区三区片免费 | 真人毛片 | 日韩一区二区三区在线观看视频 | 久久久九九| 日韩在线精品 | 国产一区二区三区在线 | 日本精品一区二区三区在线观看视频 | 一区二区三区欧美在线观看 | 国产成人精品免费视频大全最热 | 免费看黄色小视频 | 日本中文字幕在线视频 | 国产在线观看一区二区三区 | 三级欧美| 日韩精品一区二区三区中文字幕 | 99在线资源| 国产成人jvid在线播放 | 亚洲欧美在线观看视频 | 综合亚洲视频 | av网站免费看 | 国产国产精品久久久久 | 成人亚洲一区 | 午夜小影院 | 91精品国产综合久久福利软件 | 免费在线观看一区二区三区 | 亚洲国产高清在线 | 国产精品资源在线观看 | 日本h片在线观看 | 日韩中文字幕视频在线观看 | 午夜国产|