title: Open or Create Directory from QFileDialog
body: <p>I need to create a dialog for selecting a log directory that allows either the selection of a directory or the creation of a directory if a name is typed in that doesn't exist.  I have been able to accomplish one or the other but not both at once.</p>
  
  <p>With Accept mode <code>QFileDialog.AcceptOpen</code>, I can open directories.</p>
  
  <p>With Accept mode  <code>QFileDialog.AcceptSave</code>, I can create directories, but I cannot open an existing directory.</p>
  
  <p>Code Snippet:</p>
  
  <pre><code>def open_or_create_directory(self, log_dir):
      """
      open or create a directory
      Doesn't work!!!
      """
  
      dialog = QtWidgets.QFileDialog(self, caption='Data Log File Dir')
      dialog.setAcceptMode(QtWidgets.QFileDialog.AcceptSave)
      dialog.setDirectory(log_dir)
      dialog.setFileMode(QtWidgets.QFileDialog.ExistingFiles)
      dialog.setOption(QtWidgets.QFileDialog.ShowDirsOnly, True)
      dialog.setLabelText(QtWidgets.QFileDialog.Accept, "Select")
      if dialog.exec_() == QtWidgets.QFileDialog.Accepted:
         logdir = dialog.selectedFiles()
  
  </code></pre>
  
  <p>The closest path I have been able to find is <a href="https://stackoverflow.com/questions/42217120/qfiledialog-selecting-directories-and-files">QFileDialog: Selecting directories and files</a> but I don't know how to implement this in python.</p>