• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IJHack / QtPass / 25576477093

08 May 2026 07:56PM UTC coverage: 28.048% (+0.03%) from 28.015%
25576477093

push

github

web-flow
refactor: clang-tidy cleanup (1 real bug + bulk modernize/performance fixes) (#1432)

* fix(trayicon): remove dead misleading setVisible method

TrayIcon::setVisible(bool) was a name collision with its base
class QWidget::setVisible(bool) — same signature, but the
implementation didn't toggle the tray icon's visibility. It
shows/hides the parent window:

  void TrayIcon::setVisible(bool visible) {
    if (visible) parentwin->show();
    else         parentwin->hide();
  }

Two problems:
- Misleading name: doesn't do what the QWidget API contract
  promises.
- Virtual shadowing without override: calling through a QWidget*
  pointer would call the base implementation, not this one,
  silently breaking caller intent.

Searched for callers — there are none. The method is dead code.
Removed the declaration and implementation together. Show/hide
of the parent window already happens elsewhere (via showAction
/ hideAction signals in createActions).

Caught by clang-tidy modernize-use-override.

* chore(clang-tidy): drop noisy stylistic checks

Two clang-tidy checks were producing high-volume findings that
the project doesn't actually want to fix:

- modernize-use-trailing-return-type (~55 in QtPass code, ~11K
  total counting Qt headers): suggests "auto foo() -> int"
  style. Project codebase mixes both; not enforcing the trailing
  form is a deliberate stylistic choice.

- modernize-use-nodiscard (~5 in QtPass code, ~3.7K total):
  suggests [[nodiscard]] on every getter. Project is selective
  about which getters need it; auto-applying everywhere creates
  noise and doesn't reflect intent.

Disabled both. Keeps the rest of modernize-* / performance-*
active so genuine improvements (default-member-init, override,
braced-init-list, enum-size, etc.) keep getting flagged.

Also added HeaderFilterRegex to keep findings from vendored
qprogressindicator out of the diagnostic stream.

* refactor: apply clang-tidy auto-fixes (modernize-* + performance-*)

Bulk pass o... (continued)

5 of 18 new or added lines in 12 files covered. (27.78%)

9 existing lines in 1 file now uncovered.

1854 of 6610 relevant lines covered (28.05%)

27.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/trayicon.cpp
1
// SPDX-FileCopyrightText: 2015 Anne Jan Brouwer
2
// SPDX-License-Identifier: GPL-3.0-or-later
3
#include "trayicon.h"
4
#include <QAction>
5
#include <QApplication>
6
#include <QMainWindow>
7
#include <QMenu>
8

9
#ifdef QT_DEBUG
10
#include "debughelper.h"
11
#endif
12

13
/**
14
 * @brief TrayIcon::TrayIcon use a (system) tray icon with a nice QtPass logo on
15
 * it (currently) only Quits.
16
 * @param parent
17
 */
NEW
18
TrayIcon::TrayIcon(QMainWindow *parent) {
×
19
  parentwin = parent;
×
20

21
  if (QSystemTrayIcon::isSystemTrayAvailable()) {
×
22
    createActions();
×
23
    createTrayIcon();
×
24

25
    sysTrayIcon->setIcon(
×
26
        QIcon::fromTheme("qtpass-tray", QIcon(":/artwork/icon.png")));
×
27

28
    sysTrayIcon->show();
×
29

30
    QObject::connect(sysTrayIcon, &QSystemTrayIcon::activated, this,
×
31
                     &TrayIcon::iconActivated);
×
32

33
    isAllocated = true;
×
34
  }
35
#ifdef QT_DEBUG
36
  // NOLINTNEXTLINE(readability/braces)
37
  else {
38
    dbg() << "No tray icon for this OS possibly also not show options?";
39
  }
40
#endif
41
}
×
42

43
/**
44
 * @brief TrayIcon::getIsAllocated return if TrayIcon is allocated
45
 */
46
auto TrayIcon::getIsAllocated() -> bool { return isAllocated; }
×
47

48
/**
49
 * @brief TrayIcon::createActions setup the signals.
50
 */
51
void TrayIcon::createActions() {
×
52
  showAction = new QAction(tr("&Show"), this);
×
53
  connect(showAction, &QAction::triggered, parentwin, &QWidget::show);
×
54
  hideAction = new QAction(tr("&Hide"), this);
×
55
  connect(hideAction, &QAction::triggered, parentwin, &QWidget::hide);
×
56

57
  minimizeAction = new QAction(tr("Mi&nimize"), this);
×
58
  connect(minimizeAction, &QAction::triggered, parentwin,
×
59
          &QWidget::showMinimized);
×
60
  maximizeAction = new QAction(tr("Ma&ximize"), this);
×
61
  connect(maximizeAction, &QAction::triggered, parentwin,
×
62
          &QWidget::showMaximized);
×
63
  restoreAction = new QAction(tr("&Restore"), this);
×
64
  connect(restoreAction, &QAction::triggered, parentwin, &QWidget::showNormal);
×
65

66
  quitAction = new QAction(tr("&Quit"), this);
×
67
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
68
#pragma GCC diagnostic push
69
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
70
#endif
71
  connect(quitAction, &QAction::triggered, qApp, &QApplication::quit);
×
72
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
73
#pragma GCC diagnostic pop
74
#endif
75
}
×
76

77
/**
78
 * @brief TrayIcon::createTrayIcon set up menu.
79
 */
80
void TrayIcon::createTrayIcon() {
×
81
  trayIconMenu = new QMenu(this);
×
82
  trayIconMenu->addAction(showAction);
×
83
  trayIconMenu->addAction(hideAction);
×
84
  trayIconMenu->addAction(minimizeAction);
×
85
  trayIconMenu->addAction(maximizeAction);
×
86
  trayIconMenu->addAction(restoreAction);
×
87
  trayIconMenu->addSeparator();
×
88
  trayIconMenu->addAction(quitAction);
×
89

90
  sysTrayIcon = new QSystemTrayIcon(this);
×
91
  sysTrayIcon->setContextMenu(trayIconMenu);
×
92
}
×
93

94
/**
95
 * @brief TrayIcon::showHideParent toggle app visibility.
96
 */
97
void TrayIcon::showHideParent() {
×
98
  if (parentwin->isVisible()) {
×
99
    parentwin->hide();
×
100
  } else {
101
    parentwin->show();
×
102
  }
103
}
×
104

105
/**
106
 * @brief TrayIcon::iconActivated you clicked on the trayicon.
107
 * @param reason
108
 */
109
void TrayIcon::iconActivated(QSystemTrayIcon::ActivationReason reason) {
×
110
  switch (reason) {
×
111
  case QSystemTrayIcon::Trigger:
×
112
  case QSystemTrayIcon::DoubleClick:
113
    showHideParent();
×
114
    break;
×
115
  case QSystemTrayIcon::MiddleClick:
×
116
    showMessage("test", "test msg", 1000);
×
117
    break;
×
118
  default: {
×
119
  }
120
  }
121
}
×
122

123
/**
124
 * @brief TrayIcon::showMessage show a systray message for notification.
125
 * @param title
126
 * @param msg
127
 * @param time
128
 */
129
void TrayIcon::showMessage(const QString &title, const QString &msg, int time) {
×
130
  sysTrayIcon->showMessage(title, msg, QSystemTrayIcon::Information, time);
×
131
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc