Widget for embedding into Qt

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
egrath
Posts: 28
Joined: Wed May 13, 2009 8:15 am
Location: Austria
Contact:

Widget for embedding into Qt

Post by egrath »

Hello,

for a project of mine i needed a fully fledged widget to integrate Irrlicht into a Qt Application. Currently the Widget features the following
  • Compiles out of the Box with Qt 4.6 TP1 and Irrlicht SVN
  • Emits signals for: Mouse Press/Release, Mouse move, Keyboard Press/Release (On Linux, disables the nasty X11 Autorepeat which generates Key press/release events on it's own)
  • Supports all Irrlicht supported rendering Subsystems
  • Resizes correctly
  • Fully documented
Download here: http://uploaded.to/file/di5cq8 (or from my blog)

Egon
CuteAlien
Admin
Posts: 9733
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Hm, I need to find some small tool where I can use QT to test this some day :-) I want to try out Qt for so long already and never find time...

Under which license can it be used?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Nelson
Posts: 6
Joined: Wed Oct 28, 2009 12:58 pm

interactive camera integration

Post by Nelson »

Hi, I looking for a way to use the Maya (or FPS) camera from your Qt integration. What is missing?
Nelson
Posts: 6
Joined: Wed Oct 28, 2009 12:58 pm

Post by Nelson »

Ok, I found something. Implementing this event handler I can move my Maya camera.
However, the movements seem a bit buggy, it's just as if Irricht kept memorized the previews mouse position between two actions.

Code: Select all

void QIrrlichtWidget::mouseMoveEvent( QMouseEvent* event )
{
    irr::SEvent irrEvent;
   
    irrEvent.EventType = irr::EET_MOUSE_INPUT_EVENT;

    if ( device != 0 )
    {
		irrEvent.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
		irrEvent.MouseInput.X = event->x();
		irrEvent.MouseInput.Y = event->y();
		irrEvent.MouseInput.Wheel = 0.0f; // Zero is better than undefined
		if(device->postEventFromUser( irrEvent ))
			event->accept();

    }
}
Nelson
Posts: 6
Joined: Wed Oct 28, 2009 12:58 pm

Post by Nelson »

I'm going into lot of trouble with qt and IrrLicht integration.

Since Irrlicht renders in an external window, Irrlicht disables resizing calls to CIrrDeviceWin32. But when using a mouse camera like Maya, it gets the mouse position from the CIrrDeviceWin32 CursorControl. When I resize the window, the mouse position is not updated correctly.

Is that a correct behaviour? is there a way to handle a Maya cam from an external window manager?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

That's a bug that was recently fixed. Should be in 1.6.1 once it's out, but you can also use SVN versions to get the fix.
Nelson
Posts: 6
Joined: Wed Oct 28, 2009 12:58 pm

Post by Nelson »

Ok thanx for the info. Ive made my own qt camera controller for my current project, will test the fix in the future version
jcfalcone
Posts: 37
Joined: Wed Nov 28, 2007 10:04 pm

Post by jcfalcone »

i'm having some problems to add the widget in some ui.

I always get this error
QIrrlichtWidget::ctor()

The program has unexpectedly finished.

/home/jcfalcone/workspace/Projetos/Jogos/3d_Engine/3d_Engine exited with code 0
And this is my code

Code: Select all

    QIrrlichtWidget *irrWidget = new QIrrlichtWidget(this);

    ui->gridLayout->addWidget(irrWidget, 0, 0, 1, 1);

Any Idea?[/code]
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

did you put irrlicht dll file to your directory?
fabietto
Posts: 93
Joined: Wed Sep 24, 2008 4:38 pm
Location: Plymouth, UK
Contact:

Post by fabietto »

I'm still stuck at the first step... downloading the software! :D Your blog seems having some troubles and I can't download from the other link as well...
gingerheadman
Posts: 18
Joined: Sat Oct 03, 2009 7:14 am
Location: Brisbane, Australia
Contact:

Post by gingerheadman »

Edit: Even though the link on the first post was broken I was able to find a copy here: http://egonrath.eg.funpic.de/wordpress/ ... 17.tar.bz2
My website - Miscreant Software
Pazystamo
Posts: 115
Joined: Sat Dec 03, 2005 5:56 pm
Location: Lithuania
Contact:

Post by Pazystamo »

HI,
I am using unubtu and trying to compile this example with irrliht 1.7.1 , but i get errors: QIrrlichtWidget.cpp|188|error: cast from ‘void*’ to ‘irr::u32’ loses precision| line is :

Code: Select all

qDebug() << "   native window ID      = " << ( irr::u32 ) createParams.WindowId;
if i remove ( irr::u32 ) then in Application.cpp shows error on "Application::Application()"|42|undefined reference to `vtable for Application'|
My project in forum- ATMOsphere - new dynamic sky dome for Irrlicht
gingerheadman
Posts: 18
Joined: Sat Oct 03, 2009 7:14 am
Location: Brisbane, Australia
Contact:

Post by gingerheadman »

Pazystamo wrote:HI,
I am using unubtu and trying to compile this example with irrliht 1.7.1 , but i get errors: QIrrlichtWidget.cpp|188|error: cast from ‘void*’ to ‘irr::u32’ loses precision| line is :

Code: Select all

qDebug() << "   native window ID      = " << ( irr::u32 ) createParams.WindowId;
if i remove ( irr::u32 ) then in Application.cpp shows error on "Application::Application()"|42|undefined reference to `vtable for Application'|
I had the same error (also using Ubuntu btw). I just commented out the (irr::u32) and it compiles properly. I know just removing bits of code that generate errors generally isn't a good idea but it seemed to work for me :P

Code: Select all

qDebug() << "   native window ID      = " << /*( irr::u32 )*/ createParams.WindowId;
My website - Miscreant Software
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The WindowID has changed to a platform dependant struct, which you have to cast to specifically. The value would be completely useless otherwise.
Post Reply