### Bug Summary

File: | builds/wireshark/wireshark/ui/qt/welcome_page.cpp
Warning: | line 316, column 10 Value stored to 'collapseLinks' during its initialization is never read

### Annotated Source Code

Press '?' to see keyboard shortcuts

Show analyzer invocation
clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name welcome_page.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -ffloat16-excess-precision=fast -fbfloat16-excess-precision=fast -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/builds/wireshark/wireshark/build -fcoverage-compilation-dir=/builds/wireshark/wireshark/build -resource-dir /usr/lib/llvm-21/lib/clang/21 -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /builds/wireshark/wireshark/build/ui/qt -isystem /builds/wireshark/wireshark/ui/qt -isystem /builds/wireshark/wireshark/ui/qt/lua_debugger -isystem /usr/include/x86_64-linux-gnu/qt6/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt6 -isystem /usr/include/x86_64-linux-gnu/qt6/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt6/QtGui -isystem /usr/include/x86_64-linux-gnu/qt6/QtCore5Compat -isystem /usr/include/x86_64-linux-gnu/qt6/QtConcurrent -isystem /usr/include/x86_64-linux-gnu/qt6/QtPrintSupport -isystem /usr/include/x86_64-linux-gnu/qt6/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt6/QtMultimedia -isystem /usr/include/x86_64-linux-gnu/qt6/QtDBus -D G_DISABLE_DEPRECATED -D G_DISABLE_SINGLE_INCLUDES -D QT_CONCURRENT_LIB -D QT_CORE5COMPAT_LIB -D QT_CORE_LIB -D QT_DBUS_LIB -D QT_GUI_LIB -D QT_MULTIMEDIA_LIB -D QT_NETWORK_LIB -D QT_PRINTSUPPORT_LIB -D QT_WIDGETS_LIB -D WS_DEBUG -D WS_DEBUG_UTF_8 -I /builds/wireshark/wireshark/build/ui/qt/qtui_autogen/include -I /builds/wireshark/wireshark/build -I /builds/wireshark/wireshark -I /builds/wireshark/wireshark/include -D _GLIBCXX_ASSERTIONS -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/x86_64-linux-gnu/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/backward -internal-isystem /usr/lib/llvm-21/lib/clang/21/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/builds/wireshark/wireshark/= -fmacro-prefix-map=/builds/wireshark/wireshark/build/= -fmacro-prefix-map=../= -Wno-format-nonliteral -std=c++17 -fdeprecated-macro -ferror-limit 19 -fwrapv -fwrapv-pointer -fstrict-flex-arrays=3 -stack-protector 2 -fstack-clash-protection -fcf-protection=full -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /builds/wireshark/wireshark/sbout/2026-05-23-100321-3658-1 -x c++ /builds/wireshark/wireshark/ui/qt/welcome_page.cpp

Keyboard shortcuts:

- Use 'j/k' keys for keyboard navigation
- Use 'Shift+S' to show/hide relevant lines
- Use '?' to toggle this window

Close
Show only relevant lines Show control flow arrows

1 | /* welcome_page.cpp
2 | *
3 | * Wireshark - Network traffic analyzer
4 | * By Gerald Combs <gerald@wireshark.org>
5 | * Copyright 1998 Gerald Combs
6 | *
7 | * SPDX-License-Identifier: GPL-2.0-or-later
8 | */
9 |
10 | #include "config.h"
11 |
12 | #include <epan/prefs.h>
13 |
14 | #include "ui/recent.h"
15 | #include "ui/urls.h"
16 |
17 | #include <app/application_flavor.h>
18 |
19 | #include "welcome_page.h"
20 | #include <ui_welcome_page.h>
21 | #include <ui/qt/utils/tango_colors.h>
22 | #include <ui/qt/utils/color_utils.h>
23 | #include <ui/qt/utils/qt_ui_utils.h>
24 | #include <ui/qt/models/recentcapturefiles_list_model.h>
25 | #include <ui/qt/utils/workspace_state.h>
26 | #include <ui/qt/widgets/capture_card_widget.h>
27 |
28 | #include "main_application.h"
29 |
30 | #include <QClipboard>
31 | #include <QDesktopServices>
32 | #include <QDir>
33 | #include <QListWidget>
34 | #include <QMenu>
35 | #include <QResizeEvent>
36 | #include <QUrl>
37 | #include <QWidget>
38 |
39 | #ifndef VERSION_FLAVOR"Development Build"
40 | #define VERSION_FLAVOR"Development Build" ""
41 | #endif
42 |
43 | WelcomePage::WelcomePage(QWidget *parent) :
44 | QFrame(parent),
45 | welcome_ui_(new Ui::WelcomePage),
46 | #ifdef Q_OS_MAC
47 | show_in_str_(tr("Show in Finder")),
48 | #else
49 | show_in_str_(tr("Show in Folder")),
50 | #endif
51 | splash_overlay_(NULL__null)
52 |
53 | {
54 | welcome_ui_->setupUi(this);
55 |
56 | setContentsMargins(0, 0, 0, 0);
57 | setAccessibleName(tr("Welcome page"));
58 | setAccessibleDescription(tr("The %1 welcome page provides access to recent files, capture interfaces, and learning resources.").arg(mainApp->applicationName()));
59 |
60 | welcome_ui_->tipsSectionCard->setVisible(true);
61 |
62 | updateStyleSheets();
63 |
64 | /* Handle Recent Capture Files List */
65 | // In welcome_page.cpp or wherever the list is created
66 | auto *model = new RecentCaptureFilesListModel(this);
67 | auto *proxyModel = new RecentCaptureFilesReverseProxyModel(this);
68 | proxyModel->setSourceModel(model);
69 |
70 | welcome_ui_->openFileSectionRecentList->setVisible(true);
71 | welcome_ui_->openFileSectionRecentList->setModel(proxyModel);
72 | welcome_ui_->openFileSectionRecentList->setItemDelegate(new RecentCaptureFilesDelegate(welcome_ui_->openFileSectionRecentList));
73 | welcome_ui_->openFileSectionRecentList->setContextMenuPolicy(Qt::CustomContextMenu);
74 | welcome_ui_->openFileSectionRecentList->setAccessibleName(tr("Recent capture files"));
75 | welcome_ui_->openFileSectionRecentList->setAccessibleDescription(tr("List of recently opened capture files. Double-click or press Enter to open."));
76 | connect(welcome_ui_->openFileSectionRecentList, &QListView::activated,
77 | this, [this]() {
78 | QModelIndex index = welcome_ui_->openFileSectionRecentList->currentIndex();
79 | if (index.isValid()) {
80 | QString cfile = index.data(RecentCaptureFilesListModel::FilenameRole).toString();
81 | emit recentFileActivated(cfile);
82 | }
83 | });
84 | connect(welcome_ui_->openFileSectionRecentList, &QListView::customContextMenuRequested,
85 | this, &WelcomePage::showCaptureFilesContextMenu);
86 |
87 | if (WorkspaceState::instance()->recentCaptureFiles().size() > 0) {
88 | welcome_ui_->openFileSectionLabel->setVisible(true);
89 | welcome_ui_->openFileSectionRecentList->setVisible(true);
90 | } else {
91 | welcome_ui_->openFileSectionLabel->setVisible(false);
92 | welcome_ui_->openFileSectionRecentList->setVisible(false);
93 | }
94 |
95 | #ifdef Q_OS_MAC
96 | welcome_ui_->openFileSectionRecentList->setAttribute(Qt::WA_MacShowFocusRect, false);
97 | #endif
98 |
99 | welcome_ui_->openFileSectionRecentList->setTextElideMode(Qt::ElideLeft);
100 |
101 | connect(mainApp, &MainApplication::appInitialized, this, &WelcomePage::appInitialized);
102 | connect(mainApp, &MainApplication::preferencesChanged, this, &WelcomePage::applySidebarPreferences);
103 |
104 | // "Capture" header click opens Capture Options dialog
105 | if (auto *captureHeader = welcome_ui_->captureSectionCard->findChild<ClickableLabel*>(QStringLiteral("captureHeader")(QString(QtPrivate::qMakeStringPrivate(u"" "captureHeader"))))) {
106 | connect(captureHeader, &ClickableLabel::clicked, this, []() {
107 | mainApp->doTriggerMenuItem(MainApplication::CaptureOptionsDialog);
108 | });
109 | }
110 |
111 | splash_overlay_ = new SplashOverlay(this);
112 | }
113 |
114 | WelcomePage::~WelcomePage()
115 | {
116 | delete welcome_ui_;
117 | }
118 |
119 | InterfaceFrame *WelcomePage::getInterfaceFrame()
120 | {
121 | return welcome_ui_->captureSectionCard->interfaceFrame();
122 | }
123 |
124 | CaptureCardWidget *WelcomePage::captureCard()
125 | {
126 | return welcome_ui_->captureSectionCard;
127 | }
128 |
129 | const QString WelcomePage::captureFilter()
130 | {
131 | return welcome_ui_->captureSectionCard->captureFilter();
132 | }
133 |
134 | void WelcomePage::setCaptureFilter(const QString capture_filter)
135 | {
136 | welcome_ui_->captureSectionCard->setCaptureFilter(capture_filter);
137 | }
138 |
139 | void WelcomePage::setCaptureFilterText(const QString capture_filter)
140 | {
141 | welcome_ui_->captureSectionCard->setCaptureFilterText(capture_filter);
142 | }
143 |
144 | void WelcomePage::interfaceSelected()
145 | {
146 | welcome_ui_->captureSectionCard->interfaceSelected();
147 | }
148 |
149 | void WelcomePage::appInitialized()
150 | {
151 | applySidebarPreferences();
152 |
153 | splash_overlay_->fadeOut();
154 | splash_overlay_ = NULL__null;
155 |
156 | // Ensure sidebar layout adapts to the restored window size.
157 | // resizeEvent may have fired before the layout was finalized.
158 | updateSidebarLayout();
159 | }
160 |
161 | void WelcomePage::applySidebarPreferences()
162 | {
163 | // There are slides that will be shown EVEN if the section card is set hidden through the preferences.
164 | // hasVisibleSlides() checks if there are any slides that should be shown, as well as the user's preferences.
165 | bool slidesAreVisible = welcome_ui_->tipsSectionCard->hasVisibleSlides();
166 |
167 | welcome_ui_->tipsSectionCard->setSlideDeckFreeze(true);
168 | welcome_ui_->tipsSectionCard->setSlideTypeVisible(BannerEvents, recent.gui_welcome_page_sidebar_tips_events);
169 | welcome_ui_->tipsSectionCard->setSlideTypeVisible(BannerSponsorship, recent.gui_welcome_page_sidebar_tips_sponsorship);
170 | welcome_ui_->tipsSectionCard->setSlideTypeVisible(BannerTips, recent.gui_welcome_page_sidebar_tips_tips);
171 | welcome_ui_->tipsSectionCard->setSlidesTest(recent.gui_welcome_page_sidebar_tips_slides_test);
172 | welcome_ui_->tipsSectionCard->setSlideDeckFreeze(false);
173 | welcome_ui_->tipsSectionCard->setAutoAdvance(recent.gui_welcome_page_sidebar_tips_auto_advance);
174 | welcome_ui_->tipsSectionCard->setAutoAdvanceInterval(recent.gui_welcome_page_sidebar_tips_interval);
175 | welcome_ui_->tipsSectionCard->setVisible(slidesAreVisible);
176 |
177 | welcome_ui_->learnSectionCard->setVisible(recent.gui_welcome_page_sidebar_learn_visible);
178 |
179 | // Hide the entire sidebar container when all sidebar widgets are disabled,
180 | // so the main content area can expand to fill the full window width.
181 | bool sidebar_visible = slidesAreVisible || recent.gui_welcome_page_sidebar_learn_visible;
182 | welcome_ui_->sidebarContainer->setVisible(sidebar_visible);
183 | }
184 |
185 | bool WelcomePage::event(QEvent *event)
186 | {
187 | switch (event->type()) {
188 | case QEvent::ApplicationPaletteChange:
189 | {
190 | updateStyleSheets();
191 | break;
192 | }
193 | case QEvent::LanguageChange:
194 | {
195 | welcome_ui_->retranslateUi(this);
196 | break;
197 | }
198 | default:
199 | break;
200 |
201 | }
202 | return QFrame::event(event);
203 | }
204 |
205 | void WelcomePage::resizeEvent(QResizeEvent *event)
206 | {
207 | if (splash_overlay_)
208 | splash_overlay_->resize(event->size());
209 |
210 | QFrame::resizeEvent(event);
211 |
212 | updateSidebarLayout();
213 | }
214 |
215 | void WelcomePage::showEvent(QShowEvent *event)
216 | {
217 | QFrame::showEvent(event);
218 |
219 | // The final window geometry may not be known until the widget is shown
220 | // (especially on macOS with restored window positions). Ensure the
221 | // sidebar layout adapts to the actual available space.
222 | updateSidebarLayout();
223 | }
224 |
225 | /*
226 | * Adapts the sidebar widget states to the available vertical space.
227 | *
228 | * The sidebar contains two widgets stacked vertically with spacing between
229 | * them: the InfoBannerWidget (tips/sponsors) and the LearnCardWidget (docs
230 | * links + action buttons). Both support a compact mode to reduce their
231 | * height when the window is small.
232 | *
233 | * Collapse order (as the window shrinks):
234 | * 1. LearnCardWidget links collapse (vertical list -> horizontal row)
235 | * 2. InfoBannerWidget compacts (hides illustration and body text)
236 | *
237 | * Expand order (as the window grows) is the reverse:
238 | * 1. InfoBannerWidget expands back to full
239 | * 2. LearnCardWidget links expand back to vertical
240 | *
241 | * All size values are queried from the widgets and layout, not hardcoded:
242 | * - tipsFull: InfoBannerWidget::sizeHint().height()
243 | * Always returns the full preferred height (360) regardless
244 | * of compact state. This is stable because sizeHint()
245 | * reports what the widget *wants*, while compact mode is
246 | * enforced via setMaximumHeight().
247 | * - learnMax: LearnCardWidget::maximumHeight() (from .ui: 240)
248 | * - learnMin: LearnCardWidget::minimumHeight() (from .ui: 110)
249 | * - spacing: sidebarLayout->spacing() (from .ui: 16)
250 | *
251 | * Hysteresis (kHysteresis = 20px):
252 | * Without hysteresis, at the exact collapse threshold the layout
253 | * oscillates: collapsing a widget frees space, which satisfies the
254 | * expand threshold, which expands, which exceeds the threshold again.
255 | * On each resize event this cycle repeats, causing visible flickering.
256 | *
257 | * Hysteresis adds a dead zone between collapse and expand thresholds.
258 | * A widget collapses at threshold T but only re-expands at T + 20.
259 | * In the 20px gap, the current state is preserved.
260 | *
261 | * The value 20px was chosen empirically: it must be large enough that
262 | * the layout geometry change from collapsing/expanding a widget (which
263 | * can shift available height by a few pixels due to rounding, spacing,
264 | * and platform differences) doesn't cross back over the threshold. In
265 | * practice, resize events during a user drag arrive ~8-12px apart, so
266 | * 20px ensures at least one stable frame at the boundary. A larger
267 | * value would delay the transition visibly; a smaller one risks not
268 | * fully suppressing the oscillation on high-DPI displays where pixel
269 | * increments are coarser.
270 | *
271 | * Decision zones (with current widget sizes):
272 | *
273 | * available >= 636 (linksExpandAt)
274 | * -> full tips + expanded links
275 | *
276 | * available >= 506 (tipsExpandAt) and < 636
277 | * -> full tips + collapsed links
278 | * (between 616-635: hysteresis zone for links -- keeps current state
279 | * if already expanded, won't re-expand if collapsed)
280 | *
281 | * available >= 486 (tipsCompactAt) and < 506
282 | * -> hysteresis zone for tips -- keeps current tips state,
283 | * links forced collapsed
284 | *
285 | * available < 486 (tipsCompactAt)
286 | * -> compact tips + collapsed links
287 | *
288 | * Called from: resizeEvent(), showEvent(), appInitialized(), and
289 | * indirectly via updateGeometry() when the welcome header banner
290 | * visibility changes.
291 | */
292 | void WelcomePage::updateSidebarLayout()
293 | {
294 | int available = welcome_ui_->sidebarContainer->height();
295 | if (available <= 0)
296 | return;
297 |
298 | static const int kHysteresis = 20;
299 |
300 | int spacing = welcome_ui_->sidebarLayout->spacing();
301 | int tipsFull = welcome_ui_->tipsSectionCard->sizeHint().height();
302 | int learnMax = welcome_ui_->learnSectionCard->maximumHeight();
303 | int learnMin = welcome_ui_->learnSectionCard->minimumHeight();
304 |
305 | // Collapse threshold: the minimum available height to show this state.
306 | // Expand threshold: collapse + hysteresis -- prevents oscillation.
307 |
308 | // Level 1: links collapse when full tips + expanded learn don't fit.
309 | int linksCollapseAt = tipsFull + spacing + learnMax;
310 | int linksExpandAt = linksCollapseAt + kHysteresis;
311 |
312 | // Level 2: tips compact when full tips + collapsed learn don't fit.
313 | int tipsCompactAt = tipsFull + spacing + learnMin;
314 | int tipsExpandAt = tipsCompactAt + kHysteresis;
315 |
316 | bool collapseLinks = welcome_ui_->learnSectionCard->isLinksCollapsed();
| Value stored to 'collapseLinks' during its initialization is never read
317 | bool compactTips = welcome_ui_->tipsSectionCard->isCompactMode();
318 |
319 | if (available >= linksExpandAt) {
320 | collapseLinks = false;
321 | compactTips = false;
322 | } else if (available >= tipsExpandAt) {
323 | collapseLinks = true;
324 | compactTips = false;
325 | } else if (available >= tipsCompactAt) {
326 | collapseLinks = true;
327 | // tips state preserved (hysteresis zone)
328 | } else {
329 | collapseLinks = true;
330 | compactTips = true;
331 | }
332 |
333 | welcome_ui_->learnSectionCard->setLinksCollapsed(collapseLinks);
334 | welcome_ui_->tipsSectionCard->setCompactMode(compactTips);
335 | }
336 |
337 | void WelcomePage::showCaptureFilesContextMenu(QPoint pos)
338 | {
339 | QModelIndex index = welcome_ui_->openFileSectionRecentList->indexAt(pos);
340 | if (!index.isValid()) return;
341 |
342 | QMenu *recent_ctx_menu = new QMenu(this);
343 | recent_ctx_menu->setAttribute(Qt::WA_DeleteOnClose);
344 |
345 | QModelIndex sourceIndex = static_cast<QSortFilterProxyModel*>(welcome_ui_->openFileSectionRecentList->model())->mapToSource(index);
346 | RecentCaptureFilesListModel *model = static_cast<RecentCaptureFilesListModel*>(
347 | static_cast<QSortFilterProxyModel*>(welcome_ui_->openFileSectionRecentList->model())->sourceModel());
348 |
349 | QString filePath = model->data(sourceIndex, RecentCaptureFilesListModel::FilenameRole).toString();
350 | bool accessible = model->data(sourceIndex, RecentCaptureFilesListModel::AccessibleRole).toBool();
351 |
352 | QAction *show_action = recent_ctx_menu->addAction(show_in_str_);
353 | show_action->setEnabled(accessible);
354 | connect(show_action, &QAction::triggered, this, [filePath]{ desktop_show_in_folder(filePath); });
355 |
356 | QAction *copy_action = recent_ctx_menu->addAction(tr("Copy file path"));
357 | connect(copy_action, &QAction::triggered, this, [filePath]{ mainApp->clipboard()->setText(filePath); });
358 |
359 | recent_ctx_menu->addSeparator();
360 |
361 | QAction *remove_action = recent_ctx_menu->addAction(tr("Remove from list"));
362 | connect(remove_action, &QAction::triggered, this, [filePath]{
363 | WorkspaceState::instance()->removeRecentCaptureFile(filePath);
364 | });
365 |
366 | recent_ctx_menu->popup(welcome_ui_->openFileSectionRecentList->viewport()->mapToGlobal(pos));
367 | }
368 |
369 | void WelcomePage::updateStyleSheets()
370 | {
371 | QString welcome_ss = QStringLiteral((QString(QtPrivate::qMakeStringPrivate(u"" "WelcomePage {" " padding: 0;" " }" "WelcomePage, QAbstractItemView {" " background-color: palette(base);" " color: palette(text);" " }" "QAbstractItemView {" " border: 0;" "}")))
372 | "WelcomePage {"(QString(QtPrivate::qMakeStringPrivate(u"" "WelcomePage {" " padding: 0;" " }" "WelcomePage, QAbstractItemView {" " background-color: palette(base);" " color: palette(text);" " }" "QAbstractItemView {" " border: 0;" "}")))
373 | " padding: 0;"(QString(QtPrivate::qMakeStringPrivate(u"" "WelcomePage {" " padding: 0;" " }" "WelcomePage, QAbstractItemView {" " background-color: palette(base);" " color: palette(text);" " }" "QAbstractItemView {" " border: 0;" "}")))
374 | " }"(QString(QtPrivate::qMakeStringPrivate(u"" "WelcomePage {" " padding: 0;" " }" "WelcomePage, QAbstractItemView {" " background-color: palette(base);" " color: palette(text);" " }" "QAbstractItemView {" " border: 0;" "}")))
375 | "WelcomePage, QAbstractItemView {"(QString(QtPrivate::qMakeStringPrivate(u"" "WelcomePage {" " padding: 0;" " }" "WelcomePage, QAbstractItemView {" " background-color: palette(base);" " color: palette(text);" " }" "QAbstractItemView {" " border: 0;" "}")))
376 | " background-color: palette(base);"(QString(QtPrivate::qMakeStringPrivate(u"" "WelcomePage {" " padding: 0;" " }" "WelcomePage, QAbstractItemView {" " background-color: palette(base);" " color: palette(text);" " }" "QAbstractItemView {" " border: 0;" "}")))
377 | " color: palette(text);"(QString(QtPrivate::qMakeStringPrivate(u"" "WelcomePage {" " padding: 0;" " }" "WelcomePage, QAbstractItemView {" " background-color: palette(base);" " color: palette(text);" " }" "QAbstractItemView {" " border: 0;" "}")))
378 | " }"(QString(QtPrivate::qMakeStringPrivate(u"" "WelcomePage {" " padding: 0;" " }" "WelcomePage, QAbstractItemView {" " background-color: palette(base);" " color: palette(text);" " }" "QAbstractItemView {" " border: 0;" "}")))
379 | "QAbstractItemView {"(QString(QtPrivate::qMakeStringPrivate(u"" "WelcomePage {" " padding: 0;" " }" "WelcomePage, QAbstractItemView {" " background-color: palette(base);" " color: palette(text);" " }" "QAbstractItemView {" " border: 0;" "}")))
380 | " border: 0;"(QString(QtPrivate::qMakeStringPrivate(u"" "WelcomePage {" " padding: 0;" " }" "WelcomePage, QAbstractItemView {" " background-color: palette(base);" " color: palette(text);" " }" "QAbstractItemView {" " border: 0;" "}")))
381 | "}"(QString(QtPrivate::qMakeStringPrivate(u"" "WelcomePage {" " padding: 0;" " }" "WelcomePage, QAbstractItemView {" " background-color: palette(base);" " color: palette(text);" " }" "QAbstractItemView {" " border: 0;" "}")))
382 | )(QString(QtPrivate::qMakeStringPrivate(u"" "WelcomePage {" " padding: 0;" " }" "WelcomePage, QAbstractItemView {" " background-color: palette(base);" " color: palette(text);" " }" "QAbstractItemView {" " border: 0;" "}")));
383 | #if !defined(Q_OS_WIN)
384 | welcome_ss += QStringLiteral((QString(QtPrivate::qMakeStringPrivate(u"" "QAbstractItemView:item:hover {" " background-color: %1;" " color: palette(text);" "}")))
385 | "QAbstractItemView:item:hover {"(QString(QtPrivate::qMakeStringPrivate(u"" "QAbstractItemView:item:hover {" " background-color: %1;" " color: palette(text);" "}")))
386 | " background-color: %1;"(QString(QtPrivate::qMakeStringPrivate(u"" "QAbstractItemView:item:hover {" " background-color: %1;" " color: palette(text);" "}")))
387 | " color: palette(text);"(QString(QtPrivate::qMakeStringPrivate(u"" "QAbstractItemView:item:hover {" " background-color: %1;" " color: palette(text);" "}")))
388 | "}"(QString(QtPrivate::qMakeStringPrivate(u"" "QAbstractItemView:item:hover {" " background-color: %1;" " color: palette(text);" "}")))
389 | )(QString(QtPrivate::qMakeStringPrivate(u"" "QAbstractItemView:item:hover {" " background-color: %1;" " color: palette(text);" "}")))
390 | .arg(ColorUtils::hoverBackground().name(QColor::HexArgb));
391 | #endif
392 | setStyleSheet(welcome_ss);
393 |
394 | QString title_button_ss = QStringLiteral((QString(QtPrivate::qMakeStringPrivate(u"" "QLabel {" " color: %1;" "}" "QLabel::hover {" " color: %2;" "}")))
395 | "QLabel {"(QString(QtPrivate::qMakeStringPrivate(u"" "QLabel {" " color: %1;" "}" "QLabel::hover {" " color: %2;" "}")))
396 | " color: %1;"(QString(QtPrivate::qMakeStringPrivate(u"" "QLabel {" " color: %1;" "}" "QLabel::hover {" " color: %2;" "}")))
397 | "}"(QString(QtPrivate::qMakeStringPrivate(u"" "QLabel {" " color: %1;" "}" "QLabel::hover {" " color: %2;" "}")))
398 | "QLabel::hover {"(QString(QtPrivate::qMakeStringPrivate(u"" "QLabel {" " color: %1;" "}" "QLabel::hover {" " color: %2;" "}")))
399 | " color: %2;"(QString(QtPrivate::qMakeStringPrivate(u"" "QLabel {" " color: %1;" "}" "QLabel::hover {" " color: %2;" "}")))
400 | "}"(QString(QtPrivate::qMakeStringPrivate(u"" "QLabel {" " color: %1;" "}" "QLabel::hover {" " color: %2;" "}")))
401 | )(QString(QtPrivate::qMakeStringPrivate(u"" "QLabel {" " color: %1;" "}" "QLabel::hover {" " color: %2;" "}")))
402 | .arg(QColor(tango_aluminium_4).name()) // Text color
403 | .arg(QColor(tango_sky_blue_4).name()); // Hover color
404 |
405 | welcome_ui_->openFileSectionLabel->setStyleSheet(title_button_ss);
406 |
407 | welcome_ui_->openFileSectionRecentList->setStyleSheet(
408 | "QListView::item {"
409 | " padding-top: 0.2em;"
410 | " padding-bottom: 0.2em;"
411 | "}"
412 | "QListView::item::first {"
413 | " padding-top: 0;"
414 | "}"
415 | "QListView::item::last {"
416 | " padding-bottom: 0;"
417 | "}"
418 | );
419 |
420 | /* LearnCardWidget and CaptureCardWidget manage their own stylesheets */
421 | }
422 |
423 | void WelcomePage::on_openFileSectionLabel_clicked()
424 | {
425 | mainApp->doTriggerMenuItem(MainApplication::FileOpenDialog);
426 | }