@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 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/CAPGFgA05AT0Q7iHs-uO0AVtKj-K44ZnGWOJTnspxdYzPyTmd7Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
