Skip to Content
Programming with Qt, 2nd Edition
book

Programming with Qt, 2nd Edition

by Matthias Kalle Dalheimer
January 2002
Beginner to intermediate
522 pages
14h 36m
English
O'Reilly Media, Inc.
Content preview from Programming with Qt, 2nd Edition

Chapter 5. A Guided Tour Through the Qt Dialog Boxes

Dialog boxes are important in every GUI-based application. Even simple applications usually have several dialog boxes, and in applications of medium complexity, it is not uncommon to have 50 or more dialog boxes. Therefore, a GUI developer builds dialog boxes often. In this chapter, we look at the facilities Qt provides for building dialog boxes. We start with predefined dialog boxes that cover a well-defined task, which can usually be used out of the box. Afterwards, we look at building blocks you can use to create your own dialog boxes.

Predefined Dialog Boxes

Predefined dialog boxes are nice for the stressed developer because you can get good results with very little coding. Often only one line of code will suffice to customize these boxes for your purposes.

Qt currently provides several predefined dialog boxes that are used frequently: QColorDialog for selecting a color, QFileDialog for specifying files and directories, QFontDialog for selecting a font, QInputDialog for entering a one-line textual value, QProgressDialog for showing progress in lengthy operations, QMessageBox for general messages, and QErrorMessage for error messages that the user can select not to show again. We will look at each of these boxes in turn.

File Selection Dialog Boxes

QFileDialog (see Figure 5-1) provides a File Selection dialog box. It lets the user choose a file for opening, saving, or other file-related operations. Most of the time, QFileDialog ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ GUI Programming with Qt 4

C++ GUI Programming with Qt 4

Jasmin Blanchette, Mark Summerfield
C++ GUI Programming with Qt 4

C++ GUI Programming with Qt 4

Jasmin Blanchette, Mark Summerfield

Publisher Resources

ISBN: 0596000642Supplemental ContentErrata Page