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:
@@ -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 );
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user