Browse Source

Fixed displaying rows.

kevaview
Just Wonder 5 years ago
parent
commit
e044fdae22
  1. 4
      src/qt/kevadialog.cpp
  2. 11
      src/qt/kevatablemodel.cpp
  3. 2
      src/qt/kevatablemodel.h
  4. 3
      src/qt/walletmodel.cpp

4
src/qt/kevadialog.cpp

@ -70,7 +70,7 @@ void KevaDialog::setModel(WalletModel *_model) @@ -70,7 +70,7 @@ void KevaDialog::setModel(WalletModel *_model)
if(_model && _model->getOptionsModel())
{
_model->getKevaTableModel()->sort(KevaTableModel::Date, Qt::DescendingOrder);
_model->getKevaTableModel()->sort(KevaTableModel::Block, Qt::DescendingOrder);
QTableView* tableView = ui->recentRequestsView;
tableView->verticalHeader()->hide();
@ -133,7 +133,7 @@ void KevaDialog::on_showContent_clicked() @@ -133,7 +133,7 @@ void KevaDialog::on_showContent_clicked()
std::vector<KevaEntry> vKevaEntries;
model->getKevaEntries(vKevaEntries, ValtypeToString(namespaceVal));
model->getKevaTableModel()->setKeva(vKevaEntries);
model->getKevaTableModel()->setKeva(std::move(vKevaEntries));
}
void KevaDialog::on_recentRequestsView_doubleClicked(const QModelIndex &index)

11
src/qt/kevatablemodel.cpp

@ -123,15 +123,18 @@ Qt::ItemFlags KevaTableModel::flags(const QModelIndex &index) const @@ -123,15 +123,18 @@ Qt::ItemFlags KevaTableModel::flags(const QModelIndex &index) const
// actually add to table in GUI
void KevaTableModel::setKeva(std::vector<KevaEntry>& vKevaEntries)
void KevaTableModel::setKeva(std::vector<KevaEntry> vKevaEntries)
{
// Remove the old ones.
removeRows(0, list.size());
list.clear();
beginInsertRows(QModelIndex(), 0, 0);
for (auto it = vKevaEntries.begin(); it != vKevaEntries.end(); it++) {
beginInsertRows(QModelIndex(), 0, 0);
list.prepend(*it);
}
endInsertRows();
}
}
void KevaTableModel::sort(int column, Qt::SortOrder order)
{
@ -161,6 +164,6 @@ bool KevaEntryLessThan::operator()(KevaEntry &left, KevaEntry &right) const @@ -161,6 +164,6 @@ bool KevaEntryLessThan::operator()(KevaEntry &left, KevaEntry &right) const
case KevaTableModel::Value:
return pLeft->value < pRight->value;
default:
return pLeft->date.toTime_t() < pRight->date.toTime_t();
return pLeft->block < pRight->block;
}
}

2
src/qt/kevatablemodel.h

@ -68,7 +68,7 @@ public: @@ -68,7 +68,7 @@ public:
/*@}*/
const KevaEntry &entry(int row) const { return list[row]; }
void setKeva(std::vector<KevaEntry>& vKevaEntries);
void setKeva(std::vector<KevaEntry> vKevaEntries);
public Q_SLOTS:
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);

3
src/qt/walletmodel.cpp

@ -758,9 +758,10 @@ void WalletModel::getKevaEntries(std::vector<KevaEntry>& vKevaEntries, std::stri @@ -758,9 +758,10 @@ void WalletModel::getKevaEntries(std::vector<KevaEntry>& vKevaEntries, std::stri
{
LOCK(cs_main);
valtype nameSpaceVal = ValtypeFromString(nameSpace);
valtype key;
CKevaData data;
std::unique_ptr<CKevaIterator> iter(pcoinsTip->IterateKeys(ValtypeFromString(nameSpace)));
std::unique_ptr<CKevaIterator> iter(pcoinsTip->IterateKeys(nameSpaceVal));
while (iter->next(key, data)) {
KevaEntry entry;
entry.key = ValtypeToString(key);

Loading…
Cancel
Save