//修改站号
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行插入一条记录

TabWight的更多相关文章

随机推荐

  1. ip地址管理与子网划分

    1,高层协议(主机到主机或应用问题)负责名字到地址的映射.国际模块负责网际地址到局域网地址的映射.底层(如本地网或网关)程序的任务是负责本地网地址到路由上的映射. 2,地址是由4个八位字节组成(32位 ...

  2. LOJ114_k 大异或和_线性基

    LOJ114_k 大异或和_线性基 先一个一个插入到线性基中,然后高斯消元. 求第K小就是对K的每一位是1的都用对应的线性基的一行异或起来即可. 但是线性基不包含0的情况,因此不能确定能否组成0,需要 ...

  3. VS2013在右键菜单添加命令插件开发

    一.选择Visual Studio Package模板建立插件项目 由于此功能需要在右键菜单上添加命令,所以选择Visual Studio Package模板,根据模板向导步骤插件项目,在Select ...

  4. leetcode 戳气球

    有 n 个气球,编号为0 到 n-1,每个气球上都标有一个数字,这些数字存在数组 nums 中. 现在要求你戳破所有的气球.每当你戳破一个气球 i 时,你可以获得 nums[left] * nums[ ...

  5. 关于spring cloud eureka整合ribbon实现客户端的负载均衡

    1. 实现eureka整合ribbon非常简单, 1.1.首先引入所需maven依赖 <dependency> <groupId>org.springframework.boo ...

  6. Word Cloud (词云) - Matlab

    今天要总结的是 Word Cloud 最后一个部分了,用 Matlab 来创建 word cloud.Matlab R2018b 已经提供 wordcloud 函数可以直接生成词云了. >> ...

  7. thunderbird 登录网易邮箱

    登录密码不是自己的密码,而是在网易邮箱中设置的客户端授权ma,自己先进入邮箱进行设置即可

  8. spring源代码下载并导入eclipse技巧

    环境:mac 安装brew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install ...

  9. python网络爬虫之四简单爬取豆瓣图书项目

    一.爬虫项目一: 豆瓣图书网站图书的爬取: import requests import re content = requests.get("https://book.douban.com ...

  10. 【OCR技术系列一】光学字符识别技术介绍

    注:此篇内容主要是综合整理了光学字符识别 和OCR技术系列之一]字符识别技术总览,详情见文末参考文献 什么是 OCR? OCR(Optical Character Recognition,光学字符识别 ...