CSCI 265Project
Establish Qt Development Environment
40 points
Problem Statement
The purpose of this assignment is to establish a development environment that allows you to write C++ code using a GUI toolkit called Qt. Unlike typical assignments, this assignment defines a series of specific actions for you take to achieve a specific outcome. Follow the steps as defined below, and take window shots to gather information for your deliverable as you go.
Warning: These instructions are written assuming that you are downloaded cygwin over the internet. A much better method is to use the XLiveCD product from IU to install cygwin on your workstation. Alternatively, you can also run an X-Server directly from the XLiveCD.
General Information Regarding Qt and Cygwin
Qt is a multiplatform development toolkit that assists in writing graphic user interfaces (GUIs) that use X-Windows. X-Windows is a multiplatform graphical presentation layer that can run under Microsoft Windows, Apple Macintosh, and Unix. This is sometimes referred to as (X11). For this project, you are expected to compile and run under Linux using Qt libraries, and display your GUI either under Linux or your personal workstation.
Your personal workstation must be running an X-Windows server in order to display X-Windows GUIs on your desktop. Two common X-Windows products are Exceed and Cygwin. Exceed is a commercial product developed by Hummingbird ( Cygwin is a GNU-licensed product that is available for free. For the purposes of this discussion, it is assumed that you are going to install cygwin on a personal computer running Microsoft Windows.
Project Steps
1. Download cygwin from download.com and store it in a temporary directory.
2. Execute the setup program setup.exe. You are going to separate downloading the installation programs from running the installation program. During setup, choose the download option.
3. Continue with the installation until you reach a screen where you have to select what packages are going to downloaded.
Scroll down until you can see the Net and XFree86 Packages.
3. Press the symbol for Net and XFree86. (Warning, these can run a long time, do not assume that the installation is hung, just wait.) Eventually, you will see "Default" changed to "Install". Pressing Next will start the download.
4. After the download is complete, start setup again. This time, choose to install from a local directory.
5. Continue with the installation. These instructions assume that you've installed in the default installation directory C:\cygwin.
6. If you installed all the packages, you will find a subdirectory c:\cygwin\usr\X11R6\bin. Send the startxwin.bat file to the desktop so that you can execute it whenever you want to start your X-Windows server.
If you are successful, there will be a new shortcut on your desktop.
7. Now you are ready to start an xterm and the X-Windows server. Double-click on the startxwin.bat shortcut that you just created. This will start a bash xterm shell.
Take a windowsnapshot of the xterm bash shell using Alt-Print Screen. Note that this is a window snapshot, not a screen print. Paste this into your deliverable document.
You will also see an X on your taskbar. This is the X-Windows Server.
8. Use the xhost command to allow pegasus.cs.iupui.edu to sending X-Windows messages to your system.
9. If you have not already done so, make sure you have ssh installed from IUWare. Start ssh. Turn on X11 tunneling so that pegasuscan send X-Windows messages to your machine without worrying about firewalls and routers. Choose Edit -> Settings…
Then choose the checkbox for "Tunnel X11 connections" from the Tunneling Profile Setting.
10. Connect to pegasus.
Press Connect and login to pegasus.
11. Type xclock & from your ssh shell. Take a screen shot using Alt-Print Screen and paste into your deliverable document.
An X-Windows program display the clock should have also displayed. Take a window snapshot using Alt-Print Screen of that windows as well and paste it into your deliverable document.
12. Warning: This step is optional and should not be executed if you are using a dial-up connection. If you skip this step, just show deliverable 4 as N/A. Now you're ready to create an X-Windows desktop. Type startkde & from ssh (and hold on to your chair!) You may ignore any messages you get regarding unavailable physical devices like a console or a speaker. These error messages will appear in your ssh window, and can be ignored. Display your KDE desktop by right-clicking on the X on your taskbar and selecting "Show Root Window". When you are done, take a screen print using Print Screen of your entire screen, and paste it into your deliverable document. KDE is written using Qt, the same library that you are doing to use. Your desktop might look something like mine, which I've customized to have a windows look and feel. You could spend a lot of time at this step, just learning about KDE and all the options available under the menus. Feel free to explore! Click on the red hat and see if you can find out how to customize the look and feel of the desktop.
13. Now you're finally ready to do some programming. Here’s the Hello World tutorial from the trolltech web site. (
/****************************************************************
**
** Qt tutorial 1
**
****************************************************************/
#include <qapplication.h
#include <qpushbutton.h
int main( int argc, char **argv )
{
QApplication a( argc, argv );
QPushButton hello( "Hello world!", 0 );
hello.resize( 100, 30 );
a.setMainWidget( &hello );
hello.show();
return a.exec();
}
In ssh, create a directory hello_world and make it your current working directory. Now just xemacs main.cpp. (Something wonderful happens here.) What do you notice that different about emacs than just running emacs under plain unix? Take a screen shot of your emacs window and include it in your deliverables.
14. Follow the tutorial directions to "qmake –project", "qmake" and "make" your project in ssh. You should now have an executable in your hello_world directory. Execute the program. Because your path may not include the your current directory, you may have to type "./hello_world &" so it knows where your file is. You should now have a Hello World program on your desktop. Take a snapshot of it and include it in your deliverables.
15. Woo! Hoo! You've done it! Sit back and relax.
Deliverables
Your write-up for this assignment shall contain the following information:
1. Window print of the xterm bash shell.
2. Window print of ssh shell running xclock &.
3. Window print of xclock.
4. (optional) Screen print of KDE desktop.
5. Screen print of xemacs.
6. Screen print of hello_world.
7. Extra Credit (4 points)
Find the sierpinski3d screen saver and run it so that it is the background of your KDE desktop. Screen print your desktop and include it for extra credit! If your KDE desktop is excruciatingly slow, you can run sierpinkski3d as a regular application and just print the window instead of the desktop.
Acknowledgements
The tutorial used by the assignment was development by Trolltech, the developers of Qt.
(Last Revised: 1/26/2004 1:39 PM)