Browse Source

Automatically refocus on new SendCoinsEntrys and scroll to them.

miguelfreitas
Matt Corallo 13 years ago
parent
commit
9a93c4c024
  1. 7
      src/qt/sendcoinsdialog.cpp
  2. 5
      src/qt/sendcoinsentry.cpp
  3. 2
      src/qt/sendcoinsentry.h

7
src/qt/sendcoinsdialog.cpp

@ -11,6 +11,7 @@ @@ -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() @@ -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;
}

5
src/qt/sendcoinsentry.cpp

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

2
src/qt/sendcoinsentry.h

@ -31,6 +31,8 @@ public: @@ -31,6 +31,8 @@ public:
*/
QWidget *setupTabChain(QWidget *prev);
void setFocus();
public slots:
void setRemoveEnabled(bool enabled);
void clear();

Loading…
Cancel
Save