Have a list of instances of a structure, you might want to add some more info later and there is no point in redesigning everything then. Or just use QStandardItemModel.
Printable View
Have a list of instances of a structure, you might want to add some more info later and there is no point in redesigning everything then. Or just use QStandardItemModel.
That's a good idea. The problem with QStandardItems is that it must store the whole path, but show only the name in the view.
Also, how do I avoid starting huge amounts of the concurrent thumbnail functions at once? Or is it OK?
Sorry? There is Qt::DisplayRole for what gets shown and an infinite number of custom roles you can use for any data you want (such as the full path).
It's ok, they will be queued.Quote:
Also, how do I avoid starting huge amounts of the concurrent thumbnail functions at once? Or is it OK?
You can pass any integer equal or larger than Qt::UserRole as the role for any method accepting a role identifier.
Yes. QtConcurrent will only run concurrently at most as many jobs as you have cores available in your machine (so 1 task for 1 core, 2 tasks for 2 cores, etc.), excluding the main execution thread (so Qt Concurrent guarantees that at least one job will be ran). The remaining jobs will be queued until there are idle threads available.Quote:
They will be queued automatically without me taking any action?
Yes, that's correct.
Code:
enum { myCustomStringRole = Qt::UserRole+1, myCustomColorRole }; //... item->setData("my custom string", myCustomStringRole);