qt: Prevent the main window popup menu

By default, a popup menu contains checkable entries for the toolbars
and dock widgets present in the main window. This allows users to
accidentally hide the toolbar.
This commit is contained in:
Hennadii Stepanov 2021-02-23 14:14:37 +02:00
parent 1e7dd584a5
commit ca5bd1c8e5
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -88,6 +88,8 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center()); move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center());
} }
setContextMenuPolicy(Qt::PreventContextMenu);
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
enableWallet = WalletModel::isWalletEnabled(); enableWallet = WalletModel::isWalletEnabled();
#endif // ENABLE_WALLET #endif // ENABLE_WALLET
@ -544,7 +546,6 @@ void BitcoinGUI::createToolBars()
{ {
QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
appToolBar = toolbar; appToolBar = toolbar;
toolbar->setContextMenuPolicy(Qt::PreventContextMenu);
toolbar->setMovable(false); toolbar->setMovable(false);
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
toolbar->addAction(overviewAction); toolbar->addAction(overviewAction);