Merge pull request #411 from hwdro/master

Closes jp9000/obs-studio#411
master
jp9000 2015-04-11 07:13:56 -07:00
commit 0b56536ad2
4 changed files with 36 additions and 0 deletions

View File

@ -114,6 +114,7 @@ set(obs_SOURCES
visibility-checkbox.cpp
vertical-scroll-area.cpp
visibility-item-widget.cpp
slider-absoluteset-style.cpp
source-list-widget.cpp
crash-report.cpp
qt-wrappers.cpp)
@ -148,6 +149,7 @@ set(obs_HEADERS
visibility-checkbox.hpp
vertical-scroll-area.hpp
visibility-item-widget.hpp
slider-absoluteset-style.hpp
source-list-widget.hpp
qt-display.hpp
crash-report.hpp

View File

@ -0,0 +1,19 @@
#include "slider-absoluteset-style.hpp"
SliderAbsoluteSetStyle::SliderAbsoluteSetStyle(const QString& baseStyle)
:QProxyStyle(baseStyle)
{
}
SliderAbsoluteSetStyle::SliderAbsoluteSetStyle(QStyle* baseStyle)
:QProxyStyle(baseStyle)
{
}
int SliderAbsoluteSetStyle::styleHint(QStyle::StyleHint hint,
const QStyleOption* option = 0, const QWidget* widget = 0,
QStyleHintReturn* returnData = 0) const
{
if(hint == QStyle::SH_Slider_AbsoluteSetButtons)
return (Qt::LeftButton | Qt::MidButton);
return QProxyStyle::styleHint(hint, option, widget, returnData);
}

View File

@ -0,0 +1,12 @@
#pragma once
#include <QProxyStyle>
class SliderAbsoluteSetStyle : public QProxyStyle
{
public:
SliderAbsoluteSetStyle(const QString& baseStyle);
SliderAbsoluteSetStyle(QStyle* baseStyle);
int styleHint(QStyle::StyleHint hint, const QStyleOption* option,
const QWidget* widget, QStyleHintReturn* returnData) const;
};

View File

@ -1,6 +1,7 @@
#include "volume-control.hpp"
#include "qt-wrappers.hpp"
#include "mute-checkbox.hpp"
#include "slider-absoluteset-style.hpp"
#include <util/platform.h>
#include <QHBoxLayout>
#include <QVBoxLayout>
@ -161,6 +162,8 @@ VolControl::VolControl(OBSSource source_)
obs_fader_attach_source(obs_fader, source);
obs_volmeter_attach_source(obs_volmeter, source);
slider->setStyle(new SliderAbsoluteSetStyle(slider->style()));
/* Call volume changed once to init the slider position and label */
VolumeChanged();
}