0

I have a QTreeWidget in which it has 4 columns (Name, version, ID, Location). While I have the first 3 columns populated, I had wanted the last column - Location to be user-input where Users have to specify the file location of another file before it gets run by another function.

Even so, I would like to ask if is it possible for this particular column to be double-clicked for such file path inputting?

yan
  • 631
  • 9
  • 30

1 Answers1

0

This answer describes a solution for what you want without changing from the QTreeWidget convenience class.

Basically, for each item you place into that column, connect its itemDoubleClicked to a custom slot which runs item.editItem()

*For reference, the term you probably should have been searching for if you knew it was "edit triggers"

Community
  • 1
  • 1
Christopher Peterson
  • 1,570
  • 1
  • 10
  • 9
  • Hey thanks for the info but was wondering if it is any possible to change the solution you given in the link easily into python? Can it be done? – yan Feb 16 '15 at 07:04
  • Yes, it certainly is. [http://srinikom.github.io/pyside-docs/PySide/QtGui/QAbstractItemView.html?highlight=edittriggers#PySide.QtGui.PySide.QtGui.QAbstractItemView.setEditTriggers] [http://srinikom.github.io/pyside-docs/PySide/QtGui/QTreeWidgetItem.html?highlight=treewidget#PySide.QtGui.PySide.QtGui.QTreeWidgetItem.setFlags] [http://srinikom.github.io/pyside-docs/PySide/QtCore/Qt.html?highlight=itemiseditable] PySide.QtCore.Qt.ItemFlag [http://qt-project.org/wiki/Signals_and_Slots_in_PySide] – Christopher Peterson Feb 16 '15 at 20:15