Add parentWidget() to Project to avoid name-shadowing the parent member

This commit is contained in:
BigBahss 2021-02-15 11:43:18 -05:00 committed by huderlem
parent 9a9143500f
commit d9340d3b73
2 changed files with 4 additions and 4 deletions

View file

@ -31,6 +31,8 @@ public:
Project(const Project &) = delete;
Project & operator = (const Project &) = delete;
inline QWidget *parentWidget() const { return static_cast<QWidget *>(parent()); }
public:
QString root;
QStringList groupNames;
@ -219,8 +221,6 @@ private:
static int default_map_size;
static int max_object_events;
QWidget *parent;
signals:
void reloadProject();
void uncheckMonitorFilesAction();

View file

@ -36,7 +36,7 @@ int Project::max_map_data_size = 10240; // 0x2800
int Project::default_map_size = 20;
int Project::max_object_events = 64;
Project::Project(QWidget *parent) : parent(parent)
Project::Project(QWidget *parent) : QObject(parent)
{
initSignals();
}
@ -61,7 +61,7 @@ void Project::initSignals() {
static bool showing = false;
if (showing) return;
QMessageBox notice(this->parent);
QMessageBox notice(this->parentWidget());
notice.setText("File Changed");
notice.setInformativeText(QString("The file %1 has changed on disk. Would you like to reload the project?")
.arg(changed.remove(this->root + "/")));