PDA

View Full Version : QProcess output in TreeView?!?



nupul
2nd May 2006, 07:37
I wish to create a front end for the GNU "locate" tool on my system. What I am not able to figure out is how to get the output from locate (using Qprocess) and display it in a QTreeView? The user should be able to click on the column header and be able to sort the entries. How do I do this?

Example:

$> locate openoffice.png

Output:




/home/nupul/trials/menus/progs/fav_progs/openoffice.png
/opt/gnome/share/icons/hicolor/16x16/stock/generic/stock_openoffice.png
/opt/gnome/share/icons/hicolor/32x32/stock/generic/stock_openoffice.png
/opt/kde3/share/icons/hicolor/16x16/apps/openoffice.png
/opt/kde3/share/icons/hicolor/32x32/apps/openoffice.png
/opt/kde3/share/icons/hicolor/48x48/apps/openoffice.png
/opt/kde3/share/icons/hicolor/64x64/apps/openoffice.png


Thanks!

Nupul

PS: any suggestions to improve this front end are more that welcome!

zlatko
2nd May 2006, 08:05
Read this (http://www.qtcentre.org/forum/showthread.php?t=1023)
This post about use reading from stdout. After read You get result in byte array. After that create string and split it with separator "\n". Then for every new string create QtreeWidgetItem.
I think it must worked :rolleyes: