Commit 19c33b4d authored by Ahmad Samir's avatar Ahmad Samir
Browse files

Don't use a QHash to hold a few items

Instead use a vector of struct, this expands to less code, and the overhead
of a hash table isn't needed here.
parent 79efe5ce
Pipeline #90099 passed with stage
in 1 minute and 51 seconds
......@@ -291,12 +291,18 @@ void SessionManager::sessionProfileCommandReceived(const QString &text)
// store the font for each view if zoom was applied so that they can
// be restored after applying the new profile
QHash<TerminalDisplay *, QFont> zoomFontSizes;
struct ZoomFontInfo {
TerminalDisplay *display = nullptr;
QFont font;
std::vector<ZoomFontInfo> zoomFontSizes;
const QList<TerminalDisplay *> viewsList = session->views();
for (TerminalDisplay *view : viewsList) {
const QFont &viewCurFont = view->terminalFont()->getVTFont();
const QFont viewCurFont = view->terminalFont()->getVTFont();
if (viewCurFont != _sessionProfiles[session]->font()) {
zoomFontSizes.insert(view, viewCurFont);
zoomFontSizes.push_back({view, viewCurFont});
......@@ -321,12 +327,8 @@ void SessionManager::sessionProfileCommandReceived(const QString &text)
applyProfile(newProfile, true);
Q_EMIT sessionUpdated(session);
if (!zoomFontSizes.isEmpty()) {
QHashIterator<TerminalDisplay *, QFont> it(zoomFontSizes);
while (it.hasNext()) {;
for (auto &[view, font] : zoomFontSizes) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment