Yes, please :3
On Wed, Apr 3, 2013 at 2:30 PM, Justin Israel <[email protected]>wrote: > There are optimizations for the QGraphicsView, but I wouldn't think you > would need them right away with just a few items. Also the default > ViewportUpdateMode should be the MinimalViewportUpdate which tries and > draws only the smallest partial areas of the scene that change. Moving one > item should only be drawing small portions at a time. > You would probably want to make sure you have the > default DeviceCoordinateCache set for the CacheMode of the items. > > If you want to zip up a working minimal example that exhibits the > slowness, I will take a look at it for you. > > > > On Apr 3, 2013, at 7:51 PM, Tuan Nguyen wrote: > > Sorry, i had fixed the the indents. And yes, it slows when i try to moving > them (the UI) around. not when i create them. This problem not relate to > how we setup the GraphicsView and Scene, isn't it? > > I will try what you told me first :3 > > > On Wed, Apr 3, 2013 at 1:06 PM, Justin Israel <[email protected]>wrote: > >> The formatting and indents are all messed up on that gist. But it doesn't >> look like you are doing much of anything in the paint event. Is it slow to >> add them to the scene, or slow when you have 1000 of them and are just >> moving them around? >> >> One thing I can see is that it may be related to the sheer number of >> individual svg images being loaded. What you might want to do is share a >> renderer for svgs that you constantly load. For instance, you have the >> common ":/Scene_ConnectNode.svg" image being loaded multiple times for >> every GSceneItem; once for the output and then N number of input keyItems. >> What you could do is create just one renderer for it and store it on the >> scene or whereever, and then set that renderer on every new Connectionitem: >> >> ## >> self._connRenderer = QSvgRenderer(':/Scene_ConnectNode.svg') >> ... >> inputNode = ConnectionItem(self) >> inputNode.setSharedRenderer(self._connRenderer) >> self.inputNode[key] = inputNode >> ... >> outputNode = ConnectionItem(self) >> outputNode.setSharedRenderer(self._connRenderer) >> self.outputNode = outputNode >> ## >> >> You could also do the same for your node.sceneImage paths if they are a >> common set. Keep a dictionary of renderers mapping to the path, and set the >> shared renderer on each one. This might greatly reduce the number of times >> you are loading this into memory. Though for all I know, Qt might be doing >> some smart caching under the hood. But if its anything similar to QPixmaps, >> this would work. I do the same with QPixmapCache, to cache the same path >> instead of loading a new one for each. >> >> Also the docs say that by default caching is enabled so you shouldnt have >> to mess with any of that to get performance. >> >> >> >> >> On Wed, Apr 3, 2013 at 6:33 PM, Tuan Nguyen <[email protected]>wrote: >> >>> The first thing i had found out is the svg image i use for GraphicsItem >>> is too complicate, after i remove all the detail from it, it runs a little >>> smoothly but thousands of items O.O, i can't even imagine it. Here is the >>> class of GraphicsItem i used >>> >>> https://gist.github.com/illunara/5298674 >>> >>> Thanks for reply >>> >>> >>> On Wed, Apr 3, 2013 at 6:04 AM, Judah Baron <[email protected]>wrote: >>> >>>> Yeah, that sounds suspicious. What's going on with those 20 items? >>>> >>>> >>>> On Tue, Apr 2, 2013 at 11:07 AM, Justin Israel >>>> <[email protected]>wrote: >>>> >>>>> 20 items is by no means "a lot". I have had scenes with thousands of >>>>> items. It sounds like you might be doing something heavy in your paint >>>>> events. >>>>> Can you provide some more details about the items you are using? >>>>> Snippet? >>>>> On Apr 3, 2013 1:01 AM, "illunara" <[email protected]> wrote: >>>>> >>>>>> Hi everybody >>>>>> I'm working with QGraphicsView for a while, and after had finished >>>>>> some basic stuff, i realized it gets slow down when there are a lot of >>>>>> items (around 20, and it will freeze). >>>>>> >>>>>> When i set cacheMode in QGraphicsItem to ItemCoordinateCache which >>>>>> will block the paintEvent, the performance is improve. So i guess that is >>>>>> the cause. However, i don't know how to solve this yet :( >>>>>> >>>>>> Thanks >>>>>> >>>>>> -- >>>>>> 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 post to this group, send email to >>>>>> [email protected]. >>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>> >>>>>> >>>>>> >>>>> -- >>>>> 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 post to this group, send email to >>>>> [email protected]. >>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>> >>>>> >>>>> >>>> >>>> >>>> -- >>>> 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/KO-lFG2GYMY/unsubscribe?hl=en-US >>>> . >>>> To unsubscribe from this group and all its topics, send an email to >>>> [email protected]. >>>> >>>> To post to this group, send email to >>>> [email protected]. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>>> >>>> >>> >>> >>> -- >>> 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 post to this group, send email to [email protected] >>> . >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> >> -- >> 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/KO-lFG2GYMY/unsubscribe?hl=en-US >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > -- > 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 post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > 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/KO-lFG2GYMY/unsubscribe?hl=en-US > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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 post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
