pineapple-music/seekableslider.cpp

19 lines
445 B
C++
Raw Normal View History

2024-09-08 00:34:45 +08:00
// SPDX-FileCopyrightText: 2024 Gary Wang <git@blumia.net>
//
// SPDX-License-Identifier: MIT
#include "seekableslider.h"
SeekableSlider::SeekableSlider(QWidget *parent) :
QSlider(parent)
{
}
void SeekableSlider::mouseReleaseEvent(QMouseEvent *event)
{
double pos = event->pos().x() / (double)width();
setValue(pos * (maximum() - minimum()) + minimum());
emit sliderReleased();
return QSlider::mouseReleaseEvent(event);
}