From fd303ca4450d098693760090ea450a057c3cb8f2 Mon Sep 17 00:00:00 2001 From: wumu <mayi@mayi.com> Date: 星期三, 31 五月 2023 22:47:46 +0800 Subject: [PATCH] 0531 --- internal_system_v1/problemcount.h | 5 + internal_system_v1/problemcount.cpp | 31 +++++++ internal_system_v1/problemcount.ui | 179 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 212 insertions(+), 3 deletions(-) diff --git a/internal_system_v1/problemcount.cpp b/internal_system_v1/problemcount.cpp index 9a68b3e..cc554c7 100644 --- a/internal_system_v1/problemcount.cpp +++ b/internal_system_v1/problemcount.cpp @@ -1,14 +1,45 @@ #include "problemcount.h" #include "ui_problemcount.h" +#include <QDebug> ProblemCount::ProblemCount(QWidget *parent) : QMainWindow(parent), ui(new Ui::ProblemCount) { ui->setupUi(this); + ui->tableWidget->setColumnWidth(0,300); } ProblemCount::~ProblemCount() { delete ui; } + +void ProblemCount::on_tableWidget_clicked(const QModelIndex &index) +{ + qDebug()<<"index"<<index; + int noMonCnt = 0; + for(int i=3;i<=6;++i){ + noMonCnt += ui->tableWidget->item(i,2)->text().toInt(); + } + ui->tableWidget->setItem(2,2,new QTableWidgetItem(QString::number(noMonCnt))); + + int allCnt = ui->tableWidget->item(1,2)->text().toInt()+ui->tableWidget->item(2,2)->text().toInt(); + ui->tableWidget->setItem(0,2,new QTableWidgetItem(QString::number(allCnt))); + + +} + +void ProblemCount::on_tableWidget_activated(const QModelIndex &index) +{ + qDebug()<<"activated index"<<index; + int noMonCnt = 0; + for(int i=3;i<=6;++i){ + noMonCnt += ui->tableWidget->item(i,2)->text().toInt(); + } + ui->tableWidget->setItem(2,2,new QTableWidgetItem(QString::number(noMonCnt))); + + int allCnt = ui->tableWidget->item(1,2)->text().toInt()+ui->tableWidget->item(2,2)->text().toInt(); + ui->tableWidget->setItem(0,2,new QTableWidgetItem(QString::number(allCnt))); + +} diff --git a/internal_system_v1/problemcount.h b/internal_system_v1/problemcount.h index af6f449..68d3ea3 100644 --- a/internal_system_v1/problemcount.h +++ b/internal_system_v1/problemcount.h @@ -15,6 +15,11 @@ explicit ProblemCount(QWidget *parent = 0); ~ProblemCount(); +private slots: + void on_tableWidget_clicked(const QModelIndex &index); + + void on_tableWidget_activated(const QModelIndex &index); + private: Ui::ProblemCount *ui; }; diff --git a/internal_system_v1/problemcount.ui b/internal_system_v1/problemcount.ui index 37626a0..beebaa8 100644 --- a/internal_system_v1/problemcount.ui +++ b/internal_system_v1/problemcount.ui @@ -17,8 +17,8 @@ <widget class="QLabel" name="label"> <property name="geometry"> <rect> - <x>190</x> - <y>120</y> + <x>120</x> + <y>20</y> <width>421</width> <height>91</height> </rect> @@ -27,6 +27,179 @@ <string>闂涓暟</string> </property> </widget> + <widget class="QTableWidget" name="tableWidget"> + <property name="geometry"> + <rect> + <x>40</x> + <y>130</y> + <width>741</width> + <height>411</height> + </rect> + </property> + <attribute name="verticalHeaderVisible"> + <bool>false</bool> + </attribute> + <row> + <property name="text"> + <string>鏂板缓琛�</string> + </property> + </row> + <row> + <property name="text"> + <string>鏂板缓琛�</string> + </property> + </row> + <row> + <property name="text"> + <string>鏂板缓琛�</string> + </property> + </row> + <row> + <property name="text"> + <string>鏂板缓琛�</string> + </property> + </row> + <row> + <property name="text"> + <string>鏂板缓琛�</string> + </property> + </row> + <row> + <property name="text"> + <string>鏂板缓琛�</string> + </property> + </row> + <row> + <property name="text"> + <string>鏂板缓琛�</string> + </property> + </row> + <column> + <property name="text"> + <string>鎸囨爣鍚嶇О</string> + </property> + </column> + <column> + <property name="text"> + <string>浠g爜</string> + </property> + </column> + <column> + <property name="text"> + <string>鏁伴噺(涓�)</string> + </property> + </column> + <column> + <property name="text"> + <string>涓婁紶浣愯瘉璧勬枡</string> + </property> + </column> + <item row="0" column="0"> + <property name="text"> + <string>瀹¤鍙戠幇闂涓暟</string> + </property> + </item> + <item row="0" column="1"> + <property name="text"> + <string>020400</string> + </property> + </item> + <item row="0" column="2"> + <property name="text"> + <string>0</string> + </property> + </item> + <item row="1" column="0"> + <property name="text"> + <string>閲戦绫婚棶棰樹釜鏁�</string> + </property> + </item> + <item row="1" column="1"> + <property name="text"> + <string>020410</string> + </property> + </item> + <item row="1" column="2"> + <property name="text"> + <string>0</string> + </property> + </item> + <item row="2" column="0"> + <property name="text"> + <string>闈為噾棰濈被闂涓暟</string> + </property> + </item> + <item row="2" column="1"> + <property name="text"> + <string>020420</string> + </property> + </item> + <item row="2" column="2"> + <property name="text"> + <string>0</string> + </property> + </item> + <item row="3" column="0"> + <property name="text"> + <string>鍥藉鏀跨瓥鎺柦钀藉疄鏂归潰</string> + </property> + </item> + <item row="3" column="1"> + <property name="text"> + <string>020421</string> + </property> + </item> + <item row="3" column="2"> + <property name="text"> + <string>0</string> + </property> + </item> + <item row="4" column="0"> + <property name="text"> + <string>鍙戝睍瑙勫垝涓庢垬鐣ュ喅绛栨柟闈�</string> + </property> + </item> + <item row="4" column="1"> + <property name="text"> + <string>020422</string> + </property> + </item> + <item row="4" column="2"> + <property name="text"> + <string>0</string> + </property> + </item> + <item row="5" column="0"> + <property name="text"> + <string>鍐呴儴鎺у埗涓庨闄╃鐞嗘柟闈�</string> + </property> + </item> + <item row="5" column="1"> + <property name="text"> + <string>020423</string> + </property> + </item> + <item row="5" column="2"> + <property name="text"> + <string>0</string> + </property> + </item> + <item row="6" column="0"> + <property name="text"> + <string>鍏朵粬</string> + </property> + </item> + <item row="6" column="1"> + <property name="text"> + <string>020424</string> + </property> + </item> + <item row="6" column="2"> + <property name="text"> + <string>0</string> + </property> + </item> + </widget> </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> @@ -34,7 +207,7 @@ <x>0</x> <y>0</y> <width>800</width> - <height>25</height> + <height>26</height> </rect> </property> </widget> -- Gitblit v1.8.0