title: How do I connect WindowContextHelpButtonHint to a widget click?
body: <p>I can add <code>self.setWindowFlags(Qt.Window | Qt.WindowContextHelpButtonHint | Qt.WindowCloseButtonHint)</code> to the constructor of my <code>QMainWindow</code> which adds the '?' button. Now I want to add contextual help information to virtually all UI components. How do I connect a click on the '?' button and then a click on some ui element (say a <code>qlistview</code>) such that a help message pops up?</p>
  
  <p>Below is part of my program stripped to make it easy. How do I make it such that when the user clicks the '?' and then either a <code>QDoubleSpinBox</code> or the <code>QListView</code> or any of the <code>QPushButtons</code> that a help message displays?</p>
  
  <p>I have searched for this but it seems the vast amount of questions and answers are about how to remove the '?' button or how to add it. None actually deal with how to alter the button's behaviour. </p>
  
  <p>I've also tried using <code>setInputMethodHints()</code> to assign hints to ui components but this method doesn't accept custom strings as I assumed it would.</p>
  
  <p>Btw: I also would like the '?' button to not replace the minimization button. I have yet to figure out how to achieve this either.</p>
  
  <pre><code>import sys
  from PyQt4.QtCore import *
  from PyQt4.QtGui import *
  
  APPNAME = 'Mesoscale Brain Explorer'
  class MainWindow(QMainWindow):
    def __init__(self, parent=None):
      super(MainWindow, self).__init__(parent)
      self.setWindowTitle(APPNAME)
      self.sidebar = Sidebar()
      self.setWindowFlags(Qt.Window | Qt.WindowContextHelpButtonHint | Qt.WindowCloseButtonHint)
      self.setup_ui()
  
    def setup_ui(self):
      self.pl_frame = QFrame()
      splitter = QSplitter(self)
      self.enable = lambda yes: splitter.setEnabled(yes)
      splitter.setHandleWidth(3)
      splitter.setStyleSheet('QSplitter::handle {background: #cccccc;}')
      splitter.addWidget(self.sidebar)
      splitter.addWidget(self.pl_frame)
      self.setCentralWidget(splitter)
      self.menu = self.menuBar()
      m = self.menu.addMenu('&amp;File')
  
      a = QAction('&amp;New project', self)
      a.setShortcut('Ctrl+N')
      a.setStatusTip('Create new project')
      m.addAction(a)
  
      a = QAction('&amp;Open project', self)
      a.setShortcut('Ctrl+O')
      a.setStatusTip('Open project')
      m.addAction(a)
  
      a = QAction("&amp;Quit", self)
      a.setShortcut("Ctrl+Q")
      a.setStatusTip('Leave The App')
      a.setIcon(QIcon('pics/quit.png'))
      m.addAction(a)
  
      about_action = QAction('&amp;About ' + APPNAME, self)
      about_action.setStatusTip('About ' + APPNAME)
      about_action.setShortcut('F1')
  
      m = self.menu.addMenu('&amp;Project')
      m.setEnabled(False)
      a = QAction("&amp;Close", self)
      a.setStatusTip('Close project')
      m.addAction(a)
      self.project_menu = m
  
      help_menu = self.menu.addMenu('&amp;Help')
      help_menu.addAction(about_action)
  
  
  class Sidebar(QWidget):
      open_pipeconf_requested = pyqtSignal()
      open_datadialog_requested = pyqtSignal()
      automate_pipeline_requested = pyqtSignal()
      x_origin_changed = pyqtSignal(float)
      y_origin_changed = pyqtSignal(float)
      units_per_pixel_changed = pyqtSignal(float)
  
      def __init__(self, parent=None):
          super(Sidebar, self).__init__(parent)
          self.x_origin = QDoubleSpinBox()
          self.y_origin = QDoubleSpinBox()
          self.units_per_pixel = QDoubleSpinBox()
          self.setup_ui()
  
      def setup_ui(self):
          self.setContentsMargins(4, 6, 5, 0)
  
          vbox = QVBoxLayout()
  
          hbox = QHBoxLayout()
          hbox.addWidget(QLabel('Origin:'))
          hbox.addWidget(QLabel('Units per pixel:'))
          vbox.addLayout(hbox)
          hbox2 = QHBoxLayout()
          hhbox = QHBoxLayout()
          hhbox2 = QHBoxLayout()
          hhbox.addWidget(QLabel("X:"))
          hhbox.addWidget(self.x_origin)
          hhbox.addWidget(QLabel("Y:"))
          hhbox.addWidget(self.y_origin)
          hhbox2.addWidget(self.units_per_pixel)
          hbox2.addLayout(hhbox)
          hbox2.addLayout(hhbox2)
          vbox.addLayout(hbox2)
          self.units_per_pixel.setDecimals(5)
          self.units_per_pixel.setMaximum(100000)
          self.x_origin.setMaximum(100000)
          self.y_origin.setMaximum(100000)
  
          self.pl_list = QListView()
          self.pl_list.setIconSize(QSize(18, 18))
          self.pl_list.setSelectionMode(QAbstractItemView.ExtendedSelection)
          self.pl_list.setEditTriggers(QAbstractItemView.NoEditTriggers)
          vbox.addWidget(QLabel('Pipeline:'))
          vbox.addWidget(self.pl_list)
  
          pb = QPushButton('&amp;Automation')
          pb.clicked.connect(self.automate_pipeline_requested)
          vbox.addWidget(pb)
  
          vbox.addSpacerItem(QSpacerItem(0, 1, QSizePolicy.Minimum, QSizePolicy.Expanding))
  
          pb = QPushButton('&amp;Configure Pipeline')
          pb.clicked.connect(self.open_pipeconf_requested)
          vbox.addWidget(pb)
          pb = QPushButton('&amp;Manage Data')
          pb.clicked.connect(self.open_datadialog_requested)
          vbox.addWidget(pb)
  
          vbox.setStretch(0, 0)
          vbox.setStretch(1, 0)
          vbox.setStretch(2, 0)
  
          self.setLayout(vbox)
  
  if __name__ == '__main__':
    app = QApplication(sys.argv)
    app.setApplicationName(APPNAME)
    app.setOrganizationName('University of British Columbia')
  
    w = MainWindow()
    w.resize(1060, 660)
    w.show()
  
    app.exec_()
    app.deleteLater()
    del w
    sys.exit()
  </code></pre>