Skip to content

Commit 5e8942c

Browse files
authored
Fix Checking of Reload/Reset Selection in WbBuildEditor (#6844)
* fix reload button checking in WbBuildEditor popup * update changelog * fix pointer syntax * use const-pointers where applicable
1 parent 92352ac commit 5e8942c

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

docs/reference/changelog-r2025.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Bug Fixes
55
- Fixed a bug preventing the `webots-controller` executable from running on arm-based mac devices ([#6806](https://github.com/cyberbotics/webots/pull/6806)).
66
- Fixed a bug causing Webots to crash when multiple sounds were used with a [Speaker](speaker.md) node ([#6843](https://github.com/cyberbotics/webots/pull/6843)).
7+
- Fixed a bug causing the "Reload/Reset" buttons in the controller recompilation popup to not work on Windows ([#6844](https://github.com/cyberbotics/webots/pull/6844)).
78

89
## Webots R2025a
910
Released on January 31st, 2025.

src/webots/editor/WbBuildEditor.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "../../../include/controller/c/webots/utils/ansi_codes.h"
2929

3030
#include <QtGui/QAction>
31+
#include <QtWidgets/QPushButton>
3132
#include <QtWidgets/QToolBar>
3233
#include <QtWidgets/QToolButton>
3334

@@ -268,12 +269,16 @@ void WbBuildEditor::reloadMessageBoxIfNeeded() {
268269
if (WbMessageBox::enabled()) {
269270
QMessageBox messageBox(QMessageBox::Question, tr("Compilation successful"),
270271
tr("Do you want to reset or reload the world?"), QMessageBox::Cancel, this);
271-
messageBox.addButton(tr("Reload"), QMessageBox::AcceptRole);
272-
messageBox.setDefaultButton(messageBox.addButton(tr("Reset"), QMessageBox::AcceptRole));
273-
const int ret = messageBox.exec();
274-
if (ret == 0)
272+
const QPushButton *reloadButton = messageBox.addButton(tr("Reload"), QMessageBox::AcceptRole);
273+
QPushButton *resetButton = messageBox.addButton(tr("Reset"), QMessageBox::AcceptRole);
274+
messageBox.setDefaultButton(resetButton);
275+
276+
messageBox.exec();
277+
278+
const QAbstractButton *clickedButton = messageBox.clickedButton();
279+
if (clickedButton == reloadButton)
275280
emit reloadRequested();
276-
else if (ret == 1)
281+
else if (clickedButton == resetButton)
277282
emit resetRequested();
278283
}
279284
} else

0 commit comments

Comments
 (0)