Table of Contents
Building applications using qtHaskell is essentially straightforward in that the syntax of calls to the Qt library from Haskell can be derived from Qt's own excellent documentation using a simple formula, and no preprocessing of the Haskell application code is required. QtHaskell should be easily accessible to Qt programmers with a limited knowledge of Haskell and to Haskell programmers with a limited knowledge of Qt. This document is not aimed specifically at either of the above groups and assumes some knowledge of both Qt and Haskell. For details of other documentation which covers Qt and Haskell in depth, and for details of how to obtain, install and build qtHaskell, and for conditions of use see the qtHaskell User Guide.
The following example and other qtHaskell examples used in this document
can be found as prim1.hs
.. prim4.hs
in
the examples
directory.
module Main where import Qtc.Classes.Qccs import Qtc.Classes.Widgets import Qtc.Gui.Base import Qtc.Widgets.Base import Qtc.Widgets.QApplication import Qtc.Widgets.QWidget import Qtc.Widgets.QPushButton main :: IO Int main = do qApplication () hello <- qPushButton "Hello qtHaskell World" resize hello (200::Int, 60::Int) qshow hello () qApplicationExec () return 0
This corresponds to Tutorial 1 in the Qt Documentation:
#include <QApplication> #include <QPushButton> int main(int argc, char *argv[]) { QApplication app(argc, argv); QPushButton hello("Hello world!"); hello.resize(200, 60); hello.show(); return app.exec(); }