diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 729711b..00a85f2 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -631,6 +631,7 @@ void MainWindow::onWalletOpened() { connect(m_ctx->currentWallet->subaddress(), &Subaddress::labelChanged, [this]{ m_ctx->storeWallet(); }); + ui->receiveWidget->selectFirst(); // history page m_ctx->currentWallet->history()->refresh(m_ctx->currentWallet->currentSubaddressAccount()); diff --git a/src/receivewidget.cpp b/src/receivewidget.cpp index 6cbace7..836ad0d 100644 --- a/src/receivewidget.cpp +++ b/src/receivewidget.cpp @@ -131,7 +131,6 @@ void ReceiveWidget::showHeaderMenu(const QPoint& position) void ReceiveWidget::setQrCode(const QString &address){ const QrCode qrc(address, QrCode::Version::AUTO, QrCode::ErrorCorrectionLevel::MEDIUM); - int width = ui->qrCode->width() - 4; if (qrc.isValid()) { ui->qrCode->setPixmap(qrc.toPixmap(1).scaled(width, width, Qt::KeepAspectRatio)); @@ -147,6 +146,12 @@ void ReceiveWidget::showQrCodeDialog() { dialog->deleteLater(); } +void ReceiveWidget::selectFirst() { + if(m_proxyModel->rowCount() > 0) { + ui->addresses->setCurrentIndex(m_proxyModel->index(0,0)); + } +} + ReceiveWidget::~ReceiveWidget() { delete ui; } diff --git a/src/receivewidget.h b/src/receivewidget.h index 73c9f85..a4e2af9 100644 --- a/src/receivewidget.h +++ b/src/receivewidget.h @@ -24,6 +24,7 @@ Q_OBJECT public: explicit ReceiveWidget(QWidget *parent = nullptr); void setModel(SubaddressModel * model, Subaddress * subaddress); + void selectFirst(); ~ReceiveWidget() override;