Using Qt Designer:
First, we need to set-up the Java environment:
run this then re-login:
$sudo bash -c "echo JAVA_HOME=/usr/lib/jvm/java-6-sun/ >> /etc/environment"
Or, go to your home directory, view hidden files and copy this code to your .bashrc file:
export JAVA_HOME=[path to java directory]
Usually, the path is “/usr/lib/jvm/java-6-sun”.
Or, using Nautilus, create empty file and name it Qt_Jambi_Designer.
Copy and paste this inside the file:
sh [path/to/designer.sh in qt jambi]
Save the file and make it executable.
In Linux, you create a launcher having a command: [path/to/designer.sh in qt jambi]. In Windows, Go to Start->Programs->Qt->Qt Designer.
Launch Qt Designer. Choose Main Window then press Create.
You will see the widget box on the left (where the line edits or textboxes, push buttons, or command buttons in Visual Studio). In the middle of the Main Window or Form where you place widgets to create your applications and what it would look like. On the right, is the property editor where you modify or edit the values like Name of the Main Window, Title or Name of push buttons, etc.
Designing the Application:
On the widget box display widget category, click label and hold left mouse button the drag to the Main Window.
Place a Push Button (Buttons Category) and double-click on the push button label and change it to Hello World.
You may resize it by clicking in the small boxes (handles) and drag. Go to property editor Qlabel category and delete Textlabel, you may also change the object name to helloWorldLabel or helloWorldPushButton.
On the Qt Designer Menu, click on the form and preview. As you can see a preview of what your app will look like. (The Hello World button does nothing yet because we haven't put some code or assign Signals and Slots).
Assign Signal and Slots using Qt Designer
Click the Hello World push button and click the + button below the Signal/Slot editor on the right of the designer.
Assign the values:
Sender->hello world push button.
Then Add + Another Signal/Slot:
Sender->helloworld push button
Receiver->hello world label
Running the App in Preview
Click the button and see what happens.
When you press the button and hold, the label will disappear (hide) and when you release the left-mouse button, the label hello world will show again.
Where is the code?
This is where our IDE or editor comes in.
Save the Main Window: File->Save as HelloWorld.jui (it must be jui not ui).
Open the terminal or console window inside your folder where HelloWorld.jui resides.
Go to your Qt Jambi you extracted then copy the location of your bin folder where juic executable resides: $[path/to/juic]juic HelloWorld.jui
You will see HelloWorld.jui to Ui_HelloWorldMainWindow.java.
Launch your editor and open Ui_helloWorldMainWindow.java
There is the Java generated code!
to be continued...