|
@@ -192,7 +192,7 @@ void PlanCard::deletePlanItem(const enum_WeekDay weekDay, const QDateTime& time,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-/* 删除一项,传入行号 */
|
|
|
+/* 删除一项,传入行号,传入的是原始行号 */
|
|
|
PlanInfo PlanCard::deletePlanItem(const int row)
|
|
|
{
|
|
|
if(row < 0 || row >= m_model->rowCount())
|
|
@@ -200,10 +200,10 @@ PlanInfo PlanCard::deletePlanItem(const int row)
|
|
|
return PlanInfo(); /* 没有选中行 */
|
|
|
}
|
|
|
/* 获取原始模型的行号 */
|
|
|
- auto sourceRow = m_sortModel->mapToSource(m_sortModel->index(row, 0)).row();
|
|
|
+ // auto sourceRow = m_sortModel->mapToSource(m_sortModel->index(row, 0)).row();
|
|
|
/* 获取该行计划 */
|
|
|
- auto item1 = m_model->item(sourceRow, 0);
|
|
|
- auto item2 = m_model->item(sourceRow, 1);
|
|
|
+ auto item1 = m_model->item(row, 0);
|
|
|
+ auto item2 = m_model->item(row, 1);
|
|
|
PlanInfo info;
|
|
|
info.onWeekDay = static_cast<enum_WeekDay>(item1->data(UserRole_WeekDay).toInt());
|
|
|
info.onDateTime = item1->data(UserRole_Time).toDateTime();
|
|
@@ -211,7 +211,7 @@ PlanInfo PlanCard::deletePlanItem(const int row)
|
|
|
info.offDateTime = item2->data(UserRole_Time).toDateTime();
|
|
|
|
|
|
/* 删除该行 */
|
|
|
- m_model->removeRow(sourceRow);
|
|
|
+ m_model->removeRow(row);
|
|
|
|
|
|
/* 判断数据有没有空 */
|
|
|
if(m_model->rowCount() == 0)
|
|
@@ -356,7 +356,7 @@ void PlanCard::setPlanList(const QList<PlanInfo>& list)
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * @brief 获取选中的行,返回的是表面上的行号,不是实际的真实行号,真实行号需要通过sortModel来获取
|
|
|
+ * @brief 获取选中的行,返回的是真实的行号
|
|
|
*
|
|
|
* @return int
|
|
|
*/
|