Hi I have the setCurrentTime() slot in my class::QWidges so:
{
Q_OBJECT
public:
void setSoundFile
( QString soundName_
);
void setWave( SoundData* );
void playSound();
qreal currentTime() const;
public slots:
void setCurrentTime();// <---- THIS ONE
protected:
/* paint event */
/* resize event */
/* mouse events */
virtual void keyPressEvent
( QKeyEvent* event
);
private:
void updateWave();
//QPixmap m_waveCachePixmap;
SoundData* m_wave;
/* starting point of selection */
/* rubberBand */
WfRubberBand* rb;
/* current position of timeline */
qreal m_CurrentTime;
};
class WaveWidget : public QWidget
{
Q_OBJECT
public:
WaveWidget( QWidget* parent = 0 );
void setSoundFile( QString soundName_ );
void setWave( SoundData* );
void playSound();
qreal currentTime() const;
public slots:
void setCurrentTime();// <---- THIS ONE
protected:
/* paint event */
virtual void paintEvent( QPaintEvent* event );
/* resize event */
virtual void resizeEvent ( QResizeEvent* event );
/* mouse events */
virtual void mousePressEvent( QMouseEvent* event );
virtual void mouseMoveEvent( QMouseEvent* event );
virtual void mouseReleaseEvent( QMouseEvent* event );
virtual void keyPressEvent( QKeyEvent* event );
private:
void updateWave();
//QPixmap m_waveCachePixmap;
QImage m_waveCachePixmap;
SoundData* m_wave;
/* starting point of selection */
QPoint startSelection;
/* rubberBand */
WfRubberBand* rb;
/* current position of timeline */
qreal m_CurrentTime;
QTimer* timer;
};
To copy to clipboard, switch view to plain text mode
In the ctor I connect it with the timeout signal of a timer so:
WaveWidget
::WaveWidget( QWidget* parent
/* = 0 */ ) m_wave( 0 ),
rb( 0 )
{
setFocusPolicy( Qt::TabFocus );
connect( timer, SIGNAL( timeout() ), this, SLOT( setCurrentTime() ) );
}
WaveWidget::WaveWidget( QWidget* parent /* = 0 */ )
: QWidget( parent ),
m_wave( 0 ),
rb( 0 )
{
setFocusPolicy( Qt::TabFocus );
timer = new QTimer();
connect( timer, SIGNAL( timeout() ), this, SLOT( setCurrentTime() ) );
}
To copy to clipboard, switch view to plain text mode
and the slot code is so:
void WaveWidget::setCurrentTime()
{
static int i = 0;
qDebug() << i++; // only for test
}
void WaveWidget::setCurrentTime()
{
static int i = 0;
qDebug() << i++; // only for test
}
To copy to clipboard, switch view to plain text mode
The compile process is OK meanwhile when I run the app I always get a console error:
QObject::connect: No such slot WaveWidget::setCurrentTime()
Where my cose is wrong?
Help me please,
Best
Bookmarks