Replace Q_UNUSED with [[maybe_unused]] attribute

PR #19471.
This commit is contained in:
Victor Chernyakin
2023-08-17 21:09:40 -07:00
committed by GitHub
parent f3f4610ba4
commit 34d30ed031
20 changed files with 31 additions and 75 deletions

View File

@@ -502,17 +502,15 @@ void AddNewTorrentDialog::updateDiskSpaceLabel()
m_ui->labelSizeData->setText(sizeString);
}
void AddNewTorrentDialog::onSavePathChanged(const Path &newPath)
void AddNewTorrentDialog::onSavePathChanged([[maybe_unused]] const Path &newPath)
{
Q_UNUSED(newPath);
// Remember index
m_savePathIndex = m_ui->savePath->currentIndex();
updateDiskSpaceLabel();
}
void AddNewTorrentDialog::onDownloadPathChanged(const Path &newPath)
void AddNewTorrentDialog::onDownloadPathChanged([[maybe_unused]] const Path &newPath)
{
Q_UNUSED(newPath);
// Remember index
const int currentPathIndex = m_ui->downloadPath->currentIndex();
if (currentPathIndex >= 0)
@@ -525,10 +523,8 @@ void AddNewTorrentDialog::onUseDownloadPathChanged(const bool checked)
m_ui->downloadPath->setCurrentIndex(checked ? m_downloadPathIndex : -1);
}
void AddNewTorrentDialog::categoryChanged(int index)
void AddNewTorrentDialog::categoryChanged([[maybe_unused]] const int index)
{
Q_UNUSED(index);
if (m_ui->comboTTM->currentIndex() == 1)
{
const auto *btSession = BitTorrent::Session::instance();

View File

@@ -73,9 +73,8 @@ QModelIndex CookiesModel::index(int row, int column, const QModelIndex &parent)
return createIndex(row, column, &m_cookies[row]);
}
QModelIndex CookiesModel::parent(const QModelIndex &index) const
QModelIndex CookiesModel::parent([[maybe_unused]] const QModelIndex &index) const
{
Q_UNUSED(index);
return {};
}
@@ -86,9 +85,8 @@ int CookiesModel::rowCount(const QModelIndex &parent) const
return m_cookies.size();
}
int CookiesModel::columnCount(const QModelIndex &parent) const
int CookiesModel::columnCount([[maybe_unused]] const QModelIndex &parent) const
{
Q_UNUSED(parent);
return NB_COLUMNS;
}

View File

@@ -54,11 +54,8 @@ namespace
#ifdef Q_OS_MACOS
DesktopIntegration *desktopIntegrationInstance = nullptr;
bool handleDockClicked(id self, SEL cmd, ...)
bool handleDockClicked([[maybe_unused]] id self, [[maybe_unused]] SEL cmd, ...)
{
Q_UNUSED(self);
Q_UNUSED(cmd);
Q_ASSERT(desktopIntegrationInstance);
emit desktopIntegrationInstance->activationRequested();

View File

@@ -146,10 +146,9 @@ QValidator::State Private::FileSystemPathValidator::lastValidationState() const
return m_lastValidationState;
}
QValidator::State Private::FileSystemPathValidator::validate(QString &input, int &pos) const
QValidator::State Private::FileSystemPathValidator::validate(QString &input, [[maybe_unused]] int &pos) const
{
// ignore cursor position and validate the full path anyway
Q_UNUSED(pos);
// we ignore cursor position and validate the full path anyway
m_lastTestResult = testPath(Path(input));
m_lastValidationState = (m_lastTestResult == TestResult::OK)

View File

@@ -743,9 +743,8 @@ void MainWindow::on_actionDocumentation_triggered() const
QDesktopServices::openUrl(QUrl(u"https://doc.qbittorrent.org"_s));
}
void MainWindow::tabChanged(int newTab)
void MainWindow::tabChanged([[maybe_unused]] const int newTab)
{
Q_UNUSED(newTab);
// We cannot rely on the index newTab
// because the tab order is undetermined now
if (m_tabs->currentWidget() == m_splitter)

View File

@@ -76,19 +76,15 @@ void DBusNotifier::showMessage(const QString &title, const QString &message, con
});
}
void DBusNotifier::onActionInvoked(const uint messageID, const QString &action)
void DBusNotifier::onActionInvoked(const uint messageID, [[maybe_unused]] const QString &action)
{
Q_UNUSED(action);
// Check whether the notification is sent by qBittorrent
// to avoid reacting to unrelated notifications
if (m_activeMessages.contains(messageID))
emit messageClicked();
}
void DBusNotifier::onNotificationClosed(const uint messageID, const uint reason)
void DBusNotifier::onNotificationClosed(const uint messageID, [[maybe_unused]] const uint reason)
{
Q_UNUSED(reason);
m_activeMessages.remove(messageID);
}

View File

@@ -255,16 +255,15 @@ SearchWidget::~SearchWidget()
delete m_ui;
}
void SearchWidget::tabChanged(int index)
void SearchWidget::tabChanged(const int index)
{
// when we switch from a tab that is not empty to another that is empty
// the download button doesn't have to be available
m_currentSearchTab = ((index < 0) ? nullptr : m_allTabs.at(m_ui->tabWidget->currentIndex()));
}
void SearchWidget::selectMultipleBox(int index)
void SearchWidget::selectMultipleBox([[maybe_unused]] const int index)
{
Q_UNUSED(index);
if (selectedPlugin() == u"multi")
on_pluginsButton_clicked();
}

View File

@@ -293,9 +293,8 @@ QVector<BitTorrent::DownloadPriority> TorrentContentModel::getFilePriorities() c
return prio;
}
int TorrentContentModel::columnCount(const QModelIndex &parent) const
int TorrentContentModel::columnCount([[maybe_unused]] const QModelIndex &parent) const
{
Q_UNUSED(parent);
return TorrentContentModelItem::NB_COL;
}

View File

@@ -543,10 +543,8 @@ int TorrentOptionsDialog::getInactiveSeedingTime() const
return m_ui->spinInactiveTimeLimit->value();
}
void TorrentOptionsDialog::handleCategoryChanged(const int index)
void TorrentOptionsDialog::handleCategoryChanged([[maybe_unused]] const int index)
{
Q_UNUSED(index);
if (m_ui->checkAutoTMM->checkState() == Qt::Checked)
{
if (!m_allSameCategory && (m_ui->comboCategory->currentIndex() == 0))

View File

@@ -97,10 +97,8 @@ QString CategoryFilterWidget::currentCategory() const
return getCategoryFilter(static_cast<CategoryFilterProxyModel *>(model()), current);
}
void CategoryFilterWidget::onCurrentRowChanged(const QModelIndex &current, const QModelIndex &previous)
void CategoryFilterWidget::onCurrentRowChanged(const QModelIndex &current, [[maybe_unused]] const QModelIndex &previous)
{
Q_UNUSED(previous);
emit categoryChanged(getCategoryFilter(static_cast<CategoryFilterProxyModel *>(model()), current));
}

View File

@@ -95,10 +95,8 @@ QString TagFilterWidget::currentTag() const
return getTagFilter(static_cast<TagFilterProxyModel *>(model()), current);
}
void TagFilterWidget::onCurrentRowChanged(const QModelIndex &current, const QModelIndex &previous)
void TagFilterWidget::onCurrentRowChanged(const QModelIndex &current, [[maybe_unused]] const QModelIndex &previous)
{
Q_UNUSED(previous);
emit tagChanged(getTagFilter(static_cast<TagFilterProxyModel *>(model()), current));
}

View File

@@ -49,9 +49,8 @@ int WatchedFoldersModel::rowCount(const QModelIndex &parent) const
return parent.isValid() ? 0 : m_watchedFolders.count();
}
int WatchedFoldersModel::columnCount(const QModelIndex &parent) const
int WatchedFoldersModel::columnCount([[maybe_unused]] const QModelIndex &parent) const
{
Q_UNUSED(parent);
return 1;
}