From: fsb4000 Date: Tue, 6 Jan 2015 13:29:08 +0000 (+0600) Subject: the RPC Console should be a QWidget... X-Git-Tag: nvc-v0.5.1~21^2~3 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=a75927ea86b5456e0cb0bf68226c8e3402197ec8 the RPC Console should be a QWidget... to make window more independent https://github.com/bitcoin/bitcoin/commit/4a8fc152a957e54e6dd910de4382678f5c405198 --- diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 6cfe858..6b6b9e7 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -197,7 +197,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): // Double-clicking on a transaction on the transaction history page shows details connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails())); - rpcConsole = new RPCConsole(this); + rpcConsole = new RPCConsole(0); connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show())); // Clicking on "Verify Message" in the address book sends you to the verify message tab @@ -215,6 +215,8 @@ BitcoinGUI::~BitcoinGUI() #ifdef Q_OS_MAC delete appMenuBar; #endif + + delete rpcConsole; } void BitcoinGUI::createActions() @@ -809,6 +811,9 @@ void BitcoinGUI::closeEvent(QCloseEvent *event) } #endif } + // close rpcConsole in case it was open to make some space for the shutdown window + rpcConsole->close(); + QMainWindow::closeEvent(event); } diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index 30d9ab2..30e1468 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -1,7 +1,7 @@ RPCConsole - + 0 diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 1f2fa9d..ce71379 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -189,7 +189,7 @@ void RPCExecutor::request(const QString &command) } RPCConsole::RPCConsole(QWidget *parent) : - QDialog(parent, DIALOGWINDOWHINTS), + QWidget(parent), ui(new Ui::RPCConsole), historyPtr(0) { @@ -255,7 +255,7 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event) } } } - return QDialog::eventFilter(obj, event); + return QWidget::eventFilter(obj, event); } void RPCConsole::setClientModel(ClientModel *model) @@ -494,3 +494,11 @@ void RPCConsole::hideEvent(QHideEvent *event) if (!clientModel) return; } + +void RPCConsole::keyPressEvent(QKeyEvent *event) +{ + if(windowType() != Qt::Widget && event->key() == Qt::Key_Escape) + { + close(); + } +} \ No newline at end of file diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index a4d1ebb..b523f0f 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -1,7 +1,7 @@ #ifndef RPCCONSOLE_H #define RPCCONSOLE_H -#include +#include namespace Ui { class RPCConsole; @@ -9,7 +9,7 @@ namespace Ui { class ClientModel; /** Local Bitcoin RPC console. */ -class RPCConsole: public QDialog +class RPCConsole: public QWidget { Q_OBJECT @@ -29,6 +29,7 @@ public: protected: virtual bool eventFilter(QObject* obj, QEvent *event); + void keyPressEvent(QKeyEvent *); private slots: void on_lineEdit_returnPressed();