//修改站号
void CDlgParamView::OnPushButton_2_Tab8Clicked()
{
// int iSel = m_listStation.GetSelectionMark();
int iSel = ui->tableView_Tab8->currentIndex().row();
if (iSel < 0)
{
AfxMessageBox(_T("请选择站号!"), MB_ICONWARNING);
}
CString strNum = _T(""), strIp = _T(""), strPort = _T("");
QModelIndex indexstrNum = model->index(iSel, 0);
QString tempstrNum = indexstrNum.data().toString();
strNum = QS2CS(tempstrNum);
QModelIndex indexstrIp = model->index(iSel, 1);
QString tempstrIp = indexstrIp.data().toString();
strIp = QS2CS(tempstrIp);
QModelIndex indexstrPort = model->index(iSel, 2);
QString tempstrPort = indexstrPort.data().toString();
strPort = QS2CS(tempstrPort);
CDlgStationOp dlgStationOp(1, strNum, strIp, strPort);
dlgStationOp.SetThisParent(this);
if (dlgStationOp.exec() == QDialog::Accepted)
{
QModelIndex index_0 = model->index(iSel, 0);//选中行第0列的内容
QModelIndex index_1 = model->index(iSel, 1);//选中行第1列的内容
QModelIndex index_2 = model->index(iSel, 2);//选中行第2列的内容

model->setData(index_0, QVariant::fromValue(CS2QS(dlgStationOp.m_strNum)));
model->setData(index_1, QVariant::fromValue(CS2QS(dlgStationOp.m_strIpAddr)));
model->setData(index_2, QVariant::fromValue(CS2QS(dlgStationOp.m_strPort)));
}
}

//删除站号
void CDlgParamView::OnPushButton_3_Tab8Clicked()
{
if (AfxMessageBox(_T("确定要删除该站号码?"), MB_YESNO | MB_ICONQUESTION) == IDYES)
{
int iSel = ui->tableView_Tab8->currentIndex().row();
model->removeRow(iSel);
}
}

QStringList list;
list << CS2QS(dlgStationOp.m_strNum) << CS2QS(dlgStationOp.m_strIpAddr) << CS2QS(dlgStationOp.m_strPort);
QList<QStandardItem*> listQStand = QList<QStandardItem*>();
listQStand << new QStandardItem(list[0])
<< new QStandardItem(list[1])
<< new QStandardItem(list[2]);
model->insertRow(model->rowCount(), listQStand); //在第0行插入一条记录

最新文章

  1. Java的流程控制和C++的异同
  2. Spring的依赖注入怎么理解
  3. scrollTo 和 scrollBy
  4. 【转】MSMQ消息队列安装
  5. 如何下载Hibernate
  6. AE数据加载
  7. Mac OS X Mountain Lion安装Bochs
  8. hdu 5874 Friends and Enemies icpc大连站网络赛 1007 数学
  9. HDU-2017-字符串统计
  10. AbstractQueuedSynchronizer原理及代码分析
  11. vi 编辑器常用快捷键
  12. Caused by: java.lang.ClassNotFoundException: Didn&#39;t find class &quot;io.grpc.helloworldexample.HelloworldActivity&quot; on path: DexPathList
  13. Java 11 Tutorial
  14. 从零上手Python关键代码
  15. 基于TCP/IP协议的socket通讯client
  16. javascript中的require、import和export模块文件
  17. J - Oil Skimming 二分图的最大匹配
  18. html5shiv.min.js
  19. 17 汽车服务工程 李腾飞 MP4
  20. 搭建Eclipse和MyEclipse的开发环境

热门文章

  1. 谈一谈以太坊虚拟机EVM的缺陷与不足
  2. JSOI2010 联通数
  3. pom.xml内容没有错,但一直报错红叉 解决办法
  4. Oracle第三方ado.net数据提供程序(转)
  5. 动态规划基础复习 By cellur925
  6. 结对测试vs随机测试
  7. spring进行事务管理
  8. clipboard.js 实现动态获取内容并复制到剪切板
  9. DP Codeforces Round #260 (Div. 1) A. Boredom
  10. 为什么JAVA虚拟机分为线程共享和非线程共享?