[vtkusers] Cannot open include file: 'QObject'

Aytekin Vargun varguna at gmail.com
Tue Oct 20 12:59:58 EDT 2009


Thanks a lot Jeff,
I fixed the problem. In fact, cmake could find the QT locations
successfully.But I was forgetting the following lines (as you are suggesting
too): I will copy them here if the others have similar problems. But note
that some of these settings are specific to our project.

  FIND_PACKAGE(Qt4)
  IF(QT4_FOUND)
    INCLUDE( ${QT_USE_FILE} )
    IF (QT_QTXML_FOUND)
      INCLUDE_DIRECTORIES(${QT_QTXML_INCLUDE_DIR})
    ELSE(QT_QTXML_FOUND)
      MESSAGE(FATAL ERROR "Qt XML libraries missing.")
    ENDIF(QT_QTXML_FOUND)
    #IF (QT_QTHELP_FOUND)
    #  INCLUDE_DIRECTORIES(${QT_QTHELP_INCLUDE_DIR})
    #ELSE(QT_QTHELP_FOUND)
    #  MESSAGE(FATAL ERROR "Qt HELP libraries missing.")
    #ENDIF(QT_QTHELP_FOUND)
  ELSE(QT4_FOUND)
    MESSAGE(FATAL_ERROR "Cannot build without Qt4")
  ENDIF(QT4_FOUND)

Now, I am trying to run the following code that runs an SQL query, and
displays the results as a text output. But this part does not display the
SQL results in a  tabular form. The table is empty and the program crashes.
I mainly used the code in TestVtkQtTableView.cxx, TestSQLiteDatabase.cxx and
several other related test programs.

Do I need to change anything in the following two blocks of code? why
doesn't the query fill the table with data?

 // Use vtkQtTableView to display the results in a better format
  vtkRowQueryToTable* reader = vtkRowQueryToTable::New();
  reader->SetQuery( query );
  reader->Update();
  vtkTable* table = reader->GetOutput();

  VTK_CREATE(vtkQtTableView, tableView);
  tableView->SetSplitMultiComponentColumns(true);
  tableView->AddRepresentationFromInput(table); //check here
  tableView->Update();
  tableView->GetWidget()->show();

Here is the procedure that has this code:
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
int QueryDB(vtkSQLiteDatabase* db, char* queryText) {

  vtkSQLQuery* query = db->GetQueryInstance();
  //const char *queryText = "";
  //queryText = "SELECT volume, minimum, Dist_to_Bldv FROM ftkTable WHERE
volume <= 100";
  query->SetQuery( queryText );
  cerr << endl << "Running query: " << query->GetQuery() << endl;

  cerr << endl << "Using vtkSQLQuery directly to execute query:" << endl;
  if (!query->Execute())
    {
      cerr << "Query failed" << endl;
      return 1;
    }

  for ( int col = 0; col < query->GetNumberOfFields(); col++)
    {
    if ( col > 0)
      {
      cerr << ", ";
      }
    cerr << query->GetFieldName( col );
    }
  cerr << endl;
  while ( query->NextRow())
    {
    for ( int field = 0; field < query->GetNumberOfFields(); field++)
      {
      if ( field > 0)
        {
        cerr << ", ";
        }
      cerr << query->DataValue( field ).ToString().c_str();
      }
    cerr << endl;
    }

  // Use vtkQtTableView to display the results in a better format
  vtkRowQueryToTable* reader = vtkRowQueryToTable::New();
  reader->SetQuery( query );
  reader->Update();
  vtkTable* table = reader->GetOutput();

  VTK_CREATE(vtkQtTableView, tableView);
  tableView->SetSplitMultiComponentColumns(true);
  tableView->AddRepresentationFromInput(table); //check here
  tableView->Update();
  tableView->GetWidget()->show();


On Mon, Oct 19, 2009 at 9:10 AM, Jeff Baumes <jeff.baumes at kitware.com>wrote:

> It looks like the Qt include path is somehow not set up properly. Are
> you setting up your application the same way as the VTK examples do in
> their CMakeLists? I believe it is not enough to just use the VTK
> include dirs, you also have to find Qt in your project separately and
> set your include path to have the Qt paths.
>
> Jeff
>
> On Tue, Oct 13, 2009 at 6:43 PM, Aytekin Vargun <varguna at gmail.com> wrote:
> > Hello everybody,
> > I am currently using vtkSQLiteDatabase and vtkSQLQuery to create and
> query a
> > database. The result is just a text output. I would like to use
> > vtkQtTableView as in statsview.cxx program in VTK to display results in a
> > better format.
> >
> > I tried to compile my code after including vtkQtTableView.h but I am
> getting
> > the following error message:
> > vtk-nightly\guisupport\qt\vtkQtView.h(27) : fatal error C1083: Cannot
> open
> > include file: 'QObject': No such file or directory
> >
> > I use QT 4.5.2 which is working pretty good with other applications. I
> was
> > also able to compile VTK examples that use vtkSQL* and related Qt views.
> For
> > example, I compiled statsview.cxx successfully.
> >
> > This looks like a linking problem to me? What linking library should I
> use
> > to take care of this problem? I checked my cmake. All Qt versions are the
> > same!
> >
> > What other ways can I use to display the data I get after running SQL
> > queries?
> > Thanks a lot.
> > Aytekin
> >
> > --
> > My web page: http://www.cs.rpi.edu/~vargua<http://www.cs.rpi.edu/%7Evargua>
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >
>
>
>
> --
> Jeff Baumes, Ph.D.
> R&D Engineer, Kitware Inc.
> (518) 881-4932
> jeff.baumes at kitware.com
>



-- 
My web page: http://www.cs.rpi.edu/~vargua
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091020/f61ca175/attachment.htm>


More information about the vtkusers mailing list