TabWight
//修改站号
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的更多相关文章
随机推荐
- YTU 2922: Shape系列-8
2922: Shape系列-8 时间限制: 1 Sec 内存限制: 128 MB 提交: 172 解决: 99 题目描述 小聪又想借用小强的Shape类了,但是不巧的是小强去考英语四级去了,但是小 ...
- 并不对劲的bzoj5020:loj2289:p4546:[THUWC2017]在美妙的数学王国中畅游
题目大意 有一个n(\(n\leq 10^5\))个点的森林,每个点\(u\)上有个函数\(f_u(x)\),是形如\(ax+b\)或\(e^{ax+b}\)或\(sin(ax+b)\)的函数,保证当 ...
- 《JAVA与模式》之调停者模式
调停者模式是对象的行为模式.调停者模式包装了一系列对象相互作用的方式,使得这些对象不必相互明显引用.从而使它们可以较松散地耦合.当这些对象中的某些对象之间的相互作用发生改变时,不会立即影响到其他的一些 ...
- maven中添加json-lib的jar包
在maven配置文件pom.xml中添加如下配置信息: <dependency> <groupId>net.sf.json-lib</groupId> <ar ...
- jquery 插件2014
jquery Plugins:http://plugins.jquery.com/ Amazon Side Bar Menu http://plugins.jquery.com/amazonsideb ...
- ReplacementShader 测试
简介 参考网页 SetReplacementShader(Shader shader, string replacementTag); 参数中的replacementTag,是Shader中Tags中 ...
- bzoj 4184: shallot【线性基+时间线段树】
学到了线段树新姿势! 先离线读入,根据时间建一棵线段树,每个节点上开一个vector存这个区间内存在的数(使用map来记录每个数出现的一段时间),然后在线段树上dfs,到叶子节点就计算答案. 注意!! ...
- 牛客网NOIP赛前集训营-提高组(第八场)
染色 链接:https://ac.nowcoder.com/acm/contest/176/A来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 524288K,其他语言10 ...
- jquery的validate的用法
//引入js文件 //jquery 文件 <script src="__PUBLIC__/static/wap/js/jquery.min.js?v=2.1.4">&l ...
- spring源代码下载并导入eclipse技巧
环境:mac 安装brew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install ...