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

Qt 相當于 PathAppend?

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

問題描述

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

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",或將"/dir1"附加到"/dir2""/dir1/""/dir2" 將產生相同(正確)的結果 - "/dir1/dir2" (雖然簡單地連接會分別產生"/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 函數?

Is there any Qt function that does a similar thing?

推薦答案

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

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() 而不是原始的/",但這不是強制性的,因為 QT 在內部將該分隔符轉換為原生分隔符(如果需要,請參閱 用Qt構建FS路徑的跨平臺方式).

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).

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

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).

這篇關于Qt 相當于 PathAppend?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數據?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環: for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環?)
Reusing thread in loop c++(在循環 C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環形?)
主站蜘蛛池模板: 久久激情五月丁香伊人 | 日韩在线中文字幕 | 久久艹免费视频 | 国产特级毛片aaaaaa喷潮 | 国产欧美在线一区 | 免费在线播放黄色 | 一区二区三区在线免费 | 免费国产一区二区 | 欧美日韩在线视频一区二区 | 色综合99 | 男女羞羞视频在线观看 | 四虎成人免费视频 | 久久久久99 | wwwxx在线观看 | 天天噜天天干 | 中文字幕日韩欧美一区二区三区 | 久久久网| 日韩快播电影网 | 久热久热 | 精品熟人一区二区三区四区 | 福利久久 | 成人免费看片又大又黄 | 久久精品亚洲欧美日韩精品中文字幕 | 午夜网站视频 | 国产9999精品| 亚洲国产高清高潮精品美女 | 国产精品一区二区无线 | 粉嫩一区二区三区国产精品 | 亚洲色图在线观看 | 国产精品无码久久久久 | 日韩午夜一区二区三区 | 亚洲高清在线观看 | 成人黄色a | 久久精品二区 | 涩涩视频在线看 | 精品一二区 | 国产免费av在线 | 国产午夜精品一区二区三区四区 | 日韩国产中文字幕 | 日韩国产欧美 | 久久久精|