qdir

QDir::exists with mapped remote directory

自闭症网瘾萝莉.ら 提交于 2019-12-24 15:06:57
问题 I use QDir::exists to check directories. However, when the checked directory name (string) points to mapped network directory which is not available, then the function takes pretty long (up to 10secs and longer) to return. How could I realize a shorter timeout? Or is there anything better to check? 来源: https://stackoverflow.com/questions/27511809/qdirexists-with-mapped-remote-directory

Windows-Autostart: Application directory seems to be C:/Windows/system32/

南笙酒味 提交于 2019-12-10 23:56:58
问题 When my app is started from the autostart of Windows, Qt is not able to open it. The error that causes this is that QDir().absoluteFilePath("settings.cnf") returns the path C:/Windows/system32/settings.cnf even though my file is located in my working directory. Does someone know what method I must call to get the right path? 回答1: Using the default constructor QDir() defaults to the current working directory, which can be anything, depending from where the user or the system started the

QDir::SetSorting Doesn't work on Ubuntu

两盒软妹~` 提交于 2019-12-08 12:18:47
问题 I have a problem with QDir, I have this folder with lots of images, and I need to iterate through them but, they have to be sorted, so, I'm using setSorting(QDir::Name) however, It doesn't work on Ubuntu . When I iterate it with QDirIterator it selects pictures in given folder randomly. The weird thing is I use the same exact code on Windows (minGW or MSVC) and It works perfectly. someClass::someClass(QDir dir) { m_dir = dir; m_directory.setSorting(QDir::Name); QStringList filter; filter <<