WInstancesTab: Make use of Qt 5 signals and slots

This commit is contained in:
Lioncash 2020-07-03 08:19:18 -04:00
parent a72c338585
commit f798517416
1 changed files with 14 additions and 14 deletions

View File

@ -23,8 +23,8 @@ WInstancesTab::WInstancesTab(CWorldEditor *pEditor, QWidget *parent) :
mLayersProxyModel.setSourceModel(mpLayersModel); mLayersProxyModel.setSourceModel(mpLayersModel);
mTypesProxyModel.setSourceModel(mpTypesModel); mTypesProxyModel.setSourceModel(mpTypesModel);
connect(mpLayersModel, SIGNAL(modelReset()), this, SLOT(ExpandTopLevelItems())); connect(mpLayersModel, &CInstancesModel::modelReset, this, &WInstancesTab::ExpandTopLevelItems);
connect(mpTypesModel, SIGNAL(modelReset()), this, SLOT(ExpandTopLevelItems())); connect(mpTypesModel, &CInstancesModel::modelReset, this, &WInstancesTab::ExpandTopLevelItems);
int ColWidth = ui->LayersTreeView->width() * 0.29; int ColWidth = ui->LayersTreeView->width() * 0.29;
@ -42,12 +42,12 @@ WInstancesTab::WInstancesTab(CWorldEditor *pEditor, QWidget *parent) :
ui->TypesTreeView->header()->resizeSection(1, ColWidth); ui->TypesTreeView->header()->resizeSection(1, ColWidth);
ui->TypesTreeView->header()->setSortIndicator(0, Qt::AscendingOrder); ui->TypesTreeView->header()->setSortIndicator(0, Qt::AscendingOrder);
connect(ui->LayersTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(OnTreeClick(QModelIndex))); connect(ui->LayersTreeView, &QTreeView::clicked, this, &WInstancesTab::OnTreeClick);
connect(ui->LayersTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OnTreeDoubleClick(QModelIndex))); connect(ui->LayersTreeView, &QTreeView::doubleClicked, this, &WInstancesTab::OnTreeDoubleClick);
connect(ui->LayersTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(OnTreeContextMenu(QPoint))); connect(ui->LayersTreeView, &QTreeView::customContextMenuRequested, this, &WInstancesTab::OnTreeContextMenu);
connect(ui->TypesTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(OnTreeClick(QModelIndex))); connect(ui->TypesTreeView, &QTreeView::clicked, this, &WInstancesTab::OnTreeClick);
connect(ui->TypesTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OnTreeDoubleClick(QModelIndex))); connect(ui->TypesTreeView, &QTreeView::doubleClicked, this, &WInstancesTab::OnTreeDoubleClick);
connect(ui->TypesTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(OnTreeContextMenu(QPoint))); connect(ui->TypesTreeView, &QTreeView::customContextMenuRequested, this, &WInstancesTab::OnTreeContextMenu);
// Create context menu // Create context menu
mpHideInstance = new QAction(tr("Hide instance"), this); mpHideInstance = new QAction(tr("Hide instance"), this);
@ -66,12 +66,12 @@ WInstancesTab::WInstancesTab(CWorldEditor *pEditor, QWidget *parent) :
mpTreeContextMenu = new QMenu(this); mpTreeContextMenu = new QMenu(this);
mpTreeContextMenu->addActions(ActionList); mpTreeContextMenu->addActions(ActionList);
connect(mpHideInstance, SIGNAL(triggered()), this, SLOT(OnHideInstanceAction())); connect(mpHideInstance, &QAction::triggered, this, &WInstancesTab::OnHideInstanceAction);
connect(mpHideType, SIGNAL(triggered()), this, SLOT(OnHideTypeAction())); connect(mpHideType, &QAction::triggered, this, &WInstancesTab::OnHideTypeAction);
connect(mpHideAllTypes, SIGNAL(triggered()), this, SLOT(OnHideAllTypesAction())); connect(mpHideAllTypes, &QAction::triggered, this, &WInstancesTab::OnHideAllTypesAction);
connect(mpHideAllExceptType, SIGNAL(triggered()), this, SLOT(OnHideAllExceptTypeAction())); connect(mpHideAllExceptType, &QAction::triggered, this, &WInstancesTab::OnHideAllExceptTypeAction);
connect(mpUnhideAllTypes, SIGNAL(triggered()), this, SLOT(OnUnhideAllTypes())); connect(mpUnhideAllTypes, &QAction::triggered, this, &WInstancesTab::OnUnhideAllTypes);
connect(mpUnhideAll, SIGNAL(triggered()), this, SLOT(OnUnhideAll())); connect(mpUnhideAll, &QAction::triggered, this, &WInstancesTab::OnUnhideAll);
} }
WInstancesTab::~WInstancesTab() = default; WInstancesTab::~WInstancesTab() = default;