Next: The Names of Things
Up: KDE and Qt
Previous: About KDE
Events Happen
- An application that runs in the K Desktop Environment is an event-driven program. This means that when a program starts running, it displays its window (or windows) and waits for input from the mouse or keyboard. This input comes wrapped inside objects called events.
- An event can also tell the program that a window has been closed, or that the window has been exposed after being hidden behind another window. The application's entire purpose is to respond intelligently to the keyboard and mouse.
- An application has one main top-level window. It can also have other windows. These windows can exist for the entire life of the application, or they can appear and disappear as the application responds to events.
- Each window is encapsulated in a widget. The top-level window of an application is a widget. Each pop-up window is also a widget. In fact, the entire display is made up of widgets. Because one widget is capable of containing and displaying other widgets, every button, label, and menu item is its own individual widget.
- Programming the graphical display portion of your application is a matter of creating and combining widgets, and then writing the code that activates the widgets and responds to the events received by the widgets.
- A widget is any class that inherits from the Qt class named QWidget. A QWidget object contains and manages its own displayable window. It can also be set to respond to events issued by the mouse and keyboard (and whatever else you
have for input) that are sent to the window inside the widget. It knows things about its current visibility, its size, its background color, its foreground color, its position on the display, and so on. You can use the widgets defined in either Qt or KDE, or you can create your own by using QWidget as a base class.
Next: The Names of Things
Up: KDE and Qt
Previous: About KDE
Cem Ozdogan
2007-05-16