mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 14:08:03 -06:00
Use 'auto' to avoid duplicating the type name
This commit is contained in:
@@ -44,7 +44,7 @@ ScanFoldersDelegate::ScanFoldersDelegate(QObject *parent, QTreeView *foldersView
|
||||
|
||||
void ScanFoldersDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||
{
|
||||
QComboBox *combobox = static_cast<QComboBox*>(editor);
|
||||
auto *combobox = static_cast<QComboBox*>(editor);
|
||||
// Set combobox index
|
||||
if (index.data(Qt::UserRole).toInt() == ScanFoldersModel::CUSTOM_LOCATION)
|
||||
combobox->setCurrentIndex(4); // '4' is the index of the item after the separator in the QComboBox menu
|
||||
@@ -56,7 +56,7 @@ QWidget *ScanFoldersDelegate::createEditor(QWidget *parent, const QStyleOptionVi
|
||||
{
|
||||
if (index.column() != ScanFoldersModel::DOWNLOAD) return nullptr;
|
||||
|
||||
QComboBox *editor = new QComboBox(parent);
|
||||
auto *editor = new QComboBox(parent);
|
||||
|
||||
editor->setFocusPolicy(Qt::StrongFocus);
|
||||
editor->addItem(ScanFoldersModel::pathTypeDisplayName(ScanFoldersModel::DOWNLOAD_IN_WATCH_FOLDER));
|
||||
@@ -75,7 +75,7 @@ QWidget *ScanFoldersDelegate::createEditor(QWidget *parent, const QStyleOptionVi
|
||||
void ScanFoldersDelegate::comboboxIndexChanged(int index)
|
||||
{
|
||||
if (index == ScanFoldersModel::CUSTOM_LOCATION) {
|
||||
QWidget *w = static_cast<QWidget *>(sender());
|
||||
auto *w = static_cast<QWidget *>(sender());
|
||||
if (w && w->parentWidget())
|
||||
w->parentWidget()->setFocus();
|
||||
}
|
||||
@@ -83,7 +83,7 @@ void ScanFoldersDelegate::comboboxIndexChanged(int index)
|
||||
|
||||
void ScanFoldersDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||
{
|
||||
QComboBox *combobox = static_cast<QComboBox*>(editor);
|
||||
auto *combobox = static_cast<QComboBox*>(editor);
|
||||
int value = combobox->currentIndex();
|
||||
|
||||
switch (value) {
|
||||
|
||||
Reference in New Issue
Block a user