PDA

View Full Version : Application running but doesn't show up!!!



joandelason
20th March 2010, 21:03
Hi
I finally managed to compile and link my first GUI application in Qt (which is almost a miracle :)), but it doesn't show up. My application is just an OpenGl render context (like the one in the hellogl example) with the menu bar. It's quite strange because I open the task manager and the process is running.

Any idea?

THANK YOU

Lykurg
20th March 2010, 21:08
did you call show() or exec()? please provide some code because without it is hard to help. How does your main function look like?

joandelason
20th March 2010, 21:13
This is the main function. I run my app on a Mac and it works (although when closing it it crashes). But on Windows it does'n show up.


#include <QApplication>
#include <QDesktopWidget>

#include "SDIWindow.h"

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
SdiWindow window;
window.resize(window.sizeHint());

window.showMaximized();
return app.exec();
}


The code is copy-pasted from the hellogl example with a small change done to make the render context occupy the whole window.

Here is the code of the hellogl main function.


#include <QApplication>
#include <QDesktopWidget>

#include "window.h"

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Window window;
window.resize(window.sizeHint());
int desktopArea = QApplication::desktop()->width() *
QApplication::desktop()->height();
int widgetArea = window.width() * window.height();
if (((float)widgetArea / (float)desktopArea) < 0.75f)
window.show();
else
window.showMaximized();
return app.exec();
}

Lykurg
20th March 2010, 21:40
I can't see any error. Try to debug your application. See where it crashes on mac and use breakpoints to see where it might "hang up" on windows.

wysota
21st March 2010, 09:37
Could you paste the code for the window class if it is not too complicated?