Automatically refocus on new SendCoinsEntrys and scroll to them.

This commit is contained in:
Matt Corallo
2011-12-07 00:00:04 -05:00
committed by Luke Dashjr
parent 22388eac08
commit bccbc5f4c3
3 changed files with 14 additions and 0 deletions

View File

@@ -11,6 +11,7 @@
#include <QMessageBox>
#include <QLocale>
#include <QTextDocument>
#include <QScrollBar>
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;
}

View File

@@ -151,3 +151,8 @@ bool SendCoinsEntry::isClear()
return ui->payTo->text().isEmpty();
}
void SendCoinsEntry::setFocus()
{
ui->payTo->setFocus();
}

View File

@@ -30,6 +30,8 @@ public:
// Hence we have to set it up manually
QWidget *setupTabChain(QWidget *prev);
void setFocus();
public slots:
void setRemoveEnabled(bool enabled);
void clear();