I remember having some issues early on getting QIcons to work.  But they
work fine now, This is the method that I used

 # set the icons

        import os.path
        imgpath = os.path.split(
"T://WG//RTR_WG//Application//Plugins//img" )[0] + '//img//'

        self.setWindowIcon(     QIcon( imgpath + 'oneLogo.png' ) )

        self.forwardButton.setIcon( QIcon( imgpath +
"button_forwardOn.png"))
        self.backButton.setIcon( QIcon( imgpath + "button_backOn.png"))
        self.keyButton.setIcon( QIcon( imgpath + "button_okOn.png"))
        self.deleteButton.setIcon( QIcon( imgpath + "button_cancel.png"))
        self.resetButton.setIcon( QIcon( imgpath + "buttons_21.png"))


On Wed, Feb 6, 2013 at 8:15 AM, Xavier Lapointe <[email protected]>wrote:

> Hey Philipp,
>
> you might want to make sure that your path is ok (file exists and so on),
> and maybe try using 
> *addFile<http://qt-project.org/doc/qt-4.8/qicon.html#addFile>
>  *on your QIcon object ...
>
> I doubt that might be the case, bus maybe you need to cast your path to a
> QString *QIcon <http://qt-project.org/doc/qt-4.8/qicon.html#QIcon-4>* (
> const QString & *fileName* )?
>
>
>
> Cheers
>
>
>
>
>
> On Wed, Feb 6, 2013 at 8:50 AM, Simon Anderson <
> [email protected]> wrote:
>
>> Currently at work, I can see if I can get an icon showing when im home,
>> but I do remember us having icons on our buttons.
>>
>>
>>
>>
>> On Wed, Feb 6, 2013 at 6:07 AM, philipp.oeser <[email protected]>wrote:
>>
>>> **
>>>  Hi list,
>>>
>>> first of all: thanx again for bringing PyQT to Softimage!
>>> (it's just so much nicer to be able to do UIs for SI, Nuke and Maya in
>>> _one_ go :))
>>>
>>> But: I was wondering if someone else is having trouble getting QIcons to
>>> show in PyQT for Softimage?
>>> I have some code that runs fine in Maya and Nuke (it shows the icons
>>> with QStandardItems in a QTreeView)
>>> but the exact same code/ui-file just doesnt show the Icons in
>>> Softimage...
>>>
>>> ======= something like this ===============
>>> oTasksModel = QtGui.QStandardItemModel()
>>> oRootItem = oTasksModel.invisibleRootItem()
>>> self.ui.UI_tv_Tasks.setModel(oTasksModel)
>>>
>>> sTask = 'taskname'
>>> oTaskItem = QtGui.QStandardItem(sTask)
>>>
>>> sFullPath = 'validpath'
>>> oIcon = QtGui.QIcon(sFullPath)
>>> oTaskItem.setIcon(oIcon)
>>>
>>> # it seems to be taken, if you print out oTaskItem.icon(), it will print
>>> # <PyQt4.QtGui.QIcon object at 0x000....>
>>>
>>> oRootItem.appendRow(oTaskItem)
>>> ==================================
>>>
>>> Has this been done succesfully? Or can someone confirm it is not
>>> working? Should I dig deeper?
>>>
>>> Thanx in advance
>>> Philipp
>>>
>>>  P.S. using PyQt-Py2.6-x64-gpl-4.9.5-1 and PyQtForSoftimage_beta5
>>>
>>
>>
>>
>> --
>> -------------------
>> Simon Ben Anderson
>> blog: http://vinyldevelopment.wordpress.com/
>>
>
>
>
> --
> Xavier
>

Reply via email to