mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Removed wheel events from scale slider in section of main settings.
This commit is contained in:
parent
5bd45e9a20
commit
6a45a862dd
5 changed files with 23 additions and 16 deletions
|
@ -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());
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue