//修改站号
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. 专用于ASP.Net Web应用程序的日期控件

     原文引入:http://blog.csdn.net/nileel/article/details/1566051 专用于ASP.Net Web应用程序的日期控件 分类: ASP.NET/C#2007 ...

  2. nginx 静态网站配置

    /************************************************************************************** * nginx 静态网站 ...

  3. oracle分区表有什么作用

    oracle分区表有什么作用 https://zhidao.baidu.com/question/1818955865408544348.html (1) 表空间及分区表的概念 表空间: 是一个或多个 ...

  4. WIN8系统的远程桌面漏洞 利用QQ拼音纯净版实现提权

    前言 发现这个漏洞的时候, 笔者正在机房上课.正想用3389远程桌面去控制宿舍电脑的时候,因为重做系统忘记自己的IP地址,因此就随手扫描了一下IP段开3389端口的电脑. 没想到就随手扫描到一台WIN ...

  5. css content

    before after demo 1 添加描述信息 div1:after{conent:"天假额外的文字"} 2 也可以显示元素的某些属性 <a class="d ...

  6. UI:文件操作、通知中心

    对文件的操作: #define PATH @"/Users/mac/Desktop/未命名文件夹" #define ERROR(a) if(a){NSLog(@"%@&q ...

  7. ios http2客户端访问nginx失败bug

    我们将项目迁入腾讯云后,外网访问流量转发如下外网--->大禹BGP(BGPAntiDDoS)高防---->lbc(LoadBalance cluster)---->lb-----&g ...

  8. node.js在读取文件时中文乱码问题

    断更很久了........从今天开始会努力的持续更博,积极学习. 言归正传.今天在写node.js的demo时发现一个bug.我在node中读取本地的text文件时,发现英文的内容可以被读取,但是中文 ...

  9. 在JS/jQuery中,怎么触发input的keypress/keydown/keyup事件?

    怎么触发keypress/keydown/keyup事件? 问题: 1.在之前的写的input后面添加了搜索按钮 2.input只有keyup事件,如下: $("#desktop_folde ...

  10. js实现打字效果

    <!DOCTYPE html> <html> <head> <meta charset='utf-8'> <title>js typing& ...