QtitanDataGrid Quick Start
We did our best to make the process of installing and using QtitanDataGrid as easy and hassle-free as at all possible. Below is a description of just two simple steps you need to take to start using the advanced features of QtitanDataGrid in your own Qt applications:
Windows
- Open the Windows command line (cmd.exe) and switch to the folder where Qtitan files were installed.
- Run the "qtitanvars.bat" bat file.
The bat file will add the QTITANDIR environment variable with the value and will add
/lib to the PATH environment variable.
-
Add the following code to the *.pro(Qt Project) file of your application:
include($$(QTITANDIR)/src/shared/qtitangrid.pri)
-
Reconfigure your application using qmake -r or qmake -tp vc -r (for Visual Studio projects) commands
in the folder where your project file is located.
Linux
- Open the unix shell and switch to the folder where Qtitan files were installed.
- Launch the "qtitanvars.sh" script from the command line using the following command: ". ./qtitanvars.sh"
The script will add the QTITANDIR environment variable with the value and will set the value
of the LD_LIBRARY_PATH environment variable to /lib for the current unix shell.
-
Add the following code to the *.pro(Qt Project) file of your application:
include($$(QTITANDIR)/src/shared/qtitangrid.pri)
-
Reconfigure your application using the qmake -r command in the same folder your project file is located in.
QTITANDIR = $$(QTITANDIR)
include($$QTITANDIR/src/shared/qtitangrid.pri)
The minimal project utilizing Qtitan::Grid would look as follows:
hello.pro
TEMPLATE = app
QTITANDIR = $$(QTITANDIR)
include($$QTITANDIR/src/shared/qtitangrid.pri)
SOURCES += hello.cpp
hello.cpp
#include <QApplication>
#include <QStringListModel>
#include <QtitanGrid.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QStringListModel model;
QStringList list;
list << "row 1" << "row 2" << "row 3";
model.setStringList(list);
Qtitan::Grid grid;
grid.setViewType(Qtitan::Grid::TableView);
grid.view<Qtitan::GridTableView>()->setModel(&model);
grid.show();
return app.exec();
}
If everything goes well, you will see what is shown in the screenshot below.
