#include "ui_find_list.h"class FindList :public QWidget, public Ui::find_list{ Q_OBJECTpublic: FindList( QWidget * parent = 0, Qt::WindowFlags f = 0 );};
FindList::FindList(QWidget * parent, Qt::WindowFlags f):QWidget(parent, f){setupUi(this);//...}
C++ (Qt)void find_list::on_pushButton_clicked(){ QString date_s = m_ui->date_s->text(),date_po,str = m_ui->date_po->text(); QFile file("tovars.txt"); QByteArray line; QStringList spl; int sum = 0,row = 0; if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return;while (!file.atEnd()){ line = file.readLine(); line.trimmed(); str.clear(); str.append(line); str.trimmed(); spl = str.split("|"); str = spl.value(2); str.trimmed(); if ((str>=date_s) && (str<=date_po)) { spl.clear(); str.clear(); str.append(line); spl = str.split("|"); str.clear(); str = spl.value(1); sum +=str.toInt(); m_ui->pole->setItem(row,0, new QTableWidgetItem(spl.value(0))); m_ui->pole->setItem(row,1, new QTableWidgetItem(spl.value(1))); m_ui->pole->setItem(row,2, new QTableWidgetItem(spl.value(2))); row++; }}m_ui->lcd->display(row);str.clear();m_ui->itog->setText(str.setNum(sum));
connect(btn, SIGNAL(clicked()), widget, SLOT(on_pushButton_clicked()));