ProjectExplorer: Avoid accidental changes on spinbox via mouse scroll

- Introduced an Utils::attachWheelBlocker() to disable mouse wheel events on the "Parallel Jobs" field.
- This prevents unintentional modifications when users inadvertently scroll over the input.

Change-Id: Iccb93305fbcf399cae683412078782b5ea9f4ad6
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Tasuku Suzuki
2023-10-13 16:21:45 +09:00
parent 13f5367611
commit f1085b324e
5 changed files with 54 additions and 0 deletions

View File

@@ -7,6 +7,7 @@
#include "checkablemessagebox.h"
#include "environment.h"
#include "fancylineedit.h"
#include "guiutils.h"
#include "iconbutton.h"
#include "layoutbuilder.h"
#include "passworddialog.h"
@@ -2195,6 +2196,7 @@ void IntegerAspect::addToLayout(Layouting::LayoutItem &parent)
d->m_spinBox->setRange(int(d->m_minimumValue.value() / d->m_displayScaleFactor),
int(d->m_maximumValue.value() / d->m_displayScaleFactor));
d->m_spinBox->setValue(int(value() / d->m_displayScaleFactor)); // Must happen after setRange()
attachWheelBlocker(d->m_spinBox);
addLabeledItem(parent, d->m_spinBox);
connect(d->m_spinBox.data(), &QSpinBox::valueChanged,
this, &IntegerAspect::handleGuiChanged);
@@ -2294,6 +2296,7 @@ void DoubleAspect::addToLayout(LayoutItem &builder)
d->m_spinBox->setSpecialValueText(d->m_specialValueText);
if (d->m_maximumValue && d->m_maximumValue)
d->m_spinBox->setRange(d->m_minimumValue.value(), d->m_maximumValue.value());
attachWheelBlocker(d->m_spinBox);
bufferToGui(); // Must happen after setRange()!
addLabeledItem(builder, d->m_spinBox);
connect(d->m_spinBox.data(), &QDoubleSpinBox::valueChanged,