Projects Attributes Components Menubar Menu Editor Project Viewer Slot Editor Source Editor FAQ

Source Editor


You can get to the source editor a number of ways.
1) From the menubar click windows | source editor.
2) Double click on the component you wish to work with in the source editor.
3) Press alt+s on the current working component (signified by 8 black squares around it's border).
4) Right click on the component you wish to work on, and select source editor.


Source Editor Screen Shot

The source editor should be very easy to navigate. On the left is a combo box full of available components (the current one showing) the second is full of members for the current active component. The right combobox also has a "key character" it displays in the left most position in the member definition. The signifigance is:

If a '-' shows then that means the prototype is for that of a signal, upon selection it will take you to the display described in Signals & Slots.

If a '*' is shows it means it is a regular member that can has source code behind it (ie upon selection it's contents will be displayed in the editor below the combo box)

If a '+' means that it means it is a normal member that is defined elsewhere. Thus the function is read only (this can be changed by going to file | member | modify member, and unchecking the defined else where box. If nothing shows it is a normal function with no source behind it, and will most likely not be in the final source that is dumped.

If a '^' appears there, then it means the item is READONLY and there is no way for you to edit that object (by editing source, deletion, or modification) But this doesn't mean an object is readonly, you can still edit the other members, as well as adding new ones.

Function Modifier Screen Shot Members can be easily added, modified, or deleted by selecting the apropriate option under file | members on in the menubar of the source editor. The dialog offers you a text box to type in the definition of the new member, then to select the protection mode the function will be declared, then if it's a virtual member, and finally it allows you to have members (for example signals) that are declared or defined elsewhere. A member that is defined elsewhere will be readonly though, it is just there so that QtEZ will realize it exists. There are two special kinds of members they are "constructor" and "destructor" if you give either of these as your function name (with any arguments that you wish) and give it's mode as public, you can then type in a base initilizer so it can call back to whatever inherits it, you can call a base initilizer init by doing such qtez will figure out what to call it based on what this widget inherits. (If you are very new to Qt then you can find out what your component inherits by looking at it's title in the left combobox, for example a pushbutton may look like "QPushButton *p"). A reminder: variables are just members as well they just have no source contents of course, so to add a class-wide variable just add it like any other member.

You will also find the classwide header on this dialog. In there you can define, include, or declare any globals settings you want for just this class this could be done in this editor but may be more satisfactory to put it into the class itself if you only need it in one place.

There is an additional feature to the source editor, when you run your program it will test for errors/warnings during compilation. If something occurs then The Source Editor will change, to accomodate a new list at the bottom of the dialog, in it is a list of messages the compiler gave you, simply click on any of the items in the list, and it will take you to the object, member, and line that the error occured on, if the compiler gave it such info for the message.

Header Editor: The contents of this editor will go into main.h which all objects (including the main.cpp) will include. Anything put into here is a global declaration. The editor will try to figure out including pertaining to Qt, it will fill this file out with these includes when you try to run the program, of if you close and open the globals editor.

Main Editor: Everthing in this area will be appended to the main() function in a seperate file (main.cpp). It may be a seldom used dialog as most things to start Qt into the event loop are done by QtEZ, it may still be usefull on occation to put something in here.

Raw Source: You can put source code into here that may not belong in the GUI objects, came from another project, or are even just C functions. Contents of this are put into the main.cpp just before the main() function. This means if just the Main Editor above calls the contents it isn't necesary to prototype however if you are going to use this for other features then be sure to put valid declarations and prototypes into the Header Editor (as described above).

Signature/Comments: The contents of this do NOT make it to the source code dumping, instead this is just used so you can put your name and documentation for a .qtz inside the same file. It also allows you to tell people where to contact you, or how to get updates.