#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)));
}