[Mod]修改下单组件的价格和数量输入使用QLineEdit
This commit is contained in:
parent
8e988caf5c
commit
1dd5eaceae
@ -727,7 +727,7 @@ class TradingWidget(QtWidgets.QFrame):
|
|||||||
def initUi(self):
|
def initUi(self):
|
||||||
"""初始化界面"""
|
"""初始化界面"""
|
||||||
self.setWindowTitle(vtText.TRADING)
|
self.setWindowTitle(vtText.TRADING)
|
||||||
self.setMaximumWidth(400)
|
self.setFixedWidth(500)
|
||||||
self.setFrameShape(self.Box) # 设置边框
|
self.setFrameShape(self.Box) # 设置边框
|
||||||
self.setLineWidth(1)
|
self.setLineWidth(1)
|
||||||
|
|
||||||
@ -754,14 +754,14 @@ class TradingWidget(QtWidgets.QFrame):
|
|||||||
self.comboOffset = QtWidgets.QComboBox()
|
self.comboOffset = QtWidgets.QComboBox()
|
||||||
self.comboOffset.addItems(self.offsetList)
|
self.comboOffset.addItems(self.offsetList)
|
||||||
|
|
||||||
self.spinPrice = QtWidgets.QDoubleSpinBox()
|
validator = QtGui.QDoubleValidator()
|
||||||
self.spinPrice.setDecimals(globalSetting.get('maxDecimal', 4))
|
validator.setBottom(0)
|
||||||
self.spinPrice.setMinimum(0)
|
|
||||||
self.spinPrice.setMaximum(1000000)
|
|
||||||
|
|
||||||
self.spinVolume = QtWidgets.QSpinBox()
|
self.linePrice = QtWidgets.QLineEdit()
|
||||||
self.spinVolume.setMinimum(0)
|
self.linePrice.setValidator(validator)
|
||||||
self.spinVolume.setMaximum(1000000)
|
|
||||||
|
self.lineVolume = QtWidgets.QLineEdit()
|
||||||
|
self.lineVolume.setValidator(validator)
|
||||||
|
|
||||||
self.comboPriceType = QtWidgets.QComboBox()
|
self.comboPriceType = QtWidgets.QComboBox()
|
||||||
self.comboPriceType.addItems(self.priceTypeList)
|
self.comboPriceType.addItems(self.priceTypeList)
|
||||||
@ -796,8 +796,8 @@ class TradingWidget(QtWidgets.QFrame):
|
|||||||
gridleft.addWidget(self.comboDirection, 2, 1, 1, -1)
|
gridleft.addWidget(self.comboDirection, 2, 1, 1, -1)
|
||||||
gridleft.addWidget(self.comboOffset, 3, 1, 1, -1)
|
gridleft.addWidget(self.comboOffset, 3, 1, 1, -1)
|
||||||
gridleft.addWidget(self.checkFixed, 4, 1)
|
gridleft.addWidget(self.checkFixed, 4, 1)
|
||||||
gridleft.addWidget(self.spinPrice, 4, 2)
|
gridleft.addWidget(self.linePrice, 4, 2)
|
||||||
gridleft.addWidget(self.spinVolume, 5, 1, 1, -1)
|
gridleft.addWidget(self.lineVolume, 5, 1, 1, -1)
|
||||||
gridleft.addWidget(self.comboPriceType, 6, 1, 1, -1)
|
gridleft.addWidget(self.comboPriceType, 6, 1, 1, -1)
|
||||||
gridleft.addWidget(self.comboExchange, 7, 1, 1, -1)
|
gridleft.addWidget(self.comboExchange, 7, 1, 1, -1)
|
||||||
gridleft.addWidget(self.comboCurrency, 8, 1, 1, -1)
|
gridleft.addWidget(self.comboCurrency, 8, 1, 1, -1)
|
||||||
@ -883,6 +883,8 @@ class TradingWidget(QtWidgets.QFrame):
|
|||||||
gridRight.addWidget(self.labelBidVolume4, 9, 2)
|
gridRight.addWidget(self.labelBidVolume4, 9, 2)
|
||||||
gridRight.addWidget(self.labelBidVolume5, 10, 2)
|
gridRight.addWidget(self.labelBidVolume5, 10, 2)
|
||||||
|
|
||||||
|
self.labelBidVolume5.setFixedWidth(100)
|
||||||
|
|
||||||
# 发单按钮
|
# 发单按钮
|
||||||
buttonSendOrder = QtWidgets.QPushButton(vtText.SEND_ORDER)
|
buttonSendOrder = QtWidgets.QPushButton(vtText.SEND_ORDER)
|
||||||
buttonCancelAll = QtWidgets.QPushButton(vtText.CANCEL_ALL)
|
buttonCancelAll = QtWidgets.QPushButton(vtText.CANCEL_ALL)
|
||||||
@ -934,8 +936,8 @@ class TradingWidget(QtWidgets.QFrame):
|
|||||||
exchange = contract.exchange # 保证有交易所代码
|
exchange = contract.exchange # 保证有交易所代码
|
||||||
|
|
||||||
# 清空价格数量
|
# 清空价格数量
|
||||||
self.spinPrice.setValue(0)
|
self.linePrice.clear()
|
||||||
self.spinVolume.setValue(0)
|
self.lineVolume.clear()
|
||||||
|
|
||||||
# 清空行情显示
|
# 清空行情显示
|
||||||
self.labelBidPrice1.setText('')
|
self.labelBidPrice1.setText('')
|
||||||
@ -984,7 +986,7 @@ class TradingWidget(QtWidgets.QFrame):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if not self.checkFixed.isChecked():
|
if not self.checkFixed.isChecked():
|
||||||
self.spinPrice.setValue(tick.lastPrice)
|
self.linePrice.setText(str(tick.lastPrice))
|
||||||
|
|
||||||
self.labelBidPrice1.setText(str(tick.bidPrice1))
|
self.labelBidPrice1.setText(str(tick.bidPrice1))
|
||||||
self.labelAskPrice1.setText(str(tick.askPrice1))
|
self.labelAskPrice1.setText(str(tick.askPrice1))
|
||||||
@ -1053,8 +1055,8 @@ class TradingWidget(QtWidgets.QFrame):
|
|||||||
req.symbol = symbol
|
req.symbol = symbol
|
||||||
req.exchange = exchange
|
req.exchange = exchange
|
||||||
req.vtSymbol = vtSymbol
|
req.vtSymbol = vtSymbol
|
||||||
req.price = self.spinPrice.value()
|
req.price = float(self.linePrice.text())
|
||||||
req.volume = self.spinVolume.value()
|
req.volume = float(self.lineVolume.text())
|
||||||
req.direction = unicode(self.comboDirection.currentText())
|
req.direction = unicode(self.comboDirection.currentText())
|
||||||
req.priceType = unicode(self.comboPriceType.currentText())
|
req.priceType = unicode(self.comboPriceType.currentText())
|
||||||
req.offset = unicode(self.comboOffset.currentText())
|
req.offset = unicode(self.comboOffset.currentText())
|
||||||
|
Loading…
Reference in New Issue
Block a user