mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: 任务栏音量调节滑动条与输出设备选中图标的问题
替换滑块控件为DSlider,控件默认滑条已激活部分为活动色 Log: 解决任务栏音量调节滑动条与输出设备选中图标的问题 Bug: https://pms.uniontech.com/zentao/bug-view-50470.html Change-Id: Idf703318c0c8bf81841d129025409fe1a5b4102f Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/7100 Reviewed-by: <mailman@uniontech.com> Reviewed-by: fanpengcheng <fanpengcheng@uniontech.com> Tested-by: <mailman@uniontech.com>
This commit is contained in:
parent
2714dfa26c
commit
abc87b95c9
@ -167,8 +167,9 @@ inline QString getAccessibleName(QWidget *w, QAccessible::Role r, const QString
|
||||
return QVariant(m_w->minimum());\
|
||||
}\
|
||||
|
||||
// DSlider控件特有功能函数
|
||||
#define FUNC_FUNC_MINIMUMSTEPSIZE(classname) QVariant Accessible##classname::minimumStepSize() const{\
|
||||
return QVariant(m_w->singleStep());\
|
||||
return QVariant(m_w->pageStep());\
|
||||
}\
|
||||
|
||||
#define SET_FORM_ACCESSIBLE_WITH_DESCRIPTION(classname,accessiblename,accessdescription) class Accessible##classname : public QAccessibleWidget\
|
||||
|
@ -26,13 +26,11 @@
|
||||
#include <QTimer>
|
||||
|
||||
VolumeSlider::VolumeSlider(QWidget *parent)
|
||||
: QSlider(Qt::Horizontal, parent),
|
||||
: DSlider(Qt::Horizontal, parent),
|
||||
m_pressed(false),
|
||||
m_timer(new QTimer(this))
|
||||
{
|
||||
setTickInterval(50);
|
||||
setPageStep(50);
|
||||
setTickPosition(QSlider::NoTicks);
|
||||
m_timer->setInterval(100);
|
||||
|
||||
connect(m_timer, &QTimer::timeout, this, &VolumeSlider::onTimeout);
|
||||
@ -44,7 +42,7 @@ void VolumeSlider::setValue(const int value)
|
||||
return;
|
||||
|
||||
blockSignals(true);
|
||||
QSlider::setValue(value);
|
||||
DSlider::setValue(value);
|
||||
blockSignals(false);
|
||||
}
|
||||
|
||||
@ -55,7 +53,7 @@ void VolumeSlider::mousePressEvent(QMouseEvent *e)
|
||||
if (!rect().contains(e->pos()))
|
||||
return;
|
||||
m_pressed = true;
|
||||
QSlider::setValue(maximum() * e->x() / rect().width());
|
||||
DSlider::setValue(maximum() * e->x() / rect().width());
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +62,7 @@ void VolumeSlider::mouseMoveEvent(QMouseEvent *e)
|
||||
const int value = minimum() + (double((maximum()) - minimum()) * e->x() / rect().width());
|
||||
const int normalized = std::max(std::min(maximum(), value), 0);
|
||||
|
||||
QSlider::setValue(normalized);
|
||||
DSlider::setValue(normalized);
|
||||
|
||||
blockSignals(true);
|
||||
emit valueChanged(normalized);
|
||||
@ -86,7 +84,7 @@ void VolumeSlider::wheelEvent(QWheelEvent *e)
|
||||
|
||||
m_timer->start();
|
||||
|
||||
QSlider::setValue(value() + (e->delta() > 0 ? 10 : -10));
|
||||
DSlider::setValue(value() + (e->delta() > 0 ? 10 : -10));
|
||||
}
|
||||
|
||||
void VolumeSlider::onTimeout()
|
||||
|
@ -22,10 +22,10 @@
|
||||
#ifndef VOLUMESLIDER_H
|
||||
#define VOLUMESLIDER_H
|
||||
|
||||
#include <QSlider>
|
||||
#include <DSlider>
|
||||
#include <QTimer>
|
||||
|
||||
class VolumeSlider : public QSlider
|
||||
class VolumeSlider : public DTK_WIDGET_NAMESPACE::DSlider
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user