title: Click besides item in QColumnView row to trigger different Context Menu
body: <p>I would like to know how to handle a right mouse click besides an item even when on the same row. </p>
  
  <h2>Description</h2>
  
  <p>Similar to how Windows Explorer behaves that when you don't right click on the <em>name</em> of the file but in the white area to the side of it (even in white area between <em>name</em> and e.g. <em>size</em> in detail view) it gives you the "folder" context menu as opposed to the "file" context menu.</p>
  
  <h2>Implementation</h2>
  
  <p>I'm looking to implement this Context Menu functionality in a QColumnView. The columns in this view are actually <em>QListView</em> widgets. So it might be more related to how a QListView behaves.</p>
  
  <p>This is what I have now:</p>
  
  <pre><code>model = QtGui.QFileSystemModel()
  view = QtGui.QColumnView()
  view.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
  view.customContextMenuRequested.connect(contextMenu)
  </code></pre>
  
  <p>With a context menu like this:</p>
  
  <pre><code>def contextMenu(point):
      index = view.indexAt(point)
      is_selection = index.isValid()
      if not is_selection:
          # Not a valid item. Let's check what "column" we're in
          # This is our "folder" context
          child = view.childAt(point)
          listView = child.parentWidget()
          index = listView.rootIndex()
  
      path = model.filePath(index)
  
      # Create the menu
      menu = QtGui.QMenu()   
      if is_selection:
          # An item was selected (file context menu)
          menu.addAction("Explore file...")
      else:
          # An item was not selected (folder context menu)
          menu.addAction("Explore folder...")
  
      # Show the menu
      globalPoint = self.browserView.mapToGlobal(point)
      action = menu.exec_(globalPoint)
  </code></pre>
  
  <p>The <strong>problem</strong> here is that <em>clicking anywhere on the full row will be considered "as the item"</em>. Whereas what I'm looking for is <em>clicking on an area without text/icon should not be considered a on the item</em>.</p>
  
  <p>Funnily enough this image shows roughly what I mean:</p>
  
  <p><a href="https://i.stack.imgur.com/Jf65t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jf65t.png" alt="QColumnView"></a></p>
  
  <p>The blue selection bar here does not span the entire row in the view. That blue area is what I want to find. Running my interface somehow triggers that selection on the entire row, not just around the size of the label/icon.</p>
  
  <p>So right mouse clicking to the right side next to <strong>Address</strong> would trigger the "folder" functionality as opposed to the "file" functionality.</p>