--- as_slot.cpp 2002/11/25 15:45:06 1.13
+++ as_slot.cpp 2002/11/26 14:10:32 1.14
@@ -53,8 +53,7 @@
//
void Titraqform::newDoc(void)
{
- // The only way in Qt 3.X to clear rows efficiently
- m_pMaintable->setNumRows(0); // Get rid of any data in table
+ m_pMaintable->setNumRows(0); // Get rid of any data in table
}
//
@@ -193,20 +192,34 @@
//
void Titraqform::updEdit(int nRow, int nCol)
{
- QString Tasktext; // For searching through prefixed task text
QRegExp Shorten("/(\\w+)$"); // For stripping prefix off the current task
- m_pDateedit->setDate(QDate::fromString(m_pMaintable->text(nRow, TITRAQ_INDEXDATE), Qt::ISODate));
- m_pStarttime->setTime(QTime::fromString(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT), Qt::ISODate));
- m_pEndtime->setTime(QTime::fromString(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT), Qt::ISODate));
- m_pAmount->setText(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT));
+ // Field strings to check for validity and process
+ QString Textdate(m_pMaintable->text(nRow, TITRAQ_INDEXDATE));
+ QString Textstart(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT));
+ QString Textfinish(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT));
+ QString Textamount(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT));
+ QString Texttask(m_pMaintable->text(nRow, TITRAQ_INDEXTASK));
+ QString Textremark(m_pMaintable->text(nRow, TITRAQ_INDEXREMARK));
+
+ if (!Textdate.isEmpty())
+ m_pDateedit->setDate(QDate::fromString(Textdate, Qt::ISODate));
+
+ if (!Textstart.isEmpty())
+ m_pStarttime->setTime(QTime::fromString(Textstart, Qt::ISODate));
+
+ if (!Textfinish.isEmpty())
+ m_pEndtime->setTime(QTime::fromString(Textfinish, Qt::ISODate));
+
+ if (!Textamount.isEmpty())
+ m_pAmount->setText(Textamount);
// Process the task combo box to compress text length
- Tasktext = m_pMaintable->text(nRow, TITRAQ_INDEXTASK);
- Tasktext.remove(0, Shorten.search(Tasktext) + 1); // Add one to strip leading slash
+ Texttask.remove(0, Shorten.search(Texttask) + 1); // Strip leading slash
+ m_pTasks->setCurrentText(Texttask);
- m_pTasks->setCurrentText(Tasktext);
- m_pRemark->setText(m_pMaintable->text(nRow, TITRAQ_INDEXREMARK));
+ if (!Textremark.isEmpty())
+ m_pRemark->setText(Textremark);
}
//
|