Set path of setRootIndex using a directory of project
-
Hi
Im not sure when issue comes ?Do you do something like
directory->setRootIndex(model->index(":/qres/icons/"));Or what you mean ?
-
@mrjj sorry, I think I didn't explain myself well.
My goal is set setRootIndex with the path of a folder which is included in my project.
So, I included the folder using Qt Resource System, and when I use it in
model->index("path")
and I build the project, compilation does not end.QPixmap pixmapWheelX (":/qres/icons/wheel.png") was an example to explain another point where I use Qt Resource System -and this works.
-
@mrjj sorry, I think I didn't explain myself well.
My goal is set setRootIndex with the path of a folder which is included in my project.
So, I included the folder using Qt Resource System, and when I use it in
model->index("path")
and I build the project, compilation does not end.QPixmap pixmapWheelX (":/qres/icons/wheel.png") was an example to explain another point where I use Qt Resource System -and this works.
-
@mrjj said in Set path of setRootIndex using a directory of project:
So when you say "included in my project.", you mean its added to a resource file that is compiled into the project ?
and if you then use this resource file for the model, it will then compile for ever ??yes, that's right
-
@mrjj said in Set path of setRootIndex using a directory of project:
So when you say "included in my project.", you mean its added to a resource file that is compiled into the project ?
and if you then use this resource file for the model, it will then compile for ever ??yes, that's right
Hi
I tried to reproduce this by
1: add a sub folder to the project folder
2: add this folder to a resource file (included in the project)
3: use QFileSystemModel with this sub folder
however, nothing bad happened.
(it just compiled)SO did I miss a step ?
What Qt version are you using ?
-
Hi
I tried to reproduce this by
1: add a sub folder to the project folder
2: add this folder to a resource file (included in the project)
3: use QFileSystemModel with this sub folder
however, nothing bad happened.
(it just compiled)SO did I miss a step ?
What Qt version are you using ?
-
@mrjj Hi
The steps are right
My version is: Qt Creator 4.12.4
Based on Qt 5.14.2 (MSVC 2017, 32 bit)@giusirux Not the version which QtCreator was build with, we need the version of Qt you're compiling your apps with.
-
@giusirux Not the version which QtCreator was build with, we need the version of Qt you're compiling your apps with.
@Christian-Ehrlicher yes, sorry
Qt 5.13.2 -
ok, the Build problem is solved, but the path is not correct when the application runs.
The folder, which I included in the project, has three subfolders.
So, after I added the folder to a resource file, I copied and pasted the path in setRootPath and setRootIndex, but the folder which I see when the application runs is "C:"
Any suggestions? -
Hi,
AFAIK, qrc files shall contain a list of file paths. Putting a folder in there will not recursively add the files and subfolders in there.
-
Hi,
AFAIK, qrc files shall contain a list of file paths. Putting a folder in there will not recursively add the files and subfolders in there.