diff options
Diffstat (limited to 'src/qt/overviewpage.cpp')
-rw-r--r-- | src/qt/overviewpage.cpp | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 6dedde0272..5b5a8f5271 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -111,7 +111,7 @@ OverviewPage::OverviewPage(QWidget *parent) : ui->labelNumTransactions->setToolTip(tr("Total number of transactions in wallet")); // Recent transactions - ui->listTransactions->setStyleSheet("background:transparent"); + ui->listTransactions->setStyleSheet("QListView { background:transparent }"); ui->listTransactions->setItemDelegate(txdelegate); ui->listTransactions->setIconSize(QSize(DECORATION_SIZE, DECORATION_SIZE)); ui->listTransactions->setSelectionMode(QAbstractItemView::NoSelection); @@ -143,30 +143,34 @@ void OverviewPage::setNumTransactions(int count) void OverviewPage::setModel(WalletModel *model) { this->model = model; + if(model) + { + // Set up transaction list + TransactionFilterProxy *filter = new TransactionFilterProxy(); + filter->setSourceModel(model->getTransactionTableModel()); + filter->setLimit(NUM_ITEMS); + filter->setDynamicSortFilter(true); + filter->setSortRole(Qt::EditRole); + filter->sort(TransactionTableModel::Status, Qt::DescendingOrder); - // Set up transaction list - TransactionFilterProxy *filter = new TransactionFilterProxy(); - filter->setSourceModel(model->getTransactionTableModel()); - filter->setLimit(NUM_ITEMS); - filter->setDynamicSortFilter(true); - filter->setSortRole(Qt::EditRole); - filter->sort(TransactionTableModel::Status, Qt::DescendingOrder); - - ui->listTransactions->setModel(filter); - ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress); + ui->listTransactions->setModel(filter); + ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress); - // Keep up to date with wallet - setBalance(model->getBalance(), model->getUnconfirmedBalance()); - connect(model, SIGNAL(balanceChanged(qint64, qint64)), this, SLOT(setBalance(qint64, qint64))); + // Keep up to date with wallet + setBalance(model->getBalance(), model->getUnconfirmedBalance()); + connect(model, SIGNAL(balanceChanged(qint64, qint64)), this, SLOT(setBalance(qint64, qint64))); - setNumTransactions(model->getNumTransactions()); - connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int))); + setNumTransactions(model->getNumTransactions()); + connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int))); - connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(displayUnitChanged())); + connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(displayUnitChanged())); + } } void OverviewPage::displayUnitChanged() { + if(!model || !model->getOptionsModel()) + return; if(currentBalance != -1) setBalance(currentBalance, currentUnconfirmedBalance); |