Add autocomplete to bitcoin-qt's console window.

ce7413fcb7
This commit is contained in:
Luv Khemani
2016-02-27 11:57:12 +08:00
committed by lateminer
parent 5722febc74
commit a2e91361e8
4 changed files with 35 additions and 1 deletions

View File

@@ -31,6 +31,7 @@
#include <QThread>
#include <QTime>
#include <QTimer>
#include <QStringList>
#if QT_VERSION < 0x050000
#include <QUrl>
@@ -430,7 +431,19 @@ void RPCConsole::setClientModel(ClientModel *model)
ui->buildDate->setText(model->formatBuildDate());
ui->startupTime->setText(model->formatClientStartupTime());
ui->networkName->setText(QString::fromStdString(Params().NetworkIDString()));
}
//Setup autocomplete and attach it
QStringList wordList;
std::vector<std::string> commandList = tableRPC.listCommands();
for (size_t i = 0; i < commandList.size(); ++i)
{
wordList << commandList[i].c_str();
}
autoCompleter = new QCompleter(wordList, this);
ui->lineEdit->setCompleter(autoCompleter);
}
}
static QString categoryClass(int category)