embedded why error QWSMouseHandler
this is my code use, but it cant build error:cannot declare variable to be of abstract type 'QWSMouseHandler
can you help me ?
Code:
#if defined(Q_OS_LINUX)
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;
}
//QWSServer::sendMouseEvent( qpoint, 0 );
}
#else
Quote:
src/BrowserWindow.cpp:101: error: cannot declare variable 'qwsMouse' to be of abstract type 'QWSMouseHandler'
../../../../install/include/QtGui/qmouse_qws.h:67: note: because the following virtual functions are pure within 'QWSMouseHandler':
../../../../install/include/QtGui/qmouse_qws.h:77: note: virtual void QWSMouseHandler::resume()
../../../../install/include/QtGui/qmouse_qws.h:78: note: virtual void QWSMouseHandler::suspend()
src/BrowserWindow.cpp:127: error: no matching function for call to 'QWSMouseHandler::mouseChanged(QPoint*, Qt::MouseButtons&, int)'
../../../../install/include/QtGui/qmouse_qws.h:81: note: candidates are: void QWSMouseHandler::mouseChanged(const QPoint&, int, int)
make: *** [BrowserWindow.o] Error 1
Re: embedded why error QWSMouseHandler
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
Re: embedded why error QWSMouseHandler
Quote:
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
Code:
{
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);
can you help me ?
Quote:
src/BrowserWindow.cpp: In member function 'virtual void BrowserWindow::keyReleaseEvent(QKeyEvent*)':
src/BrowserWindow.cpp:115: error: cannot call member function 'const QPoint& QMouse::pos()' 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:
Code:
{
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();
}
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::pos()'
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::pos()'
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&)'
Re: embedded why error QWSMouseHandler
Code:
QPoint qpoint
= qmouseSonnh
->pos
();
qmouseSonnh->mouseChanged (qpoint,buttons,0);
with this modification it should compile, if not try clean build
Re: embedded why error QWSMouseHandler
yeah, i cleaned project, but error:
BrowserWindow.o: In function `QMouse':
/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/123/src/BrowserWindow.h:20: undefined reference to `vtable for QMouse'
/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/123/src/BrowserWindow.h:20: undefined reference to `vtable for QMouse'
/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/123/src/BrowserWindow.h:20: undefined reference to `vtable for QMouse'
/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/123/src/BrowserWindow.h:20: undefined reference to `vtable for QMouse'
/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/123/src/BrowserWindow.h:20: undefined reference to `vtable for QMouse'
BrowserWindow.o:/tango3/qt_SMP8654F_bin_4.5.2-1.1/src/demos/embedded/123/src/BrowserWindow.h:20: more undefined references to `vtable for QMouse' follow
collect2: ld returned 1 exit status
Re: embedded why error QWSMouseHandler
Are you trying to use signals and slots withe QMouse?
And show the implementation of QMouse.
Re: embedded why error QWSMouseHandler
Did you implement the following virtual methods? (just in case, you missed them)
Code:
{
public:
void mouseChanged
( const QPoint & position,
int state,
int wheel
= 0 );
void resume ();// ?
void suspend ();// ?
};