Thanks for the replies. I should have been more clear. What I'm doing that takes the time is instantiating 50k QIcons using file paths to 50k jpegs, each 512x512 pixels. Creating items, telling the icons what size I want them to display, adding them to my QStandardItemModel and displaying them in my view is still fast. I run the same code in Maya 2016 and 2017.
I'm at home now but I'll try to be more specific tomorrow. On 22 May 2017 9:42 PM, "Justin Israel" <[email protected]> wrote: > > > On Mon, May 22, 2017, 8:10 PM Michael Boon <[email protected]> wrote: > >> Hey all, >> >> I've just discovered that QIcon is really slow to create in Maya 2017. >> I'm creating what is essentially a file browser, and my old version had a >> QStandardItemModel, a QListView with >> setViewModel(QtWidgets.QListView.IconMode) >> and about 50,000 icons. Creating the icons used to take ~1 second and >> now takes ~5 minutes. >> > > Are they actually 50k discreet source images, or is it 50k items in your > model which make use of a smaller collection of icons? > > Do you make any use of reusing the same QIcon for the same source file or > is a new instance created per item for the same file each time? If you know > all your icons up front, you can create the set of them up front. Or you > can use a cache to create them once as needed and retrieved from the cache > on subsequent needs. > > If nothing has changed in your own code between Qt4 and Qt5, maybe there > is a difference in how they implicitly cache images for you. > > >> Has anyone else found this? Does anyone know a way around it? Or has >> anyone else found that they can create QIcons fast? >> >> Thanks! >> >> Boon >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit https://groups.google.com/d/ >> msgid/python_inside_maya/185bdb63-7a77-4201-83e8- >> 3f361b1cca4b%40googlegroups.com >> <https://groups.google.com/d/msgid/python_inside_maya/185bdb63-7a77-4201-83e8-3f361b1cca4b%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Python Programming for Autodesk Maya" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/python_inside_maya/4J47CxyM11A/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/python_inside_maya/CAPGFgA27psr3di%3Dv2JksA6pdhapKUJNqnTERESs8vMi > U4LG2_g%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA27psr3di%3Dv2JksA6pdhapKUJNqnTERESs8vMiU4LG2_g%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAA27_y%2BK0CS5-HKrijv7cgqFT%3DD9kn3B0qrCAs%3D%3Di5gdaxpRZw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
