
Originally Posted by
Santosh Reddy
The error means that the "QWSMouseHandler" is not a complete type, to make it complete you need to implement the pure virtual functions. You need to subclass "QWSMouseHandler" and then implement them, use it.
The last error is regarding the datatype mismatch, that should be simple
yeah, but when i subclass it then error
{
public:
void mouseChanged
( const QPoint & position,
int state,
int wheel
= 0 );
};
void BrowserWindow
::keyReleaseEvent(QKeyEvent *event
) {
#if defined(Q_OS_LINUX)
QPoint qpoint
= QMouse
::pos();
Qt::MouseButtons buttons = Qt::NoButton;
if (qFuzzyCompare(slideValue(), static_cast<qreal>(1.0f)))
{
if (event->key() == Qt::Key_Left)
{
qpoint.setX(qpoint.x() + 30);
}
if (event->key() == Qt::Key_Up)
{
qpoint.setY(qpoint.x() + 30);
}
if (event->key() == Qt::Key_Down)
{
qpoint.setX(qpoint.x() - 30);
}
if (event->key() == Qt::Key_Right)
{
qpoint.setY(qpoint.x() - 30);
}
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
{
buttons |= Qt::LeftButton;
}
QMouse::mouseChanged (qpoint,buttons,0);
class QMouse : public QWSMouseHandler
{
public:
explicit QMouse(const QString &driver = QString(),const QString &device = QString());
void mouseChanged ( const QPoint & position, int state, int wheel = 0 );
const QPoint & pos () ;
};
void BrowserWindow::keyReleaseEvent(QKeyEvent *event)
{
#if defined(Q_OS_LINUX)
QPoint qpoint = QMouse::pos();
Qt::MouseButtons buttons = Qt::NoButton;
if (qFuzzyCompare(slideValue(), static_cast<qreal>(1.0f)))
{
if (event->key() == Qt::Key_Left)
{
qpoint.setX(qpoint.x() + 30);
}
if (event->key() == Qt::Key_Up)
{
qpoint.setY(qpoint.x() + 30);
}
if (event->key() == Qt::Key_Down)
{
qpoint.setX(qpoint.x() - 30);
}
if (event->key() == Qt::Key_Right)
{
qpoint.setY(qpoint.x() - 30);
}
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
{
buttons |= Qt::LeftButton;
}
QMouse::mouseChanged (qpoint,buttons,0);
To copy to clipboard, switch view to plain text mode
can you help me ?
src/BrowserWindow.cpp: In member function 'virtual void BrowserWindow::keyReleaseEvent(QKeyEvent*)':
src/BrowserWindow.cpp:115: error: cannot call member function 'const QPoint& QMouse:

os()' without object
src/BrowserWindow.cpp:139: error: cannot call member function 'void QMouse::mouseChanged(const QPoint&, int, int)' without object
make: *** [BrowserWindow.o] Error 1
Added after 12 minutes:
{
public:
void mouseChanged
( const QPoint & position,
int state,
int wheel
= 0 );
void resume ();
void suspend ();
};
#endif
void BrowserWindow
::keyReleaseEvent(QKeyEvent *event
) {
#if defined(Q_OS_LINUX)
QMouse* qmouseSonnh;
qmouseSonnh = new QMouse;
QPoint qpoint
= qmouseSonnh
->pos
();
Qt::MouseButtons buttons = Qt::NoButton;
if (qFuzzyCompare(slideValue(), static_cast<qreal>(1.0f)))
{
if (event->key() == Qt::Key_Left)
{
qpoint.setX(qpoint.x() + 30);
}
if (event->key() == Qt::Key_Up)
{
qpoint.setY(qpoint.x() + 30);
}
if (event->key() == Qt::Key_Down)
{
qpoint.setX(qpoint.x() - 30);
}
if (event->key() == Qt::Key_Right)
{
qpoint.setY(qpoint.x() - 30);
}
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
{
buttons |= Qt::LeftButton;
}
qmouseSonnh->mouseChanged (qpoint,buttons,0);
//QWSServer::sendMouseEvent( qpoint, 0 );
}
#else
int delta = 50;
switch (event->key())
{
case Qt::Key_Left:
pos.rx() -= delta;
break;
case Qt::Key_Right:
pos.rx() += delta;
break;
case Qt::Key_Up:
pos.ry() -= delta;
break;
case Qt::Key_Down:
pos.ry() += delta;
break;
case Qt::Key_Return:
break;
default:
break;
}
#endif
switch (event->key())
{
case Qt::Key_Home:
if (m_animation->state() == QAbstractAnimation::Running)
{
const QAbstractAnimation::Direction direction = m_animation->direction() == QAbstractAnimation::Forward
? QAbstractAnimation::Forward
: QAbstractAnimation::Backward;
m_animation->setDirection(direction);
}
else if (qFuzzyCompare(slideValue(), static_cast<qreal>(1.0f)))
{
showHomeView();
}
else
{
showBrowserView();
}
case Qt::Key_F1:
if (!qFuzzyCompare(slideValue(), static_cast<qreal>(1.0f)))
{
m_homeView->SetBookMark();
}
break;
default:
return;
}
event->accept();
}
class QMouse : public QWSMouseHandler
{
public:
explicit QMouse(const QString &driver = QString(),const QString &device = QString());
void mouseChanged ( const QPoint & position, int state, int wheel = 0 );
const QPoint & pos () ;
void resume ();
void suspend ();
};
#endif
void BrowserWindow::keyReleaseEvent(QKeyEvent *event)
{
#if defined(Q_OS_LINUX)
QMouse* qmouseSonnh;
qmouseSonnh = new QMouse;
QPoint qpoint = qmouseSonnh->pos();
Qt::MouseButtons buttons = Qt::NoButton;
if (qFuzzyCompare(slideValue(), static_cast<qreal>(1.0f)))
{
if (event->key() == Qt::Key_Left)
{
qpoint.setX(qpoint.x() + 30);
}
if (event->key() == Qt::Key_Up)
{
qpoint.setY(qpoint.x() + 30);
}
if (event->key() == Qt::Key_Down)
{
qpoint.setX(qpoint.x() - 30);
}
if (event->key() == Qt::Key_Right)
{
qpoint.setY(qpoint.x() - 30);
}
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
{
buttons |= Qt::LeftButton;
}
qmouseSonnh->mouseChanged (qpoint,buttons,0);
//QWSServer::sendMouseEvent( qpoint, 0 );
}
#else
int delta = 50;
QPoint pos = QCursor::pos();
switch (event->key())
{
case Qt::Key_Left:
pos.rx() -= delta;
break;
case Qt::Key_Right:
pos.rx() += delta;
break;
case Qt::Key_Up:
pos.ry() -= delta;
break;
case Qt::Key_Down:
pos.ry() += delta;
break;
case Qt::Key_Return:
break;
default:
break;
}
QCursor::setPos(pos);
#endif
QWidget::keyReleaseEvent(event);
switch (event->key())
{
case Qt::Key_Home:
if (m_animation->state() == QAbstractAnimation::Running)
{
const QAbstractAnimation::Direction direction = m_animation->direction() == QAbstractAnimation::Forward
? QAbstractAnimation::Forward
: QAbstractAnimation::Backward;
m_animation->setDirection(direction);
}
else if (qFuzzyCompare(slideValue(), static_cast<qreal>(1.0f)))
{
showHomeView();
}
else
{
showBrowserView();
}
case Qt::Key_F1:
if (!qFuzzyCompare(slideValue(), static_cast<qreal>(1.0f)))
{
m_homeView->SetBookMark();
}
break;
default:
return;
}
event->accept();
}
To copy to clipboard, switch view to plain text mode
BrowserWindow.o:/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/web-browser-sonnh89-24-5-2011/src/BrowserWindow.cpp:106: undefined reference to `QMouse:
os()'
BrowserWindow.o:/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/web-browser-sonnh89-24-5-2011/src/BrowserWindow.cpp:106: undefined reference to `QMouse:
os()'
BrowserWindow.o:/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/web-browser-sonnh89-24-5-2011/src/BrowserWindow.cpp:130: undefined reference to `QMouse::mouseChanged(QPoint const&, int, int)'
BrowserWindow.o:/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/web-browser-sonnh89-24-5-2011/src/BrowserWindow.cpp:130: undefined reference to `QMouse::mouseChanged(QPoint const&, int, int)'
BrowserWindow.o: In function `BrowserWindow':
/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/web-browser-sonnh89-24-5-2011/src/BrowserWindow.cpp:35: undefined reference to `QMouse::QMouse(QString const&, QString const&)'
/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/web-browser-sonnh89-24-5-2011/src/BrowserWindow.cpp:35: undefined reference to `QMouse::QMouse(QString const&, QString const&)'
/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/web-browser-sonnh89-24-5-2011/src/BrowserWindow.cpp:35: undefined reference to `QMouse::QMouse(QString const&, QString const&)'
/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/web-browser-sonnh89-24-5-2011/src/BrowserWindow.cpp:35: undefined reference to `QMouse::QMouse(QString const&, QString const&)'
Bookmarks