#include "leadingcompany.h" #include "ui_leadingcompany.h" LeadingCompany::LeadingCompany(QWidget *parent) : QMainWindow(parent), ui(new Ui::LeadingCompany) { ui->setupUi(this); ui->menubar->hide(); ui->statusbar->hide(); m_industryLeaderModel = new QStandardItemModel(this); m_industryLeaderModel->setColumnCount(6); m_trendLeaderModel = new QStandardItemModel(this); m_trendLeaderModel->setColumnCount(7); ui->tableView_industry->setModel(m_industryLeaderModel); ui->tableView_trend->setModel(m_trendLeaderModel); QStringList industryLabels; industryLabels<<"名字"<<"代号"<<"行业"<<"等级"<<"市值"<<"收盘价"; m_industryLeaderModel->setHorizontalHeaderLabels(industryLabels); QStringList trendLabels; trendLabels<<"名字"<<"代号"<<"趋势方向"<<"行业"<<"等级"<<"市值"<<"收盘价"; m_trendLeaderModel->setHorizontalHeaderLabels(trendLabels); } LeadingCompany::~LeadingCompany() { delete ui; } void LeadingCompany::on_pushButton_add_clicked() { QString name = ui->lineEdit_stockName->text(); QString code = ui->lineEdit_stockCode->text(); QString type = ui->comboBox->currentText(); // 添加到数据库 // 添加到文本浏览器来提示消息 ui->textBrowser->append(QString("%1 %2 %3").arg(type).arg(name).arg(code)); }