Questions tagged [qdir]

A QDir is a class from the Qt toolkit which provides access to directory structures and their contents.

A QDir is used to manipulate path names, access information regarding paths and files, and manipulate the underlying file system. It can also be used to access Qt's resource system.

The official documentation can be found here for Qt 4.8 and here for Qt 5.

84 questions
1
vote
2 answers

List files in sub-directories with QDir's filter

I'm looking for a function similar to the python glob function. If my folder structure is: folder1/abc1.txt folder1/xyz1.txt folder1/abc2.txt folder2/abc3.txt folder2/xyz4.txt folder3/abc5.txt then if I give */abc*, I'm looking for an output…
eng3
  • 431
  • 3
  • 18
1
vote
0 answers

QDir::exists with mapped remote directory

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…
Horst Walter
  • 13,663
  • 32
  • 126
  • 228
1
vote
2 answers

QT Creator Error (no match for operator =)

I'm receiving this error everytime I build my code. I'm using QT Creator 3.1, (5.2.1 build) error: no match for 'operator+' (operand types are 'QStringList' and 'const char [2]') Here is a snippet of code, hope it can help (the asterix line is…
1
vote
1 answer

How to add a list of directories and subdirectories to a QStringList?

How can I add a list of directories and subdirectories to a QStringList? This is what I have... QStringList dirList; QDirIterator iterateFolders("/Users/userName/targetFolder", QDir::Dirs, QDirIterator::Subdirectories); while…
fs_tigre
  • 10,650
  • 13
  • 73
  • 146
1
vote
1 answer

QTDir why not display all the folder in the root "/" in MacOs?

I'm starting to use QT, and trying QDir I copy the example in the references of QT the one which listing the content of a folder. I'm trying to listing the content of the root path in a MacOS snow leopard, version of QT 5.1.1 But don't appear all of…
Angoll
  • 55
  • 1
  • 3
1
vote
2 answers

QFileDialog returns selected file with wrong seperators

I noticed that QFileDialog instance is returning absolute paths for the member function selectedFile() that have the wrong separator for the given operating system. This is not expected on a cross platform language (python) What should I do to…
UpAndAdam
  • 4,515
  • 3
  • 28
  • 46
1
vote
1 answer

Sorting with multiple conditions in QDir::entryInfoList

Qt's doc says that QDir::entryInfoList can accept multiple sorting conditions but how to do is unclear to me. This enum describes the sort options available to QDir, e.g. for entryList() and entryInfoList(). The sort value is specified by OR-ing…
IsaacS
  • 3,551
  • 6
  • 39
  • 61
0
votes
1 answer

Listing Directory Entries with Qt on Remote Windows Server

I am on a Windows Server which is in the same network as the Server with the computer name service. I got this simple code which tries to list the content QFileInfoList fiList = QDir("\\service\\Documents").entryInfoList(QDir::Files); qDebug() <<…
k_k
  • 83
  • 7
0
votes
1 answer

How to enter input separated by semi colon by using setInputMask()

My goal is to display only files which user wants to see. For instance, "*.h; *.txt" as an input should shows the only *.h and *.txt files in selected folder. The program works for only one input(ie. *.h) The code: QString mask = ";"; QStringList…
Efe Şafak
  • 25
  • 4
0
votes
1 answer

How to open Subdirectories in a directories by using recursive function?

My program is already works well but I want to add one more condition. The program opens a directory and display .h and .cpp files. But if there is a subdirectory, I can not see the .cpp and .h files inside subdirectory. Here is my…
Efe Şafak
  • 25
  • 4
0
votes
1 answer

QDir Won't Show Symbolically Linked Shadow Copy Directory Contents Using EntryList()

Hi I have a very unique situation hopefully the solution is simple... I am writing a backup program that uses Volume Shadow Copy Service to freeze the state of files to be backed up. I cannot traverse the shadow copy directly using QDir set to the…
riverofwind
  • 525
  • 4
  • 17
0
votes
1 answer

Cannot remove a directory with bad name, created accidentally by Qt in Windows 10

I've created a directory using QDir but the given name had two dots in the end, Qt created this directory although its bad naming, and now my windows 10 OS cannot operate on this invalid directory. I cannot do any operation on it. I've done…
Mehran Khazaeizadeh
  • 1,021
  • 1
  • 7
  • 13
0
votes
0 answers

Accesing multiple sub folders with QDir

Could not find my solution in prior posts. How can I read all the files from out of my resource folder which has multiple subfolders. For example the file structure: fonts/test1 ...test1.ttf fonts/test2 ...test2.otf fonts/test3 ...test3.woff2 …
pennyBoy
  • 397
  • 2
  • 17
0
votes
1 answer

How to save a file from Qrc to application directory

I am using Qt 5.15.1. If I have a file in in my Qt app's qrc file, is it possible to save the file into application's directory so that I can use that file as a normal file on the file system? QFile my_file(":/data/file.txt"); QDir…
TheWaterProgrammer
  • 7,055
  • 12
  • 70
  • 159
0
votes
1 answer

How can I concatenate absolute path with relative path?

Is there any function in QDir that allow us to concatenate 2 path (one is direct path and the other one is relative) For example: path 1 is "C:/home/user1/project/data" path 2 is : "../data2/file.txt" the result should be a String equal to…
Maram
  • 31
  • 10