This example is part of the ROSE-svn, you can find it at projects/RoseQt/AstViewer
setNode() signal of the AstBrowser was connected to the
You can find the example ui-file which creation is described here, in the AstViewer directory (MyWidget.ui)
#include "rose.h" #include "ui_MyWidget.h" #include <QApplication> int main(int argc, char**argv) { SgProject * proj = frontend(argc,argv); QApplication app (argc,argv); QWidget * wdg = new QWidget(); Ui::MyWidget ui; ui.setupUi(wdg); wdg->show(); ui.astBrowserWidget->setNode(proj); app.exec(); return 0; };
First the .h file which was created from the .ui has to be included. If you use the provided makefile-rules its name is ui_NameOfUiFile.h . Then a new QApplication and QWidget is created, the configuration object, which was created by QtDesigner is used to setup the main-widget. Finally the exec() function of the QApplication is called, which starts the GUI.
Makefile.am which you need in order to build this example project. For a more detailed description of how to use Qt and autotools see Setup of BuildSystem
include $(top_srcdir)/src/roseExtensions/qtWidgets/Make.inc
if ROSE_WITH_ROSEQT
INCLUDES += . $(ROSE_INCLUDES)
bin_PROGRAMS = AstProperties
AstProperties_SOURCES = main.cpp
nodist_AstProperties_SOURCES = ui_MyWidget.h
BUILT_SOURCES = ui_MyWidget.h
AstProperties_LDADD = $(ROSE_LIBS)
endif
1.4.7