made textFloat's work properly and displayed at correct position

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@756 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-03-03 22:52:40 +00:00
parent c65b1100b6
commit 4380519a40
4 changed files with 24 additions and 52 deletions

View File

@@ -176,7 +176,7 @@ songEditor::songEditor( song * _song ) :
connect( m_masterVolumeSlider, SIGNAL( sliderReleased() ), this,
SLOT( masterVolumeReleased() ) );
m_mvsStatus = new textFloat( m_masterVolumeSlider );
m_mvsStatus = new textFloat;
m_mvsStatus->setTitle( tr( "Master volume" ) );
m_mvsStatus->setPixmap( embed::getIconPixmap( "master_volume" ) );
@@ -208,7 +208,7 @@ songEditor::songEditor( song * _song ) :
connect( m_masterPitchSlider, SIGNAL( sliderReleased() ), this,
SLOT( masterPitchReleased() ) );
m_mpsStatus = new textFloat( m_masterPitchSlider );
m_mpsStatus = new textFloat;
m_mpsStatus->setTitle( tr( "Master pitch" ) );
m_mpsStatus->setPixmap( embed::getIconPixmap( "master_pitch" ) );
@@ -515,10 +515,7 @@ void songEditor::masterVolumeChanged( int _new_val )
if( m_mvsStatus->isVisible() == FALSE && m_s->m_loadingProject == FALSE
&& m_masterVolumeSlider->showStatus() )
{
m_mvsStatus->reparent( m_masterVolumeSlider );
m_mvsStatus->move( m_masterVolumeSlider->mapTo(
m_masterVolumeSlider->topLevelWidget(),
QPoint( 0, 0 ) ) +
m_mvsStatus->moveGlobal( m_masterVolumeSlider,
QPoint( m_masterVolumeSlider->width() + 2, -2 ) );
m_mvsStatus->setVisibilityTimeOut( 1000 );
}
@@ -530,10 +527,7 @@ void songEditor::masterVolumeChanged( int _new_val )
void songEditor::masterVolumePressed( void )
{
m_mvsStatus->reparent( m_masterVolumeSlider );
m_mvsStatus->move( m_masterVolumeSlider->mapTo(
m_masterVolumeSlider->topLevelWidget(),
QPoint( 0, 0 ) ) +
m_mvsStatus->moveGlobal( m_masterVolumeSlider,
QPoint( m_masterVolumeSlider->width() + 2, -2 ) );
m_mvsStatus->show();
masterVolumeMoved( m_s->m_masterVolumeModel.value() );
@@ -564,11 +558,8 @@ void songEditor::masterPitchChanged( int _new_val )
if( m_mpsStatus->isVisible() == FALSE && m_s->m_loadingProject == FALSE
&& m_masterPitchSlider->showStatus() )
{
m_mpsStatus->reparent( m_masterPitchSlider );
m_mpsStatus->move( m_masterPitchSlider->mapTo(
m_masterPitchSlider->topLevelWidget(),
QPoint( 0, 0 ) ) +
QPoint( m_masterPitchSlider->width() + 2, -2 ) );
m_mpsStatus->moveGlobal( m_masterPitchSlider,
QPoint( m_masterPitchSlider->width() + 2, -2 ) );
m_mpsStatus->setVisibilityTimeOut( 1000 );
}
}
@@ -578,11 +569,8 @@ void songEditor::masterPitchChanged( int _new_val )
void songEditor::masterPitchPressed( void )
{
m_mpsStatus->reparent( m_masterPitchSlider );
m_mpsStatus->move( m_masterPitchSlider->mapTo(
m_masterPitchSlider->topLevelWidget(),
QPoint( 0, 0 ) ) +
QPoint( m_masterPitchSlider->width() + 2, -2 ) );
m_mpsStatus->moveGlobal( m_masterPitchSlider,
QPoint( m_masterPitchSlider->width() + 2, -2 ) );
m_mpsStatus->show();
masterPitchMoved( m_s->m_masterPitchModel.value() );
}

View File

@@ -204,7 +204,7 @@ trackContentObjectView::trackContentObjectView( trackContentObject * _tco,
{
if( s_textFloat == NULL )
{
s_textFloat = new textFloat( this );
s_textFloat = new textFloat;
s_textFloat->setPixmap( embed::getIconPixmap( "clock" ) );
}
@@ -255,7 +255,7 @@ bool trackContentObjectView::fixedTCOs( void )
bool trackContentObjectView::close( void )
{
m_trackView->getTrackContentWidget()->removeTCOView( this );
QWidget::close();
return( QWidget::close() );
}
@@ -412,7 +412,7 @@ void trackContentObjectView::mousePressEvent( QMouseEvent * _me )
"resizing." ),
embed::getIconPixmap( "hint" ), 0 );
}
s_textFloat->reparent( this );
// s_textFloat->reparent( this );
// setup text-float as if TCO was already moved/resized
mouseMoveEvent( _me );
s_textFloat->show();
@@ -461,9 +461,7 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
s_textFloat->setText( QString( "%1:%2" ).
arg( m_tco->startPosition().getTact() + 1 ).
arg( m_tco->startPosition().getTact64th() ) );
s_textFloat->move( QPoint( 8,
s_textFloat->parentWidget()->height() -
s_textFloat->height() - 24 ) );
s_textFloat->moveGlobal( this, QPoint( width() + 2, 8 ) );
}
else if( m_action == MoveSelection )
{
@@ -513,8 +511,7 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
arg( m_tco->startPosition().getTact64th() ).
arg( m_tco->endPosition().getTact() + 1 ).
arg( m_tco->endPosition().getTact64th() ) );
s_textFloat->move( mapTo( topLevelWidget(), QPoint( 0, 0 ) ) +
QPoint( width() + 2, 8 ) );
s_textFloat->moveGlobal( this, QPoint( width() + 2, 8 ) );
}
else
{
@@ -1747,7 +1744,7 @@ void trackView::update( void )
bool trackView::close( void )
{
m_trackContainerView->removeTrackView( this );
QWidget::close();
return( QWidget::close() );
}

View File

@@ -75,7 +75,7 @@ knob::knob( int _knob_num, QWidget * _parent, const QString & _name ) :
{
if( s_textFloat == NULL )
{
s_textFloat = new textFloat( this );
s_textFloat = new textFloat;
}
setAcceptDrops( TRUE );
@@ -349,12 +349,12 @@ void knob::mousePressEvent( QMouseEvent * _me )
{
QApplication::setOverrideCursor( Qt::BlankCursor );
}
s_textFloat->reparent( this );
// s_textFloat->reparent( this );
s_textFloat->setText( m_hintTextBeforeValue +
QString::number(
model()->value() ) +
m_hintTextAfterValue );
s_textFloat->move( mapTo( topLevelWidget(), QPoint( 0, 0 ) ) +
s_textFloat->moveGlobal( this,
QPoint( m_knobPixmap->width() + 2, 0 ) );
s_textFloat->show();
m_buttonPressed = TRUE;
@@ -443,11 +443,8 @@ void knob::mouseDoubleClickEvent( QMouseEvent * )
void knob::paintEvent( QPaintEvent * _me )
{
QRect ur = _me->rect();
QPainter p( this );
p.translate( -ur.x(), -ur.y() );
drawKnob( &p );
if( !m_label.isEmpty() )
{
@@ -473,12 +470,10 @@ void knob::wheelEvent( QWheelEvent * _we )
model()->incValue( inc );
s_textFloat->reparent( this );
s_textFloat->setText( m_hintTextBeforeValue +
QString::number( model()->value() ) +
m_hintTextAfterValue );
s_textFloat->move( mapTo( topLevelWidget(), QPoint( 0, 0 ) ) +
QPoint( m_knobPixmap->width() + 2, 0 ) );
s_textFloat->moveGlobal( this, QPoint( m_knobPixmap->width() + 2, 0 ) );
s_textFloat->setVisibilityTimeOut( 1000 );
emit sliderMoved( model()->value() );
@@ -519,12 +514,10 @@ void knob::setPosition( const QPoint & _p )
void knob::reset( void )
{
model()->setValue( model()->initValue() );
s_textFloat->reparent( this );
s_textFloat->setText( m_hintTextBeforeValue +
QString::number( model()->value() ) +
m_hintTextAfterValue );
s_textFloat->move( mapTo( topLevelWidget(), QPoint( 0, 0 ) ) +
QPoint( m_knobPixmap->width() + 2, 0 ) );
s_textFloat->moveGlobal( this, QPoint( m_knobPixmap->width() + 2, 0 ) );
s_textFloat->setVisibilityTimeOut( 1000 );
}
@@ -542,12 +535,10 @@ void knob::copyValue( void )
void knob::pasteValue( void )
{
model()->setValue( s_copiedValue );
s_textFloat->reparent( this );
s_textFloat->setText( m_hintTextBeforeValue +
QString::number( model()->value() ) +
m_hintTextAfterValue );
s_textFloat->move( mapTo( topLevelWidget(), QPoint( 0, 0 ) ) +
QPoint( m_knobPixmap->width() + 2, 0 ) );
s_textFloat->moveGlobal( this, QPoint( m_knobPixmap->width() + 2, 0 ) );
s_textFloat->setVisibilityTimeOut( 1000 );
}

View File

@@ -4,7 +4,7 @@
* volume_knob.cpp - defines a knob that display it's value as either a
* percentage or in dBV.
*
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -81,8 +81,7 @@ void volumeKnob::mousePressEvent( QMouseEvent * _me )
{
QApplication::setOverrideCursor( Qt::BlankCursor );
}
s_textFloat->reparent( this );
QString val;
if( configManager::inst()->value( "app", "displaydbv" ).toInt() )
{
@@ -96,7 +95,7 @@ void volumeKnob::mousePressEvent( QMouseEvent * _me )
}
s_textFloat->setText( m_hintTextBeforeValue + val );
s_textFloat->move( mapTo( topLevelWidget(), QPoint( 0, 0 ) ) +
s_textFloat->moveGlobal( this,
QPoint( m_knobPixmap->width() + 2, 0 ) );
s_textFloat->show();
m_buttonPressed = TRUE;
@@ -156,8 +155,6 @@ void volumeKnob::wheelEvent( QWheelEvent * _we )
model()->incValue( inc );
s_textFloat->reparent( this );
QString val;
if( configManager::inst()->value( "app", "displaydbv" ).toInt() )
{
@@ -171,8 +168,7 @@ void volumeKnob::wheelEvent( QWheelEvent * _we )
}
s_textFloat->setText( m_hintTextBeforeValue + val );
s_textFloat->move( mapTo( topLevelWidget(), QPoint( 0, 0 ) ) +
QPoint( m_knobPixmap->width() + 2, 0 ) );
s_textFloat->moveGlobal( this, QPoint( m_knobPixmap->width() + 2, 0 ) );
s_textFloat->setVisibilityTimeOut( 1000 );
emit sliderMoved( model()->value() );