On Mon, Sep 8, 2014 at 6:45 PM, Bay Gann Boon <[email protected]> wrote:
> Hi Justin, > thank you again for taking the time to explain using > QItemDelegate to me. Would it be possible for you to explain to me what you > mean by " For more expensive calls or things where the value doesn't > change, you can compute them once ahead of time."? just want to understand > the scenario that you're speaking of. > "More expensive calls" being stuff like computing the same result over and over, or loading images from disk, or doing network stuff, or calling to the Maya API for anything that could take time. You just want to make sure you are doing the least amount possible in paint events, because they get called a ton of times. > > Regarding the tutorial you speak of, I'm assuming it's > the PyQT UI Tutorial on cmivfx? > Yea, in that cmiVFX PyQt video I used custom painting for a Gauge widget that draws progress > > Thank you > Gann Boon Bay > > On Sun, Sep 7, 2014 at 12:41 PM, Justin Israel <[email protected]> > wrote: > >> @Marcus, I believe based on the example code that a different image is >> meant to be used dynamically for each item. That is, unless I read the >> example wrong. >> >> @Bay, since you can only assign one delegate per row/column, you would >> need to have all of you conditions in that same delegate. Just be very >> mindful of what you do in a paint method. It gets called very often and you >> don't want to do anything that takes a lot of time otherwise it will lag. >> For more expensive calls or things where the value doesn't change, you can >> compute them once ahead of time. >> >> I tend to use both style sheets and paint logic. Stylesheets are great >> for overall custom looks and behavior, but obviously they can only express >> logic within the ability of css. If you end up wanting to draw anything >> more custom, then paint logic let's you do basically thing you want. I did >> an example of this in my PyQt video where I made a custom gauge widget. I >> also use custom paint delegates for stuff like drawing special progress >> bars in views or different types of dynamic state indicators. >> On 8/09/2014 5:23 AM, "Marcus Ottosson" <[email protected]> wrote: >> >>> Hi Bay, >>> >>> Am I understanding you correctly in that you want to have an image >>> appear when the user hovers an item, and have another image appear when he >>> exits? You can do something like this: >>> >>> QListWidgetItem { >>> background-image: url(my_image.png)} >>> QListWidgetItem:hover { >>> background-image: url(my_hover_image.png)} >>> QListWidgetItem:checked:hover { >>> background-image: url(my_checked_hover_image.png)} >>> >>> Where “my_image” is an image path relative to where you ran the script. >>> >>> I personally avoid any styling in Python and haven’t yet found a reason >>> to since I started using Stylesheets, they rock! >>> >>> >>> -- >>> 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/CAFRtmODCq%2B_a06N8rvyJ6WPaUFqO6DTsJQiivck%3Du8Yj5Pgc_w%40mail.gmail.com >>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODCq%2B_a06N8rvyJ6WPaUFqO6DTsJQiivck%3Du8Yj5Pgc_w%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 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/N8eOmxHAjp4/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/CAPGFgA05AT0Q7iHs-uO0AVtKj-K44ZnGWOJTnspxdYzPyTmd7Q%40mail.gmail.com >> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA05AT0Q7iHs-uO0AVtKj-K44ZnGWOJTnspxdYzPyTmd7Q%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/CAO52s0GQuje-coyeEe0VN8FpH2z%2B5ZWAwvH8VcyP03iGr9xd3g%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAO52s0GQuje-coyeEe0VN8FpH2z%2B5ZWAwvH8VcyP03iGr9xd3g%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/CAPGFgA1y%3DxXeymqn%3DUnkcMBGkk0sXk3PgLX_jv46tftZPKanhA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
