[PyKDE] Radiobutton in table?
jbublitz at nwinternet.com
Thu Apr 13 16:52:48 BST 2006
On Thursday 13 April 2006 02:01, Behnam Kamrani wrote:
> I would appreciate a lot if somebody can help me to create a
> radiobutton in a table using pyqt?
> To use Checkbox or Combobox is pretty easy by having QComboTableItems
> or QCheckTableItems. However, apparently there is not an object like
> So the my question is hot to place a group of radiobuttons in a table.
> Thanks a lot in advance!
I haven't done that, but I have put things like buttons to popup lists and
calendars and similar things in tables, and the procedure would be the same.
Basically, you subclass QTableItem and overload two methods: createEditor()
and setContentFromEditor(). createEditor() returns the widget to be displayed
in the cell when the cell is being edited, and it can be any widget, not just
a QLineEdit. Probably a QButtonGroup that contains the radio buttons.
setContentFromEditor() can be used to set the QTableItem's text from the
selected radio button. If you want the radio buttons displayed continuously
(not just when editing), I'm not sure how to do that - maybe the EditType
parameter controls that, but don't really know.
Of course you'll have to manage cell size to make all of the radio buttons
See the Qt docs for QTableItem for starters.
More information about the PyQt