Alex K
Alex K

Reputation: 11165

Get Network path for files in Qt

I am using Qt's QFileDialog to let user add files, but I run into issues adding files from network drives. The path I get from getOpenFileName() function is always local one. So if a network share \\share1 is mounted in Windows as J:\, I will get a path starting with J:\.

This is not useful because people may have the same share mounted under different letter and when one user adds a path to the DB I want the other users to be able to access that path without guessing which server it's supposed to be on.

Upvotes: 1

Views: 3228

Answers (1)

user362638
user362638

Reputation:

It seems that you cannot make this with Qt alone, you need to use WinAPI. Check if the path contains : character and then find out the network path using WNetGetConnection.

Upvotes: 1

Related Questions