disabled slider scroll

This commit is contained in:
Hane 2024-05-07 19:38:17 +02:00
commit 16604277fb
2 changed files with 17 additions and 5 deletions

View file

@ -10,6 +10,14 @@ void MeterSlider::setPeakValue(float peakValue) {
this->peakValue = peakValue;
}
bool MeterSlider::event(QEvent* ev) {
if (ev->type() == QEvent::Wheel) {
ev->setAccepted(false);
return false;
}
return QSlider::event(ev);
}
void MeterSlider::paintEvent(QPaintEvent *event) {
QStyleOptionSlider sliderComplex = QStyleOptionSlider();
sliderComplex.initFrom(this);
@ -246,7 +254,7 @@ void MainWindow::compose() {
windowHeight += bottom;
log_debugcpp("windowHeight loop: " + std::to_string(windowHeight));
}
windowHeight += mainMenuBar->height();
windowHeight += mainMenuBar->sizeHint().height();
log_debugcpp("windowHeight final value: " + std::to_string(windowHeight));
//Undoing scrolling
@ -406,7 +414,7 @@ ChannelWidget::ChannelWidget(uint32_t channelCount, EndpointHandler* eph, QWidge
*/
//uint32_t epChannelCount = eph->getChannelCount();
for(uint64_t channel = 0, col = 0, row = 0; channel < channelCount && channelCount > 1; channel++){
QSlider* tmp = new QSlider(Qt::Horizontal);
MeterSlider* tmp = new MeterSlider(Qt::Horizontal);
QLabel* tmpLb = new QLabel("");
tmp->setTickInterval(5);
tmp->setSingleStep(1);
@ -656,7 +664,6 @@ void EndpointWidget::customEvent(QEvent* ev) {
QWidget::customEvent(ev);
}
EndpointWidget::~EndpointWidget() {
timer->stop();
delete timer;

View file

@ -78,7 +78,9 @@ class MeterSlider : public QSlider {
private:
float peakValue;
protected:
bool event(QEvent* ev) override;
void paintEvent(QPaintEvent *event) override;
public:
void setPeakValue(float peakValue);
using QSlider::QSlider;
@ -165,6 +167,9 @@ public:
//void populateEndpointWidget(EndpointHandler *eph);
//void setEndpointHandlers(std::vector<EndpointHandler*> *ephs);
//protected:
//bool event(QEvent* ev) override;
public slots:
void updateMainVolume(int newValue);
void updateMute(int checked);