C++ GUI Programming with Qt 3.pdf

(22320 KB) Pobierz
155516817 UNPDF
C ++ GUI Programming
with Qt 3
B RUCE P ERENS ’ O PEN S OURCE S ERIES
C++ GUI Programming with Qt 3
Jasmin Blanchette, Mark Summerfield
Managing Linux Systems with Webmin: System
Administration and Module Development
Jamie Cameron
Understanding the Linux Virtual Memory Manager
Mel Gorman
Implementing CIFS: The Common Internet File System
Christopher R. Hertel
Embedded Software Development with eCos
Anthony J. Massa
Rapid Application Development with Mozilla
Nigel McFarlane
The Linux Development Platform: Configuring, Using,
and Maintaining a Complete Programming
Environment
Rafeeq Ur Rehman, Christopher Paul
Intrusion Detection Systems with Snort:
Advanced IDS Techniques with Snort, Apache,
MySQL, PHP, and ACID
Rafeeq Ur Rehman
The Official Samba-3 HOWTO and Reference Guide
John H. Terpstra, Jelmer R. Vernooij, Editors
C ++ GUI Programming
with Qt 3
Jasmin Blanchette
Mark Summerfield
Prentice Hall in association with Trolltech Press
Library of Congress Cataloging-in-Publication Data
A CIP catalog record for this book can be obtained from the Library of Congress
Editorial/Production Supervision: Kathleen M. Caren
Cover Design Director: Jerry Votta
Art Director: Gail Cocker-Bogusz
Manufacturing Buyer: Maura Zaldivar
Acquisitions Editor: Jill Harry
Editorial Assistant: Brenda Mulligan
Marketing Manager: Dan Depasquale
2004 Trolltech AS
Published by Pearson Education, Inc.
Publishing as Prentice Hall Professional Technical Reference
Upper Saddle River, New Jersey 07458
This material may only be distributed subject to the terms and conditions set forth in the
Open Publication License, v1.0 or later (the latest version is available at http://www.open-
content.org/openpub/ ).
Prentice Hall PTR offers excellent discounts on this book when ordered in quanti-
ty for bulk purchases or special sales. For more information, please contact: U.S.
Corporate and Government Sales, 1-800-382-3419, corpsales@pearsontechgroup.
com. For sales outside of the U.S., please contact: International Sales, 1-317-581-
3793, international@pearsontechgroup.com.
Trolltech ,Qt , and the Trolltech logo are registered trademarks of Trolltech. OpenGL
is a trademark of Silicon Graphics, Inc. in the United States and other countries. All
other company and product names mentioned herein are the trademarks or registered
trademarks of their respective owners.
The authors, copyright holder, and publisher have taken care in the preparation of this book,
but make no expressed or implied warranty of any kind and assume no responsibility for
errors or omissions. The information in this book is furnished for informational use only, is
subject to change without notice, and does not represent a commitment on the part of the
copyright holder or the publisher. No liability is assumed for incidental or consequential
damages in connection with or arising out of the use of the information or programs
contained herein.
The software described in this book is furnished under a license agreement or non-disclosure
agreement. The software may be used or copied only in accordance with the terms of the
agreement.
Printed in the United States of America
First Printing
ISBN 0-13-124072-2
Pearson Education Ltd.
Pearson Education Australia Pty., Limited
Pearson Education Singapore, Pte. Ltd.
Pearson Education North Asia Ltd.
Pearson Education Canada, Ltd.
Pearson Educación de Mexico, S.A. de C.V.
Pearson Education-Japan
Pearson Education Malaysia, Pte. Ltd.
Copyright
155516817.001.png
Contents
Foreword .........................................................
ix
Preface ...........................................................
xi
Acknowledgments ............................................... xiii
A Brief History of Qt ............................................
xv
Part I: Basic Qt
1 . Getting Started ...............................................
3
Hello Qt .....................................................
3
Making Connections .........................................
5
Using the Reference Documentation ..........................
8
2 . Creating Dialogs .............................................. 11
Subclassing QDialog ......................................... 11
Signals and Slots in Depth ................................... 18
Rapid Dialog Design ......................................... 21
Shape-Changing Dialogs ..................................... 28
Dynamic Dialogs ............................................
33
Built-in Widget and Dialog Classes ...........................
33
3 . Creating Main Windows ...................................... 39
Subclassing QMainWindow .................................. 40
Creating Menus and Toolbars ................................ 44
Implementing the File Menu ................................. 49
Setting Up the Status Bar .................................... 56
Using Dialogs ............................................... 58
Storing Settings ............................................. 63
Multiple Documents ......................................... 64
Splash Screens .............................................. 67
v
Zgłoś jeśli naruszono regulamin