Thanks a lot Jeff,<br>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.<br>
<br> FIND_PACKAGE(Qt4)<br> IF(QT4_FOUND)<br> INCLUDE( ${QT_USE_FILE} )<br> IF (QT_QTXML_FOUND)<br> INCLUDE_DIRECTORIES(${QT_<div id=":19b" class="ii gt">QTXML_INCLUDE_DIR})<br> ELSE(QT_QTXML_FOUND)<br> MESSAGE(FATAL ERROR "Qt XML libraries missing.")<br>
ENDIF(QT_QTXML_FOUND)<br> #IF (QT_QTHELP_FOUND)<br> # INCLUDE_DIRECTORIES(${QT_QTHELP_INCLUDE_DIR})<br> #ELSE(QT_QTHELP_FOUND)<br> # MESSAGE(FATAL ERROR "Qt HELP libraries missing.")<br> #ENDIF(QT_QTHELP_FOUND)<br>
ELSE(QT4_FOUND)<br> MESSAGE(FATAL_ERROR "Cannot build without Qt4")<br> ENDIF(QT4_FOUND)<br><br>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.<br>
<br>Do I need to change anything in the following two blocks of code? why doesn't the query fill the table with data?<br><br> // Use vtkQtTableView to display the results in a better format<br> vtkRowQueryToTable* reader = vtkRowQueryToTable::New();<br>
reader->SetQuery( query );<br> reader->Update();<br> vtkTable* table = reader->GetOutput();<br><br> VTK_CREATE(vtkQtTableView, tableView);<br> tableView->SetSplitMultiComponentColumns(true);<br> tableView->AddRepresentationFromInput(table); //check here<br>
tableView->Update(); <br> tableView->GetWidget()->show();<br><br>Here is the procedure that has this code:<br>/////////////////////////////////////////////////////////////<br>/////////////////////////////////////////////////////////////<br>
int QueryDB(vtkSQLiteDatabase* db, char* queryText) {<br><br> vtkSQLQuery* query = db->GetQueryInstance();<br> //const char *queryText = "";<br> //queryText = "SELECT volume, minimum, Dist_to_Bldv FROM ftkTable WHERE volume <= 100";<br>
query->SetQuery( queryText );<br> cerr << endl << "Running query: " << query->GetQuery() << endl;<br><br> cerr << endl << "Using vtkSQLQuery directly to execute query:" << endl;<br>
if (!query->Execute())<br> {<br> cerr << "Query failed" << endl;<br> return 1;<br> }<br><br> for ( int col = 0; col < query->GetNumberOfFields(); col++)<br> {<br> if ( col > 0)<br>
{<br> cerr << ", ";<br> }<br> cerr << query->GetFieldName( col );<br> }<br> cerr << endl;<br> while ( query->NextRow())<br> {<br> for ( int field = 0; field < query->GetNumberOfFields(); field++)<br>
{<br> if ( field > 0)<br> {<br> cerr << ", ";<br> }<br> cerr << query->DataValue( field ).ToString().c_str();<br> }<br> cerr << endl;<br> }<br>
<br> // Use vtkQtTableView to display the results in a better format<br> vtkRowQueryToTable* reader = vtkRowQueryToTable::New();<br> reader->SetQuery( query );<br> reader->Update();<br> vtkTable* table = reader->GetOutput();<br>
<br> VTK_CREATE(vtkQtTableView, tableView);<br> tableView->SetSplitMultiComponentColumns(true);<br> tableView->AddRepresentationFromInput(table); //check here<br> tableView->Update(); <br> tableView->GetWidget()->show();</div>
<br><br><div class="gmail_quote">On Mon, Oct 19, 2009 at 9:10 AM, Jeff Baumes <span dir="ltr"><<a href="mailto:jeff.baumes@kitware.com">jeff.baumes@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
It looks like the Qt include path is somehow not set up properly. Are<br>
you setting up your application the same way as the VTK examples do in<br>
their CMakeLists? I believe it is not enough to just use the VTK<br>
include dirs, you also have to find Qt in your project separately and<br>
set your include path to have the Qt paths.<br>
<br>
Jeff<br>
<div><div></div><div class="h5"><br>
On Tue, Oct 13, 2009 at 6:43 PM, Aytekin Vargun <<a href="mailto:varguna@gmail.com">varguna@gmail.com</a>> wrote:<br>
> Hello everybody,<br>
> I am currently using vtkSQLiteDatabase and vtkSQLQuery to create and query a<br>
> database. The result is just a text output. I would like to use<br>
> vtkQtTableView as in statsview.cxx program in VTK to display results in a<br>
> better format.<br>
><br>
> I tried to compile my code after including vtkQtTableView.h but I am getting<br>
> the following error message:<br>
> vtk-nightly\guisupport\qt\vtkQtView.h(27) : fatal error C1083: Cannot open<br>
> include file: 'QObject': No such file or directory<br>
><br>
> I use QT 4.5.2 which is working pretty good with other applications. I was<br>
> also able to compile VTK examples that use vtkSQL* and related Qt views. For<br>
> example, I compiled statsview.cxx successfully.<br>
><br>
> This looks like a linking problem to me? What linking library should I use<br>
> to take care of this problem? I checked my cmake. All Qt versions are the<br>
> same!<br>
><br>
> What other ways can I use to display the data I get after running SQL<br>
> queries?<br>
> Thanks a lot.<br>
> Aytekin<br>
><br>
> --<br>
> My web page: <a href="http://www.cs.rpi.edu/%7Evargua" target="_blank">http://www.cs.rpi.edu/~vargua</a><br>
><br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
<font color="#888888"><br>
<br>
<br>
--<br>
Jeff Baumes, Ph.D.<br>
R&D Engineer, Kitware Inc.<br>
(518) 881-4932<br>
<a href="mailto:jeff.baumes@kitware.com">jeff.baumes@kitware.com</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>My web page: <a href="http://www.cs.rpi.edu/~vargua">http://www.cs.rpi.edu/~vargua</a><br>