diff --git a/plugins/display/brightnessadjwidget.cpp b/plugins/display/brightnessadjwidget.cpp index 1b339a977..19b10e82c 100644 --- a/plugins/display/brightnessadjwidget.cpp +++ b/plugins/display/brightnessadjwidget.cpp @@ -52,7 +52,9 @@ void BrightnessAdjWidget::loadBrightnessItem() QPixmap rightPixmap = ImageUtil::loadSvg(":/icons/resources/brightnesshigh", QSize(20, 20)); sliderContainer->setIcon(SliderContainer::IconPosition::LeftIcon,leftPixmap, QSize(), 12); sliderContainer->setIcon(SliderContainer::IconPosition::RightIcon, rightPixmap, QSize(), 12); - + // 需求要求调节范围是10%-100%,且调节幅度为1% + sliderContainer->setRange(10, 100); + sliderContainer->setPageStep(1); sliderContainer->setFixedWidth(310); sliderContainer->setFixedHeight(itemHeight); sliderContainer->updateSliderValue(monitor->brightness()); diff --git a/plugins/sound/sounddeviceswidget.cpp b/plugins/sound/sounddeviceswidget.cpp index 9fcfa7264..d2c9ba3e6 100644 --- a/plugins/sound/sounddeviceswidget.cpp +++ b/plugins/sound/sounddeviceswidget.cpp @@ -112,6 +112,8 @@ void SoundDevicesWidget::initUi() SliderProxyStyle *proxy = new SliderProxyStyle(SliderProxyStyle::Normal); m_sliderContainer->setSliderProxyStyle(proxy); + m_sliderContainer->setRange(0, std::round(m_soundInter->maxUIVolume() * 100.00)); + m_sliderContainer->setPageStep(2); sliderLayout->addWidget(m_sliderContainer); QHBoxLayout *topLayout = new QHBoxLayout(this); @@ -212,7 +214,9 @@ void SoundDevicesWidget::initConnection() connect(m_delegate, &SettingDelegate::selectIndexChanged, this, &SoundDevicesWidget::onSelectIndexChanged); connect(m_soundInter, &DBusAudio::PortEnabledChanged, this, &SoundDevicesWidget::onAudioDevicesChanged); connect(m_soundInter, &DBusAudio::CardsWithoutUnavailableChanged, this, &SoundDevicesWidget::onAudioDevicesChanged); - + connect(m_soundInter, &DBusAudio::MaxUIVolumeChanged, this, [ = ] (double maxValue) { + m_sliderContainer->setRange(0, std::round(maxValue * 100.00)); + }); connect(m_sliderContainer, &SliderContainer::sliderValueChanged, this, [ this ](int value) { m_sinkInter->SetVolume(value * 0.01, true); });