[3dsMax][pyside] fun

Is anyone able to get a simple QIcon to show up with pyside? Button or QlistWidget or anything?

Here is my code straight from Autodesk help, with the icon additions…

from PySide import QtGui
import MaxPlus

class _GCProtector(object):
widgets = []

def make_cylinder():
obj = MaxPlus.Factory.CreateGeomObject(MaxPlus.ClassIds.Cylinder)
obj.ParameterBlock.Radius.Value = 10.0
obj.ParameterBlock.Height.Value = 30.0
node = MaxPlus.Factory.CreateNode(obj)
time = MaxPlus.Core.GetCurrentTime()
MaxPlus.ViewportManager.RedrawViews(time)

return

app = QtGui.QApplication.instance()
if not app:
app = QtGui.QApplication([])

def main():
MaxPlus.FileManager.Reset(True)
w = QtGui.QWidget()
w.resize(250, 100)
w.setWindowTitle(‘Window’)
_GCProtector.widgets.append(w)
w.show()

main_layout = QtGui.QVBoxLayout()
label = QtGui.QLabel("Click button to create a cylinder in the scene")
main_layout.addWidget(label)

cylinder_btn = QtGui.QPushButton("Cylinder")

#-------- addition to get a simple icon to work
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("H:/3D/0-Library/Default/default_icon.jpg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
cylinder_btn.setIcon(icon)
#-------- 

main_layout.addWidget(cylinder_btn)
w.setLayout(main_layout)

cylinder_btn.clicked.connect(make_cylinder)

if name == ‘main’:
main()

So I have found out that if I run the same code or similar in Pyside within our local python2.7 dir the icons work. In the 3ds max build it doesn’t.
Not sure where to go from here. I think the problem lies within the QtGui modules…

Any ideas.
david

problem is that max doesn’t ship with standard pyside, your max pyside doesn’t support jpegs for instance.

call:
print QtGui.QImageReader.supportedImageFormats()

and you’ll see whats installed.

if you compare your installation and the standard pyside you’ll see that you don’t have taht plugin/imageformats folder.
that’s why it works with standard pyside installation but not with max

Change your file to a png and try again. I converted all our icons to png and it seems to work. It’s a native format to Qt.