Advertisement
Guest User

Untitled

a guest
Jul 13th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from PySide import QtCore, QtGui
  2.  
  3. class TestWidget(QtGui.QWidget):
  4.   """
  5.  A simple Pie menu class. Use in a similar way to QMenu: Create a PieMenu and add QActions to it with QAction.
  6.  """
  7.  
  8.   def __init__(self, parent=None):
  9.     super(TestWidget, self).__init__(parent)
  10.  
  11.     # with this flag set the application does not quit properly, without it does
  12.     self.setWindowFlags(QtCore.Qt.Tool)
  13.  
  14.   def mousePressEvent(self, e):
  15.     self.close() # this closes the widget but does not quit the application
  16.     app = QtGui.QApplication.instance()
  17.     if True: # what logic can I use to figure out if this is a standalone app or run from a host applicatin?
  18.       app.quit()
  19.  
  20.  
  21. if __name__ == '__main__':
  22.   import sys
  23.   app = QtGui.QApplication(sys.argv)
  24.   w = TestWidget()
  25.   w.show()
  26.   sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement