Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
251}253void BitcoinGUI::createActions()254{255QActionGroup *tabGroup = new QActionGroup(this);256connect(modalOverlay, &ModalOverlay::triggered, tabGroup, &QActionGroup::setEnabled);258overviewAction = new QAction(platformStyle->SingleColorIcon(":/icons/overview"), tr("&Overview"), this);259overviewAction->setStatusTip(tr("Show general overview of wallet"));260overviewAction->setToolTip(overviewAction->statusTip());261overviewAction->setCheckable(true);262overviewAction->setShortcut(QKeySequence(QStringLiteral("Alt+1")));263tabGroup->addAction(overviewAction);265sendCoinsAction = new QAction(platformStyle->SingleColorIcon(":/icons/send"), tr("&Send"), this);266sendCoinsAction->setStatusTip(tr("Send coins to a Bitcoin address"));267sendCoinsAction->setToolTip(sendCoinsAction->statusTip());268sendCoinsAction->setCheckable(true);269sendCoinsAction->setShortcut(QKeySequence(QStringLiteral("Alt+2")));270tabGroup->addAction(sendCoinsAction);272receiveCoinsAction = new QAction(platformStyle->SingleColorIcon(":/icons/receiving_addresses"), tr("&Receive"), this);273receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and bitcoin: URIs)"));274receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip());275receiveCoinsAction->setCheckable(true);276receiveCoinsAction->setShortcut(QKeySequence(QStringLiteral("Alt+3")));277tabGroup->addAction(receiveCoinsAction);279historyAction = new QAction(platformStyle->SingleColorIcon(":/icons/history"), tr("&Transactions"), this);280historyAction->setStatusTip(tr("Browse transaction history"));281historyAction->setToolTip(historyAction->statusTip());282historyAction->setCheckable(true);283historyAction->setShortcut(QKeySequence(QStringLiteral("Alt+4")));284tabGroup->addAction(historyAction);286#ifdef ENABLE_WALLET287// These showNormalIfMinimized are needed because Send Coins and Receive Coins288// can be triggered from the tray menu, and need to show the GUI to be useful.289connect(overviewAction, &QAction::triggered, [this]{ showNormalIfMinimized(); });290connect(overviewAction, &QAction::triggered, this, &BitcoinGUI::gotoOverviewPage);291connect(sendCoinsAction, &QAction::triggered, [this]{ showNormalIfMinimized(); });292connect(sendCoinsAction, &QAction::triggered, [this]{ gotoSendCoinsPage(); });293connect(receiveCoinsAction, &QAction::triggered, [this]{ showNormalIfMinimized(); });294connect(receiveCoinsAction, &QAction::triggered, this, &BitcoinGUI::gotoReceiveCoinsPage);295connect(historyAction, &QAction::triggered, [this]{ showNormalIfMinimized(); });296connect(historyAction, &QAction::triggered, this, &BitcoinGUI::gotoHistoryPage);297#endif // ENABLE_WALLET299quitAction = new QAction(tr("E&xit"), this);300quitAction->setStatusTip(tr("Quit application"));301quitAction->setShortcut(QKeySequence(tr("Ctrl+Q")));302quitAction->setMenuRole(QAction::QuitRole);303aboutAction = new QAction(tr("&About %1").arg(CLIENT_NAME), this);304aboutAction->setStatusTip(tr("Show information about %1").arg(CLIENT_NAME));305aboutAction->setMenuRole(QAction::AboutRole);306aboutAction->setEnabled(false);307aboutQtAction = new QAction(tr("About &Qt"), this);308aboutQtAction->setStatusTip(tr("Show information about Qt"));309aboutQtAction->setMenuRole(QAction::AboutQtRole);310optionsAction = new QAction(tr("&Options…"), this);311optionsAction->setStatusTip(tr("Modify configuration options for %1").arg(CLIENT_NAME));312optionsAction->setMenuRole(QAction::PreferencesRole);313optionsAction->setEnabled(false);315encryptWalletAction = new QAction(tr("&Encrypt Wallet…"), this);316encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet"));317encryptWalletAction->setCheckable(true);318backupWalletAction = new QAction(tr("&Backup Wallet…"), this);319backupWalletAction->setStatusTip(tr("Backup wallet to another location"));320changePassphraseAction = new QAction(tr("&Change Passphrase…"), this);321changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption"));322signMessageAction = new QAction(tr("Sign &message…"), this);323signMessageAction->setStatusTip(tr("Sign messages with your Bitcoin addresses to prove you own them"));324verifyMessageAction = new QAction(tr("&Verify message…"), this);325verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Bitcoin addresses"));326m_load_psbt_action = new QAction(tr("&Load PSBT from file…"), this);327m_load_psbt_action->setStatusTip(tr("Load Partially Signed Bitcoin Transaction"));328m_load_psbt_clipboard_action = new QAction(tr("Load PSBT from &clipboard…"), this);329m_load_psbt_clipboard_action->setStatusTip(tr("Load Partially Signed Bitcoin Transaction from clipboard"));331openRPCConsoleAction = new QAction(tr("Node window"), this);332openRPCConsoleAction->setStatusTip(tr("Open node debugging and diagnostic console"));333// initially disable the debug window menu item334openRPCConsoleAction->setEnabled(false);335openRPCConsoleAction->setObjectName("openRPCConsoleAction");337usedSendingAddressesAction = new QAction(tr("&Sending addresses"), this);338usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels"));339usedReceivingAddressesAction = new QAction(tr("&Receiving addresses"), this);340usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels"));342openAction = new QAction(tr("Open &URI…"), this);343openAction->setStatusTip(tr("Open a bitcoin: URI"));345m_open_wallet_action = new QAction(tr("Open Wallet"), this);346m_open_wallet_action->setEnabled(false);347m_open_wallet_action->setStatusTip(tr("Open a wallet"));348m_open_wallet_menu = new QMenu(this);350m_close_wallet_action = new QAction(tr("Close Wallet…"), this);351m_close_wallet_action->setStatusTip(tr("Close wallet"));353m_create_wallet_action = new QAction(tr("Create Wallet…"), this);354m_create_wallet_action->setEnabled(false);355m_create_wallet_action->setStatusTip(tr("Create a new wallet"));357//: Name of the menu item that restores wallet from a backup file.358m_restore_wallet_action = new QAction(tr("Restore Wallet…"), this);359m_restore_wallet_action->setEnabled(false);360//: Status tip for Restore Wallet menu item361m_restore_wallet_action->setStatusTip(tr("Restore a wallet from a backup file"));363m_close_all_wallets_action = new QAction(tr("Close All Wallets…"), this);364m_close_all_wallets_action->setStatusTip(tr("Close all wallets"));366m_migrate_wallet_action = new QAction(tr("Migrate Wallet"), this);367m_migrate_wallet_action->setEnabled(false);368m_migrate_wallet_action->setStatusTip(tr("Migrate a wallet"));369m_migrate_wallet_menu = new QMenu(this);371showHelpMessageAction = new QAction(tr("&Command-line options"), this);372showHelpMessageAction->setMenuRole(QAction::NoRole);373showHelpMessageAction->setStatusTip(tr("Show the %1 help message to get a list with possible Bitcoin command-line options").arg(CLIENT_NAME));375m_mask_values_action = new QAction(tr("&Mask values"), this);376m_mask_values_action->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_M));377m_mask_values_action->setStatusTip(tr("Mask the values in the Overview tab"));378m_mask_values_action->setCheckable(true);380m_export_watchonly_action = new QAction(tr("Export watch-only wallet"), this);381m_export_watchonly_action->setEnabled(false);382m_export_watchonly_action->setStatusTip(tr("Export a watch-only version of the current wallet that can be restored onto another node."));384connect(quitAction, &QAction::triggered, this, &BitcoinGUI::quitRequested);385connect(aboutAction, &QAction::triggered, this, &BitcoinGUI::aboutClicked);386connect(aboutQtAction, &QAction::triggered, qApp, QApplication::aboutQt);387connect(optionsAction, &QAction::triggered, this, &BitcoinGUI::optionsClicked);388connect(showHelpMessageAction, &QAction::triggered, this, &BitcoinGUI::showHelpMessageClicked);389connect(openRPCConsoleAction, &QAction::triggered, this, &BitcoinGUI::showDebugWindow);390// prevents an open debug window from becoming stuck/unusable on client shutdown391connect(quitAction, &QAction::triggered, rpcConsole, &QWidget::hide);393#ifdef ENABLE_WALLET394if(walletFrame)395{396connect(encryptWalletAction, &QAction::triggered, walletFrame, &WalletFrame::encryptWallet);397connect(backupWalletAction, &QAction::triggered, walletFrame, &WalletFrame::backupWallet);398connect(changePassphraseAction, &QAction::triggered, walletFrame, &WalletFrame::changePassphrase);399connect(signMessageAction, &QAction::triggered, [this]{ showNormalIfMinimized(); });400connect(signMessageAction, &QAction::triggered, [this]{ gotoSignMessageTab(); });401connect(m_load_psbt_action, &QAction::triggered, [this]{ gotoLoadPSBT(); });402connect(m_load_psbt_clipboard_action, &QAction::triggered, [this]{ gotoLoadPSBT(true); });403connect(verifyMessageAction, &QAction::triggered, [this]{ showNormalIfMinimized(); });404connect(verifyMessageAction, &QAction::triggered, [this]{ gotoVerifyMessageTab(); });405connect(usedSendingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedSendingAddresses);406connect(usedReceivingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedReceivingAddresses);407connect(openAction, &QAction::triggered, this, &BitcoinGUI::openClicked);408connect(m_open_wallet_menu, &QMenu::aboutToShow, [this] {409m_open_wallet_menu->clear();410for (const auto& [path, info] : m_wallet_controller->listWalletDir()) {411const auto& [loaded, format] = info;412QString name = GUIUtil::WalletDisplayName(path);413// An single ampersand in the menu item's text sets a shortcut for this item.414// Single & are shown when && is in the string. So replace & with &&.415name.replace(QChar('&'), QString("&&"));416bool is_legacy = format == "bdb";417if (is_legacy) {418name += " (needs migration)";419}420QAction* action = m_open_wallet_menu->addAction(name);422if (loaded || is_legacy) {423// This wallet is already loaded or it is a legacy wallet424action->setEnabled(false);425continue;426}428connect(action, &QAction::triggered, [this, path] {429auto activity = new OpenWalletActivity(m_wallet_controller, this);430connect(activity, &OpenWalletActivity::opened, this, &BitcoinGUI::setCurrentWallet, Qt::QueuedConnection);431connect(activity, &OpenWalletActivity::opened, rpcConsole, &RPCConsole::setCurrentWallet, Qt::QueuedConnection);432activity->open(path);433});434}435if (m_open_wallet_menu->isEmpty()) {436QAction* action = m_open_wallet_menu->addAction(tr("No wallets available"));437action->setEnabled(false);438}439});440connect(m_restore_wallet_action, &QAction::triggered, [this] {441//: Name of the wallet data file format.442QString name_data_file = tr("Wallet Data");444//: The title for Restore Wallet File Windows445QString title_windows = tr("Load Wallet Backup");447QString backup_file = GUIUtil::getOpenFileName(this, title_windows, QString(), name_data_file + QLatin1String(" (*.dat *.wallet);;") + tr("All Files") + QLatin1String(" (*)"), nullptr);448if (backup_file.isEmpty()) return;450bool wallet_name_ok;451/*: Title of pop-up window shown when the user is attempting to452restore a wallet. */453QString title = tr("Restore Wallet");454//: Label of the input field where the name of the wallet is entered.455QString label = tr("Wallet Name");456QString wallet_name = QInputDialog::getText(this, title, label, QLineEdit::Normal, "", &wallet_name_ok);457if (!wallet_name_ok) return;458if (wallet_name.isEmpty()) {459QMessageBox::critical(nullptr, tr("Invalid Wallet Name"), tr("Wallet name cannot be empty"));460return;461}463auto activity = new RestoreWalletActivity(m_wallet_controller, this);464connect(activity, &RestoreWalletActivity::restored, this, &BitcoinGUI::setCurrentWallet, Qt::QueuedConnection);465connect(activity, &RestoreWalletActivity::restored, rpcConsole, &RPCConsole::setCurrentWallet, Qt::QueuedConnection);467auto backup_file_path = fs::PathFromString(backup_file.toStdString());468activity->restore(backup_file_path, wallet_name.toStdString());469});470connect(m_close_wallet_action, &QAction::triggered, [this] {471m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this);472});473connect(m_create_wallet_action, &QAction::triggered, this, &BitcoinGUI::createWallet);474connect(m_close_all_wallets_action, &QAction::triggered, [this] {475m_wallet_controller->closeAllWallets(this);476});477connect(m_migrate_wallet_menu, &QMenu::aboutToShow, [this] {478m_migrate_wallet_menu->clear();479for (const auto& [wallet_name, info] : m_wallet_controller->listWalletDir()) {480const auto& [loaded, format] = info;482if (format != "bdb") { // Skip already migrated wallets483continue;484}486QString name = GUIUtil::WalletDisplayName(wallet_name);487// An single ampersand in the menu item's text sets a shortcut for this item.488// Single & are shown when && is in the string. So replace & with &&.489name.replace(QChar('&'), QString("&&"));490QAction* action = m_migrate_wallet_menu->addAction(name);492connect(action, &QAction::triggered, [this, wallet_name] {493auto activity = new MigrateWalletActivity(m_wallet_controller, this);494connect(activity, &MigrateWalletActivity::migrated, this, &BitcoinGUI::setCurrentWallet);495activity->migrate(wallet_name);496});497}498if (m_migrate_wallet_menu->isEmpty()) {499QAction* action = m_migrate_wallet_menu->addAction(tr("No wallets available"));500action->setEnabled(false);
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.