aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2016-12-29 13:53:25 +0000
committerJonas Schnelli <dev@jonasschnelli.ch>2018-03-26 18:40:26 +0700
commitd1ec34a761d1d99b84e792fb6a6e62dbd8b5bdde (patch)
tree936d68c75f957e139ece9ef9a7f1b377dce36f83 /src
parentd49cc70e6d96b45a4c062cbe2fa49a8181c8560f (diff)
Qt: QComboBox::setVisible doesn't work in toolbars, so defer adding it at all until needed
Diffstat (limited to 'src')
-rw-r--r--src/qt/bitcoingui.cpp17
-rw-r--r--src/qt/bitcoingui.h1
2 files changed, 8 insertions, 10 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 2530c9dc7c..6791a4a164 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -86,6 +86,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
progressBar(0),
progressDialog(0),
appMenuBar(0),
+ appToolBar(0),
overviewAction(0),
historyAction(0),
quitAction(0),
@@ -453,6 +454,7 @@ void BitcoinGUI::createToolBars()
if(walletFrame)
{
QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
+ appToolBar = toolbar;
toolbar->setContextMenuPolicy(Qt::PreventContextMenu);
toolbar->setMovable(false);
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
@@ -467,15 +469,7 @@ void BitcoinGUI::createToolBars()
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
}
@@ -551,8 +545,11 @@ bool BitcoinGUI::addWallet(const QString& name, WalletModel *walletModel)
setWalletActionsEnabled(true);
m_wallet_selector->addItem(name);
if (m_wallet_selector->count() == 2) {
- m_wallet_selector->setVisible(true);
- m_wallet_selector->setVisible(true);
+ m_wallet_selector_label = new QLabel();
+ m_wallet_selector_label->setText(tr("Wallet:") + " ");
+ m_wallet_selector_label->setBuddy(m_wallet_selector);
+ appToolBar->addWidget(m_wallet_selector_label);
+ appToolBar->addWidget(m_wallet_selector);
}
rpcConsole->addWallet(name, walletModel);
return walletFrame->addWallet(name, walletModel);
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 597c583ef2..5037203306 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -89,6 +89,7 @@ private:
QProgressDialog *progressDialog;
QMenuBar *appMenuBar;
+ QToolBar *appToolBar;
QAction *overviewAction;
QAction *historyAction;
QAction *quitAction;