Commit ba5d2dc0 authored by François Cartegnie's avatar François Cartegnie 🤞

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

parent cae4f1c6
......@@ -47,6 +47,7 @@
#include "qt4.hpp"
#include "input_manager.hpp"
#include "util/qt_dirs.hpp"
#include "util/customwidgets.hpp"
#include "../../audio_filter/equalizer_presets.h"
#include <vlc_intf_strings.h>
......@@ -529,7 +530,7 @@ void ExtVideo::setWidgetValue( QObject *widget )
QCheckBox *checkbox = qobject_cast<QCheckBox*> ( widget );
QSpinBox *spinbox = qobject_cast<QSpinBox*> ( 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 );
QComboBox *combobox = qobject_cast<QComboBox*> ( widget );
......@@ -605,7 +606,7 @@ void ExtVideo::updateFilterOptions()
QCheckBox *checkbox = qobject_cast<QCheckBox*> ( sender() );
QSpinBox *spinbox = qobject_cast<QSpinBox*> ( 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() );
QComboBox *combobox = qobject_cast<QComboBox*> ( sender() );
......
......@@ -843,7 +843,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QDial" name="rotateAngleDial">
<widget class="VLCQDial" name="rotateAngleDial">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
......@@ -1795,6 +1795,13 @@
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>VLCQDial</class>
<extends>QDial</extends>
<header>util/customwidgets.hpp</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>adjustEnable</tabstop>
<tabstop>hueSlider</tabstop>
......
......@@ -87,6 +87,22 @@ QString QVLCDebugLevelSpinBox::textFromValue( int v ) const
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
***************************************************************************/
......
......@@ -37,6 +37,7 @@
#include <QTimer>
#include <QToolButton>
#include <QAbstractAnimation>
#include <QDial>
class QPixmap;
class QWidget;
......@@ -51,6 +52,15 @@ protected:
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
{
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