mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-06-02 09:02:34 +02:00
2021-01-15 Fred Gleason <fredg@paravelsystems.com>
* Modified the 'RDLibraryModel::addCart()' to return 'QModelIndex' rather than 'int'. * Renamed 'RDLibraryModel::refreshCartLine()' to 'RDLibrary::updateCartLine()' and made it protected. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
42e1358386
commit
3536c8b151
@ -20794,3 +20794,5 @@
|
|||||||
2021-01-15 Fred Gleason <fredg@paravelsystems.com>
|
2021-01-15 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Modified the 'RDLibraryModel::addCart()' to return 'QModelIndex'
|
* Modified the 'RDLibraryModel::addCart()' to return 'QModelIndex'
|
||||||
rather than 'int'.
|
rather than 'int'.
|
||||||
|
* Renamed 'RDLibraryModel::refreshCartLine()' to
|
||||||
|
'RDLibrary::updateCartLine()' and made it protected.
|
||||||
|
@ -400,7 +400,7 @@ void RDLibraryModel::removeCart(unsigned cartnum)
|
|||||||
void RDLibraryModel::refreshRow(const QModelIndex &index)
|
void RDLibraryModel::refreshRow(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if(isCart(index)) {
|
if(isCart(index)) {
|
||||||
refreshCartLine(index.row());
|
updateCartLine(index.row());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,27 +410,12 @@ void RDLibraryModel::refreshCart(unsigned cartnum)
|
|||||||
QString cartnum_str=QString().sprintf("%06u",cartnum);
|
QString cartnum_str=QString().sprintf("%06u",cartnum);
|
||||||
for(int i=0;i<d_texts.size();i++) {
|
for(int i=0;i<d_texts.size();i++) {
|
||||||
if(d_texts.at(i).at(0).toString()==cartnum_str) {
|
if(d_texts.at(i).at(0).toString()==cartnum_str) {
|
||||||
refreshCartLine(i);
|
updateCartLine(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RDLibraryModel::refreshCartLine(int cartline)
|
|
||||||
{
|
|
||||||
QString sql=sqlFields()+
|
|
||||||
"where "+
|
|
||||||
"CART.NUMBER="+d_texts.at(cartline).at(0).toString();
|
|
||||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
|
||||||
if(q->first()) {
|
|
||||||
updateRow(cartline,q);
|
|
||||||
emit dataChanged(createIndex(cartline,0,0),
|
|
||||||
createIndex(cartline,columnCount(),(quint32)0));
|
|
||||||
}
|
|
||||||
delete q;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RDLibraryModel::setFilterSql(const QString &sql)
|
void RDLibraryModel::setFilterSql(const QString &sql)
|
||||||
{
|
{
|
||||||
updateModel(sql);
|
updateModel(sql);
|
||||||
@ -502,6 +487,21 @@ void RDLibraryModel::updateModel(const QString &filter_sql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RDLibraryModel::updateCartLine(int cartline)
|
||||||
|
{
|
||||||
|
QString sql=sqlFields()+
|
||||||
|
"where "+
|
||||||
|
"CART.NUMBER="+d_texts.at(cartline).at(0).toString();
|
||||||
|
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||||
|
if(q->first()) {
|
||||||
|
updateRow(cartline,q);
|
||||||
|
emit dataChanged(createIndex(cartline,0,0),
|
||||||
|
createIndex(cartline,columnCount(),(quint32)0));
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void RDLibraryModel::updateRow(int row,RDSqlQuery *q)
|
void RDLibraryModel::updateRow(int row,RDSqlQuery *q)
|
||||||
{
|
{
|
||||||
unsigned cartnum=q->value(0).toUInt();
|
unsigned cartnum=q->value(0).toUInt();
|
||||||
|
@ -62,7 +62,6 @@ class RDLibraryModel : public QAbstractItemModel
|
|||||||
void removeCart(unsigned cartnum);
|
void removeCart(unsigned cartnum);
|
||||||
void refreshRow(const QModelIndex &index);
|
void refreshRow(const QModelIndex &index);
|
||||||
void refreshCart(unsigned cartnum);
|
void refreshCart(unsigned cartnum);
|
||||||
void refreshCartLine(int cartline);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void rowCountChanged(int rows);
|
void rowCountChanged(int rows);
|
||||||
@ -73,6 +72,7 @@ class RDLibraryModel : public QAbstractItemModel
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateModel(const QString &filter_sql);
|
void updateModel(const QString &filter_sql);
|
||||||
|
void updateCartLine(int cartline);
|
||||||
void updateRow(int row,RDSqlQuery *q);
|
void updateRow(int row,RDSqlQuery *q);
|
||||||
QString sqlFields() const;
|
QString sqlFields() const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user