Author Topic: QMouseEvent  (Read 5022 times)

Offline der_burner

  • Single posting newcomer
  • *
  • Posts: 4
QMouseEvent
« on: January 22, 2010, 09:03:27 am »
Hello together,

i had an Problem with Code::Blocks, qt4 and qtOpenGl.

An easy example from http://mih.voxindeserto.de/threadedcube.html I downloaded and want to build in Code::Blocks. After some Problems to Found the QT Libaries I have only one error. And I don't know how I can solve it.

I get every time the Error Message:

Code: [Select]
||=== qt4test, Debug ===|
exampleglwidget.cpp|2|error: QMouseEvent: No such file or directory|
exampleglwidget.cpp||In member function ‘virtual void ExampleGLWidget::mouseMoveEvent(QMouseEvent*)’:|
exampleglwidget.cpp|34|error: ‘class QMouseEvent’ has no member named ‘buttons’|
exampleglwidget.cpp|39|error: ‘class QMouseEvent’ has no member named ‘buttons’|
||=== Build finished: 3 errors, 0 warnings ===|

Why Code:Blocks couldn't find QMouseEvent?
The Inclue
Code: [Select]
#include <QApplication>he found, also if I insert the
Code: [Select]
#include <qevent.h> but then the class QMouseEvent has no member named buttons always displayed.

In KDevelop the same code is build without Errors. But I don't like KDevelop, I want to use Code:Blocks.

Can somebody help me?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: QMouseEvent
« Reply #1 on: January 22, 2010, 10:03:48 am »
i had an Problem with Code::Blocks, qt4 and qtOpenGl.
Seeing your error message you don't have a problem with code::blocks, but with the compiler - it is complaining.

Can somebody help me?
You most likely missing to set the include path's so the compiler can find all required header files (or it picks the wrong ones  in case you setup a wrong include path). To "debug", enable the full compiler log (see my signature) and post again. Please post the full log.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline der_burner

  • Single posting newcomer
  • *
  • Posts: 4
Re: QMouseEvent
« Reply #2 on: January 22, 2010, 10:26:25 am »
I found the error! The Function buttons() in QMouseEvent don't exists button() is the right one ;)

But now I have an other Problem:

Code: [Select]
examplerenderthread.o||In function `ExampleRenderThread::draw()':|
/qt4test/examplerenderthread.cpp|137|undefined reference to `glMatrixMode'|
/qt4test/examplerenderthread.cpp|138|undefined reference to `glLoadIdentity'|
/qt4test/examplerenderthread.cpp|139|undefined reference to `glTranslatef'|
/qt4test/examplerenderthread.cpp|140|undefined reference to `glRotatef'|
/qt4test/examplerenderthread.cpp|141|undefined reference to `glRotatef'|
/qt4test/examplerenderthread.cpp|142|undefined reference to `glRotatef'|
...
...
...

He's don't finde the OpenGL commands, I found in the Internet I must instert "QT += opengl" in the .pov file, I do! And I must set the additional linker options "-lglui -lglut -lGLU -lGL" but where I do that? When I insert it under Project->Build Options->Linker settings->other Linker options it will don't use!

Build Log:

Code: [Select]
g++  -o qt4test exampleglwidget.o examplerenderthread.o main.o    -L/usr/share/qt3/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread



Offline der_burner

  • Single posting newcomer
  • *
  • Posts: 4
Re: QMouseEvent
« Reply #3 on: January 22, 2010, 10:45:13 am »
I see g++ takes "-L/usr/share/qt3/lib" why? He should take QT4 where I can change it?

Offline der_burner

  • Single posting newcomer
  • *
  • Posts: 4
Re: QMouseEvent
« Reply #4 on: January 22, 2010, 10:51:12 am »
ok, the solution of all Problems is easy I used qmake instead of qmake-qt4 ;)

Now all is right, Thank you for help