From 9a93c4c02471fea7acb4882efaebaaefc1733466 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 7 Dec 2011 00:00:04 -0500 Subject: [PATCH] Automatically refocus on new SendCoinsEntrys and scroll to them. --- src/qt/sendcoinsdialog.cpp | 7 +++++++ src/qt/sendcoinsentry.cpp | 5 +++++ src/qt/sendcoinsentry.h | 2 ++ 3 files changed, 14 insertions(+) diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 762f27df..6d328911 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -11,6 +11,7 @@ #include #include #include +#include SendCoinsDialog::SendCoinsDialog(QWidget *parent) : QDialog(parent), @@ -188,6 +189,12 @@ SendCoinsEntry *SendCoinsDialog::addEntry() // Focus the field, so that entry can start immediately entry->clear(); + entry->setFocus(); + ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->sizeHint()); + QCoreApplication::instance()->processEvents(); + QScrollBar* bar = ui->scrollArea->verticalScrollBar(); + if (bar) + bar->setSliderPosition(bar->maximum()); return entry; } diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 23b11ccd..ab5460f8 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -151,3 +151,8 @@ bool SendCoinsEntry::isClear() return ui->payTo->text().isEmpty(); } +void SendCoinsEntry::setFocus() +{ + ui->payTo->setFocus(); +} + diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index b7f4a0af..cdbf8932 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -31,6 +31,8 @@ public: */ QWidget *setupTabChain(QWidget *prev); + void setFocus(); + public slots: void setRemoveEnabled(bool enabled); void clear();