HCICHI ComputerHuman Interaction l Who knows best what
HCI/CHI: Computer-Human Interaction l Who knows best what users want/expect in a GUI ä developer? ä human factors engineer? ä user? l Must meet user expectations even if they don’t make sense ä Where is the Quit menu item? Why? ä Where is help? ä What about keyboard shortcuts? l Don’t let the application interfere with the GUI and vice versa Duke CPS 108 11. 1
GUI programming with C++ (lessons for Java) l l Widget is a generic term for a GUI component (aka window) ä listbox, file dialog, button, slidebar, radio button, . . . ä widgets (components) typically have child widgets (see the Composite pattern) When a widget is constructed it often requires a parent widget as a parameter Design Heuristic: keep GUI and the application separate ä minimize coupling in a coupled environment ä re-use/redesign one part mor easily Design Heuristic ä don’t have widgets talk to each other (use mediator) GUI/applications deal with event processing ä mouse clicks, button presses, slidebars, etc. ä what mechanism exists for processing events? Duke CPS 108 11. 2
Qt, a GUI toolkit l events processed with signals and slots ä signal generates an event, e. g. , button push ä slot processes the event, e. g. , pop up a file dialog box QPush. Button * quit. B = new QPush. Button(“Quit”, . . . ); connect (quit. B, SIGNAL(clicked()), q. App, SLOT(quit()); l l q. App is a global variable, of type QApplication ä one QApplication per program defined first in main() ä main returns q. App. exec() SIGNAL and SLOT are macros, expanded by a meta-object compiler (moc) ä moc generates. cc files from user-defined Qt subclasses Duke CPS 108 11. 3
What about Designing GUIs? l l l Design decisions: who designs the GUI? What (if anything) do you need to know about app internals? Qt expertise, who has it? [remember, Java on the horizon] l Implementation ä Lay out the GUI [draw it, sketch it] ä get the main widgets up and running, but not connected ä develop methods/events that are application specific ä develop commands, menus, buttons, etc. l Compiling using moc, Qt classes, see Makefile Duke CPS 108 11. 4
- Slides: 4