diff --git a/QTradeProgram.VC.db b/QTradeProgram.VC.db index 36af000..629998e 100644 Binary files a/QTradeProgram.VC.db and b/QTradeProgram.VC.db differ diff --git a/Sqbase/ordertypedelegate.cpp b/Sqbase/ordertypedelegate.cpp index 22b3e85..c370750 100644 --- a/Sqbase/ordertypedelegate.cpp +++ b/Sqbase/ordertypedelegate.cpp @@ -99,10 +99,10 @@ void HighlightDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt if (isHighlighted) { // 设置高亮背景 painter->fillRect(opt.rect, QColor(255, 192, 203)); // 浅黄色背景 - // 设置加粗字体 - QFont boldFont = opt.font; - boldFont.setBold(true); - painter->setFont(boldFont); + + //QFont boldFont = opt.font;// 设置加粗字体 + //boldFont.setBold(true); + //painter->setFont(boldFont); // 绘制文本 painter->setPen(opt.palette.color(QPalette::Text)); diff --git a/Sqbase/qbigorderviewer.cpp b/Sqbase/qbigorderviewer.cpp index f47acf7..02f5696 100644 --- a/Sqbase/qbigorderviewer.cpp +++ b/Sqbase/qbigorderviewer.cpp @@ -239,10 +239,17 @@ void QBigOrderViewer::onBigOrderAdded(const BigOrderInfo &order) m_model->insertRow(row); setRowData(row, newOrder); + // 为订单生成唯一标识 + QString orderId = QString("%1_%2_%3") + .arg(order.code) + .arg(QString::number(order.price, 'f', 2)) + .arg(QDateTime::currentMSecsSinceEpoch()); + // 设置高亮标记 for (int col = 0; col < m_model->columnCount(); ++col) { QModelIndex index = m_model->index(row, col); - m_model->setData(index, true, IsHighlightedRole); + m_model->setData(index, true, IsHighlightedRole); + m_model->setData(index, orderId, Qt::UserRole + 102); // 存储唯一标识 } // 通知视图更新 @@ -251,16 +258,32 @@ void QBigOrderViewer::onBigOrderAdded(const BigOrderInfo &order) emit m_model->dataChanged(topLeft, bottomRight); // 2秒后取消高亮 - QTimer::singleShot(2000, this, [this, row]() { - for (int col = 0; col < m_model->columnCount(); ++col) { - QModelIndex index = m_model->index(row, col); + QTimer::singleShot(2000, this, [this, orderId]() { + for (int row = 0; row < m_model->rowCount(); ++row) { + QModelIndex index = m_model->index(row, 0); m_model->setData(index, false, IsHighlightedRole); + QString currentOrderId = index.data(Qt::UserRole + 102).toString(); + + if (currentOrderId == orderId) { + + for (int col = 0; col < m_model->columnCount(); ++col) { + QModelIndex cellIndex = m_model->index(row, col); + m_model->setData(cellIndex, false, IsHighlightedRole); + } + + // 通知视图更新 + QModelIndex topLeft = m_model->index(row, 0); + QModelIndex bottomRight = m_model->index(row, m_model->columnCount() - 1); + emit m_model->dataChanged(topLeft, bottomRight); + + break; // 找到后退出循环 + } } - // 通知视图更新 - QModelIndex topLeft = m_model->index(row, 0); - QModelIndex bottomRight = m_model->index(row, m_model->columnCount() - 1); - emit m_model->dataChanged(topLeft, bottomRight); + //// 通知视图更新 + //QModelIndex topLeft = m_model->index(row, 0); + //QModelIndex bottomRight = m_model->index(row, m_model->columnCount() - 1); + //emit m_model->dataChanged(topLeft, bottomRight); }); // 确保代理模型按时间降序排序,新数据在顶部 diff --git a/Sqbase/qorderprocessor.cpp b/Sqbase/qorderprocessor.cpp index 05a9b7e..94367df 100644 --- a/Sqbase/qorderprocessor.cpp +++ b/Sqbase/qorderprocessor.cpp @@ -90,6 +90,11 @@ QVector QOrderProcessor::findMaxVolumeItem(const OrderBookData & d const OrderBookEntry* maxItem; QVector items = data.asks; for (int i = 0; i < items.size(); i++) { + + // 不处理刚打开程序时,推送过来的摆盘数据 + if (data.askTime == NULL) + continue; + // 同一个价格挡位的订单中股票数量大于,阈值才有可能是大单 if (volume < items[i].volume) { for (int j = 0; j< items[i].details.size(); j++) // 超过list的最大数量,就不会返回数据了 @@ -121,6 +126,11 @@ QVector QOrderProcessor::findMaxVolumeItem(const OrderBookData & d items = data.bids; for (int i = 0; i < items.size(); i++) { + + // 不处理刚打开程序时,推送过来的摆盘数据 + if (data.bidTime == NULL) + continue; + // 同一个价格挡位的订单中股票数量大于,阈值才有可能是大单 if (volume < items[i].volume) { for (int j = 0; j< items[i].details.size(); j++) diff --git a/config/replyCodeList.csv b/config/replyCodeList.csv index f2d51cb..fe5967c 100644 --- a/config/replyCodeList.csv +++ b/config/replyCodeList.csv @@ -1,9 +1,9 @@ Ʊ,ֵ 09885,200000 -00581,30000 +00581,1.02e+06 03383,800000 02666,500000 00839,500000 06098,600000 -06865,10000 -00700,1000 +06865,50000 +00700,8000