Removed wheel events from scale slider in section of main settings.

This commit is contained in:
23rd 2024-09-04 16:11:42 +03:00 committed by John Preston
parent 5bd45e9a20
commit 6a45a862dd
5 changed files with 23 additions and 16 deletions

View file

@ -462,19 +462,10 @@ void CreateGiveawayBox(
const auto &padding = st::giveawayGiftCodeSliderPadding; const auto &padding = st::giveawayGiftCodeSliderPadding;
Ui::AddSkip(sliderContainer, padding.top()); Ui::AddSkip(sliderContainer, padding.top());
class Slider : public Ui::MediaSlider {
public:
using Ui::MediaSlider::MediaSlider;
protected:
void wheelEvent(QWheelEvent *e) override {
e->ignore();
}
};
const auto slider = sliderContainer->add( const auto slider = sliderContainer->add(
object_ptr<Slider>(sliderContainer, st::settingsScale), object_ptr<Ui::MediaSliderWheelless>(
sliderContainer,
st::settingsScale),
st::boxRowPadding); st::boxRowPadding);
Ui::AddSkip(sliderContainer, padding.bottom()); Ui::AddSkip(sliderContainer, padding.bottom());
slider->resize(slider->width(), st::settingsScale.seekSize.height()); slider->resize(slider->width(), st::settingsScale.seekSize.height());

View file

@ -265,14 +265,17 @@ SliderWithLabel MakeSliderWithLabel(
const style::MediaSlider &sliderSt, const style::MediaSlider &sliderSt,
const style::FlatLabel &labelSt, const style::FlatLabel &labelSt,
int skip, int skip,
int minLabelWidth) { int minLabelWidth,
bool ignoreWheel) {
auto result = object_ptr<Ui::RpWidget>(parent); auto result = object_ptr<Ui::RpWidget>(parent);
const auto raw = result.data(); const auto raw = result.data();
const auto height = std::max( const auto height = std::max(
sliderSt.seekSize.height(), sliderSt.seekSize.height(),
labelSt.style.font->height); labelSt.style.font->height);
raw->resize(sliderSt.seekSize.width(), height); raw->resize(sliderSt.seekSize.width(), height);
const auto slider = Ui::CreateChild<Ui::MediaSlider>(raw, sliderSt); const auto slider = ignoreWheel
? Ui::CreateChild<Ui::MediaSliderWheelless>(raw, sliderSt)
: Ui::CreateChild<Ui::MediaSlider>(raw, sliderSt);
const auto label = Ui::CreateChild<Ui::FlatLabel>(raw, labelSt); const auto label = Ui::CreateChild<Ui::FlatLabel>(raw, labelSt);
slider->resize(slider->width(), sliderSt.seekSize.height()); slider->resize(slider->width(), sliderSt.seekSize.height());
rpl::combine( rpl::combine(

View file

@ -214,6 +214,7 @@ struct SliderWithLabel {
const style::MediaSlider &sliderSt, const style::MediaSlider &sliderSt,
const style::FlatLabel &labelSt, const style::FlatLabel &labelSt,
int skip, int skip,
int minLabelWidth = 0); int minLabelWidth = 0,
bool ignoreWheel = false);
} // namespace Settings } // namespace Settings

View file

@ -598,7 +598,8 @@ void SetupInterfaceScale(
st::settingsScale, st::settingsScale,
st::settingsScaleLabel, st::settingsScaleLabel,
st::normalFont->spacew * 2, st::normalFont->spacew * 2,
st::settingsScaleLabel.style.font->width("300%")); st::settingsScaleLabel.style.font->width("300%"),
true);
container->add( container->add(
std::move(sliderWithLabel.widget), std::move(sliderWithLabel.widget),
icon ? st::settingsScalePadding : st::settingsBigScalePadding); icon ? st::settingsScalePadding : st::settingsBigScalePadding);

View file

@ -230,4 +230,15 @@ private:
}; };
class MediaSliderWheelless : public MediaSlider {
public:
using Ui::MediaSlider::MediaSlider;
protected:
void wheelEvent(QWheelEvent *e) override {
e->ignore();
}
};
} // namespace Ui } // namespace Ui