wumu
2023-07-31 91343c3ca84cffa9b3d78dde393877cc311f8bc8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "problemnotmoney.h"
#include "ui_problemnotmoney.h"
 
ProblemNotMoney::ProblemNotMoney(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ProblemNotMoney)
{
    ui->setupUi(this);
    ui->tableWidget->setColumnWidth(0,300);
}
 
ProblemNotMoney::~ProblemNotMoney()
{
    delete ui;
}
 
void ProblemNotMoney::on_tableWidget_clicked(const QModelIndex &index)
{
    int allCnt = 0;
    for(int i=1;i<ui->tableWidget->rowCount();++i){
        allCnt += ui->tableWidget->item(i,2)->text().toInt();
    }
    ui->tableWidget->setItem(0,2,new QTableWidgetItem(QString::number(allCnt)));
}