[PyQt] QGraphicsView fails to setWindowIcon

Dan Smith lalkabar69 at hotmail.co.uk
Thu Aug 19 15:16:18 BST 2010


Hey,

I'm using sub-classed QGraphicsView's in an MDIArea I want to change the
icon of the window from 'within' the object, but it just seems to ignore
me... no errors or warnings... it just doesn't do it.

if self.world.is_dirty:
    self.setWindowIcon( QtGui.QIcon ( 'images/dirty.png' ) )
    self.setWindowTitle('dirty')
else:
    self.setWindowIcon( QtGui.QIcon ( 'images/clean.png' ) )
    self.setWindowTitle('clean')

Using the above, the WindowTitle changes perfectly and as expected, but the
icon remains stubbornly fixed as the MainWindow icon. 
I thought it might be stuggling with the QIcon, but I've checked the
isNull() and that's false.. so not Null.

As I test, I tried the changing the icon from the MainWindow object and that
works fine...

self.mdiArea.activeSubWindow().setWindowIcon(QtGui.QIcon
('images/dirty.png'))

So why is it ignoring me when i try it from the View?

Any Ideas?
Dan


--
I am using the free version of SPAMfighter.
We are a community of 7 million users fighting spam.
SPAMfighter has removed 227308 of my spam emails to date.
Get the free SPAMfighter here: http://www.spamfighter.com/len

The Professional version does not have this message




More information about the PyQt mailing list