[Interest] building a light weight tree model

Frank Rueter | OHUfx frank at ohufx.com
Wed May 3 00:18:45 CEST 2017


Thanks for the tip.
I don't know C++ so that's not an option, but I can Cythonise and 
compile later.

Actually, I started with a command line app that just printed out a 
report. In my analysis I need to visit every file and directory and 
collect data such as size, file extensions, matches to a user filter etc.
Hence it felt natural to collect QStandardItems as I went, rather than 
us QFileSystemModel and then cycle through all items after the fact.
I will have a look at doing that though, since you  seem to be in 
agreement that it will be faster.

 >>QStandardItemModel is not the API you are looking for
Can you clarify please? I thought it was one of the simplest models and 
hence I gravitated towards that.
Should I use QAbstractItemModel instead (unless I end up using 
QFileSystemModel)?

Cheers,
frank

On 3/05/17 7:52 AM, André Somers wrote:
>
> Hi
>
>
> Op 02/05/2017 om 09:15 schreef Frank Rueter | OHUfx:
>> I need a few custom views for my data, including representing 
>> collections of files with a certain extension as virtual zip files, 
>> i.e. items that don't actually exist on disk.
> So, use a proxy model or a model that wraps the original one.
>> I assumed using QFileSystemModel would not be the most efficient way 
>> to use i this case (based on various comments I read in the past).
> Eh... If you want to know if your code is efficient, you should not 
> start from assumptions. You should start with measurements and some 
> concrete goals.
>
> Other than that, I fully agree with Chris: if you want this to work 
> fast, use C++ and avoid QStandardItemModel, especially for "huge" 
> models. QStandardItemModel is not the API you are looking for (ever, 
> IMHO, with a possible exception for small toy projects).
>
> André
>
>>
>>
>> On 2/05/17 6:25 PM, Ch'Gans wrote:
>>>
>>>
>>> On 2 May 2017 at 17:55, Frank Rueter | OHUfx <frank at ohufx.com 
>>> <mailto:frank at ohufx.com>> wrote:
>>>
>>>     Hi all,
>>>
>>>     Here is a snippet of test code to mimic a light weight tree model.
>>>     All it is trying to do is mimic the parenting according to the
>>>     directory structure on disk using QStandardItems in a
>>>     QStandardModel.
>>>     It works, but it took me way longer to figure out than I
>>>     expected, and I have a feeling some of you may have good advise
>>>     on how to make it more efficient.
>>>     https://pastebin.com/vRkzDPtt
>>>
>>>
>>> What's your definition of "more efficient", what are the problems, 
>>> what make you think it's not efficient?
>>>
>>> If you want efficiency, then don't use python and don't use 
>>> QStandardModel, if you want expediency then use QFileSystemModel.
>>>
>>> My 2 cents.
>>> Chris
>>>
>>>
>>>
>>>
>>>     I am not using QFileSystemModel as I wanted to keep things as
>>>     efficient as possible and also need to add some custom items to
>>>     the model.
>>>     Also, for the Python programmers: in my actual code I am using
>>>     scandir.walk() instead of os.walk() for speed.
>>>
>>>     Any input would be greatly appreciated as I will need to run
>>>     this over disks that have massive amounts of files.
>>>
>>>     Cheers,
>>>     frank
>>>
>>>
>>>     -- 
>>>
>>>     ohufxLogo 50x50 <http://www.ohufx.com> 	
>>>     	*vfx compositing <http://ohufx.com/compositing.html> |
>>>     *workflow customisation and consulting
>>>     <http://ohufx.com/customising.html>* *
>>>     		*<http://ohufx.com/compositing.html>*
>>>     <http://www.nukepedia.com/nubridge> 	
>>>     	
>>>
>>>     Your gateway to over 1,000 free tools... right inside of Nuke
>>>     <http://www.nukepedia.com/nubridge>
>>>
>>>
>>>     _______________________________________________
>>>     Interest mailing list
>>>     Interest at qt-project.org <mailto:Interest at qt-project.org>
>>>     http://lists.qt-project.org/mailman/listinfo/interest
>>>     <http://lists.qt-project.org/mailman/listinfo/interest>
>>>
>>>
>>
>>
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170503/68691c46/attachment.html>


More information about the Interest mailing list