next up previous
Next: The Regular Approach Up: Mini How-To: Qt on Previous: Getting Started

The Brute Force Approach

First create a new NetBeans project with the name "HelloQtOnNetBeans" and then perform the following steps:

In the NetBeans project-view the source file will appear in the 'Source Files'-section, the header file in the 'Header File'-section and the Qt-project file in the main project section.

In the project-properties view enter the name of the output-file under the link tab: './hello'.

Finally edit the 'Makefile' that you will find in the NetBeans project-section 'Important Files':

  1. Remove 'build: .build-pre .build-impl .build-post' and replace it with
    build:
    	qmake -o Makefile-Qt HelloQtOnNetBeans.pro
    	make -f Makefile-Qt
    Don't forget to enter a 'Tab' at the beginning of the qmake- and make-line!

  2. Remove 'clean: .clean-pre .clean-impl .clean-post' and replace it with
    clean:
    	make clean -f Makefile-Qt
    Again: don't forget to enter a 'Tab' at the beginning of the make-line!

The line 'qmake -o ..' will automatically create a 'make'-file named 'Makefile-Qt', which is compatible with the GNU C/C++ build-process in the NetBeans C/C++ pack. The process is based on the Qt-project file (here 'HelloQtOnNetBeans.pro') and on the NetBeans C/C++ project properties, you set before. The other lines define the 'make'- and the 'clean'-commands.

Now you can build the program by right-clicking on the project name 'HelloQtOnNetBeans' and selecting 'Build Project'. You can also clean your project or select 'Clean and Build Project' in order to start with a clean environment. Selecting 'Run Project' will start the program and you will see the following window on your screen:

Figure 1.1:The 'Hello Qt' Example
\includegraphics[width=7cm, clip]{HelloQtOnNetBeans.ps}

Your first Qt GUI-program on NetBeans is successfully lunched!



next up previous
Next: The Regular Approach Up: Mini How-To: Qt on Previous: Getting Started

TSSE, 23 October 2008