Widgets/Fader: open input dialog on double click

There have been requests to have an input dialog when double clicking
the fader (like we have it for knobs for ages already).

Closes #3588157.
This commit is contained in:
Tobias Doerffel
2012-11-28 00:10:11 +01:00
parent 8db0d0b0fa
commit 8a75c40fd6
2 changed files with 23 additions and 0 deletions

View File

@@ -74,6 +74,7 @@ public:
private:
virtual void contextMenuEvent( QContextMenuEvent * _me );
virtual void mousePressEvent( QMouseEvent *ev );
virtual void mouseDoubleClickEvent( QMouseEvent* mouseEvent );
virtual void mouseMoveEvent( QMouseEvent *ev );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void wheelEvent( QWheelEvent *ev );

View File

@@ -45,6 +45,7 @@
*/
#include <QtGui/QInputDialog>
#include <QtGui/QMouseEvent>
#include <QtGui/QPaintEvent>
#include <QtGui/QPainter>
@@ -154,6 +155,27 @@ void fader::mousePressEvent( QMouseEvent* mouseEvent )
void fader::mouseDoubleClickEvent( QMouseEvent* mouseEvent )
{
bool ok;
// TODO: dbV handling
int newValue = QInputDialog::getInteger( this, windowTitle(),
tr( "Please enter a new value between %1 and %2:" ).
arg( model()->minValue()*100 ).
arg( model()->maxValue()*100 ),
model()->value()*100,
model()->minValue()*100,
model()->maxValue()*100, 1, &ok );
if( ok )
{
model()->setValue( newValue / 100.0f );
}
}
void fader::mouseReleaseEvent( QMouseEvent * _me )
{
s_textFloat->hide();