2011/9/10, Gene Hansen <[email protected]>:
> Figured it out. I was totally going down the wrong path.
>
> The icons in my QTreeViews were not showing up because the relative path to
> their resource file does not work when running under maya.exe. I had no idea
> that PyQt doesn't error when it can't locate a resource and it was happily
> assigning blank icons to my tree.
>
>
>
> On Fri, Sep 9, 2011 at 11:23 AM, Gene Hansen <[email protected]> wrote:
>
>> Thanks for the reply Justin!
>>
>> Okay, using setStyleSheet() is the only real progress I've made on this
>> issue. However, style sheets don't seem to provide the level of control I
>> need to restore certain widgets to what they look like before Maya gets a
>> hold of them.
>>
>> My main problem is what Maya is doing to two QTreeViews that make up the
>> bulk of my tool. The tree views are using a custom QAbstractItemModel
>> class
>> and a custom item class that create a look much like the Outliner where
>> each
>> item has an icon that reflects its "type". Running the widget outside Maya
>> works great, all icons appear and everything functions like it should. Run
>> the tree views in Maya however and the icons never appear.
>>
>> I stepped through the code while running in Maya and my item model is
>> definitely assigning the icons but the icons simply don't show up. The
>> Maya
>> "style" that is being inherited by tool seems to be disabling icon display
>> for trees or setting tree items to some sort of simplified text only look.
>>
>> I search the Qt stylesheet docs for a solution, but its icon controls seem
>> very limited. I was able to get icons to appear while running in Maya but
>> only for use as the "expander" button and only based only limited
>> predefined
>> conditions.
>>
>> The docs I found are here:
>> http://doc.qt.nokia.com/4.7/stylesheet-examples.html#customizing-qtreeview
>>
>> Anyone have any more ideas on this? It's extremely aggravating that there
>> isn't a simple way to block a parent widgets "style" from cascading down
>> to
>> it's children.
>>
>>
>>
>>
>>
>> On Thu, Sep 8, 2011 at 1:14 PM, Justin <[email protected]> wrote:
>>
>>> You can use QWidget.setStyleSheet() to define your own style that
>>> overloads the default maya style.
>>>
>>> Example.
>>> dialog = QtGui.QDialog()
>>> dialog.setStyleSheet("background-color: rgb(0, 255, 25); color:
>>> rgb(255, 0, 3);")
>>>
>>>
>>> On Sep 8, 1:16 am, ehansen <[email protected]> wrote:
>>> > Hey Guys,
>>> >
>>> > I'm working on a new tool in PyQt and I have Maya as the parent of the
>>> > tool's window (Maya is a QMainWindow object). Problem I'm having is
>>> > that the tool is inheriting Maya's "style" and its drastically
>>> > modifying the look and feel of my widgets.
>>> >
>>> > Anyone know how to prevent child widgets from inheriting Maya's look?
>>> > I'm working in Maya 2012.
>>> >
>>> > Thanks in advance!
>>>
>>> --
>>> view archives: http://groups.google.com/group/python_inside_maya
>>> change your subscription settings:
>>> http://groups.google.com/group/python_inside_maya/subscribe
>>>
>>
>>
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>

-- 
从我的移动设备发送

Sincerely yours,
Kurt

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to