Thanks Justin! Cheers.
2013/3/5 Justin Israel <[email protected]> > You can use button.setCursor() and pass it a QCursor with either one of > the built-in shapes or a custom pixmap > http://qt-project.org/doc/qt-4.8/qwidget.html#cursor-prop > > This will add it as a cursor just for that widget. > On Mar 6, 2013 1:53 AM, "CharlieWales" <[email protected]> wrote: > >> Is it posibble to add an icon to my mouse cursor? I mean, how would i go >> about showing an icon when I hover over a button that has a context menu as >> Maya does with its own popupMenus (showing a little icon next to the mouse >> cursor)? This way users can tell if there is a context menu attached to >> some UI. >> >> >> >> ######################################################################################## >> >> ######################################################################################## >> >> import sys >> from PyQt4 import QtGui, QtCore >> >> class MainForm(QtGui.QMainWindow): >> def __init__(self, parent=None): >> super(MainForm, self).__init__(parent) >> >> # create button >> self.button = QtGui.QPushButton("test button", self) >> self.button.resize(100, 30) >> >> # set button context menu policy >> self.button.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) >> self.connect(self.button, >> QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), >> self.on_context_menu) >> >> # create context menu >> self.popMenu = QtGui.QMenu(self) >> self.popMenu.addAction(QtGui.QAction('test0', self)) >> self.popMenu.addAction(QtGui.QAction('test1', self)) >> self.popMenu.addSeparator() >> self.popMenu.addAction(QtGui.QAction('test2', self)) >> >> def on_context_menu(self, point): >> # show context menu >> self.popMenu.exec_(self.button.mapToGlobal(point)) >> >> form = MainForm() >> form.show() >> >> >> >> >> ######################################################################################## >> >> ######################################################################################## >> >> >> I would like to add some visual cue to the button to show that it has a >> context menu. >> >> Cheers. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- *Carlos Rico Adega *Maya Generalist* *------------------------------------- <http://www.vimeo.com/16765581> LinkedIn<http://www.linkedin.com/pub/carlos-rico/6/58/325> [email protected] -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
