forked from qt-creator/qt-creator
Core: Modernize
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using modernize-use-default-member-init (partially) Change-Id: Idf10d7ffb1d98a04edc09a25c35e4e9e3abe87b5 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -101,7 +101,7 @@ class CategoryModel : public QAbstractListModel
|
||||
{
|
||||
public:
|
||||
CategoryModel();
|
||||
~CategoryModel();
|
||||
~CategoryModel() override;
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
@@ -172,7 +172,7 @@ void CategoryModel::setPages(const QList<IOptionsPage*> &pages,
|
||||
if (!category) {
|
||||
category = new Category;
|
||||
category->id = categoryId;
|
||||
category->tabWidget = 0;
|
||||
category->tabWidget = nullptr;
|
||||
category->index = -1;
|
||||
m_categories.append(category);
|
||||
}
|
||||
@@ -189,7 +189,7 @@ void CategoryModel::setPages(const QList<IOptionsPage*> &pages,
|
||||
if (!category) {
|
||||
category = new Category;
|
||||
category->id = categoryId;
|
||||
category->tabWidget = 0;
|
||||
category->tabWidget = nullptr;
|
||||
category->index = -1;
|
||||
m_categories.append(category);
|
||||
}
|
||||
@@ -233,7 +233,7 @@ Category *CategoryModel::findCategoryById(Id id)
|
||||
return category;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------- Category filter model
|
||||
@@ -245,7 +245,7 @@ Category *CategoryModel::findCategoryById(Id id)
|
||||
class CategoryFilterModel : public QSortFilterProxyModel
|
||||
{
|
||||
public:
|
||||
CategoryFilterModel() {}
|
||||
CategoryFilterModel() = default;
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
@@ -284,7 +284,7 @@ class CategoryListViewDelegate : public QStyledItemDelegate
|
||||
public:
|
||||
explicit CategoryListViewDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
|
||||
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
|
||||
{
|
||||
QSize size = QStyledItemDelegate::sizeHint(option, index);
|
||||
size.setHeight(qMax(size.height(), 32));
|
||||
@@ -540,7 +540,7 @@ void SettingsDialog::createGui()
|
||||
headerLabelFont.setPointSize(pointSize + 2);
|
||||
m_headerLabel->setFont(headerLabelFont);
|
||||
|
||||
QHBoxLayout *headerHLayout = new QHBoxLayout;
|
||||
auto headerHLayout = new QHBoxLayout;
|
||||
const int leftMargin = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
|
||||
headerHLayout->addSpacerItem(new QSpacerItem(leftMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored));
|
||||
headerHLayout->addWidget(m_headerLabel);
|
||||
@@ -559,7 +559,7 @@ void SettingsDialog::createGui()
|
||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &SettingsDialog::accept);
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &SettingsDialog::reject);
|
||||
|
||||
QGridLayout *mainGridLayout = new QGridLayout;
|
||||
auto mainGridLayout = new QGridLayout;
|
||||
mainGridLayout->addWidget(m_filterLineEdit, 0, 0, 1, 1);
|
||||
mainGridLayout->addLayout(headerHLayout, 0, 1, 1, 1);
|
||||
mainGridLayout->addWidget(m_categoryList, 1, 0, 1, 1);
|
||||
@@ -598,12 +598,12 @@ void SettingsDialog::ensureCategoryWidget(Category *category)
|
||||
return;
|
||||
|
||||
m_model.ensurePages(category);
|
||||
QTabWidget *tabWidget = new QTabWidget;
|
||||
auto tabWidget = new QTabWidget;
|
||||
tabWidget->tabBar()->setObjectName("qc_settings_main_tabbar"); // easier lookup in Squish
|
||||
for (IOptionsPage *page : category->pages) {
|
||||
QWidget *widget = page->widget();
|
||||
ICore::setupScreenShooter(page->displayName(), widget);
|
||||
SmartScrollArea *ssa = new SmartScrollArea(this);
|
||||
auto ssa = new SmartScrollArea(this);
|
||||
ssa->setWidget(widget);
|
||||
widget->setAutoFillBackground(false);
|
||||
tabWidget->addTab(ssa, page->displayName());
|
||||
|
||||
Reference in New Issue
Block a user