[ROOT] TQtWidget problem

From: H.-Gerd Rosarius (rosarius@getit.de)
Date: Mon Jul 28 2003 - 17:04:35 MEST


Hello Rooters,

I am going to build a standalone application for MS Windows 
which is able to display Root objects like TCanvas or TH1F.

If I understood right the Root-GUI-classes (the TG*-Classes) 
only work properly under Windows if I use the Root-Interpreter-Mode. 
It is not possible to built a "real" windows GUI application 
with 'em. (At least that is what I understood from this URL:
http://root.cern.ch/root/roottalk/roottalk02/2324.html
Please correct me if I am wrong)

Because of that fact I tested the Root-Qt-Edition for my 
application. The documentation sais it is possible to embbed 
a TCanvas-Object by use of the class TQtWidget that is shipped with 
the package.

However, my application simply crashes at runtime each time TQt-Widget-
Object is reached. My compiler (MS VC6) does not complain about
anything at compile-time. The debugger is no help, too.
Here's the code for a simple application:

//--- Qt-Root-App ----------------------------------------------
// Qt-Libraries
#include <qapplication.h>
#include <qmainwindow.h>

// Root-Qt-Library
#include "TQtWidget.h"

int main( int argc, char **argv )
{
  QApplication a( argc, argv );
  QMainWindow* mw = new QMainWindow();
  mw->setCaption( "Qt Root Application" );
  a.setMainWidget( mw );

  // Here it crashes at runtime
  TQtWidget wg = new TQtWidget( mw, "Hello" );

  // Following code not reached 
  mw->setCentralWidget( &wg );
  mw->resize( 800, 600 );
  mw->show();

  int exitStatus = a.exec();
  delete mw;
  return exitStatus;
}
//--- End ----------------------------------------------

Am I doing something completely wrong or is it a bug in TQtWidget?
What about QT-Libs? Using v2.3 for Windows. If that's the problem,
I would expect it at compile-time.

Is some friendly person out there who is able to help me?

Thanks a lot

  H.-Gerd Rosarius

Tech: Using Root 3.05/05 (Qt-Edition) from BNL on a Win 2000 OS and
      MSVC6 as compiler.    



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET