[Add] Double click order monitor cells to cancel order

This commit is contained in:
vn.py 2019-01-11 15:49:11 +08:00
parent a89cba984d
commit 857b0c243c

View File

@ -507,6 +507,24 @@ class OrderMonitor(BaseMonitor):
} }
} }
def init_ui(self):
"""
Connect signal.
"""
super(OrderMonitor, self).init_ui()
self.setToolTip("双击单元格撤单")
self.itemDoubleClicked.connect(self.cancel_order)
def cancel_order(self, cell):
"""
Cancel order if cell double clicked.
"""
order = cell.get_data()
req = order.create_cancel_request()
self.main_engine.cancel_order(req, order.gateway_name)
class PositionMonitor(BaseMonitor): class PositionMonitor(BaseMonitor):
""" """
Monitor for position data. Monitor for position data.