December 7, 2010

qwertyuiopearendil qwertyuiopea..
Lab Rat
91 posts

Application is Closed

 

Hi All,
I’ve inserted an observer into my app that take a look to the camera folder, it’s a feature, my real app is a cartographic app, but when i start camera my application is closed, it doesn’t crash it simply closes and retrun 0 the ret value of exec() function.
Some of could give em an Hand?
thanks

11 replies

December 7, 2010

Alexander Kuchumov Alexander Kuchumov
Lab Rat
377 posts

Which OS do you use? Symbian, Maemo?…

December 7, 2010

qwertyuiopearendil qwertyuiopea..
Lab Rat
91 posts

I’m working on Symbian OS

December 8, 2010

Alexander Kuchumov Alexander Kuchumov
Lab Rat
377 posts

How do you use camera? QtMultimediaKit from QtMobility?

December 8, 2010

GordonSchumacher GordonSchuma..
Lab Rat
93 posts

Can you post your main() function?

December 9, 2010

qwertyuiopearendil qwertyuiopea..
Lab Rat
91 posts

I’m using QFileSystemWatcher to understand when a new img is created into the default picture folder.
I’ve tried to use CCAmera and MCameraObserver2 but I had not any results…

December 9, 2010

GordonSchumacher GordonSchuma..
Lab Rat
93 posts

I’m specifically interested in how you’re launching the actual “guts” of the program though; could you put it on Pastebin? I will be more able to help if I can see it… :)

December 10, 2010

qwertyuiopearendil qwertyuiopea..
Lab Rat
91 posts

Sorry but i’m not able to understand what do you wana see…

December 10, 2010

GordonSchumacher GordonSchuma..
Lab Rat
93 posts

You should have a function somewhere with the prototype:

  1. int main (int argc, char* argv[])

That function is the one I want to see. If it’s large (though it generally will not be for a Qt program), you could put it on Pastebin.

December 10, 2010

disperso disperso
Ant Farmer
183 posts

Just in case: Pastebin [pastebin.com] is a website where you can publish some snippets of code, so you can share them with others. You don’t need to use it if you don’t want to, just post here the code (mark it with “@” signs, so it will be formatted).

December 13, 2010

qwertyuiopearendil qwertyuiopea..
Lab Rat
91 posts

This is my main function:

  1. int main(int argc, char *argv[])
  2. {
  3.     QApplication a(argc, argv);
  4.  
  5.     createDirs();
  6.  
  7.     QPixmap pixmap(":/images/Default.png");
  8.     QSplashScreen splash(pixmap);
  9.     splash.show();
  10.  
  11.     QGraphicsScene *scene=new QGraphicsScene(0,0,SCREEN_WIDTH,SCREEN_HEIGHT);
  12.     scene->setBackgroundBrush(QBrush(QPixmap(":images/backgroundTile.png")));
  13.  
  14.     LeoGraphicsView *view=LeoGraphicsView::defaultView();
  15.     LeoGraphicsView::defaultView()->setScene(scene);
  16.  
  17.     LeoChartGraphicsObject* viewObject = LeoChartGraphicsObject::defaultChart();
  18.     scene->addItem(viewObject);
  19.  
  20.     view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  21.     view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  22.  
  23.     QFrame* frame = new QFrame(view);
  24.     frame->setGeometry(QRect(0, 0, SCREEN_WIDTH, 65));
  25.     frame->setStyleSheet(QString::fromUtf8("background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgb(97, 97, 97), stop: 0.5 rgb(33, 33, 33), stop: 0.51 rgb(27, 27, 27), stop: 1 rgb(0, 0, 0));"));
  26.     frame->setFrameShape(QFrame::StyledPanel);
  27.     frame->setFrameShadow(QFrame::Raised);
  28.  
  29.     QPushButton *zoomIn=new QPushButton(view);
  30.     zoomIn->setGeometry(295,10,40,40);
  31.     zoomIn->setFlat(true);
  32.     zoomIn->setFocusPolicy(Qt::NoFocus);
  33.     zoomIn->setStyleSheet("background-image: url(:/images/ImmaginePiu.png);");
  34.     QObject::connect(zoomIn,SIGNAL(clicked()),viewObject,SLOT(zoomInSlot()));
  35.  
  36.     QPushButton *zoomOut=new QPushButton(view);
  37.     zoomOut->setGeometry(235,10,40,40);
  38.     zoomOut->setFlat(true);
  39.     zoomOut->setFocusPolicy(Qt::NoFocus);
  40.     zoomOut->setStyleSheet("background-image: url(:/images/ImmagineMeno.png);");
  41.     QObject::connect(zoomOut,SIGNAL(clicked()),viewObject,SLOT(zoomOutSlot()));
  42.  
  43.     QPushButton *cameraBtn=new QPushButton(view);
  44.     cameraBtn->setGeometry(15,15,44,36);
  45.     cameraBtn->setFlat(true);
  46.     cameraBtn->setFocusPolicy(Qt::NoFocus);
  47.     cameraBtn->setStyleSheet("background-image: url(:/images/BarCamera.png);");
  48.     cameraBtn->setHidden(true);
  49.     QObject::connect(cameraBtn,SIGNAL(clicked()),viewObject,SLOT(cameraSlot()));
  50.  
  51.     QPushButton *menuBtn=new QPushButton(view);
  52.     menuBtn->setGeometry(5,577,112,52);
  53.     menuBtn->setFlat(true);
  54.     menuBtn->setFocusPolicy(Qt::NoFocus);
  55.     menuBtn->setStyleSheet("QPushButton { background-image: url(:/images/menu.png);}QPushButton:pressed { background-image: url(:/images/menu1.png);}");
  56.     QObject::connect(menuBtn,SIGNAL(clicked()),viewObject,SLOT(showMenu()));
  57.  
  58.     QMainWindow *mainWindow=new QMainWindow;
  59.     mainWindow->setGeometry(0,0,SCREEN_WIDTH,SCREEN_HEIGHT);
  60.     mainWindow->setWindowState(Qt::WindowFullScreen);
  61.     mainWindow->setCentralWidget(view);
  62.  
  63.     mainWindow->show();
  64.  
  65.     LeoWarningWidget* wdtWarning = new LeoWarningWidget();
  66.     wdtWarning->show();
  67.  
  68.     splash.finish(mainWindow);
  69.  
  70.     int nVal =  a.exec();
  71.     if(nVal == 0)
  72.     {
  73.         delete wdtWarning; wdtWarning = 0;
  74.         delete zoomIn; zoomIn = 0;
  75.         delete zoomOut; zoomOut = 0;
  76.         delete cameraBtn; cameraBtn = 0;
  77.         delete menuBtn; menuBtn = 0;
  78.         delete frame; frame = 0;
  79.  
  80.         delete viewObject; viewObject = 0;
  81.         delete view; view = 0;
  82.         delete scene; scene = 0;
  83.         delete mainWindow; mainWindow = 0;
  84.     }
  85.     qDebug() << "End of App";
  86.     return nVal;
  87. }

Thanks for all

December 14, 2010

GordonSchumacher GordonSchuma..
Lab Rat
93 posts

Well, a few notes…

You don’t need to delete all those classes near the end; since you’ve created the objects parented to the QMainWindow, it will handle the cleanup of those classes when the QMainWindow is destroyed.

Take a look at the example for QSplashScreen in the Qt documentation. You need to call QApplication::processEvents() after splash.show() so that the splash screen is actually displayed, since the application’s message loop has not been started yet.

You may want to add some breakpoints or qDebug() calls in your LeoGraphicsView class to make sure it is actually getting shown – perhaps in showEvent(), and perhaps also in closeEvent(). If it is getting closed by something, do the same elsewhere in your code to see where/why that’s happening.

Post a response here if the initial stuff doesn’t help any.

You also may want to check the console output of Qt; it often displays helpful messages if there are issues at runtime.

 
  ‹‹ Can backend of Phonon in Symbian support mp3 with an url?      Custom style for a QTableWidgetItem ››

You must log in to post a reply. Not a member yet? Register here!