mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-13 14:14:00 +01:00
Qt: Add a combobox to toolbar to select from multiple wallets
This commit is contained in:
committed by
Jonas Schnelli
parent
3dba3c3ac1
commit
e449f9a9e6
@@ -36,6 +36,7 @@
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QComboBox>
|
||||
#include <QDateTime>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDragEnterEvent>
|
||||
@@ -459,6 +460,23 @@ void BitcoinGUI::createToolBars()
|
||||
toolbar->addAction(receiveCoinsAction);
|
||||
toolbar->addAction(historyAction);
|
||||
overviewAction->setChecked(true);
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
QWidget *spacer = new QWidget();
|
||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
toolbar->addWidget(spacer);
|
||||
|
||||
m_wallet_selector_label = new QLabel();
|
||||
m_wallet_selector_label->setText(tr("Wallet:") + " ");
|
||||
toolbar->addWidget(m_wallet_selector_label);
|
||||
m_wallet_selector_label->setVisible(false);
|
||||
m_wallet_selector = new QComboBox();
|
||||
toolbar->addWidget(m_wallet_selector);
|
||||
m_wallet_selector->setVisible(false);
|
||||
m_wallet_selector_label->setBuddy(m_wallet_selector);
|
||||
|
||||
connect(m_wallet_selector, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(setCurrentWallet(const QString&)));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,6 +548,11 @@ bool BitcoinGUI::addWallet(const QString& name, WalletModel *walletModel)
|
||||
if(!walletFrame)
|
||||
return false;
|
||||
setWalletActionsEnabled(true);
|
||||
m_wallet_selector->addItem(name);
|
||||
if (m_wallet_selector->count() == 2) {
|
||||
m_wallet_selector->setVisible(true);
|
||||
m_wallet_selector->setVisible(true);
|
||||
}
|
||||
return walletFrame->addWallet(name, walletModel);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user