From ee986b8e56d3f6cc1d69aa352fc8fab3b89e74af Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 12 Feb 2025 15:39:40 -0500 Subject: [PATCH] Remove unnecessary const qualifier, unused variable --- include/core/map.h | 2 +- src/core/map.cpp | 2 +- src/core/maplayout.cpp | 4 +--- src/editor.cpp | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/core/map.h b/include/core/map.h index a25db5e9..b223536d 100644 --- a/include/core/map.h +++ b/include/core/map.h @@ -84,7 +84,7 @@ public: void openScript(QString label); void removeEvent(Event *); void addEvent(Event *); - int getIndexOfEvent(const Event *) const; + int getIndexOfEvent(Event *) const; void deleteConnections(); QList getConnections() const; diff --git a/src/core/map.cpp b/src/core/map.cpp index e784ba5f..aac20138 100644 --- a/src/core/map.cpp +++ b/src/core/map.cpp @@ -230,7 +230,7 @@ void Map::addEvent(Event *event) { if (!m_ownedEvents.contains(event)) m_ownedEvents.insert(event); } -int Map::getIndexOfEvent(const Event *event) const { +int Map::getIndexOfEvent(Event *event) const { return m_events.value(event->getEventGroup()).indexOf(event); } diff --git a/src/core/maplayout.cpp b/src/core/maplayout.cpp index 35fcc2f7..2b52a80f 100644 --- a/src/core/maplayout.cpp +++ b/src/core/maplayout.cpp @@ -177,8 +177,6 @@ void Layout::setDimensions(int newWidth, int newHeight, bool setNewBlockdata, bo } void Layout::adjustDimensions(QMargins margins, bool setNewBlockdata) { - int oldWidth = this->width; - int oldHeight = this->height; int newWidth = this->width + margins.left() + margins.right(); int newHeight = this->height + margins.top() + margins.bottom(); @@ -190,7 +188,7 @@ void Layout::adjustDimensions(QMargins margins, bool setNewBlockdata) { if ((x < margins.left()) || (x >= newWidth - margins.right()) || (y < margins.top()) || (y >= newHeight - margins.bottom())) { newBlockdata.append(0); } else { - int index = (y - margins.top()) * oldWidth + (x - margins.left()); + int index = (y - margins.top()) * this->width + (x - margins.left()); newBlockdata.append(this->blockdata.value(index)); } } diff --git a/src/editor.cpp b/src/editor.cpp index 823d1196..5aa79310 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -2192,7 +2192,7 @@ void Editor::deleteSelectedEvents() { // If deleting multiple events, just let editor work out next selected. Event *nextSelectedEvent = nullptr; if (eventsToDelete.length() == 1) { - const Event *eventToDelete = eventsToDelete.first(); + Event *eventToDelete = eventsToDelete.first(); Event::Group event_group = eventToDelete->getEventGroup(); int index = this->map->getIndexOfEvent(eventToDelete); if (index != this->map->getNumEvents(event_group) - 1)