2021-01-15 Fred Gleason <fredg@paravelsystems.com>

* Modified the 'RDLibraryModel::addCart()' to return 'QModelIndex'
	rather than 'int'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-01-15 07:35:15 -05:00
parent aa41ce2f84
commit 42e1358386
4 changed files with 8 additions and 5 deletions

View File

@ -20791,3 +20791,6 @@
2021-01-14 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rdlibrary(1) that caused a SQL error to be generated
when neither audio nor macro carts were selected in the cart filter.
2021-01-15 Fred Gleason <fredg@paravelsystems.com>
* Modified the 'RDLibraryModel::addCart()' to return 'QModelIndex'
rather than 'int'.

View File

@ -334,7 +334,7 @@ QString RDLibraryModel::cartOwnedBy(const QModelIndex &index)
}
int RDLibraryModel::addCart(unsigned cartnum)
QModelIndex RDLibraryModel::addCart(unsigned cartnum)
{
//
// Find the insertion offset
@ -372,7 +372,7 @@ int RDLibraryModel::addCart(unsigned cartnum)
endInsertRows();
emit rowCountChanged(d_texts.size());
return offset;
return createIndex(offset,0,0);
}

View File

@ -58,7 +58,7 @@ class RDLibraryModel : public QAbstractItemModel
RDCart::Type cartType(const QModelIndex &index) const;
QString cutName(const QModelIndex &index) const;
QString cartOwnedBy(const QModelIndex &index);
int addCart(unsigned cartnum);
QModelIndex addCart(unsigned cartnum);
void removeCart(unsigned cartnum);
void refreshRow(const QModelIndex &index);
void refreshCart(unsigned cartnum);

View File

@ -377,8 +377,8 @@ void MainWidget::addData()
EditCart *cart=
new EditCart(cartnums,&lib_import_path,true,profile_ripping,this);
if(cart->exec()) {
int row=lib_cart_model->addCart(cart_num);
lib_cart_view->scrollTo(lib_cart_model->index(row,0));
QModelIndex row=lib_cart_model->addCart(cart_num);
SelectRow(row);
SendNotification(RDNotification::AddAction,cart_num);
}
else {