Commit ba5d2dc0 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: QDial: show value on control (fix #8906)

parent cae4f1c6
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "qt4.hpp" #include "qt4.hpp"
#include "input_manager.hpp" #include "input_manager.hpp"
#include "util/qt_dirs.hpp" #include "util/qt_dirs.hpp"
#include "util/customwidgets.hpp"
#include "../../audio_filter/equalizer_presets.h" #include "../../audio_filter/equalizer_presets.h"
#include <vlc_intf_strings.h> #include <vlc_intf_strings.h>
...@@ -529,7 +530,7 @@ void ExtVideo::setWidgetValue( QObject *widget ) ...@@ -529,7 +530,7 @@ void ExtVideo::setWidgetValue( QObject *widget )
QCheckBox *checkbox = qobject_cast<QCheckBox*> ( widget ); QCheckBox *checkbox = qobject_cast<QCheckBox*> ( widget );
QSpinBox *spinbox = qobject_cast<QSpinBox*> ( widget ); QSpinBox *spinbox = qobject_cast<QSpinBox*> ( widget );
QDoubleSpinBox *doublespinbox = qobject_cast<QDoubleSpinBox*>( widget ); QDoubleSpinBox *doublespinbox = qobject_cast<QDoubleSpinBox*>( widget );
QDial *dial = qobject_cast<QDial*> ( widget ); VLCQDial *dial = qobject_cast<VLCQDial*> ( widget );
QLineEdit *lineedit = qobject_cast<QLineEdit*> ( widget ); QLineEdit *lineedit = qobject_cast<QLineEdit*> ( widget );
QComboBox *combobox = qobject_cast<QComboBox*> ( widget ); QComboBox *combobox = qobject_cast<QComboBox*> ( widget );
...@@ -605,7 +606,7 @@ void ExtVideo::updateFilterOptions() ...@@ -605,7 +606,7 @@ void ExtVideo::updateFilterOptions()
QCheckBox *checkbox = qobject_cast<QCheckBox*> ( sender() ); QCheckBox *checkbox = qobject_cast<QCheckBox*> ( sender() );
QSpinBox *spinbox = qobject_cast<QSpinBox*> ( sender() ); QSpinBox *spinbox = qobject_cast<QSpinBox*> ( sender() );
QDoubleSpinBox *doublespinbox = qobject_cast<QDoubleSpinBox*>( sender() ); QDoubleSpinBox *doublespinbox = qobject_cast<QDoubleSpinBox*>( sender() );
QDial *dial = qobject_cast<QDial*> ( sender() ); VLCQDial *dial = qobject_cast<VLCQDial*> ( sender() );
QLineEdit *lineedit = qobject_cast<QLineEdit*> ( sender() ); QLineEdit *lineedit = qobject_cast<QLineEdit*> ( sender() );
QComboBox *combobox = qobject_cast<QComboBox*> ( sender() ); QComboBox *combobox = qobject_cast<QComboBox*> ( sender() );
......
...@@ -843,7 +843,7 @@ ...@@ -843,7 +843,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QDial" name="rotateAngleDial"> <widget class="VLCQDial" name="rotateAngleDial">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
...@@ -1795,6 +1795,13 @@ ...@@ -1795,6 +1795,13 @@
</layout> </layout>
</widget> </widget>
</widget> </widget>
<customwidgets>
<customwidget>
<class>VLCQDial</class>
<extends>QDial</extends>
<header>util/customwidgets.hpp</header>
</customwidget>
</customwidgets>
<tabstops> <tabstops>
<tabstop>adjustEnable</tabstop> <tabstop>adjustEnable</tabstop>
<tabstop>hueSlider</tabstop> <tabstop>hueSlider</tabstop>
......
...@@ -87,6 +87,22 @@ QString QVLCDebugLevelSpinBox::textFromValue( int v ) const ...@@ -87,6 +87,22 @@ QString QVLCDebugLevelSpinBox::textFromValue( int v ) const
return QString( "%1 (%2)" ).arg( v ).arg( texts[v] ); return QString( "%1 (%2)" ).arg( v ).arg( texts[v] );
} }
VLCQDial::VLCQDial( QWidget *parent ) : QDial( parent )
{
}
void VLCQDial::paintEvent( QPaintEvent *event )
{
QDial::paintEvent( event );
QPainter painter( this );
QRect rect = geometry();
painter.setPen( QPen( palette().color( QPalette::WindowText ) ) );
painter.drawText( QRectF( 0, rect.height() * 0.66, rect.width(), rect.height() ),
Qt::AlignHCenter, QString::number( value() ), 0 );
painter.end();
}
/*************************************************************************** /***************************************************************************
* Hotkeys converters * Hotkeys converters
***************************************************************************/ ***************************************************************************/
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <QTimer> #include <QTimer>
#include <QToolButton> #include <QToolButton>
#include <QAbstractAnimation> #include <QAbstractAnimation>
#include <QDial>
class QPixmap; class QPixmap;
class QWidget; class QWidget;
...@@ -51,6 +52,15 @@ protected: ...@@ -51,6 +52,15 @@ protected:
virtual void paintEvent( QPaintEvent * event ); virtual void paintEvent( QPaintEvent * event );
}; };
class VLCQDial : public QDial
{
Q_OBJECT
public:
VLCQDial( QWidget *parent = NULL );
protected:
virtual void paintEvent( QPaintEvent * event );
};
class QToolButtonExt : public QToolButton class QToolButtonExt : public QToolButton
{ {
Q_OBJECT Q_OBJECT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment