diff --git a/src/config.cpp b/src/config.cpp index daf53067..0ea49b6c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -575,7 +575,7 @@ void ProjectConfig::onNewConfigFileCreated() { form.addRow(new QLabel("Game Version"), baseGameVersionComboBox); QDialogButtonBox buttonBox(QDialogButtonBox::Ok, Qt::Horizontal, &dialog); - connect(&buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept())); + connect(&buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); form.addRow(&buttonBox); if (dialog.exec() == QDialog::Accepted) { diff --git a/src/ui/neweventtoolbutton.cpp b/src/ui/neweventtoolbutton.cpp index 6c3a59a0..58510a2d 100644 --- a/src/ui/neweventtoolbutton.cpp +++ b/src/ui/neweventtoolbutton.cpp @@ -7,8 +7,7 @@ NewEventToolButton::NewEventToolButton(QWidget *parent) : QToolButton(parent) { setPopupMode(QToolButton::MenuButtonPopup); - QObject::connect(this, SIGNAL(triggered(QAction*)), - this, SLOT(setDefaultAction(QAction*))); + QObject::connect(this, &NewEventToolButton::triggered, this, &NewEventToolButton::setDefaultAction); this->init(); } @@ -17,11 +16,11 @@ void NewEventToolButton::init() // Add a context menu to select different types of map events. this->newObjectAction = new QAction("New Object", this); this->newObjectAction->setIcon(QIcon(":/icons/add.ico")); - connect(this->newObjectAction, SIGNAL(triggered(bool)), this, SLOT(newObject())); + connect(this->newObjectAction, &QAction::triggered, this, &NewEventToolButton::newObject); this->newWarpAction = new QAction("New Warp", this); this->newWarpAction->setIcon(QIcon(":/icons/add.ico")); - connect(this->newWarpAction, SIGNAL(triggered(bool)), this, SLOT(newWarp())); + connect(this->newWarpAction, &QAction::triggered, this, &NewEventToolButton::newWarp); /* // disable this functionality for now this->newHealLocationAction = new QAction("New Heal Location", this); @@ -31,23 +30,23 @@ void NewEventToolButton::init() this->newTriggerAction = new QAction("New Trigger", this); this->newTriggerAction->setIcon(QIcon(":/icons/add.ico")); - connect(this->newTriggerAction, SIGNAL(triggered(bool)), this, SLOT(newTrigger())); + connect(this->newTriggerAction, &QAction::triggered, this, &NewEventToolButton::newTrigger); this->newWeatherTriggerAction = new QAction("New Weather Trigger", this); this->newWeatherTriggerAction->setIcon(QIcon(":/icons/add.ico")); - connect(this->newWeatherTriggerAction, SIGNAL(triggered(bool)), this, SLOT(newWeatherTrigger())); + connect(this->newWeatherTriggerAction, &QAction::triggered, this, &NewEventToolButton::newWeatherTrigger); this->newSignAction = new QAction("New Sign", this); this->newSignAction->setIcon(QIcon(":/icons/add.ico")); - connect(this->newSignAction, SIGNAL(triggered(bool)), this, SLOT(newSign())); + connect(this->newSignAction, &QAction::triggered, this, &NewEventToolButton::newSign); this->newHiddenItemAction = new QAction("New Hidden Item", this); this->newHiddenItemAction->setIcon(QIcon(":/icons/add.ico")); - connect(this->newHiddenItemAction, SIGNAL(triggered(bool)), this, SLOT(newHiddenItem())); + connect(this->newHiddenItemAction, &QAction::triggered, this, &NewEventToolButton::newHiddenItem); this->newSecretBaseAction = new QAction("New Secret Base", this); this->newSecretBaseAction->setIcon(QIcon(":/icons/add.ico")); - connect(this->newSecretBaseAction, SIGNAL(triggered(bool)), this, SLOT(newSecretBase())); + connect(this->newSecretBaseAction, &QAction::triggered, this, &NewEventToolButton::newSecretBase); QMenu *alignMenu = new QMenu(); alignMenu->addAction(this->newObjectAction); diff --git a/src/ui/regionmapeditor.cpp b/src/ui/regionmapeditor.cpp index a116aa5a..eab70589 100644 --- a/src/ui/regionmapeditor.cpp +++ b/src/ui/regionmapeditor.cpp @@ -631,7 +631,7 @@ void RegionMapEditor::on_pushButton_CityMap_add_clicked() { QString name; form.addRow(&buttonBox); - connect(&buttonBox, SIGNAL(rejected()), &popup, SLOT(reject())); + connect(&buttonBox, &QDialogButtonBox::rejected, &popup, &QDialog::reject); connect(&buttonBox, &QDialogButtonBox::accepted, [&popup, &input, &name](){ name = input->text().remove(QRegularExpression("[^a-zA-Z0-9_]+")); if (!name.isEmpty()) @@ -666,8 +666,8 @@ void RegionMapEditor::on_action_RegionMap_Resize_triggered() { QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &popup); form.addRow(&buttonBox); - connect(&buttonBox, SIGNAL(rejected()), &popup, SLOT(reject())); - connect(&buttonBox, SIGNAL(accepted()), &popup, SLOT(accept())); + connect(&buttonBox, &QDialogButtonBox::rejected, &popup, &QDialog::reject); + connect(&buttonBox, &QDialogButtonBox::accepted, &popup, &QDialog::accept); if (popup.exec() == QDialog::Accepted) { resize(widthSpinBox->value(), heightSpinBox->value()); @@ -760,7 +760,7 @@ void RegionMapEditor::on_action_Swap_triggered() { QString beforeSection, afterSection; uint8_t oldId, newId; - connect(&buttonBox, SIGNAL(rejected()), &popup, SLOT(reject())); + connect(&buttonBox, &QDialogButtonBox::rejected, &popup, &QDialog::reject); connect(&buttonBox, &QDialogButtonBox::accepted, [this, &popup, &oldSecBox, &newSecBox, &beforeSection, &afterSection, &oldId, &newId](){ beforeSection = oldSecBox->currentText(); diff --git a/src/ui/tileseteditor.cpp b/src/ui/tileseteditor.cpp index 755e941d..2729fd37 100644 --- a/src/ui/tileseteditor.cpp +++ b/src/ui/tileseteditor.cpp @@ -157,12 +157,12 @@ void TilesetEditor::setMetatileLabelValidator() { void TilesetEditor::initMetatileSelector() { this->metatileSelector = new TilesetEditorMetatileSelector(this->primaryTileset, this->secondaryTileset, this->map); - connect(this->metatileSelector, SIGNAL(hoveredMetatileChanged(uint16_t)), - this, SLOT(onHoveredMetatileChanged(uint16_t))); - connect(this->metatileSelector, SIGNAL(hoveredMetatileCleared()), - this, SLOT(onHoveredMetatileCleared())); - connect(this->metatileSelector, SIGNAL(selectedMetatileChanged(uint16_t)), - this, SLOT(onSelectedMetatileChanged(uint16_t))); + connect(this->metatileSelector, &TilesetEditorMetatileSelector::hoveredMetatileChanged, + this, &TilesetEditor::onHoveredMetatileChanged); + connect(this->metatileSelector, &TilesetEditorMetatileSelector::hoveredMetatileCleared, + this, &TilesetEditor::onHoveredMetatileCleared); + connect(this->metatileSelector, &TilesetEditorMetatileSelector::selectedMetatileChanged, + this, &TilesetEditor::onSelectedMetatileChanged); this->metatilesScene = new QGraphicsScene; this->metatilesScene->addItem(this->metatileSelector); @@ -175,10 +175,10 @@ void TilesetEditor::initMetatileSelector() void TilesetEditor::initMetatileLayersItem() { Metatile *metatile = Tileset::getMetatile(this->metatileSelector->getSelectedMetatile(), this->primaryTileset, this->secondaryTileset); this->metatileLayersItem = new MetatileLayersItem(metatile, this->primaryTileset, this->secondaryTileset); - connect(this->metatileLayersItem, SIGNAL(tileChanged(int, int)), - this, SLOT(onMetatileLayerTileChanged(int, int))); - connect(this->metatileLayersItem, SIGNAL(selectedTilesChanged(QPoint, int, int)), - this, SLOT(onMetatileLayerSelectionChanged(QPoint, int, int))); + connect(this->metatileLayersItem, &MetatileLayersItem::tileChanged, + this, &TilesetEditor::onMetatileLayerTileChanged); + connect(this->metatileLayersItem, &MetatileLayersItem::selectedTilesChanged, + this, &TilesetEditor::onMetatileLayerSelectionChanged); this->metatileLayersScene = new QGraphicsScene; this->metatileLayersScene->addItem(this->metatileLayersItem); @@ -187,13 +187,14 @@ void TilesetEditor::initMetatileLayersItem() { void TilesetEditor::initTileSelector() { - this->tileSelector = new TilesetEditorTileSelector(this->primaryTileset, this->secondaryTileset, projectConfig.getTripleLayerMetatilesEnabled()); - connect(this->tileSelector, SIGNAL(hoveredTileChanged(uint16_t)), - this, SLOT(onHoveredTileChanged(uint16_t))); - connect(this->tileSelector, SIGNAL(hoveredTileCleared()), - this, SLOT(onHoveredTileCleared())); - connect(this->tileSelector, SIGNAL(selectedTilesChanged()), - this, SLOT(onSelectedTilesChanged())); + this->tileSelector = new TilesetEditorTileSelector(this->primaryTileset, this->secondaryTileset, + projectConfig.getTripleLayerMetatilesEnabled()); + connect(this->tileSelector, &TilesetEditorTileSelector::hoveredTileChanged, + this, &TilesetEditor::onHoveredTileChanged); + connect(this->tileSelector, &TilesetEditorTileSelector::hoveredTileCleared, + this, &TilesetEditor::onHoveredTileCleared); + connect(this->tileSelector, &TilesetEditorTileSelector::selectedTilesChanged, + this, &TilesetEditor::onSelectedTilesChanged); this->tilesScene = new QGraphicsScene; this->tilesScene->addItem(this->tileSelector); @@ -715,8 +716,8 @@ void TilesetEditor::on_actionChange_Metatiles_Count_triggered() form.addRow(new QLabel("Secondary Tileset"), secondarySpinBox); QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog); - connect(&buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept())); - connect(&buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); + connect(&buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); + connect(&buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); form.addRow(&buttonBox); if (dialog.exec() == QDialog::Accepted) { @@ -773,9 +774,12 @@ void TilesetEditor::on_actionChange_Metatiles_Count_triggered() void TilesetEditor::on_actionChange_Palettes_triggered() { if (!this->paletteEditor) { - this->paletteEditor = new PaletteEditor(this->project, this->primaryTileset, this->secondaryTileset, this->paletteId, this); - connect(this->paletteEditor, SIGNAL(changedPaletteColor()), this, SLOT(onPaletteEditorChangedPaletteColor())); - connect(this->paletteEditor, SIGNAL(changedPalette(int)), this, SLOT(onPaletteEditorChangedPalette(int))); + this->paletteEditor = new PaletteEditor(this->project, this->primaryTileset, + this->secondaryTileset, this->paletteId, this); + connect(this->paletteEditor, &PaletteEditor::changedPaletteColor, + this, &TilesetEditor::onPaletteEditorChangedPaletteColor); + connect(this->paletteEditor, &PaletteEditor::changedPalette, + this, &TilesetEditor::onPaletteEditorChangedPalette); } if (!this->paletteEditor->isVisible()) {