mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Merge pull request #5048 from godric3/map-editor-remove-parent-chains
remove chains of `parent()->parent()` in map editor
This commit is contained in:
commit
189e7dc94d
@ -69,6 +69,7 @@ public:
|
||||
void redo();
|
||||
|
||||
PlayerColor defaultPlayer;
|
||||
QDialog * settingsDialog = nullptr;
|
||||
|
||||
private:
|
||||
std::unique_ptr<CMap> _map;
|
||||
|
@ -310,12 +310,12 @@ void LoseConditions::onObjectSelect()
|
||||
QObject::connect(&l, &ObjectPickerLayer::selectionMade, this, &LoseConditions::onObjectPicked);
|
||||
}
|
||||
|
||||
dynamic_cast<QWidget*>(parent()->parent()->parent()->parent()->parent()->parent()->parent())->hide();
|
||||
controller->settingsDialog->hide();
|
||||
}
|
||||
|
||||
void LoseConditions::onObjectPicked(const CGObjectInstance * obj)
|
||||
{
|
||||
dynamic_cast<QWidget*>(parent()->parent()->parent()->parent()->parent()->parent()->parent())->show();
|
||||
controller->settingsDialog->show();
|
||||
|
||||
for(int lvl : {0, 1})
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ MapSettings::MapSettings(MapController & ctrl, QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
|
||||
assert(controller.map());
|
||||
|
||||
controller.settingsDialog = this;
|
||||
show();
|
||||
|
||||
for(auto const & objectPtr : VLC->skillh->objects)
|
||||
@ -73,6 +73,7 @@ MapSettings::MapSettings(MapController & ctrl, QWidget *parent) :
|
||||
|
||||
MapSettings::~MapSettings()
|
||||
{
|
||||
controller.settingsDialog = nullptr;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ void TimedEvent::on_addObjectToDelete_clicked()
|
||||
QObject::connect(&l, &ObjectPickerLayer::selectionMade, this, &TimedEvent::onObjectPicked);
|
||||
}
|
||||
hide();
|
||||
dynamic_cast<QWidget *>(parent()->parent()->parent()->parent()->parent()->parent()->parent())->hide();
|
||||
controller.settingsDialog->hide();
|
||||
}
|
||||
|
||||
void TimedEvent::on_removeObjectToDelete_clicked()
|
||||
@ -133,7 +133,7 @@ void TimedEvent::on_removeObjectToDelete_clicked()
|
||||
void TimedEvent::onObjectPicked(const CGObjectInstance * obj)
|
||||
{
|
||||
show();
|
||||
dynamic_cast<QWidget *>(parent()->parent()->parent()->parent()->parent()->parent()->parent())->show();
|
||||
controller.settingsDialog->show();
|
||||
|
||||
for(int lvl : {0, 1})
|
||||
{
|
||||
|
@ -528,12 +528,12 @@ void VictoryConditions::onObjectSelect()
|
||||
QObject::connect(&l, &ObjectPickerLayer::selectionMade, this, &VictoryConditions::onObjectPicked);
|
||||
}
|
||||
|
||||
dynamic_cast<QWidget*>(parent()->parent()->parent()->parent()->parent()->parent()->parent())->hide();
|
||||
controller->settingsDialog->hide();
|
||||
}
|
||||
|
||||
void VictoryConditions::onObjectPicked(const CGObjectInstance * obj)
|
||||
{
|
||||
dynamic_cast<QWidget*>(parent()->parent()->parent()->parent()->parent()->parent()->parent())->show();
|
||||
controller->settingsDialog->show();
|
||||
|
||||
for(int lvl : {0, 1})
|
||||
{
|
||||
|
@ -202,12 +202,12 @@ void PlayerParams::on_townSelect_clicked()
|
||||
QObject::connect(&l, &ObjectPickerLayer::selectionMade, this, &PlayerParams::onTownPicked);
|
||||
}
|
||||
|
||||
dynamic_cast<QWidget*>(parent()->parent()->parent()->parent())->hide();
|
||||
controller.settingsDialog->hide();
|
||||
}
|
||||
|
||||
void PlayerParams::onTownPicked(const CGObjectInstance * obj)
|
||||
{
|
||||
dynamic_cast<QWidget*>(parent()->parent()->parent()->parent())->show();
|
||||
controller.settingsDialog->show();
|
||||
|
||||
for(int lvl : {0, 1})
|
||||
{
|
||||
|
@ -22,6 +22,7 @@ PlayerSettings::PlayerSettings(MapController & ctrl, QWidget *parent) :
|
||||
controller(ctrl)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
controller.settingsDialog = this;
|
||||
show();
|
||||
|
||||
int players = 0;
|
||||
@ -46,6 +47,7 @@ PlayerSettings::PlayerSettings(MapController & ctrl, QWidget *parent) :
|
||||
|
||||
PlayerSettings::~PlayerSettings()
|
||||
{
|
||||
controller.settingsDialog = nullptr;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user