aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/terminal
diff options
context:
space:
mode:
authorMarcus Tillmanns <marcus.tillmanns@qt.io>2023-12-12 08:05:26 +0100
committerMarcus Tillmanns <marcus.tillmanns@qt.io>2023-12-12 12:05:25 +0000
commit5f3950c620d8faf2afeb6209c5bfe04093fd2270 (patch)
treea1e4077ad5b2d196c38206fb442de9f569771048 /src/plugins/terminal
parentc622601db5e657421efcc4eff50e261f8314a141 (diff)
Terminal: Defer shell model init
Speculative fix for sometimes slow load times of the Terminal plugin on Windows Task-number: QTCREATORBUG-29840 Change-Id: I6782db075bfaa25fbabe2bac2a8f0f3b4af4f833 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/terminal')
-rw-r--r--src/plugins/terminal/terminalpane.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/terminal/terminalpane.cpp b/src/plugins/terminal/terminalpane.cpp
index e6a9af415fb..3e4ce3e8b79 100644
--- a/src/plugins/terminal/terminalpane.cpp
+++ b/src/plugins/terminal/terminalpane.cpp
@@ -273,11 +273,15 @@ void TerminalPane::initActions()
cmd->setAttribute(Command::CA_UpdateIcon);
}
-void TerminalPane::createShellMenu()
+static Internal::ShellModel *shellModel()
{
- const Internal::ShellModel *shellModel = new Internal::ShellModel(&m_shellMenu);
+ static Internal::ShellModel model;
+ return &model;
+}
- connect(&m_shellMenu, &QMenu::aboutToShow, &m_shellMenu, [shellModel, this] {
+void TerminalPane::createShellMenu()
+{
+ connect(&m_shellMenu, &QMenu::aboutToShow, &m_shellMenu, [this] {
m_shellMenu.clear();
const auto addItems = [this](const QList<Internal::ShellModelItem> &items) {
@@ -292,9 +296,9 @@ void TerminalPane::createShellMenu()
}
};
- addItems(shellModel->local());
+ addItems(shellModel()->local());
m_shellMenu.addSection(Tr::tr("Devices"));
- addItems(shellModel->remote());
+ addItems(shellModel()->remote());
});
}