本文整理汇总了C++中QStringListModel::index方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringListModel::index方法的具体用法?C++ QStringListModel::index怎么用?C++ QStringListModel::index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringListModel
的用法示例。
在下文中一共展示了QStringListModel::index方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addBouchot
void QQBoardsSettings::addBouchot()
{
QQBouchotSettingsDialog bouchotSettingsDialog(this);
bouchotSettingsDialog.setGroups(m_listGroups);
bouchotSettingsDialog.setNames(m_listNames);
if(bouchotSettingsDialog.exec() == QDialog::Accepted)
{
QQBouchot::QQBouchotSettings bSettings = bouchotSettingsDialog.bouchotSettings();
QString bouchotName = bouchotSettingsDialog.bouchotName();
if(m_listNames.contains(bouchotName))
{
qWarning() << "Trying to insert a bouchot with an already existing name, that's forbidden";
}
else
{
m_listNames.append(bouchotName);
if(! m_listGroups.contains(bSettings.group()))
m_listGroups.append(bSettings.group());
QStringListModel *model = (QStringListModel *) ui->bouchotListView->model();
int numRow = model->rowCount();
model->insertRows(numRow,1);
model->setData(model->index(numRow), QVariant(bouchotName));
m_newBouchots.insert(bouchotName, bSettings);
m_oldBouchots.removeAll(bouchotName);
}
}
}
示例2: olccsAddBouchot
void QQBoardsSettings::olccsAddBouchot()
{
QQBoardWizard wizard(this);
if(wizard.exec() == QDialog::Accepted)
{
QQBouchot::QQBouchotSettings bSettings = wizard.bouchotSettings();
QString bouchotName = wizard.bouchotName();
if(m_listNames.contains(bouchotName))
{
qWarning() << "Trying to insert a bouchot with an already existing name, that's forbidden";
}
else
{
m_listNames.append(bouchotName);
if(! m_listGroups.contains(bSettings.group()))
m_listGroups.append(bSettings.group());
QStringListModel *model = (QStringListModel *) ui->bouchotListView->model();
int numRow = model->rowCount();
model->insertRows(numRow, 1);
model->setData(model->index(numRow), QVariant(bouchotName));
m_newBouchots.insert(bouchotName, bSettings);
m_oldBouchots.removeAll(bouchotName);
}
if(wizard.showAdvanced())
{
QStringListModel *model = (QStringListModel *) ui->bouchotListView->model();
QItemSelectionModel *selModel = ui->bouchotListView->selectionModel();
for(int i = 0; i < model->rowCount(); i++)
{
QModelIndex mIndex = model->index(i);
if(model->data(mIndex, Qt::EditRole).toString() == bouchotName)
{
selModel->select(mIndex, QItemSelectionModel::ClearAndSelect);
editBouchot();
}
}
}
}
}
示例3: setBouchots
void QQBoardsSettings::setBouchots(const QMap<QString, QQBouchot::QQBouchotSettings> currentListBouchot)
{
m_bouchots = currentListBouchot;
QStringListModel *model = (QStringListModel *) ui->bouchotListView->model();
model->removeRows(0, model->rowCount());
model->insertRows(0, m_bouchots.size());
m_listNames = currentListBouchot.keys();
QMapIterator<QString, QQBouchot::QQBouchotSettings> i(m_bouchots);
int index = 0;
while(i.hasNext())
{
i.next();
QQBouchot::QQBouchotSettings settings = i.value();
if(! m_listGroups.contains(settings.group()))
m_listGroups.append(settings.group());
model->setData(model->index(index++), QVariant(i.key()));
}
}
示例4: outputMultiTunnels
int LzExcelOutput::outputMultiTunnels(ClearanceMultiTunnels * inputdata, QString templatepath, QString outputfile, QString insertimgpath)
{
QString templatename = "MultiTunnelsTemplate.xls";
int ret = copy(templatepath, templatename, outputfile);
if (ret != 0)
return ret;
// 插入图片路径不存在
if (!QFile(insertimgpath).exists())
return 3;
//操作已经存在的excel,生成限界尺寸表
ExcelEngine excel;
excel.Open(outputfile, 1, false);
QString linename = inputdata->getLineName();
// 限界表名称
excel.SetCellData(1,1,QObject::tr("%1-区段桥隧综合最小建筑限界尺寸表").arg(linename));
excel.SetCellData(52,1,QObject::tr("%1-区段桥隧综合最小建筑限界尺寸图").arg(linename));
// 线路名称
excel.SetCellData(3,3,linename);
excel.SetCellData(54,2,linename);
excel.SetCellData(54,5,linename);
// 区段
excel.SetCellData(3,9,linename);
QString endStationName = inputdata->getEndStationName();
// 面向站名
excel.SetCellData(3,15,endStationName);
excel.SetCellData(54,13,endStationName);
QStringListModel * tunnelsmodel = inputdata->getTunnelsNames();
// 桥隧总数
excel.SetCellData(4,4,tunnelsmodel->rowCount());
// 桥梁数
excel.SetCellData(4,11,inputdata->getNumOfOutOfClearanceBridges());
// 隧道数
excel.SetCellData(4,14,inputdata->getNumOfOutOfClearanceTunnels());
// 时间
// 采集日期
QModelIndex index = tunnelsmodel->index(0,0);
QString tunnelinfo = index.data().toString();//这两行代码获取QStringListModel中第一行的值
QStringList strlist = tunnelinfo.split("-");
if (strlist.length() < 3)
return -1;
QString collectdate = strlist.at(2);
excel.SetCellData(49,15,collectdate);
excel.SetCellData(54,16,collectdate);
// 最小曲线半径
int minRadius = inputdata->getMinRadius();
excel.SetCellData(5,5,minRadius);
// 最大外轨超高
excel.SetCellData(5,10,inputdata->getWaiGuiChaoGao());
// 最低接触网高度
excel.SetCellData(5,16,inputdata->getJieChuWangGaoDu());
ClearanceData * data = &inputdata->getClearanceStraightData();
int rowcount = data->getMaps().size();
// Excel模板从第10行开始为高度限界数据,前面几行为表头或空格
int startrownum = 10;
int startcolumnnumdef = 1;
// 临时变量
int startcolumnnum = startcolumnnumdef;
float tmpval;
_int64 tmppos;
int tmpradius;
float minHeight;
for (int i = 0; i < 3; i++)
{
startcolumnnum = startcolumnnumdef;
switch(i)
{
case Curve_Straight:
if (inputdata->getNumOfStraight())
{
data = &inputdata->getClearanceStraightData();
startcolumnnum += LzOutputTableColumn::Straight_Left_Val;
}
else
continue;
break;
case Curve_Left:
if (inputdata->getNumOfLeft())
{
data = &inputdata->getClearanceLeftData();
startcolumnnum += LzOutputTableColumn::LeftCurve_Left_Val;
}
else
continue;
//.........这里部分代码省略.........
开发者ID:fanxiang090909,项目名称:Railway-Tunnel-Construction-Dlearance-Measure-LanZhou,代码行数:101,代码来源:lz_excel_output.cpp