469 lines
15 KiB
C++
469 lines
15 KiB
C++
#include "Handicap.h"
|
|||
|
|
#include <QIcon>
|
||
|
|
#include <QComboBox>
|
||
|
|
#include "Global.h"
|
||
|
|
#include "Utils.h"
|
||
|
|
|
||
|
|
Handicap::Handicap(QWidget *parent)
|
||
|
|
: QDialog(parent)
|
||
|
|
{
|
||
|
|
ui.setupUi(this);
|
||
|
|
|
||
|
|
// 设置窗口图标
|
||
|
|
this->setWindowIcon(QIcon(":/images/Images/client.ico"));
|
||
|
|
// 设置窗口标题
|
||
|
|
this->setWindowTitle("注单盘口判断处理");
|
||
|
|
// 设置为对话框窗口
|
||
|
|
setWindowFlags(Qt::Dialog);
|
||
|
|
// 设置窗口仅有关闭按钮
|
||
|
|
setWindowFlags(Qt::WindowCloseButtonHint);
|
||
|
|
setFixedSize(883,552);
|
||
|
|
|
||
|
|
|
||
|
|
// 设置盘口判断方案样式
|
||
|
|
ui.solutionComboBox->setItemData(0, QBrush(QColor(Qt::red)), Qt::ForegroundRole);
|
||
|
|
ui.solutionComboBox->setItemData(1, QBrush(QColor(Qt::darkGreen)), Qt::ForegroundRole);
|
||
|
|
ui.solutionComboBox->setItemData(2, QBrush(QColor(Qt::darkBlue)), Qt::ForegroundRole);
|
||
|
|
|
||
|
|
ui.solutionComboBox->setItemData(3, QBrush(QColor(0xFF,0xAA,0x00)), Qt::ForegroundRole);
|
||
|
|
ui.solutionComboBox->setItemData(4, QBrush(QColor(0xAA,0x55,0xFF)), Qt::ForegroundRole);
|
||
|
|
ui.solutionComboBox->setItemData(5, QBrush(QColor(Qt::darkRed)), Qt::ForegroundRole);
|
||
|
|
ui.solutionComboBox->setItemData(6, QBrush(QColor(0xFF,0xAA,0xFF)), Qt::ForegroundRole);
|
||
|
|
|
||
|
|
// 存在重载必须强制类型转换
|
||
|
|
connect(ui.solutionComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),this,&Handicap::slotSolutionChange);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
ui.projectCheckBox->setChecked(g_config->handicapProject());
|
||
|
|
ui.typeCheckBox->setChecked(g_config->handicapType());
|
||
|
|
ui.solutionComboBox->setCurrentText(g_config->handicapMethod());
|
||
|
|
|
||
|
|
if (ui.solutionComboBox->currentText() == "A")
|
||
|
|
{
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:red;}");
|
||
|
|
}
|
||
|
|
else if (ui.solutionComboBox->currentText() == "B")
|
||
|
|
{
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:darkGreen;}");
|
||
|
|
}
|
||
|
|
else if (ui.solutionComboBox->currentText() == "C")
|
||
|
|
{
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:darkBlue;}");
|
||
|
|
}
|
||
|
|
else if (ui.solutionComboBox->currentText() == "S")
|
||
|
|
{
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:#ffaa00;}");
|
||
|
|
}
|
||
|
|
else if (ui.solutionComboBox->currentText() == "X")
|
||
|
|
{
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:#aa55ff;}");
|
||
|
|
}
|
||
|
|
else if (ui.solutionComboBox->currentText() == "Y")
|
||
|
|
{
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:darkRed;}");
|
||
|
|
}
|
||
|
|
else if (ui.solutionComboBox->currentText() == "Z")
|
||
|
|
{
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:#ffaaff;}");
|
||
|
|
}
|
||
|
|
ui.tableWidget->setColumnCount(10);
|
||
|
|
ui.tableWidget->setHorizontalHeaderLabels({"注单项目", "让球","受让","大","小","主队大","主队小","客队大","客队小","补单" });
|
||
|
|
ui.tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||
|
|
ui.tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||
|
|
ui.tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||
|
|
ui.tableWidget->horizontalHeader()->resizeSection(0, 50);
|
||
|
|
|
||
|
|
|
||
|
|
for (int i = 0; i < 9; i++)
|
||
|
|
{
|
||
|
|
ui.tableWidget->insertRow(i);
|
||
|
|
ui.tableWidget->setItem(i, 0, new QTableWidgetItem(g_gameTypes[i]));
|
||
|
|
ui.tableWidget->setItem(i, 1, new QTableWidgetItem("C"));
|
||
|
|
ui.tableWidget->item(i, 1)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||
|
|
ui.tableWidget->item(i, 1)->setForeground(QBrush(QColor(Qt::darkBlue)));
|
||
|
|
ui.tableWidget->setItem(i, 2, new QTableWidgetItem("C"));
|
||
|
|
ui.tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||
|
|
ui.tableWidget->item(i, 2)->setForeground(QBrush(QColor(Qt::darkBlue)));
|
||
|
|
ui.tableWidget->setItem(i, 3, new QTableWidgetItem("C"));
|
||
|
|
ui.tableWidget->item(i, 3)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||
|
|
ui.tableWidget->item(i, 3)->setForeground(QBrush(QColor(Qt::darkBlue)));
|
||
|
|
ui.tableWidget->setItem(i, 4, new QTableWidgetItem("C"));
|
||
|
|
ui.tableWidget->item(i, 4)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||
|
|
ui.tableWidget->item(i, 4)->setForeground(QBrush(QColor(Qt::darkBlue)));
|
||
|
|
ui.tableWidget->setItem(i, 5, new QTableWidgetItem("C"));
|
||
|
|
ui.tableWidget->item(i, 5)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||
|
|
ui.tableWidget->item(i, 5)->setForeground(QBrush(QColor(Qt::darkBlue)));
|
||
|
|
ui.tableWidget->setItem(i, 6, new QTableWidgetItem("C"));
|
||
|
|
ui.tableWidget->item(i, 6)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||
|
|
ui.tableWidget->item(i, 6)->setForeground(QBrush(QColor(Qt::darkBlue)));
|
||
|
|
ui.tableWidget->setItem(i, 7, new QTableWidgetItem("C"));
|
||
|
|
ui.tableWidget->item(i, 7)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||
|
|
ui.tableWidget->item(i, 7)->setForeground(QBrush(QColor(Qt::darkBlue)));
|
||
|
|
ui.tableWidget->setItem(i, 8, new QTableWidgetItem("C"));
|
||
|
|
ui.tableWidget->item(i, 8)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||
|
|
ui.tableWidget->item(i, 8)->setForeground(QBrush(QColor(Qt::darkBlue)));
|
||
|
|
|
||
|
|
QWidget* widget = new QWidget;
|
||
|
|
QHBoxLayout* layout = new QHBoxLayout;
|
||
|
|
QCheckBox* box = new QCheckBox;
|
||
|
|
layout->addWidget(box);
|
||
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
||
|
|
layout->setAlignment(box, Qt::AlignCenter);
|
||
|
|
widget->setLayout(layout);
|
||
|
|
ui.tableWidget->setCellWidget(i, 9, widget);
|
||
|
|
}
|
||
|
|
QList<QMap<QString, QString>> handicap = g_config->handicap();
|
||
|
|
for (int i = 0; i < handicap.count(); i++)
|
||
|
|
{
|
||
|
|
if (handicap[i]["COLUMN"] != "9")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(handicap[i]["ROW"].toInt(), handicap[i]["COLUMN"].toInt())->setText(handicap[i]["SOLUTION"]);
|
||
|
|
// 设置对应的颜色
|
||
|
|
if (handicap[i]["SOLUTION"] == "A")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(handicap[i]["ROW"].toInt(), handicap[i]["COLUMN"].toInt())->setForeground(QBrush(QColor(Qt::red)));
|
||
|
|
}
|
||
|
|
else if (handicap[i]["SOLUTION"] == "B")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(handicap[i]["ROW"].toInt(), handicap[i]["COLUMN"].toInt())->setForeground(QBrush(QColor(Qt::darkGreen)));
|
||
|
|
}
|
||
|
|
else if (handicap[i]["SOLUTION"] == "C")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(handicap[i]["ROW"].toInt(), handicap[i]["COLUMN"].toInt())->setForeground(QBrush(QColor(Qt::darkBlue)));
|
||
|
|
}
|
||
|
|
else if (handicap[i]["SOLUTION"] == "S")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(handicap[i]["ROW"].toInt(), handicap[i]["COLUMN"].toInt())->setForeground(QBrush(QColor(0xFF, 0xAA, 0x00)));
|
||
|
|
}
|
||
|
|
else if (handicap[i]["SOLUTION"] == "X")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(handicap[i]["ROW"].toInt(), handicap[i]["COLUMN"].toInt())->setForeground(QBrush(QColor(0xAA, 0x55, 0xFF)));
|
||
|
|
}
|
||
|
|
else if (handicap[i]["SOLUTION"] == "Y")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(handicap[i]["ROW"].toInt(), handicap[i]["COLUMN"].toInt())->setForeground(QBrush(QColor(Qt::darkRed)));
|
||
|
|
}
|
||
|
|
else if (handicap[i]["SOLUTION"] == "Z")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(handicap[i]["ROW"].toInt(), handicap[i]["COLUMN"].toInt())->setForeground(QBrush(QColor(0xFF, 0xAA, 0xFF)));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
QCheckBox* checkBox = reinterpret_cast<QCheckBox*>(ui.tableWidget->cellWidget(handicap[i]["ROW"].toInt(), handicap[i]["COLUMN"].toInt())->layout()->itemAt(0)->widget());
|
||
|
|
if (checkBox)
|
||
|
|
{
|
||
|
|
// 设置选中状态
|
||
|
|
if (handicap[i]["REBET"] == "TRUE")
|
||
|
|
{
|
||
|
|
checkBox->setChecked(true);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
checkBox->setChecked(false);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
connect(ui.setButton,&QPushButton::clicked,this,&Handicap::slotSetSolution);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
Handicap::~Handicap()
|
||
|
|
{}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
void Handicap::slotSolutionChange(int index)
|
||
|
|
{
|
||
|
|
switch (index)
|
||
|
|
{
|
||
|
|
case 0:
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:red;}");
|
||
|
|
break;
|
||
|
|
case 1:
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:darkGreen;}");
|
||
|
|
break;
|
||
|
|
case 2:
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:darkBlue;}");
|
||
|
|
break;
|
||
|
|
case 3:
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:#ffaa00;}");
|
||
|
|
break;
|
||
|
|
case 4:
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:#aa55ff;}");
|
||
|
|
break;
|
||
|
|
case 5:
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:darkRed;}");
|
||
|
|
break;
|
||
|
|
default:
|
||
|
|
ui.solutionComboBox->setStyleSheet("QComboBox{color:#ffaaff;}");
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void Handicap::slotSetSolution()
|
||
|
|
{
|
||
|
|
QString project = ui.projectComboBox->currentText();
|
||
|
|
QString type = ui.typeComboBox->currentText();
|
||
|
|
QString solution = ui.solutionComboBox->currentText();
|
||
|
|
// 单个
|
||
|
|
if (ui.projectCheckBox->isChecked() && ui.typeCheckBox->isChecked())
|
||
|
|
{
|
||
|
|
int row = 0, column = 0;
|
||
|
|
for (row; row < ui.tableWidget->rowCount(); row++)
|
||
|
|
{
|
||
|
|
QString rowText = ui.tableWidget->item(row, 0)->text();
|
||
|
|
if (rowText == project)
|
||
|
|
{
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
for (column; column < ui.tableWidget->columnCount(); column++)
|
||
|
|
{
|
||
|
|
QString columnText = ui.tableWidget->horizontalHeaderItem(column)->text();
|
||
|
|
if (columnText == type)
|
||
|
|
{
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
ui.tableWidget->item(row,column)->setText(solution);
|
||
|
|
if (solution == "A")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row,column)->setForeground(QBrush(QColor(Qt::red)));
|
||
|
|
}
|
||
|
|
else if (solution == "B")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::darkGreen)));
|
||
|
|
}
|
||
|
|
else if (solution == "C")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::darkBlue)));
|
||
|
|
}
|
||
|
|
else if (solution == "S")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(0xFF, 0xAA, 0x00)));
|
||
|
|
}
|
||
|
|
else if (solution == "X")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(0xAA, 0x55, 0xFF)));
|
||
|
|
}
|
||
|
|
else if (solution == "Y")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::darkRed)));
|
||
|
|
}
|
||
|
|
else if (solution == "Z")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(0xFF, 0xAA, 0xFF)));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
else if (ui.projectCheckBox->isChecked() && !ui.typeCheckBox->isChecked())
|
||
|
|
{
|
||
|
|
int row = 0, column = 0;
|
||
|
|
for (row; row < ui.tableWidget->rowCount(); row++)
|
||
|
|
{
|
||
|
|
QString rowText = ui.tableWidget->item(row, 0)->text();
|
||
|
|
if (rowText == project)
|
||
|
|
{
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
for (column; column < ui.tableWidget->columnCount(); column++)
|
||
|
|
{
|
||
|
|
// 第一列 最后一列跳过
|
||
|
|
if (column == 0 || column == ui.tableWidget->columnCount() - 1)
|
||
|
|
{
|
||
|
|
continue;
|
||
|
|
}
|
||
|
|
ui.tableWidget->item(row, column)->setText(solution);
|
||
|
|
if (solution == "A")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::red)));
|
||
|
|
}
|
||
|
|
else if (solution == "B")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::darkGreen)));
|
||
|
|
}
|
||
|
|
else if (solution == "C")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::darkBlue)));
|
||
|
|
}
|
||
|
|
else if (solution == "S")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(0xFF, 0xAA, 0x00)));
|
||
|
|
}
|
||
|
|
else if (solution == "X")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(0xAA, 0x55, 0xFF)));
|
||
|
|
}
|
||
|
|
else if (solution == "Y")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::darkRed)));
|
||
|
|
}
|
||
|
|
else if (solution == "Z")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(0xFF, 0xAA, 0xFF)));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
else if (!ui.projectCheckBox->isChecked() && ui.typeCheckBox->isChecked())
|
||
|
|
{
|
||
|
|
int row = 0, column = 0;
|
||
|
|
for (column; column < ui.tableWidget->columnCount(); column++)
|
||
|
|
{
|
||
|
|
QString columnText = ui.tableWidget->horizontalHeaderItem(column)->text();
|
||
|
|
if (columnText == type)
|
||
|
|
{
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
for (row; row < ui.tableWidget->rowCount(); row++)
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setText(solution);
|
||
|
|
if (solution == "A")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::red)));
|
||
|
|
}
|
||
|
|
else if (solution == "B")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::darkGreen)));
|
||
|
|
}
|
||
|
|
else if (solution == "C")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::darkBlue)));
|
||
|
|
}
|
||
|
|
else if (solution == "S")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(0xFF, 0xAA, 0x00)));
|
||
|
|
}
|
||
|
|
else if (solution == "X")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(0xAA, 0x55, 0xFF)));
|
||
|
|
}
|
||
|
|
else if (solution == "Y")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::darkRed)));
|
||
|
|
}
|
||
|
|
else if (solution == "Z")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(0xFF, 0xAA, 0xFF)));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
for (int row = 0; row < ui.tableWidget->rowCount(); row++)
|
||
|
|
{
|
||
|
|
for (int column = 0; column < ui.tableWidget->columnCount(); column++)
|
||
|
|
{
|
||
|
|
// 第一列 最后一列跳过
|
||
|
|
if (column == 0 || column == ui.tableWidget->columnCount() - 1)
|
||
|
|
{
|
||
|
|
continue;
|
||
|
|
}
|
||
|
|
ui.tableWidget->item(row, column)->setText(solution);
|
||
|
|
if (solution == "A")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::red)));
|
||
|
|
}
|
||
|
|
else if (solution == "B")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::darkGreen)));
|
||
|
|
}
|
||
|
|
else if (solution == "C")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::darkBlue)));
|
||
|
|
}
|
||
|
|
else if (solution == "S")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(0xFF, 0xAA, 0x00)));
|
||
|
|
}
|
||
|
|
else if (solution == "X")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(0xAA, 0x55, 0xFF)));
|
||
|
|
}
|
||
|
|
else if (solution == "Y")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(Qt::darkRed)));
|
||
|
|
}
|
||
|
|
else if (solution == "Z")
|
||
|
|
{
|
||
|
|
ui.tableWidget->item(row, column)->setForeground(QBrush(QColor(0xFF, 0xAA, 0xFF)));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
// 整列
|
||
|
|
}
|
||
|
|
|
||
|
|
void Handicap::closeEvent(QCloseEvent * event)
|
||
|
|
{
|
||
|
|
QList<QMap<QString, QString>> list;
|
||
|
|
|
||
|
|
// 遍历所有行
|
||
|
|
for (int row = 0; row < ui.tableWidget->rowCount(); row++)
|
||
|
|
{
|
||
|
|
// 获取第一列标题(注单项目)
|
||
|
|
QString rowText = ui.tableWidget->item(row, 0)->text();
|
||
|
|
// 获取补单选择状态
|
||
|
|
QCheckBox* checkBox = reinterpret_cast<QCheckBox*>(ui.tableWidget->cellWidget(row, ui.tableWidget->columnCount() - 1)->layout()->itemAt(0)->widget());
|
||
|
|
bool rebet = checkBox->isChecked();
|
||
|
|
// 遍历所有列
|
||
|
|
for (int column = 0; column < ui.tableWidget->columnCount(); column++)
|
||
|
|
{
|
||
|
|
// 第一列跳过
|
||
|
|
if (column == 0)
|
||
|
|
{
|
||
|
|
continue;
|
||
|
|
}
|
||
|
|
// 获取列标题
|
||
|
|
QString columnText = ui.tableWidget->horizontalHeaderItem(column)->text();
|
||
|
|
|
||
|
|
// 最后一列记录checkbox
|
||
|
|
if (column == ui.tableWidget->columnCount() - 1)
|
||
|
|
{
|
||
|
|
QMap<QString, QString> map;
|
||
|
|
map["ROW"] = QString::number(row);
|
||
|
|
map["COLUMN"] = QString::number(column);
|
||
|
|
QCheckBox* checkBox = reinterpret_cast<QCheckBox*>(ui.tableWidget->cellWidget(row, column)->layout()->itemAt(0)->widget());
|
||
|
|
if (checkBox->isChecked())
|
||
|
|
{
|
||
|
|
map["REBET"] = "TRUE";
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
map["REBET"] = "FALSE";
|
||
|
|
}
|
||
|
|
map["project"] = rowText;
|
||
|
|
list.append(map);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
// 根据名称获取wtype rtype等参数
|
||
|
|
QMap<QString, QString> map = Utils::instance().type(rowText, columnText);
|
||
|
|
map["ROW"] = QString::number(row);
|
||
|
|
map["COLUMN"] = QString::number(column);
|
||
|
|
map["SOLUTION"] = ui.tableWidget->item(row, column)->text();
|
||
|
|
if (rebet)
|
||
|
|
{
|
||
|
|
map["REBET"] = "TRUE";
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
map["REBET"] = "FALSE";
|
||
|
|
}
|
||
|
|
list.append(map);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
g_config->setHandicap(list);
|
||
|
|
}
|