address book edit: edit the right row
This commit is contained in:
parent
66d536ed07
commit
c30075142f
1 changed files with 5 additions and 2 deletions
|
@ -82,7 +82,7 @@ void AddressBookDialog::on_copyToClipboard_clicked()
|
||||||
|
|
||||||
foreach (QModelIndex index, indexes)
|
foreach (QModelIndex index, indexes)
|
||||||
{
|
{
|
||||||
QVariant address = table->model()->data(index);
|
QVariant address = index.data();
|
||||||
QApplication::clipboard()->setText(address.toString());
|
QApplication::clipboard()->setText(address.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,6 +94,9 @@ void AddressBookDialog::on_editButton_clicked()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/* Map selected index to source address book model */
|
||||||
|
QAbstractProxyModel *proxy_model = static_cast<QAbstractProxyModel*>(getCurrentTable()->model());
|
||||||
|
QModelIndex selected = proxy_model->mapToSource(indexes.at(0));
|
||||||
|
|
||||||
/* Double click also triggers edit button */
|
/* Double click also triggers edit button */
|
||||||
EditAddressDialog dlg(
|
EditAddressDialog dlg(
|
||||||
|
@ -101,7 +104,7 @@ void AddressBookDialog::on_editButton_clicked()
|
||||||
EditAddressDialog::EditSendingAddress :
|
EditAddressDialog::EditSendingAddress :
|
||||||
EditAddressDialog::EditReceivingAddress);
|
EditAddressDialog::EditReceivingAddress);
|
||||||
dlg.setModel(model);
|
dlg.setModel(model);
|
||||||
dlg.loadRow(indexes.at(0).row());
|
dlg.loadRow(selected.row());
|
||||||
if(dlg.exec())
|
if(dlg.exec())
|
||||||
{
|
{
|
||||||
dlg.saveCurrentRow();
|
dlg.saveCurrentRow();
|
||||||
|
|
Loading…
Reference in a new issue