Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QtGui.QIcon("filename.png") results in blank button, version PyQt4.4.4
Forum Updated to NodeBB v4.3 + New Features

QtGui.QIcon("filename.png") results in blank button, version PyQt4.4.4

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SatelliteEyes
    wrote on last edited by
    #1

    Hi, I have the following code to put an "Exit" button on a toolbar (zetcode tutorial).

    @def initUI(self):
    exitAction = QtGui.QAction(QtGui.QIcon('exit.png'),'Exit',self)
    ...
    @

    This gives me a toolbar with an invisible button. I can mouse over it, which triggers a little blank raised button, and click it, which causes an exit as it is supposed to. The icon, however, is not present.

    I have been over the Qt forums and version-specific documentation (http://doc.qt.digia.com/4.4/index.html) and have tried many many versions of the above code including creating a QPixmap (because I can not find 'exit.png' in my path, so I believe I need to make my own), and adding a new .png to my working directory. Do I have to draw my own? How do I do that? Is it a command line prompt that pulls up a Paint-like application?

    Supposedly pyqt looks for icons in \usr\share\pixmaps. I used sys.path.append to add this to my sys.path and then I substituted a known .png file for 'exit.png'. I still got the blank button.

    All the help I have seen suggests using QIcon.fromTheme('exit'), but when I tried that I got AttributeError: fromTheme. Does this function not exist in my version? This is for a work project and I am not an admin on my computer, so I've got to do with the version I have. Is there a workaround for v.4.4.4?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved