Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a filePath m_curProjFile.

I want to open the folder containing the file and have the file selected.
(in windows explore).

By Now I used:

C++
QDesktopServices::openUrl(QUrl(QString("file:///")+  QFileInfo(m_curProjFile).absolutePath()));



Only can open the folder but I still have to find the file by eyes from the long list!

any hint?

thanks in advance!
Posted

1 solution

See this Qt forum thread: http://qt-project.org/forums/viewthread/18643[^].

Use the system or QProcess::execute command passing a string to start the Windows Explorer with the /select parameter (see http://support.microsoft.com/kb/152457/en-us[^]).

But this solution is platform dependant. Depending on your requirements you might also use the QFileDialog class to show a file open dialog.
 
Share this answer
 
Comments
jiazhiqiang 10-Dec-14 6:43am    
thanks very much!this's really helpful!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900