[PyQt] On/Off Switch
Saeed Mahdizadeh Bakhshmand
saeedbakhshmand at gmail.com
Sun May 29 21:11:45 BST 2016
Thanks, earlier than seeing your message I managed to use connect and
disconnect functions to be activated while entering On and Off states,
respectively. I used this example
implement state machine and added:
which ApplyButton_connect and ApplyButton_disconnect are as following:
the function that should be carried out on cell selection''')
'''#call to the function that should be carried out on cell selection''')
On Wed, May 25, 2016 at 11:18 AM, David Cortesi <davecortesi at gmail.com>
> You want to make table items selectable when switch is On, and not
> selectable when Off?
> I think the answer is in the flags() method of your table MODEL (not view).
> You have I assume a table model based on QAbstractTableModel (
> and it has a flags() method returning the boolean OR of the flags in
> So, when the switch (button? checkbox?) state is Off, flags() must not
> return the Qt.ItemIsSelectable for any item.
> When the switch changes state from On to Off, you tell the VIEW to clear
> the selection (http://doc.qt.io/qt-5/qabstractitemview.html#clearSelection
> Best of luck,
> Dave Cortesi
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt